1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
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"
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)"
61 class SwGetRefFieldType
: public SwFieldType
65 /// Overlay in order to update all ref-fields.
66 virtual void Modify( const SfxPoolItem
*, const SfxPoolItem
* );
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
89 virtual String
Expand() const;
90 virtual SwField
* Copy() const;
93 String
MakeRefNumStr( const SwTxtNode
& rTxtNodeOfField
,
94 const SwTxtNode
& rTxtNodeOfReferencedItem
,
95 const sal_uInt32 nRefNumFormat
) const;
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
; }
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
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
);
123 bool IsRefToHeadingCrossRefBookmark() const;
124 bool IsRefToNumItemCrossRefBookmark() const;
125 const SwTxtNode
* GetReferencedTxtNode() const;
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: */