LCOV - code coverage report
Current view: top level - sw/inc - postithelper.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 15 15 100.0 %
Date: 2012-08-25 Functions: 11 12 91.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 3 6 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 _POSTITHELPER_HXX
      29                 :            : #define _POSTITHELPER_HXX
      30                 :            : 
      31                 :            : #include <swrect.hxx>
      32                 :            : #include <fmtfld.hxx>
      33                 :            : #include <redline.hxx>
      34                 :            : #include <vector>
      35                 :            : #include <vcl/window.hxx>
      36                 :            : #include <SidebarWindowsTypes.hxx>
      37                 :            : #include <svl/brdcst.hxx>
      38                 :            : 
      39                 :            : class SwTxtFld;
      40                 :            : class SwRootFrm;
      41                 :            : class String;
      42                 :            : class SwPostItMgr;
      43                 :            : class SwEditWin;
      44                 :            : namespace sw { namespace sidebarwindows {
      45                 :            :     class SwSidebarWin;
      46                 :            : } }
      47                 :            : 
      48                 :            : struct SwPosition;
      49                 :            : 
      50                 :            : typedef sal_Int64 SwPostItBits;
      51                 :            : 
      52                 :        240 : struct SwLayoutInfo
      53                 :            : {
      54                 :            :     const SwFrm* mpAnchorFrm;
      55                 :            :     SwRect mPosition;
      56                 :            :     SwRect mPageFrame;
      57                 :            :     SwRect mPagePrtArea;
      58                 :            :     unsigned long mnPageNumber;
      59                 :            :     sw::sidebarwindows::SidebarPosition meSidebarPosition;
      60                 :            :     sal_uInt16 mRedlineAuthor;
      61                 :            : 
      62                 :         99 :     SwLayoutInfo()
      63                 :            :         : mpAnchorFrm(0)
      64                 :            :         , mPosition()
      65                 :            :         , mPageFrame()
      66                 :            :         , mPagePrtArea()
      67                 :            :         , mnPageNumber(1)
      68                 :            :         , meSidebarPosition(sw::sidebarwindows::SIDEBAR_NONE)
      69                 :         99 :         , mRedlineAuthor(0)
      70                 :         99 :     {}
      71                 :            : };
      72                 :            : 
      73                 :            : namespace SwPostItHelper
      74                 :            : {
      75                 :            :     enum SwLayoutStatus
      76                 :            :     {
      77                 :            :         INVISIBLE, VISIBLE, INSERTED, DELETED, NONE, HIDDEN
      78                 :            :     };
      79                 :            : 
      80                 :            :     SwLayoutStatus getLayoutInfos( std::vector< SwLayoutInfo >&, SwPosition& );
      81                 :            :     long getLayoutHeight( const SwRootFrm* pRoot );
      82                 :            :     void setSidebarChanged( SwRootFrm* pRoot, bool bBrowseMode );
      83                 :            :     unsigned long getPageInfo( SwRect& rPageFrm, const SwRootFrm* , const Point& );
      84                 :            : }
      85                 :            : 
      86                 :         78 : class SwSidebarItem
      87                 :            : {
      88                 :            : public:
      89                 :            :     sw::sidebarwindows::SwSidebarWin* pPostIt;
      90                 :            :     bool bShow;
      91                 :            :     bool bFocus;
      92                 :            : 
      93                 :            :     SwPostItHelper::SwLayoutStatus mLayoutStatus;
      94                 :            :     SwLayoutInfo maLayoutInfo;
      95                 :            : 
      96                 :         18 :     SwSidebarItem( const bool aShow,
      97                 :            :                    const bool aFocus)
      98                 :            :         : pPostIt(0)
      99                 :            :         , bShow(aShow)
     100                 :            :         , bFocus(aFocus)
     101                 :            :         , mLayoutStatus( SwPostItHelper::INVISIBLE )
     102                 :         18 :         , maLayoutInfo()
     103                 :         18 :     {}
     104         [ -  + ]:         15 :     virtual ~SwSidebarItem(){}
     105                 :            :     virtual SwPosition GetAnchorPosition() const = 0;
     106                 :            :     virtual bool UseElement() = 0;
     107                 :            :     virtual SwFmtFld* GetFmtFld() const = 0;
     108                 :            :     virtual SfxBroadcaster* GetBroadCaster() const = 0;
     109                 :            :     virtual sw::sidebarwindows::SwSidebarWin* GetSidebarWindow( SwEditWin& rEditWin,
     110                 :            :                                                                 WinBits nBits,
     111                 :            :                                                                 SwPostItMgr& aMgr,
     112                 :            :                                                                 SwPostItBits aBits) = 0;
     113                 :            : };
     114                 :            : 
     115                 :            : class SwAnnotationItem: public SwSidebarItem
     116                 :            : {
     117                 :            :     private:
     118                 :            :     SwFmtFld* pFmtFld;
     119                 :            : 
     120                 :            :     public:
     121                 :         18 :     SwAnnotationItem( SwFmtFld* p,
     122                 :            :                       const bool aShow,
     123                 :            :                       const bool aFocus)
     124                 :            :         : SwSidebarItem( aShow, aFocus )
     125                 :         18 :         , pFmtFld(p)
     126                 :         18 :     {}
     127         [ -  + ]:         30 :     virtual ~SwAnnotationItem() {}
     128                 :            :     virtual SwPosition GetAnchorPosition() const;
     129                 :            :     virtual bool UseElement();
     130                 :         18 :     virtual SwFmtFld* GetFmtFld() const {return pFmtFld;}
     131         [ +  - ]:         33 :     virtual SfxBroadcaster* GetBroadCaster() const { return dynamic_cast<SfxBroadcaster *> (pFmtFld); }
     132                 :            :     virtual sw::sidebarwindows::SwSidebarWin* GetSidebarWindow( SwEditWin& rEditWin,
     133                 :            :                                                                 WinBits nBits,
     134                 :            :                                                                 SwPostItMgr& aMgr,
     135                 :            :                                                                 SwPostItBits aBits);
     136                 :            : };
     137                 :            : 
     138                 :            : #endif // _POSTITHELPER_HXX
     139                 :            : 
     140                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10