1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef OOX_CORE_RELATIONS_HXX
21 #define OOX_CORE_RELATIONS_HXX
24 #include <boost/shared_ptr.hpp>
25 #include "oox/helper/helper.hxx"
26 #include "oox/dllapi.h"
31 // ============================================================================
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 ( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/" ascii )
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 ( "http://schemas.openxmlformats.org/package/2006/relationships/" ascii )
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 ( "http://schemas.microsoft.com/office/2006/relationships/" ascii )
48 // ============================================================================
57 inline explicit Relation() : mbExternal( false ) {}
60 // ============================================================================
63 typedef ::boost::shared_ptr
< Relations
> RelationsRef
;
65 class OOX_DLLPUBLIC Relations
: public ::std::map
< OUString
, Relation
>
68 explicit Relations( const OUString
& rFragmentPath
);
70 /** Returns the path of the fragment this relations collection is related to. */
71 inline const OUString
& getFragmentPath() const { return maFragmentPath
; }
73 /** Returns the relation with the passed relation identifier. */
74 const Relation
* getRelationFromRelId( const OUString
& rId
) const;
75 /** Returns the first relation with the passed type. */
76 const Relation
* getRelationFromFirstType( const OUString
& rType
) const;
77 /** Finds all relations associated with the passed type. */
78 RelationsRef
getRelationsFromType( const OUString
& rType
) const;
80 /** Returns the external target of the relation with the passed relation identifier. */
81 OUString
getExternalTargetFromRelId( const OUString
& rRelId
) const;
82 /** Returns the internal target of the relation with the passed relation identifier. */
83 OUString
getInternalTargetFromRelId( const OUString
& rRelId
) const;
85 /** Returns the full fragment path for the target of the passed relation. */
86 OUString
getFragmentPathFromRelation( const Relation
& rRelation
) const;
87 /** Returns the full fragment path for the passed relation identifier. */
88 OUString
getFragmentPathFromRelId( const OUString
& rRelId
) const;
89 /** Returns the full fragment path for the first relation of the passed type. */
90 OUString
getFragmentPathFromFirstType( const OUString
& rType
) const;
93 OUString maFragmentPath
;
96 // ============================================================================
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */