LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/inc - IMark.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 15 17 88.2 %
Date: 2013-07-09 Functions: 15 27 55.6 %
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 _IMARK_HXX
      20             : #define _IMARK_HXX
      21             : 
      22             : #include <vcl/keycod.hxx>
      23             : #include <calbck.hxx>
      24             : #include <pam.hxx>
      25             : #include <boost/operators.hpp>
      26             : #include <boost/shared_ptr.hpp>
      27             : #include <map>
      28             : #include "swdll.hxx"
      29             : 
      30             : #ifndef SW_DECL_SWSERVEROBJECT_DEFINED
      31             : #define SW_DECL_SWSERVEROBJECT_DEFINED
      32        2653 : SV_DECL_REF( SwServerObject )
      33             : #endif
      34             : 
      35             : 
      36             : struct SwPosition;
      37             : 
      38             : namespace sw { namespace mark
      39             : {
      40             : 
      41       27586 :     class SAL_DLLPUBLIC_EXPORT IMark
      42             :         : virtual public SwModify // inherited as interface
      43             :         , public ::boost::totally_ordered<IMark>
      44             :     {
      45             :         public:
      46             :             //getters
      47             :             virtual const SwPosition& GetMarkPos() const =0;
      48             :             // GetOtherMarkPos() is only guaranteed to return a valid
      49             :             // reference if IsExpanded() returned true
      50             :             virtual const SwPosition& GetOtherMarkPos() const =0;
      51             :             virtual const SwPosition& GetMarkStart() const =0;
      52             :             virtual const SwPosition& GetMarkEnd() const =0;
      53             :             virtual const OUString& GetName() const =0;
      54             :             virtual bool IsExpanded() const =0;
      55             :             virtual bool IsCoveringPosition(const SwPosition& rPos) const =0;
      56             : 
      57             :             //setters
      58             :             // not available in IMark
      59             :             // inside core, you can cast to MarkBase and use its setters,
      60             :             // make sure to update the sortings in Markmanager in this case
      61             : 
      62             :             //operators and comparisons (non-virtual)
      63             :             bool operator<(const IMark& rOther) const
      64             :                 { return GetMarkStart() < rOther.GetMarkStart(); }
      65          65 :             bool operator==(const IMark& rOther) const
      66          65 :                 { return GetMarkStart() == rOther.GetMarkStart(); }
      67       77690 :             bool StartsBefore(const SwPosition& rPos) const
      68       77690 :                 { return GetMarkStart() < rPos; }
      69         497 :             bool StartsAfter(const SwPosition& rPos) const
      70         497 :                 { return GetMarkStart() > rPos; }
      71           0 :             bool EndsBefore(const SwPosition& rPos) const
      72           0 :                 { return GetMarkEnd() < rPos; }
      73             :             bool EndsAfter(const SwPosition& rPos) const
      74             :                 { return GetMarkEnd() > rPos; }
      75             : 
      76             :             virtual OUString ToString( ) const =0;
      77             :     };
      78             : 
      79        4092 :     class SAL_DLLPUBLIC_EXPORT IBookmark
      80             :         : virtual public IMark
      81             :     {
      82             :         public:
      83             :             virtual const OUString& GetShortName() const =0;
      84             :             virtual const KeyCode& GetKeyCode() const =0;
      85             :             virtual void SetShortName(const OUString&) =0;
      86             :             virtual void SetKeyCode(const KeyCode&) =0;
      87             :     };
      88             : 
      89          32 :     class SAL_DLLPUBLIC_EXPORT IFieldmark
      90             :         : virtual public IMark
      91             :     {
      92             :         public:
      93             :             typedef ::std::map< OUString, ::com::sun::star::uno::Any> parameter_map_t;
      94             :             //getters
      95             :             virtual OUString GetFieldname() const =0;
      96             :             virtual OUString GetFieldHelptext() const =0;
      97             :             virtual parameter_map_t* GetParameters() =0;
      98             :             virtual const parameter_map_t* GetParameters() const =0;
      99             : 
     100             :             //setters
     101             :             virtual void SetFieldname(const OUString& rFieldname) =0;
     102             :             virtual void SetFieldHelptext(const OUString& rFieldHelptext) =0;
     103             :             virtual void Invalidate() = 0;
     104             :     };
     105             : 
     106           8 :     class SAL_DLLPUBLIC_EXPORT ICheckboxFieldmark
     107             :         : virtual public IFieldmark
     108             :     {
     109             :         public:
     110             :             virtual bool IsChecked() const =0;
     111             :             virtual void SetChecked(bool checked) =0;
     112             :     };
     113             : 
     114             :     // Apple llvm-g++ 4.2.1 with _GLIBCXX_DEBUG won't eat boost::bind for this
     115             :     // Neither will MSVC 2008 with _DEBUG
     116             :     struct CompareIMarkStartsAfter
     117             :     {
     118         495 :         bool operator()(SwPosition const& rPos,
     119             :                         boost::shared_ptr<sw::mark::IMark> const& pMark)
     120             :         {
     121         495 :             return pMark->StartsAfter(rPos);
     122             :         }
     123             : #ifdef DBG_UTIL
     124             :         bool operator()(boost::shared_ptr<sw::mark::IMark> const& pMark,
     125             :                         SwPosition const& rPos)
     126             :         {
     127             :             return pMark->StartsBefore(rPos);
     128             :         }
     129             :         bool operator()(boost::shared_ptr<sw::mark::IMark> const& pMark1,
     130             :                         boost::shared_ptr<sw::mark::IMark> const& pMark2)
     131             :         {
     132             :             return (*pMark1) < (*pMark2);
     133             :         }
     134             : #endif
     135             :     };
     136             : 
     137             :     // MSVC 2008 with _DEBUG calls this with parameters in wrong order
     138             :     // so it needs 3 overloads...
     139             :     struct CompareIMarkStartsBefore
     140             :     {
     141       77690 :         bool operator()(boost::shared_ptr<sw::mark::IMark> const& pMark,
     142             :                         SwPosition const& rPos)
     143             :         {
     144       77690 :             return pMark->StartsBefore(rPos);
     145             :         }
     146             : #ifdef DBG_UTIL
     147             :         bool operator()(SwPosition const& rPos,
     148             :                         boost::shared_ptr<sw::mark::IMark> const& pMark)
     149             :         {
     150             :             return pMark->StartsAfter(rPos);
     151             :         }
     152             :         bool operator()(boost::shared_ptr<sw::mark::IMark> const& pMark1,
     153             :                         boost::shared_ptr<sw::mark::IMark> const& pMark2)
     154             :         {
     155             :             return (*pMark1) < (*pMark2);
     156             :         }
     157             : #endif
     158             :     };
     159             : 
     160             : }}
     161             : #endif
     162             : 
     163             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10