bump product version to 4.1.6.2
[LibreOffice.git] / sw / inc / reffld.hxx
blob9550de42539c7c50531dcddb2e18c55ee2f94e6a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef SW_REFFLD_HXX
20 #define SW_REFFLD_HXX
22 #include <fldbas.hxx>
24 class SfxPoolItem;
25 class SwDoc;
26 class SwTxtNode;
27 class SwTxtFld;
29 enum REFERENCESUBTYPE
31 REF_SETREFATTR = 0,
32 REF_SEQUENCEFLD,
33 REF_BOOKMARK,
34 REF_OUTLINE,
35 REF_FOOTNOTE,
36 REF_ENDNOTE
39 enum REFERENCEMARK
41 REF_BEGIN,
42 REF_PAGE = REF_BEGIN, ///< "Page"
43 REF_CHAPTER, ///< "Chapter"
44 REF_CONTENT, ///< "Reference"
45 REF_UPDOWN, ///< "Above/Below"
46 REF_PAGE_PGDESC, ///< "As Page Style"
47 REF_ONLYNUMBER, ///< "Category and Number"
48 REF_ONLYCAPTION, ///< "Caption Text"
49 REF_ONLYSEQNO, ///< "Numbering"
50 // --> #i81002#
51 /// new reference format types for referencing bookmarks and set references
52 REF_NUMBER, ///< "Number"
53 REF_NUMBER_NO_CONTEXT, ///< "Number (no context)"
54 REF_NUMBER_FULL_CONTEXT, ///< "Number (full context)"
55 REF_END
59 /// Get reference.
61 class SwGetRefFieldType : public SwFieldType
63 SwDoc* pDoc;
64 protected:
65 /// Overlay in order to update all ref-fields.
66 virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
67 public:
68 SwGetRefFieldType(SwDoc* pDoc );
69 virtual SwFieldType* Copy() const;
71 SwDoc* GetDoc() const { return pDoc; }
73 void MergeWithOtherDoc( SwDoc& rDestDoc );
75 static SwTxtNode* FindAnchor( SwDoc* pDoc, const String& rRefMark,
76 sal_uInt16 nSubType, sal_uInt16 nSeqNo,
77 sal_uInt16* pStt, sal_uInt16* pEnd = 0 );
81 class SW_DLLPUBLIC SwGetRefField : public SwField
83 private:
84 OUString sSetRefName;
85 String sTxt;
86 sal_uInt16 nSubType;
87 sal_uInt16 nSeqNo;
89 virtual String Expand() const;
90 virtual SwField* Copy() const;
92 // #i81002#
93 String MakeRefNumStr( const SwTxtNode& rTxtNodeOfField,
94 const SwTxtNode& rTxtNodeOfReferencedItem,
95 const sal_uInt32 nRefNumFormat ) const;
97 public:
98 SwGetRefField( SwGetRefFieldType*, const String& rSetRef,
99 sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uLong nFmt );
101 virtual ~SwGetRefField();
103 virtual String GetFieldName() const;
105 const OUString& GetSetRefName() const { return sSetRefName; }
107 // #i81002#
108 /** The <SwTxtFld> instance, which represents the text attribute for the
109 <SwGetRefField> instance, has to be passed to the method.
110 This <SwTxtFld> instance is needed for the reference format type REF_UPDOWN
111 and REF_NUMBER.
112 Note: This instance may be NULL (field in Undo/Redo). This will cause
113 no update for these reference format types. */
114 void UpdateField( const SwTxtFld* pFldTxtAttr );
116 void SetExpand( const String& rStr ) { sTxt = rStr; }
118 /// Get/set sub type.
119 virtual sal_uInt16 GetSubType() const;
120 virtual void SetSubType( sal_uInt16 n );
122 // --> #i81002#
123 bool IsRefToHeadingCrossRefBookmark() const;
124 bool IsRefToNumItemCrossRefBookmark() const;
125 const SwTxtNode* GetReferencedTxtNode() const;
126 // #i85090#
127 String GetExpandedTxtOfReferencedTxtNode() const;
130 /// Get/set SequenceNo (of interest only for REF_SEQUENCEFLD).
131 sal_uInt16 GetSeqNo() const { return nSeqNo; }
132 void SetSeqNo( sal_uInt16 n ) { nSeqNo = n; }
134 // Name of reference.
135 virtual const OUString& GetPar1() const;
136 virtual void SetPar1(const OUString& rStr);
138 virtual OUString GetPar2() const;
139 virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhichId ) const;
140 virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhichId );
142 void ConvertProgrammaticToUIName();
144 virtual String GetDescription() const;
148 #endif /// SW_REFFLD_HXX
150 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */