1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 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. 14 * 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). 20 * 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. 25 * 26 ************************************************************************/ 27 #ifndef SW_REFFLD_HXX 28 #define SW_REFFLD_HXX 29 30 #include <fldbas.hxx> 31 32 class SfxPoolItem; 33 class SwDoc; 34 class SwTxtNode; 35 class SwTxtFld; 36 37 enum REFERENCESUBTYPE 38 { 39 REF_SETREFATTR = 0, 40 REF_SEQUENCEFLD, 41 REF_BOOKMARK, 42 REF_OUTLINE, 43 REF_FOOTNOTE, 44 REF_ENDNOTE 45 }; 46 47 enum REFERENCEMARK 48 { 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 65 }; 66 67 68 /*-------------------------------------------------------------------- 69 Beschreibung: Referenz holen 70 --------------------------------------------------------------------*/ 71 72 class SwGetRefFieldType : public SwFieldType 73 { 74 SwDoc* pDoc; 75 protected: 76 // ueberlagert, um alle Ref-Felder zu updaten 77 virtual void Modify( const SfxPoolItem*, const SfxPoolItem * ); 78 public: 79 SwGetRefFieldType(SwDoc* pDoc ); 80 virtual SwFieldType* Copy() const; 81 82 SwDoc* GetDoc() const { return pDoc; } 83 84 void MergeWithOtherDoc( SwDoc& rDestDoc ); 85 86 static SwTxtNode* FindAnchor( SwDoc* pDoc, const String& rRefMark, 87 sal_uInt16 nSubType, sal_uInt16 nSeqNo, 88 sal_uInt16* pStt, sal_uInt16* pEnd = 0 ); 89 }; 90 91 /*-------------------------------------------------------------------- 92 Beschreibung: Referenzfeld 93 --------------------------------------------------------------------*/ 94 95 class SW_DLLPUBLIC SwGetRefField : public SwField 96 { 97 private: 98 String sSetRefName; 99 String sTxt; 100 sal_uInt16 nSubType; 101 sal_uInt16 nSeqNo; 102 103 virtual String Expand() const; 104 virtual SwField* Copy() const; 105 106 // --> OD 2007-08-24 #i81002# 107 String MakeRefNumStr( const SwTxtNode& rTxtNodeOfField, 108 const SwTxtNode& rTxtNodeOfReferencedItem, 109 const sal_uInt32 nRefNumFormat ) const; 110 // <-- 111 public: 112 SwGetRefField( SwGetRefFieldType*, const String& rSetRef, 113 sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uLong nFmt ); 114 115 virtual ~SwGetRefField(); 116 117 virtual String GetFieldName() const; 118 119 const String& GetSetRefName() const { return sSetRefName; } 120 121 // --> OD 2007-09-06 #i81002# 122 // The <SwTxtFld> instance, which represents the text attribute for the 123 // <SwGetRefField> instance, has to be passed to the method. 124 // This <SwTxtFld> instance is needed for the reference format type REF_UPDOWN 125 // and REF_NUMBER. 126 // Note: This instance may be NULL (field in Undo/Redo). This will cause 127 // no update for these reference format types. 128 void UpdateField( const SwTxtFld* pFldTxtAttr ); 129 // <-- 130 void SetExpand( const String& rStr ) { sTxt = rStr; } 131 132 // SubType erfragen/setzen 133 virtual sal_uInt16 GetSubType() const; 134 virtual void SetSubType( sal_uInt16 n ); 135 136 // --> OD 2007-11-09 #i81002# 137 bool IsRefToHeadingCrossRefBookmark() const; 138 bool IsRefToNumItemCrossRefBookmark() const; 139 const SwTxtNode* GetReferencedTxtNode() const; 140 // <-- 141 // --> OD 2008-01-09 #i85090# 142 String GetExpandedTxtOfReferencedTxtNode() const; 143 // <-- 144 145 // SequenceNo erfragen/setzen (nur fuer REF_SEQUENCEFLD interressant) 146 sal_uInt16 GetSeqNo() const { return nSeqNo; } 147 void SetSeqNo( sal_uInt16 n ) { nSeqNo = n; } 148 149 // Name der Referenz 150 virtual const String& GetPar1() const; 151 virtual void SetPar1(const String& rStr); 152 153 virtual String GetPar2() const; 154 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhichId ) const; 155 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhichId ); 156 157 void ConvertProgrammaticToUIName(); 158 159 virtual String GetDescription() const; 160 }; 161 162 163 #endif // SW_REFFLD_HXX 164 165