LCOV - code coverage report
Current view: top level - sw/inc - reffld.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 4 6 66.7 %
Date: 2014-11-03 Functions: 5 7 71.4 %
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             : bool IsFrameBehind( const SwTxtNode& rMyNd, sal_Int32 nMySttPos,
      30             :                     const SwTxtNode& rBehindNd, sal_Int32 nSttPos );
      31             : 
      32             : enum REFERENCESUBTYPE
      33             : {
      34             :     REF_SETREFATTR = 0,
      35             :     REF_SEQUENCEFLD,
      36             :     REF_BOOKMARK,
      37             :     REF_OUTLINE,
      38             :     REF_FOOTNOTE,
      39             :     REF_ENDNOTE
      40             : };
      41             : 
      42             : enum REFERENCEMARK
      43             : {
      44             :     REF_BEGIN,
      45             :     REF_PAGE = REF_BEGIN, ///< "Page"
      46             :     REF_CHAPTER,          ///< "Chapter"
      47             :     REF_CONTENT,          ///< "Reference"
      48             :     REF_UPDOWN,           ///< "Above/Below"
      49             :     REF_PAGE_PGDESC,      ///< "As Page Style"
      50             :     REF_ONLYNUMBER,       ///< "Category and Number"
      51             :     REF_ONLYCAPTION,      ///< "Caption Text"
      52             :     REF_ONLYSEQNO,        ///< "Numbering"
      53             :     // --> #i81002#
      54             :     /// new reference format types for referencing bookmarks and set references
      55             :     REF_NUMBER,              ///< "Number"
      56             :     REF_NUMBER_NO_CONTEXT,   ///< "Number (no context)"
      57             :     REF_NUMBER_FULL_CONTEXT, ///< "Number (full context)"
      58             :     REF_END
      59             : };
      60             : 
      61             : /// Get reference.
      62             : 
      63       10090 : class SwGetRefFieldType : public SwFieldType
      64             : {
      65             :     SwDoc* pDoc;
      66             : protected:
      67             :     /// Overlay in order to update all ref-fields.
      68             :     virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE;
      69             : public:
      70             :     SwGetRefFieldType(SwDoc* pDoc );
      71             :     virtual SwFieldType*    Copy() const SAL_OVERRIDE;
      72             : 
      73         936 :     SwDoc*                  GetDoc() const { return pDoc; }
      74             : 
      75             :     void MergeWithOtherDoc( SwDoc& rDestDoc );
      76             : 
      77             :     static SwTxtNode* FindAnchor( SwDoc* pDoc, const OUString& rRefMark,
      78             :                                         sal_uInt16 nSubType, sal_uInt16 nSeqNo,
      79             :                                         sal_Int32* pStt, sal_Int32* pEnd = 0 );
      80             : };
      81             : 
      82             : class SW_DLLPUBLIC SwGetRefField : public SwField
      83             : {
      84             : private:
      85             :     OUString sSetRefName;
      86             :     OUString sTxt;
      87             :     sal_uInt16 nSubType;
      88             :     sal_uInt16 nSeqNo;
      89             : 
      90             :     virtual OUString    Expand() const SAL_OVERRIDE;
      91             :     virtual SwField*    Copy() const SAL_OVERRIDE;
      92             : 
      93             :     // #i81002#
      94             :     OUString MakeRefNumStr( const SwTxtNode& rTxtNodeOfField,
      95             :                           const SwTxtNode& rTxtNodeOfReferencedItem,
      96             :                           const sal_uInt32 nRefNumFormat ) const;
      97             : 
      98             : public:
      99             :     SwGetRefField( SwGetRefFieldType*, const OUString& rSetRef,
     100             :                     sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uLong nFmt );
     101             : 
     102             :     virtual ~SwGetRefField();
     103             : 
     104             :     virtual OUString GetFieldName() const SAL_OVERRIDE;
     105             : 
     106           6 :     OUString GetSetRefName() const { return sSetRefName; }
     107             : 
     108             :     // #i81002#
     109             :     /** The <SwTxtFld> instance, which represents the text attribute for the
     110             :        <SwGetRefField> instance, has to be passed to the method.
     111             :        This <SwTxtFld> instance is needed for the reference format type REF_UPDOWN
     112             :        and REF_NUMBER.
     113             :        Note: This instance may be NULL (field in Undo/Redo). This will cause
     114             :        no update for these reference format types. */
     115             :     void                UpdateField( const SwTxtFld* pFldTxtAttr );
     116             : 
     117          74 :     void                SetExpand( const OUString& rStr ) { sTxt = rStr; }
     118             : 
     119             :     /// Get/set sub type.
     120             :     virtual sal_uInt16      GetSubType() const SAL_OVERRIDE;
     121             :     virtual void        SetSubType( sal_uInt16 n ) SAL_OVERRIDE;
     122             : 
     123             :     // --> #i81002#
     124             :     bool IsRefToHeadingCrossRefBookmark() const;
     125             :     bool IsRefToNumItemCrossRefBookmark() const;
     126             :     const SwTxtNode* GetReferencedTxtNode() const;
     127             :     // #i85090#
     128             :     OUString GetExpandedTxtOfReferencedTxtNode() const;
     129             : 
     130             :     /// Get/set SequenceNo (of interest only for REF_SEQUENCEFLD).
     131           0 :     sal_uInt16              GetSeqNo() const        { return nSeqNo; }
     132           0 :     void                SetSeqNo( sal_uInt16 n )    { nSeqNo = n; }
     133             : 
     134             :     // Name of reference.
     135             :     virtual OUString    GetPar1() const SAL_OVERRIDE;
     136             :     virtual void        SetPar1(const OUString& rStr) SAL_OVERRIDE;
     137             : 
     138             :     virtual OUString GetPar2() const SAL_OVERRIDE;
     139             :     virtual bool        QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhichId ) const SAL_OVERRIDE;
     140             :     virtual bool        PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhichId ) SAL_OVERRIDE;
     141             : 
     142             :     void                ConvertProgrammaticToUIName();
     143             : 
     144             :     virtual OUString GetDescription() const SAL_OVERRIDE;
     145             : };
     146             : 
     147             : #endif /// INCLUDED_SW_INC_REFFLD_HXX
     148             : 
     149             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10