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/source | |
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/source')
-rw-r--r-- | oox/source/token/relationship.cxx | 33 | ||||
-rw-r--r-- | oox/source/token/relationship.inc | 1 |
2 files changed, 34 insertions, 0 deletions
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"}, |