diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-12-24 13:15:27 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-04-16 05:02:26 +0200 |
commit | 93e0a48d09456578527d1e498f708edbeae19667 (patch) | |
tree | 6c3ea916278c904ced23b69518742b135dff9316 /oox | |
parent | 4d64bd4cbf652c5286272edc271f45ec447b10b8 (diff) |
first stab at replacing hard coded relationships with calls to a method
Change-Id: I4d1fd6ac3d32180972d82c67a81adf4953e3a82d
Reviewed-on: https://gerrit.libreoffice.org/32409
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/Library_oox.mk | 1 | ||||
-rw-r--r-- | oox/source/token/relationship.cxx | 33 | ||||
-rw-r--r-- | oox/source/token/relationship.inc | 1 |
3 files changed, 35 insertions, 0 deletions
diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk index 3d6c684d3fc4..3b4a6ac80744 100644 --- a/oox/Library_oox.mk +++ b/oox/Library_oox.mk @@ -288,6 +288,7 @@ $(eval $(call gb_Library_add_exception_objects,oox,\ oox/source/token/namespacemap \ oox/source/token/propertynames \ oox/source/token/tokenmap \ + oox/source/token/relationship \ oox/source/vml/vmldrawing \ oox/source/vml/vmldrawingfragment \ oox/source/vml/vmlformatting \ diff --git a/oox/source/token/relationship.cxx b/oox/source/token/relationship.cxx new file mode 100644 index 000000000000..f98e31cbbb6e --- /dev/null +++ b/oox/source/token/relationship.cxx @@ -0,0 +1,33 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <oox/token/relationship.hxx> + +#include <map> + +namespace oox { + +OUString getRelationship(Relationship eRelationship) +{ + static const std::map<Relationship, OUString> aMap = + { +#include "relationship.inc" + }; + + auto itr = aMap.find(eRelationship); + if (itr != aMap.end()) + return itr->second; + + SAL_WARN("oox", "could not find an entry for the relationship: " << (int) eRelationship); + return OUString(); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/token/relationship.inc b/oox/source/token/relationship.inc new file mode 100644 index 000000000000..b36c627530c6 --- /dev/null +++ b/oox/source/token/relationship.inc @@ -0,0 +1 @@ +{Relationship::HYPERLINK, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"}, |