LCOV - code coverage report
Current view: top level - sw/inc - reffld.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 3 6 50.0 %
Date: 2014-04-11 Functions: 4 7 57.1 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : #ifndef INCLUDED_SW_INC_REFFLD_HXX
      20             : #define INCLUDED_SW_INC_REFFLD_HXX
      21             : 
      22             : #include <fldbas.hxx>
      23             : 
      24             : class SfxPoolItem;
      25             : class SwDoc;
      26             : class SwTxtNode;
      27             : class SwTxtFld;
      28             : 
      29             : enum REFERENCESUBTYPE
      30             : {
      31             :     REF_SETREFATTR = 0,
      32             :     REF_SEQUENCEFLD,
      33             :     REF_BOOKMARK,
      34             :     REF_OUTLINE,
      35             :     REF_FOOTNOTE,
      36             :     REF_ENDNOTE
      37             : };
      38             : 
      39             : enum REFERENCEMARK
      40             : {
      41             :     REF_BEGIN,
      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"
      50             :     // --> #i81002#
      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)"
      55             :     REF_END
      56             : };
      57             : 
      58             : /// Get reference.
      59             : 
      60        3696 : class SwGetRefFieldType : public SwFieldType
      61             : {
      62             :     SwDoc* pDoc;
      63             : protected:
      64             :     /// Overlay in order to update all ref-fields.
      65             :     virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE;
      66             : public:
      67             :     SwGetRefFieldType(SwDoc* pDoc );
      68             :     virtual SwFieldType*    Copy() const SAL_OVERRIDE;
      69             : 
      70         461 :     SwDoc*                  GetDoc() const { return pDoc; }
      71             : 
      72             :     void MergeWithOtherDoc( SwDoc& rDestDoc );
      73             : 
      74             :     static SwTxtNode* FindAnchor( SwDoc* pDoc, const OUString& rRefMark,
      75             :                                         sal_uInt16 nSubType, sal_uInt16 nSeqNo,
      76             :                                         sal_Int32* pStt, sal_Int32* pEnd = 0 );
      77             : };
      78             : 
      79             : class SW_DLLPUBLIC SwGetRefField : public SwField
      80             : {
      81             : private:
      82             :     OUString sSetRefName;
      83             :     OUString sTxt;
      84             :     sal_uInt16 nSubType;
      85             :     sal_uInt16 nSeqNo;
      86             : 
      87             :     virtual OUString    Expand() const SAL_OVERRIDE;
      88             :     virtual SwField*    Copy() const SAL_OVERRIDE;
      89             : 
      90             :     // #i81002#
      91             :     OUString MakeRefNumStr( const SwTxtNode& rTxtNodeOfField,
      92             :                           const SwTxtNode& rTxtNodeOfReferencedItem,
      93             :                           const sal_uInt32 nRefNumFormat ) const;
      94             : 
      95             : public:
      96             :     SwGetRefField( SwGetRefFieldType*, const OUString& rSetRef,
      97             :                     sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uLong nFmt );
      98             : 
      99             :     virtual ~SwGetRefField();
     100             : 
     101             :     virtual OUString GetFieldName() const SAL_OVERRIDE;
     102             : 
     103           0 :     OUString GetSetRefName() const { return sSetRefName; }
     104             : 
     105             :     // #i81002#
     106             :     /** The <SwTxtFld> instance, which represents the text attribute for the
     107             :        <SwGetRefField> instance, has to be passed to the method.
     108             :        This <SwTxtFld> instance is needed for the reference format type REF_UPDOWN
     109             :        and REF_NUMBER.
     110             :        Note: This instance may be NULL (field in Undo/Redo). This will cause
     111             :        no update for these reference format types. */
     112             :     void                UpdateField( const SwTxtFld* pFldTxtAttr );
     113             : 
     114          30 :     void                SetExpand( const OUString& rStr ) { sTxt = rStr; }
     115             : 
     116             :     /// Get/set sub type.
     117             :     virtual sal_uInt16      GetSubType() const SAL_OVERRIDE;
     118             :     virtual void        SetSubType( sal_uInt16 n ) SAL_OVERRIDE;
     119             : 
     120             :     // --> #i81002#
     121             :     bool IsRefToHeadingCrossRefBookmark() const;
     122             :     bool IsRefToNumItemCrossRefBookmark() const;
     123             :     const SwTxtNode* GetReferencedTxtNode() const;
     124             :     // #i85090#
     125             :     OUString GetExpandedTxtOfReferencedTxtNode() const;
     126             : 
     127             :     /// Get/set SequenceNo (of interest only for REF_SEQUENCEFLD).
     128           0 :     sal_uInt16              GetSeqNo() const        { return nSeqNo; }
     129           0 :     void                SetSeqNo( sal_uInt16 n )    { nSeqNo = n; }
     130             : 
     131             :     // Name of reference.
     132             :     virtual OUString    GetPar1() const SAL_OVERRIDE;
     133             :     virtual void        SetPar1(const OUString& rStr) SAL_OVERRIDE;
     134             : 
     135             :     virtual OUString GetPar2() const SAL_OVERRIDE;
     136             :     virtual bool        QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhichId ) const SAL_OVERRIDE;
     137             :     virtual bool        PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhichId ) SAL_OVERRIDE;
     138             : 
     139             :     void                ConvertProgrammaticToUIName();
     140             : 
     141             :     virtual OUString GetDescription() const SAL_OVERRIDE;
     142             : };
     143             : 
     144             : #endif /// INCLUDED_SW_INC_REFFLD_HXX
     145             : 
     146             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10