LCOV - code coverage report
Current view: top level - libreoffice/sw/inc - fmtfld.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 10 11 90.9 %
Date: 2012-12-27 Functions: 8 10 80.0 %
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 _FMTFLD_HXX
      20             : #define _FMTFLD_HXX
      21             : 
      22             : #include <list>
      23             : #include <svl/poolitem.hxx>
      24             : #include <svl/brdcst.hxx>
      25             : #include <svl/smplhint.hxx>
      26             : 
      27             : #include "swdllapi.h"
      28             : #include <calbck.hxx>
      29             : 
      30             : class SwField;
      31             : class SwTxtFld;
      32             : class SwView;
      33             : class SwFieldType;
      34             : 
      35             : // ATT_FLD
      36             : class SW_DLLPUBLIC SwFmtFld : public SfxPoolItem, public SwClient, public SfxBroadcaster
      37             : {
      38             :     friend class SwTxtFld;
      39             :     friend void _InitCore();
      40             : 
      41             :     SwField *pField;
      42             :     SwTxtFld* pTxtAttr;
      43             : 
      44             :     SwFmtFld(); ///< Default attibute.
      45             : 
      46             :     /* Protected CopyCtor.
      47             :      @@@ copy construction allowed, but copy assignment is not? @@@ */
      48             :     SwFmtFld& operator=(const SwFmtFld& rFld);
      49             : 
      50             : protected:
      51             :     virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
      52             :     virtual void SwClientNotify( const SwModify& rModify, const SfxHint& rHint );
      53             : 
      54             : public:
      55             :     TYPEINFO();
      56             : 
      57             :     /// Single argument constructors shall be explicit.
      58             :     explicit SwFmtFld( const SwField &rFld );
      59             : 
      60             :     /// @@@ copy construction allowed, but copy assignment is not? @@@
      61             :     SwFmtFld( const SwFmtFld& rAttr );
      62             : 
      63             :     virtual ~SwFmtFld();
      64             : 
      65             :     /// "Pure virtual methods" of SfxPoolItem.
      66             :     virtual int             operator==( const SfxPoolItem& ) const;
      67             :     virtual SfxPoolItem*    Clone( SfxItemPool* pPool = 0 ) const;
      68             : 
      69             :     virtual bool GetInfo( SfxPoolItem& rInfo ) const;
      70             : 
      71      129056 :     const SwField *GetFld() const   { return pField; }
      72         510 :     SwField *GetFld()               { return pField; }
      73             : 
      74             :     /**
      75             :        Sets current field.
      76             : 
      77             :        @param pField          new field
      78             : 
      79             :        @attention The current field will be destroyed before setting the new field.
      80             :      */
      81             :     void SetFld(SwField * pField);
      82             : 
      83          55 :     const SwTxtFld *GetTxtFld() const   { return pTxtAttr; }
      84          67 :     SwTxtFld *GetTxtFld()               { return pTxtAttr; }
      85             : 
      86             :     void RegisterToFieldType( SwFieldType& );
      87             :     sal_Bool IsFldInDoc() const;
      88             :     sal_Bool IsProtect() const;
      89             : };
      90             : 
      91        1989 : class SW_DLLPUBLIC SwFmtFldHint : public SfxHint
      92             : {
      93             : #define SWFMTFLD_INSERTED   1
      94             : #define SWFMTFLD_REMOVED    2
      95             : #define SWFMTFLD_FOCUS      3
      96             : #define SWFMTFLD_CHANGED    4
      97             : #define SWFMTFLD_LANGUAGE   5
      98             : 
      99             :     const SwFmtFld* pFld;
     100             :     sal_Int16 nWhich;
     101             :     const SwView* pView;
     102             : 
     103             : public:
     104        1989 :     SwFmtFldHint( const SwFmtFld* p, sal_Int16 n, const SwView* pV = 0)
     105             :         : pFld(p)
     106             :         , nWhich(n)
     107        1989 :         , pView(pV)
     108        1989 :     {}
     109             : 
     110             :     TYPEINFO();
     111           6 :     const SwFmtFld* GetField() const { return pFld; }
     112           6 :     sal_Int16 Which() const { return nWhich; }
     113           0 :     const SwView* GetView() const { return pView; }
     114             : };
     115             : 
     116             : #endif
     117             : 
     118             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10