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

Generated by: LCOV version 1.10