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

Generated by: LCOV version 1.10