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

           Branch data     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 OOX_CORE_RELATIONS_HXX
      21                 :            : #define OOX_CORE_RELATIONS_HXX
      22                 :            : 
      23                 :            : #include <map>
      24                 :            : #include <boost/shared_ptr.hpp>
      25                 :            : #include "oox/helper/helper.hxx"
      26                 :            : #include "oox/dllapi.h"
      27                 :            : 
      28                 :            : namespace oox {
      29                 :            : namespace core {
      30                 :            : 
      31                 :            : // ============================================================================
      32                 :            : 
      33                 :            : /** Expands to an OUString containing an 'officeDocument' relation type created
      34                 :            :     from the passed literal(!) ASCII(!) character array. */
      35                 :            : #define CREATE_OFFICEDOC_RELATION_TYPE( ascii ) \
      36                 :            :     CREATE_OUSTRING( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/" ascii )
      37                 :            : 
      38                 :            : /** Expands to an OUString containing a 'package' relation type created from
      39                 :            :     the passed literal(!) ASCII(!) character array. */
      40                 :            : #define CREATE_PACKAGE_RELATION_TYPE( ascii ) \
      41                 :            :     CREATE_OUSTRING( "http://schemas.openxmlformats.org/package/2006/relationships/" ascii )
      42                 :            : 
      43                 :            : /** Expands to an OUString containing an MS Office specific relation type
      44                 :            :     created from the passed literal(!) ASCII(!) character array. */
      45                 :            : #define CREATE_MSOFFICE_RELATION_TYPE( ascii ) \
      46                 :            :     CREATE_OUSTRING( "http://schemas.microsoft.com/office/2006/relationships/" ascii )
      47                 :            : 
      48                 :            : // ============================================================================
      49                 :            : 
      50                 :       5175 : struct Relation
      51                 :            : {
      52                 :            :     ::rtl::OUString     maId;
      53                 :            :     ::rtl::OUString     maType;
      54                 :            :     ::rtl::OUString     maTarget;
      55                 :            :     bool                mbExternal;
      56                 :            : 
      57                 :       1035 :     inline explicit     Relation() : mbExternal( false ) {}
      58                 :            : };
      59                 :            : 
      60                 :            : // ============================================================================
      61                 :            : 
      62                 :            : class Relations;
      63                 :            : typedef ::boost::shared_ptr< Relations > RelationsRef;
      64                 :            : 
      65                 :        755 : class OOX_DLLPUBLIC Relations : public ::std::map< ::rtl::OUString, Relation >
      66                 :            : {
      67                 :            : public:
      68                 :            :     explicit            Relations( const ::rtl::OUString& rFragmentPath );
      69                 :            : 
      70                 :            :     /** Returns the path of the fragment this relations collection is related to. */
      71                 :        273 :     inline const ::rtl::OUString& getFragmentPath() const { return maFragmentPath; }
      72                 :            : 
      73                 :            :     /** Returns the relation with the passed relation identifier. */
      74                 :            :     const Relation*     getRelationFromRelId( const ::rtl::OUString& rId ) const;
      75                 :            :     /** Returns the first relation with the passed type. */
      76                 :            :     const Relation*     getRelationFromFirstType( const ::rtl::OUString& rType ) const;
      77                 :            :     /** Finds all relations associated with the passed type. */
      78                 :            :     RelationsRef        getRelationsFromType( const ::rtl::OUString& rType ) const;
      79                 :            : 
      80                 :            :     /** Returns the external target of the relation with the passed relation identifier. */
      81                 :            :     ::rtl::OUString     getExternalTargetFromRelId( const ::rtl::OUString& rRelId ) const;
      82                 :            : 
      83                 :            :     /** Returns the full fragment path for the target of the passed relation. */
      84                 :            :     ::rtl::OUString     getFragmentPathFromRelation( const Relation& rRelation ) const;
      85                 :            :     /** Returns the full fragment path for the passed relation identifier. */
      86                 :            :     ::rtl::OUString     getFragmentPathFromRelId( const ::rtl::OUString& rRelId ) const;
      87                 :            :     /** Returns the full fragment path for the first relation of the passed type. */
      88                 :            :     ::rtl::OUString     getFragmentPathFromFirstType( const ::rtl::OUString& rType ) const;
      89                 :            : 
      90                 :            : private:
      91                 :            :     ::rtl::OUString     maFragmentPath;
      92                 :            : };
      93                 :            : 
      94                 :            : // ============================================================================
      95                 :            : 
      96                 :            : } // namespace core
      97                 :            : } // namespace oox
      98                 :            : 
      99                 :            : #endif
     100                 :            : 
     101                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10