LCOV - code coverage report
Current view: top level - sw/inc - reffld.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 6 50.0 %
Date: 2012-08-25 Functions: 4 7 57.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 2 50.0 %

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

Generated by: LCOV version 1.10