LCOV - code coverage report
Current view: top level - include/svtools - imapobj.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 10 16 62.5 %
Date: 2014-11-03 Functions: 10 17 58.8 %
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             : 
      20             : #ifndef INCLUDED_SVTOOLS_IMAPOBJ_HXX
      21             : #define INCLUDED_SVTOOLS_IMAPOBJ_HXX
      22             : 
      23             : #include <svtools/svtdllapi.h>
      24             : #include <svl/macitem.hxx>
      25             : #include <rtl/strbuf.hxx>
      26             : 
      27             : class Point;
      28             : class Rectangle;
      29             : class SvStream;
      30             : 
      31             : #define IMAP_OBJ_NONE       ((sal_uInt16)0x0000)
      32             : #define IMAP_OBJ_RECTANGLE  ((sal_uInt16)0x0001)
      33             : #define IMAP_OBJ_CIRCLE     ((sal_uInt16)0x0002)
      34             : #define IMAP_OBJ_POLYGON    ((sal_uInt16)0x0003)
      35             : #define IMAP_OBJ_VERSION    ((sal_uInt16)0x0005)
      36             : 
      37             : #define IMAGE_MAP_VERSION   ((sal_uInt16)0x0001)
      38             : 
      39             : #define IMAPMAGIC           "SDIMAP"
      40             : 
      41             : #define IMAP_MIRROR_HORZ    0x00000001L
      42             : #define IMAP_MIRROR_VERT    0x00000002L
      43             : 
      44             : #define IMAP_FORMAT_BIN     0x00000001L
      45             : #define IMAP_FORMAT_CERN    0x00000002L
      46             : #define IMAP_FORMAT_NCSA    0x00000004L
      47             : #define IMAP_FORMAT_DETECT  0xffffffffL
      48             : 
      49             : #define IMAP_ERR_OK         0x00000000L
      50             : #define IMAP_ERR_FORMAT     0x00000001L
      51             : 
      52          26 : class SVT_DLLPUBLIC IMapObject
      53             : {
      54             :     friend class        ImageMap;
      55             : 
      56             :     OUString            aURL;
      57             :     OUString            aAltText;
      58             :     OUString            aDesc;
      59             :     OUString            aTarget;
      60             :     OUString            aName;
      61             :     SvxMacroTableDtor   aEventList;
      62             :     bool                bActive;
      63             : 
      64             : protected:
      65             :     sal_uInt16              nReadVersion;
      66             : 
      67             :     // binary import/export
      68             :     virtual void        WriteIMapObject( SvStream& rOStm ) const = 0;
      69             :     virtual void        ReadIMapObject(  SvStream& rIStm ) = 0;
      70             : 
      71             :     // helper methods
      72             :     void AppendCERNCoords(OStringBuffer& rBuf, const Point& rPoint100) const;
      73             :     void AppendCERNURL(OStringBuffer& rBuf, const OUString& rBaseURL) const;
      74             :     void AppendNCSACoords(OStringBuffer& rBuf, const Point& rPoint100) const;
      75             :     void AppendNCSAURL(OStringBuffer&rBuf, const OUString& rBaseURL) const;
      76             : 
      77             : public:
      78             : 
      79             :     static rtl_TextEncoding nActualTextEncoding;
      80             : 
      81             :                         IMapObject();
      82             :                         IMapObject( const OUString& rURL,
      83             :                                     const OUString& rAltText,
      84             :                                     const OUString& rDesc,
      85             :                                     const OUString& rTarget,
      86             :                                     const OUString& rName,
      87             :                                     bool bActive );
      88          30 :     virtual             ~IMapObject() {};
      89             : 
      90             :     virtual sal_uInt16      GetVersion() const;
      91             :     virtual sal_uInt16      GetType() const = 0;
      92             :     virtual bool            IsHit( const Point& rPoint ) const = 0;
      93             : 
      94             :     void                Write ( SvStream& rOStm, const OUString& rBaseURL ) const;
      95             :     void                Read( SvStream& rIStm, const OUString& rBaseURL );
      96             : 
      97             :     virtual Rectangle   GetBoundRect() const = 0;
      98             : 
      99          14 :     const OUString&     GetURL() const { return aURL; }
     100           0 :     void                SetURL( const OUString& rURL ) { aURL = rURL; }
     101             : 
     102           4 :     const OUString&     GetAltText() const { return aAltText; }
     103           0 :     void                SetAltText( const OUString& rAltText) { aAltText = rAltText; }
     104             : 
     105           2 :     const OUString&     GetDesc() const { return aDesc; }
     106           0 :     void                SetDesc( const OUString& rDesc ) { aDesc = rDesc; }
     107             : 
     108           4 :     const OUString&     GetTarget() const { return aTarget; }
     109           0 :     void                SetTarget( const OUString& rTarget ) { aTarget = rTarget; }
     110             : 
     111           4 :     const OUString&     GetName() const { return aName; }
     112           0 :     void                SetName( const OUString& rName ) { aName = rName; }
     113             : 
     114           6 :     bool                IsActive() const { return bActive; }
     115           0 :     void                SetActive( bool bSetActive = true ) { bActive = bSetActive; }
     116             : 
     117             :     bool                IsEqual( const IMapObject& rEqObj );
     118             : 
     119             :     // IMap-Events
     120           4 :     inline const SvxMacroTableDtor& GetMacroTable() const { return aEventList;}
     121           4 :     inline void SetMacroTable( const SvxMacroTableDtor& rTbl ) { aEventList = rTbl; }
     122             : 
     123             :     inline const SvxMacro&  GetEvent( sal_uInt16 nEvent ) const;
     124             :     inline bool             HasEvent( sal_uInt16 nEvent ) const;
     125             :            void             SetEvent( sal_uInt16 nEvent, const SvxMacro& );
     126             :     inline bool             DelEvent( sal_uInt16 nEvent );
     127             : };
     128             : 
     129             : inline bool IMapObject::HasEvent( sal_uInt16 nEvent ) const
     130             : {
     131             :     return aEventList.IsKeyValid( nEvent );
     132             : }
     133             : inline const SvxMacro& IMapObject::GetEvent( sal_uInt16 nEvent ) const
     134             : {
     135             :     return *(aEventList.Get( nEvent ));
     136             : }
     137             : inline bool IMapObject::DelEvent( sal_uInt16 nEvent )
     138             : {
     139             :     return aEventList.Erase( nEvent );
     140             : }
     141             : 
     142             : #endif
     143             : 
     144             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10