merged tag ooo/OOO330_m14
[LibreOffice.git] / sw / inc / reffld.hxx
blobb2b61dff64340901a958a43edb3f2ab82ad58645
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
27 #ifndef _REFFLD_HXX
28 #define _REFFLD_HXX
30 #include <fldbas.hxx>
32 class SfxPoolItem;
33 class SwDoc;
34 class SwTxtNode;
35 class SwTxtFld;
37 enum REFERENCESUBTYPE
39 REF_SETREFATTR = 0,
40 REF_SEQUENCEFLD,
41 REF_BOOKMARK,
42 REF_OUTLINE,
43 REF_FOOTNOTE,
44 REF_ENDNOTE
47 enum REFERENCEMARK
49 REF_BEGIN,
50 REF_PAGE = REF_BEGIN,
51 REF_CHAPTER,
52 REF_CONTENT,
53 REF_UPDOWN,
54 REF_PAGE_PGDESC,
55 REF_ONLYNUMBER,
56 REF_ONLYCAPTION,
57 REF_ONLYSEQNO,
58 // --> OD 2007-08-24 #i81002#
59 // new reference format types for referencing bookmarks and set references
60 REF_NUMBER,
61 REF_NUMBER_NO_CONTEXT,
62 REF_NUMBER_FULL_CONTEXT,
63 // <--
64 REF_END
68 /*--------------------------------------------------------------------
69 Beschreibung: Referenz holen
70 --------------------------------------------------------------------*/
72 class SwGetRefFieldType : public SwFieldType
74 SwDoc* pDoc;
75 public:
76 SwGetRefFieldType(SwDoc* pDoc );
77 virtual SwFieldType* Copy() const;
79 SwDoc* GetDoc() const { return pDoc; }
80 // ueberlagert, um alle Ref-Felder zu updaten
81 virtual void Modify( SfxPoolItem *, SfxPoolItem * );
83 void MergeWithOtherDoc( SwDoc& rDestDoc );
85 static SwTxtNode* FindAnchor( SwDoc* pDoc, const String& rRefMark,
86 USHORT nSubType, USHORT nSeqNo,
87 USHORT* pStt, USHORT* pEnd = 0 );
90 /*--------------------------------------------------------------------
91 Beschreibung: Referenzfeld
92 --------------------------------------------------------------------*/
94 class SW_DLLPUBLIC SwGetRefField : public SwField
96 private:
97 String sSetRefName;
98 String sTxt;
99 USHORT nSubType;
100 USHORT nSeqNo;
102 // --> OD 2007-08-24 #i81002#
103 String MakeRefNumStr( const SwTxtNode& rTxtNodeOfField,
104 const SwTxtNode& rTxtNodeOfReferencedItem,
105 const sal_uInt32 nRefNumFormat ) const;
106 // <--
107 public:
108 SwGetRefField( SwGetRefFieldType*, const String& rSetRef,
109 USHORT nSubType, USHORT nSeqNo, ULONG nFmt );
111 virtual ~SwGetRefField();
113 virtual String GetCntnt(BOOL bName = FALSE) const;
114 virtual String Expand() const;
115 virtual SwField* Copy() const;
117 const String& GetSetRefName() const { return sSetRefName; }
119 // --> OD 2007-09-06 #i81002#
120 // The <SwTxtFld> instance, which represents the text attribute for the
121 // <SwGetRefField> instance, has to be passed to the method.
122 // This <SwTxtFld> instance is needed for the reference format type REF_UPDOWN
123 // and REF_NUMBER.
124 // Note: This instance may be NULL (field in Undo/Redo). This will cause
125 // no update for these reference format types.
126 void UpdateField( const SwTxtFld* pFldTxtAttr );
127 // <--
128 void SetExpand( const String& rStr ) { sTxt = rStr; }
130 // SubType erfragen/setzen
131 virtual USHORT GetSubType() const;
132 virtual void SetSubType( USHORT n );
134 // --> OD 2007-11-09 #i81002#
135 bool IsRefToHeadingCrossRefBookmark() const;
136 bool IsRefToNumItemCrossRefBookmark() const;
137 const SwTxtNode* GetReferencedTxtNode() const;
138 // <--
139 // --> OD 2008-01-09 #i85090#
140 String GetExpandedTxtOfReferencedTxtNode() const;
141 // <--
143 // SequenceNo erfragen/setzen (nur fuer REF_SEQUENCEFLD interressant)
144 USHORT GetSeqNo() const { return nSeqNo; }
145 void SetSeqNo( USHORT n ) { nSeqNo = n; }
147 // Name der Referenz
148 virtual const String& GetPar1() const;
149 virtual void SetPar1(const String& rStr);
151 virtual String GetPar2() const;
152 virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, USHORT nWhichId ) const;
153 virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, USHORT nWhichId );
155 void ConvertProgrammaticToUIName();
157 virtual String GetDescription() const;
161 #endif // _REFFLD_HXX