LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/svtools - imap.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 6 6 100.0 %
Date: 2012-08-25 Functions: 5 5 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 4 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef _IMAP_HXX
      30                 :            : #define _IMAP_HXX
      31                 :            : 
      32                 :            : #include "svtools/svtdllapi.h"
      33                 :            : #include <tools/string.hxx>
      34                 :            : #include <tools/stream.hxx>
      35                 :            : #include <vector>
      36                 :            : 
      37                 :            : class Point;
      38                 :            : class Rectangle;
      39                 :            : class Size;
      40                 :            : class Fraction;
      41                 :            : class IMapObject;
      42                 :            : 
      43                 :            : typedef ::std::vector< IMapObject* > IMapObjectList_impl;
      44                 :            : 
      45                 :            : class SVT_DLLPUBLIC ImageMap
      46                 :            : {
      47                 :            : private:
      48                 :            : 
      49                 :            :     IMapObjectList_impl maList;
      50                 :            :     String              aName;
      51                 :            : 
      52                 :            : protected:
      53                 :            : 
      54                 :            :     // Binaer laden/speichern
      55                 :            :     void                ImpWriteImageMap( SvStream& rOStm, const String& ) const ;
      56                 :            :     void                ImpReadImageMap( SvStream& rIStm, size_t nCount, const String& );
      57                 :            : 
      58                 :            :     // Im-/Export
      59                 :            :     void                ImpWriteCERN( SvStream& rOStm, const String& rBaseURL ) const;
      60                 :            :     void                ImpWriteNCSA( SvStream& rOStm, const String& rBaseURL ) const;
      61                 :            :     sal_uLong           ImpReadCERN( SvStream& rOStm, const String& rBaseURL );
      62                 :            :     sal_uLong           ImpReadNCSA( SvStream& rOStm, const String& rBaseURL );
      63                 :            : 
      64                 :            :     void                ImpReadCERNLine( const rtl::OString& rLine, const String& rBaseURL );
      65                 :            :     Point               ImpReadCERNCoords( const char** ppStr );
      66                 :            :     long                ImpReadCERNRadius( const char** ppStr );
      67                 :            :     String              ImpReadCERNURL( const char** ppStr, const String& rBaseURL );
      68                 :            : 
      69                 :            :     void                ImpReadNCSALine( const rtl::OString& rLine, const String& rBaseURL );
      70                 :            :     String              ImpReadNCSAURL( const char** ppStr, const String& rBaseURL );
      71                 :            :     Point               ImpReadNCSACoords( const char** ppStr );
      72                 :            : 
      73                 :            :     sal_uLong           ImpDetectFormat( SvStream& rIStm );
      74                 :            : 
      75                 :            : public:
      76                 :            : 
      77                 :            :     TYPEINFO();
      78                 :            : 
      79         [ +  - ]:          4 :                         ImageMap() {};
      80                 :            :                         ImageMap( const String& rName );
      81                 :            :                         ImageMap( const ImageMap& rImageMap );
      82                 :            : 
      83                 :            :                         // Der Dtor gibt den intern belegten
      84                 :            :                         // Speicher wieder frei;
      85                 :            :                         //  alle IMapObjekte werden im Dtor zerstoert;
      86                 :            :     virtual             ~ImageMap();
      87                 :            : 
      88                 :            :     // Zuweisungsoperator
      89                 :            :     ImageMap&           operator=( const ImageMap& rImageMap );
      90                 :            : 
      91                 :            :     // Vergleichsoperator (es wird alles auf Gleichheit geprueft)
      92                 :            :     sal_Bool                operator==( const ImageMap& rImageMap );
      93                 :            :     sal_Bool                operator!=( const ImageMap& rImageMap );
      94                 :            : 
      95                 :            :     // In die Map wird ein neues IMap-Obkekt ans Ende eingefuegt
      96                 :            :     void                InsertIMapObject( const IMapObject& rIMapObject );
      97                 :            : 
      98                 :            :     // Zugriff auf einzelne IMapObjekte; die Objekte
      99                 :            :     // duerfen von aussen _nicht_ zerstoert werden
     100                 :         16 :     IMapObject*         GetIMapObject( size_t nPos ) const
     101                 :            :                         {
     102         [ +  - ]:         16 :                             return ( nPos < maList.size() ) ? maList[ nPos ] : NULL;
     103                 :            :                         }
     104                 :            : 
     105                 :            :     // Gibt das Objekt zurueck, das zuerst getroffen wurde oder NULL;
     106                 :            :     // Groessen- und Positionsangaben sind in 1/100mm;
     107                 :            :     // rTotalSize ist die Originalgroesse des Bildes;
     108                 :            :     // rDisplaySize die aktuelle Darstellungsgroesse;
     109                 :            :     // rRelPoint bezieht sich auf die Darstellungsgroesse
     110                 :            :     // und die linke oebere Ecke des Bildes
     111                 :            :     IMapObject*         GetHitIMapObject( const Size& rOriginalSize,
     112                 :            :                                           const Size& rDisplaySize,
     113                 :            :                                           const Point& rRelHitPoint,
     114                 :            :                                           sal_uLong nFlags = 0 );
     115                 :            : 
     116                 :            :     // Gibt die Gesamtanzahl der IMap-Objekte zurueck
     117                 :         26 :     size_t              GetIMapObjectCount() const { return maList.size(); }
     118                 :            : 
     119                 :            :     // Loescht alle internen Objekte
     120                 :            :     void                ClearImageMap();
     121                 :            : 
     122                 :            :     // liefert die aktuelle Versionsnummer
     123                 :            :     sal_uInt16          GetVersion() const;
     124                 :            : 
     125                 :            :     // liefert / setzt den Namen der ImageMap
     126                 :          4 :     const String&       GetName() const { return aName; }
     127                 :          2 :     void                SetName( const String& rName ) { aName = rName; }
     128                 :            : 
     129                 :            :     // skaliert alle Objekte der ImageMap entpr. dem uebergebenen Faktor
     130                 :            :     void                Scale( const Fraction& rFractX, const Fraction& rFracY );
     131                 :            : 
     132                 :            :     // Im-/Export
     133                 :            :     void                Write ( SvStream& rOStm, const String& rBaseURL ) const;
     134                 :            :     void                Read( SvStream& rIStm, const String& rBaseURL );
     135                 :            : 
     136                 :            :     void                Write( SvStream& rOStm, sal_uLong nFormat, const String& rBaseURL ) const;
     137                 :            :     sal_uLong               Read( SvStream& rIStm, sal_uLong nFormat, const String& rBaseURL );
     138                 :            : };
     139                 :            : 
     140                 :            : class IMapCompat
     141                 :            : {
     142                 :            :     SvStream*       pRWStm;
     143                 :            :     sal_uLong           nCompatPos;
     144                 :            :     sal_uLong           nTotalSize;
     145                 :            :     sal_uInt16          nStmMode;
     146                 :            : 
     147                 :            :                     IMapCompat() {}
     148                 :            :                     IMapCompat( const IMapCompat& ) {}
     149                 :            :     IMapCompat&     operator=( const IMapCompat& ) { return *this; }
     150                 :            :     sal_Bool            operator==( const IMapCompat& ) { return sal_False; }
     151                 :            : 
     152                 :            : public:
     153                 :            : 
     154                 :            :                     IMapCompat( SvStream& rStm, const sal_uInt16 nStreamMode );
     155                 :            :                     ~IMapCompat();
     156                 :            : };
     157                 :            : 
     158                 :            : #endif // _IMAP_HXX
     159                 :            : 
     160                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10