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

Generated by: LCOV version 1.10