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