merge the formfield patch from ooo-build
[ooovba.git] / sw / inc / reffld.hxx
blob4c7ea6e7e4c759d32943e9c1f5f20aa098e7b51a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: reffld.hxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _REFFLD_HXX
31 #define _REFFLD_HXX
33 #include <fldbas.hxx>
35 class SfxPoolItem;
36 class SwDoc;
37 class SwTxtNode;
38 class SwTxtFld;
40 enum REFERENCESUBTYPE
42 REF_SETREFATTR = 0,
43 REF_SEQUENCEFLD,
44 REF_BOOKMARK,
45 REF_OUTLINE,
46 REF_FOOTNOTE,
47 REF_ENDNOTE
50 enum REFERENCEMARK
52 REF_BEGIN,
53 REF_PAGE = REF_BEGIN,
54 REF_CHAPTER,
55 REF_CONTENT,
56 REF_UPDOWN,
57 REF_PAGE_PGDESC,
58 REF_ONLYNUMBER,
59 REF_ONLYCAPTION,
60 REF_ONLYSEQNO,
61 // --> OD 2007-08-24 #i81002#
62 // new reference format types for referencing bookmarks and set references
63 REF_NUMBER,
64 REF_NUMBER_NO_CONTEXT,
65 REF_NUMBER_FULL_CONTEXT,
66 // <--
67 REF_END
71 /*--------------------------------------------------------------------
72 Beschreibung: Referenz holen
73 --------------------------------------------------------------------*/
75 class SwGetRefFieldType : public SwFieldType
77 SwDoc* pDoc;
78 public:
79 SwGetRefFieldType(SwDoc* pDoc );
80 virtual SwFieldType* Copy() const;
82 SwDoc* GetDoc() const { return pDoc; }
83 // ueberlagert, um alle Ref-Felder zu updaten
84 virtual void Modify( SfxPoolItem *, SfxPoolItem * );
86 void MergeWithOtherDoc( SwDoc& rDestDoc );
88 static SwTxtNode* FindAnchor( SwDoc* pDoc, const String& rRefMark,
89 USHORT nSubType, USHORT nSeqNo,
90 USHORT* pStt, USHORT* pEnd = 0 );
93 /*--------------------------------------------------------------------
94 Beschreibung: Referenzfeld
95 --------------------------------------------------------------------*/
97 class SW_DLLPUBLIC SwGetRefField : public SwField
99 private:
100 String sSetRefName;
101 String sTxt;
102 USHORT nSubType;
103 USHORT nSeqNo;
105 // --> OD 2007-08-24 #i81002#
106 String MakeRefNumStr( const SwTxtNode& rTxtNodeOfField,
107 const SwTxtNode& rTxtNodeOfReferencedItem,
108 const sal_uInt32 nRefNumFormat ) const;
109 // <--
110 public:
111 SwGetRefField( SwGetRefFieldType*, const String& rSetRef,
112 USHORT nSubType, USHORT nSeqNo, ULONG nFmt );
114 virtual ~SwGetRefField();
116 virtual String GetCntnt(BOOL bName = FALSE) const;
117 virtual String Expand() const;
118 virtual SwField* Copy() const;
120 const String& GetSetRefName() const { return sSetRefName; }
122 // --> OD 2007-09-06 #i81002#
123 // The <SwTxtFld> instance, which represents the text attribute for the
124 // <SwGetRefField> instance, has to be passed to the method.
125 // This <SwTxtFld> instance is needed for the reference format type REF_UPDOWN
126 // and REF_NUMBER.
127 // Note: This instance may be NULL (field in Undo/Redo). This will cause
128 // no update for these reference format types.
129 void UpdateField( const SwTxtFld* pFldTxtAttr );
130 // <--
131 void SetExpand( const String& rStr ) { sTxt = rStr; }
133 // SubType erfragen/setzen
134 virtual USHORT GetSubType() const;
135 virtual void SetSubType( USHORT n );
137 // --> OD 2007-11-09 #i81002#
138 bool IsRefToHeadingCrossRefBookmark() const;
139 bool IsRefToNumItemCrossRefBookmark() const;
140 const SwTxtNode* GetReferencedTxtNode() const;
141 // <--
142 // --> OD 2008-01-09 #i85090#
143 String GetExpandedTxtOfReferencedTxtNode() const;
144 // <--
146 // SequenceNo erfragen/setzen (nur fuer REF_SEQUENCEFLD interressant)
147 USHORT GetSeqNo() const { return nSeqNo; }
148 void SetSeqNo( USHORT n ) { nSeqNo = n; }
150 // Name der Referenz
151 virtual const String& GetPar1() const;
152 virtual void SetPar1(const String& rStr);
154 virtual String GetPar2() const;
155 virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, USHORT nWhichId ) const;
156 virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, USHORT nWhichId );
158 void ConvertProgrammaticToUIName();
160 virtual String GetDescription() const;
164 #endif // _REFFLD_HXX