LCOV - code coverage report
Current view: top level - libreoffice/sw/source/ui/inc - content.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 45 0.0 %
Date: 2012-12-27 Functions: 0 36 0.0 %
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 _CONTENT_HXX
      20             : #define _CONTENT_HXX
      21             : #include <limits.h>     // USHRT_MAX
      22             : #include "swcont.hxx"
      23             : 
      24             : #include <vcl/menu.hxx>
      25             : 
      26             : class SwWrtShell;
      27             : class SwContentArr;
      28             : class SwContentType;
      29             : class SwFmtFld;
      30             : class SwTxtINetFmt;
      31             : class SwTOXBase;
      32             : class SwRedline;
      33             : 
      34             : //----------------------------------------------------------------------------
      35             : //  helper classes
      36             : //----------------------------------------------------------------------------
      37             : 
      38           0 : class SwPopup : public PopupMenu
      39             : {
      40             :     sal_uInt16          nCurId;
      41           0 :     virtual void    Select(){nCurId = GetCurItemId();}
      42             : 
      43             : public:
      44             :     SwPopup() :
      45             :         PopupMenu(),
      46             :         nCurId(USHRT_MAX){}
      47             : 
      48             :     sal_uInt16          GetCurId() const { return nCurId; }
      49             : 
      50             : };
      51             : 
      52             : //----------------------------------------------------------------------------
      53             : 
      54           0 : class SwOutlineContent : public SwContent
      55             : {
      56             :     sal_uInt16  nOutlinePos;
      57             :     sal_uInt8   nOutlineLevel;
      58             :     sal_Bool    bIsMoveable;
      59             :     public:
      60           0 :         SwOutlineContent(   const SwContentType* pCnt,
      61             :                             const String& rName,
      62             :                             sal_uInt16 nArrPos,
      63             :                             sal_uInt8 nLevel,
      64             :                             sal_Bool bMove,
      65             :                             long nYPos) :
      66             :             SwContent(pCnt, rName, nYPos),
      67           0 :             nOutlinePos(nArrPos), nOutlineLevel(nLevel), bIsMoveable(bMove) {}
      68             : 
      69           0 :     sal_uInt16  GetPos(){return nOutlinePos;}
      70           0 :     sal_uInt8   GetOutlineLevel(){return nOutlineLevel;}
      71           0 :     sal_Bool    IsMoveable(){return bIsMoveable;};
      72             : };
      73             : 
      74             : //----------------------------------------------------------------------------
      75           0 : class SwRegionContent : public SwContent
      76             : {
      77             : 
      78             :     sal_uInt8   nRegionLevel;
      79             : 
      80             :     public:
      81           0 :         SwRegionContent(    const SwContentType* pCnt,
      82             :                             const String& rName,
      83             :                             sal_uInt8 nLevel,
      84             :                             long nYPos) :
      85             :             SwContent(pCnt, rName, nYPos),
      86           0 :                         nRegionLevel(nLevel){}
      87           0 :     sal_uInt8   GetRegionLevel() const {return nRegionLevel;}
      88             : };
      89             : //----------------------------------------------------------------------------
      90             : 
      91           0 : class SwURLFieldContent : public SwContent
      92             : {
      93             :     String sURL;
      94             :     const SwTxtINetFmt* pINetAttr;
      95             : 
      96             : public:
      97           0 :     SwURLFieldContent(  const SwContentType* pCnt,
      98             :                             const String& rName,
      99             :                             const String& rURL,
     100             :                             const SwTxtINetFmt* pAttr,
     101             :                             long nYPos )
     102           0 :         : SwContent( pCnt, rName, nYPos ), sURL( rURL ), pINetAttr( pAttr )
     103           0 :     {}
     104             : 
     105             :     virtual sal_Bool    IsProtect() const;
     106           0 :     const String&   GetURL()                { return sURL; }
     107           0 :     const SwTxtINetFmt* GetINetAttr()       { return pINetAttr; }
     108             : };
     109             : 
     110             : //----------------------------------------------------------------------------
     111           0 : class SwPostItContent : public SwContent
     112             : {
     113             :     const SwFmtFld*     pFld;
     114             :     SwRedline*          pRedline;
     115             :     bool                mbPostIt;
     116             : public:
     117           0 :     SwPostItContent( const SwContentType* pCnt,
     118             :                             const String& rName,
     119             :                             const SwFmtFld* pField,
     120             :                             long nYPos )
     121           0 :         : SwContent( pCnt, rName, nYPos ), pFld( pField ),mbPostIt(true)
     122           0 :     {}
     123             :     SwPostItContent( const SwContentType* pCnt,
     124             :                             const String& rName,
     125             :                             SwRedline* pRed,
     126             :                             long nYPos )
     127             :         : SwContent( pCnt, rName, nYPos ), pRedline( pRed ),mbPostIt(false)
     128             :     {}
     129             : 
     130           0 :     const SwFmtFld* GetPostIt()     { return pFld; }
     131           0 :     SwRedline* GetRedline() { return pRedline; }
     132             :     virtual sal_Bool    IsProtect()     const;
     133           0 :     bool            IsPostIt()      {return mbPostIt; }
     134             : };
     135             : 
     136             : //----------------------------------------------------------------------------
     137             : 
     138             : class SwGraphicContent : public SwContent
     139             : {
     140             :     String      sLink;
     141             : public:
     142           0 :     SwGraphicContent(const SwContentType* pCnt, const String& rName, const String& rLink, long nYPos)
     143           0 :         : SwContent( pCnt, rName, nYPos ), sLink( rLink )
     144           0 :         {}
     145             :     virtual ~SwGraphicContent();
     146             : 
     147           0 :     const String&   GetLink() const {return sLink;}
     148             : };
     149             : 
     150             : //----------------------------------------------------------------------------
     151             : class SwTOXBaseContent : public SwContent
     152             : {
     153             :     const SwTOXBase* pBase;
     154             : public:
     155           0 :     SwTOXBaseContent(const SwContentType* pCnt, const String& rName, long nYPos, const SwTOXBase& rBase)
     156           0 :         : SwContent( pCnt, rName, nYPos ), pBase(&rBase)
     157           0 :         {}
     158             :     virtual ~SwTOXBaseContent();
     159             : 
     160           0 :     const SwTOXBase* GetTOXBase() const {return pBase;}
     161             : };
     162             : /*
     163             :     class ContentType contains information to one type of content.
     164             :     MemberArray is only populated if the content is requested by
     165             :     GetMember. It is reloaded after Invalidate() only if the content
     166             :     should be read again.
     167             : */
     168             : //----------------------------------------------------------------------------
     169             : 
     170             : class SwContentType : public SwTypeNumber
     171             : {
     172             :     SwWrtShell*         pWrtShell;
     173             :     SwContentArr*       pMember;            // array for content
     174             :     String              sContentTypeName;   // name of content type
     175             :     String              sSingleContentTypeName; // name of content type, singular
     176             :     String              sTypeToken;         // attachment for URL
     177             :     sal_uInt16              nMemberCount;       // content count
     178             :     sal_uInt16              nContentType;       // content type's Id
     179             :     sal_uInt8               nOutlineLevel;
     180             :     sal_Bool                bDataValid :    1;  //
     181             :     sal_Bool                bEdit:          1;  // can this type be edited?
     182             :     sal_Bool                bDelete:        1;  // can this type be deleted?
     183             : protected:
     184             :         void            RemoveNewline(String&);
     185             : public:
     186             :         SwContentType(SwWrtShell* pParent, sal_uInt16 nType, sal_uInt8 nLevel );
     187             :         ~SwContentType();
     188             : 
     189             :         void                Init(sal_Bool* pbInvalidateWindow = 0);
     190             :         void                FillMemberList(sal_Bool* pbLevelChanged = NULL);
     191           0 :         sal_uInt16              GetMemberCount() const
     192           0 :                                 {return nMemberCount;};
     193           0 :         sal_uInt16              GetType() const {return nContentType;}
     194             :         const SwContent*    GetMember(sal_uInt16 nIndex);
     195           0 :         const String&       GetName() {return sContentTypeName;}
     196           0 :         const String&       GetSingleName() const {return sSingleContentTypeName;}
     197           0 :         const String&       GetTypeToken() const{return sTypeToken;}
     198             : 
     199           0 :         void                SetOutlineLevel(sal_uInt8 nNew)
     200             :                             {
     201           0 :                                 nOutlineLevel = nNew;
     202           0 :                                 Invalidate();
     203           0 :                             }
     204             : 
     205             :         void                Invalidate(); // only nMemberCount is read again
     206             : 
     207           0 :         sal_Bool                IsEditable() const {return bEdit;}
     208           0 :         sal_Bool                IsDeletable() const {return bDelete;}
     209             : };
     210             : 
     211             : #endif
     212             : 
     213             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10