1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: reffld.hxx,v $
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 ************************************************************************/
61 // --> OD 2007-08-24 #i81002#
62 // new reference format types for referencing bookmarks and set references
64 REF_NUMBER_NO_CONTEXT
,
65 REF_NUMBER_FULL_CONTEXT
,
71 /*--------------------------------------------------------------------
72 Beschreibung: Referenz holen
73 --------------------------------------------------------------------*/
75 class SwGetRefFieldType
: public SwFieldType
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
105 // --> OD 2007-08-24 #i81002#
106 String
MakeRefNumStr( const SwTxtNode
& rTxtNodeOfField
,
107 const SwTxtNode
& rTxtNodeOfReferencedItem
,
108 const sal_uInt32 nRefNumFormat
) const;
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
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
);
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;
142 // --> OD 2008-01-09 #i85090#
143 String
GetExpandedTxtOfReferencedTxtNode() const;
146 // SequenceNo erfragen/setzen (nur fuer REF_SEQUENCEFLD interressant)
147 USHORT
GetSeqNo() const { return nSeqNo
; }
148 void SetSeqNo( USHORT n
) { nSeqNo
= n
; }
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