LCOV - code coverage report
Current view: top level - sw/inc - fmtfld.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 18 19 94.7 %
Date: 2015-06-13 12:38:46 Functions: 10 12 83.3 %
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             : 
      20             : #ifndef INCLUDED_SW_INC_FMTFLD_HXX
      21             : #define INCLUDED_SW_INC_FMTFLD_HXX
      22             : 
      23             : #include <com/sun/star/text/XTextField.hpp>
      24             : 
      25             : #include <cppuhelper/weakref.hxx>
      26             : #include <svl/poolitem.hxx>
      27             : #include <svl/SfxBroadcaster.hxx>
      28             : #include <svl/smplhint.hxx>
      29             : 
      30             : #include "swdllapi.h"
      31             : #include <calbck.hxx>
      32             : 
      33             : class SwField;
      34             : class SwTextField;
      35             : class SwView;
      36             : class SwFieldType;
      37             : 
      38             : // ATT_FLD
      39             : class SW_DLLPUBLIC SwFormatField
      40             :     : public SfxPoolItem
      41             :     , public SwModify
      42             :     , public SfxBroadcaster
      43             : {
      44             :     friend void _InitCore();
      45             :     SwFormatField( sal_uInt16 nWhich ); // for default-Attibute
      46             : 
      47             :     ::com::sun::star::uno::WeakReference<
      48             :         ::com::sun::star::text::XTextField> m_wXTextField;
      49             : 
      50             :     SwField* mpField;
      51             :     SwTextField* mpTextField; // the TextAttribute
      52             : 
      53             :     // @@@ copy construction allowed, but copy assignment is not? @@@
      54             :     SwFormatField& operator=(const SwFormatField& rField) SAL_DELETED_FUNCTION;
      55             : 
      56             : protected:
      57             :     virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) SAL_OVERRIDE;
      58             :     virtual void SwClientNotify( const SwModify& rModify, const SfxHint& rHint ) SAL_OVERRIDE;
      59             : 
      60             : public:
      61             :     TYPEINFO_OVERRIDE();
      62             : 
      63             :     /// Single argument constructors shall be explicit.
      64             :     explicit SwFormatField( const SwField &rField );
      65             : 
      66             :     /// @@@ copy construction allowed, but copy assignment is not? @@@
      67             :     SwFormatField( const SwFormatField& rAttr );
      68             : 
      69             :     virtual ~SwFormatField();
      70             : 
      71             :     /// "Pure virtual methods" of SfxPoolItem.
      72             :     virtual bool            operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
      73             :     virtual SfxPoolItem*    Clone( SfxItemPool* pPool = 0 ) const SAL_OVERRIDE;
      74             : 
      75             :     virtual bool GetInfo( SfxPoolItem& rInfo ) const SAL_OVERRIDE;
      76             : 
      77             :     void InvalidateField();
      78             : 
      79      161537 :     const SwField* GetField() const
      80             :     {
      81      161537 :         return mpField;
      82             :     }
      83       27494 :     SwField* GetField()
      84             :     {
      85       27494 :         return mpField;
      86             :     }
      87             : 
      88             :     /**
      89             :        Sets current field.
      90             : 
      91             :        @param pField          new field
      92             : 
      93             :        @attention The current field will be destroyed before setting the new field.
      94             :      */
      95             :     void SetField( SwField * pField );
      96             : 
      97        7056 :     const SwTextField* GetTextField() const
      98             :     {
      99        7056 :         return mpTextField;
     100             :     }
     101        6645 :     SwTextField* GetTextField()
     102             :     {
     103        6645 :         return mpTextField;
     104             :     }
     105             :     void SetTextField( SwTextField& rTextField );
     106             :     void ClearTextField();
     107             : 
     108             :     void RegisterToFieldType( SwFieldType& );
     109             :     bool IsFieldInDoc() const;
     110             :     bool IsProtect() const;
     111             : 
     112             :     SAL_DLLPRIVATE ::com::sun::star::uno::WeakReference<
     113        1283 :         ::com::sun::star::text::XTextField> const& GetXTextField() const
     114        1283 :             { return m_wXTextField; }
     115        1272 :     SAL_DLLPRIVATE void SetXTextField(::com::sun::star::uno::Reference<
     116             :                     ::com::sun::star::text::XTextField> const& xTextField)
     117        1272 :             { m_wXTextField = xTextField; }
     118             : };
     119             : 
     120             : enum class SwFormatFieldHintWhich
     121             : {
     122             :     INSERTED   = 1,
     123             :     REMOVED    = 2,
     124             :     FOCUS      = 3,
     125             :     CHANGED    = 4,
     126             :     LANGUAGE   = 5
     127             : };
     128             : 
     129        6887 : class SW_DLLPUBLIC SwFormatFieldHint : public SfxHint
     130             : {
     131             :     const SwFormatField*   pField;
     132             :     SwFormatFieldHintWhich nWhich;
     133             :     const SwView*     pView;
     134             : 
     135             : public:
     136        6887 :     SwFormatFieldHint( const SwFormatField* p, SwFormatFieldHintWhich n, const SwView* pV = 0)
     137             :         : pField(p)
     138             :         , nWhich(n)
     139        6887 :         , pView(pV)
     140        6887 :     {}
     141             : 
     142         100 :     const SwFormatField* GetField() const { return pField; }
     143         100 :     SwFormatFieldHintWhich Which() const { return nWhich; }
     144           0 :     const SwView* GetView() const { return pView; }
     145             : };
     146             : 
     147             : #endif
     148             : 
     149             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11