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

Generated by: LCOV version 1.10