sc: filter: rtf: add method "AddFont"
[LibreOffice.git] / include / unotools / configpaths.hxx
blobd24e8537eb7591ae1501e08920a50fa758a26738
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 INCLUDED_UNOTOOLS_CONFIGPATHS_HXX
21 #define INCLUDED_UNOTOOLS_CONFIGPATHS_HXX
23 #include <unotools/unotoolsdllapi.h>
24 #include <rtl/ustring.hxx>
26 namespace utl
29 /** extract the local nodename and the parent nodepath
30 from a configuration path.
32 @param _sInPath
33 A configuration path that is not an empty or root path.<BR/>
34 If this is not a valid configuration path, it is interpreted as
35 local name of a node.
37 @param _rsOutPath
38 On exit: The configuration path obtained by dropping
39 the last level off <var>_sInPath</var>.<BR/>
40 If <var>_sInPath</var> could not be parsed as a valid
41 configuration path, this is set to an empty string.
43 @param _rsLocalName
44 On exit: The plain (non-escaped) name of the node identified by
45 <var>_sInPath</var>. <BR/>
46 If <var>_sInPath</var> could not be parsed as a valid
47 configuration path, this is set to <var>_sInPath</var>.
49 @returns
50 <TRUE/>, if a parent path could be set
51 <FALSE/>, if the path was a one-level path or an invalid path
54 UNOTOOLS_DLLPUBLIC bool splitLastFromConfigurationPath(OUString const& _sInPath,
55 OUString& _rsOutPath,
56 OUString& _rsLocalName);
58 /** extract the first nodename from a configuration path.
60 @param _sInPath
61 A relative configuration path that is not empty.<BR/>
62 If this is not a valid configuration path, it is interpreted as
63 a single name of a node.
65 @param _sOutPath
66 If non-null, contains the remainder of the path upon return.
68 @returns
69 The plain (non-escaped) name of the node that is the first step
70 when traversing <var>_sInPath</var>.<BR/>
71 If <var>_sInPath</var> could not be parsed as a valid
72 configuration path, it is returned unaltered.
75 UNOTOOLS_DLLPUBLIC OUString extractFirstFromConfigurationPath(
76 OUString const& _sInPath, OUString* _sOutPath = nullptr);
78 /** check whether a path is to a nested node with respect to a parent path.
80 @param _sNestedPath
81 A configuration path that maybe points to a descendant of the node
82 identified by <var>_sPrefixPath</var>, with both paths starting
83 from the same node (or both being absolute).
85 @param _sPrefixPath
86 A configuration path.<BR/>
87 If this path is absolute, <var>_sNestedPath</var> should be absolute;
88 If this path is relative, <var>_sNestedPath</var> should be relative;
89 If this path is empty, <var>_sNestedPath</var> may start with a '/',
90 which is disregarded.
92 @returns
93 <TRUE/>, if <var>_sPrefixPath</var> is a prefix of <var>_sNestedPath</var>;
94 <FALSE/> otherwise.<BR/>
95 If both paths are equal <TRUE/> is returned.
98 bool isPrefixOfConfigurationPath(OUString const& _sNestedPath,
99 OUString const& _sPrefixPath);
101 /** get the relative path to a nested node with respect to a parent path.
103 @param _sNestedPath
104 A configuration path that points to a descendant of the node
105 identified by <var>_sPrefixPath</var>, with both paths starting
106 from the same node (or both being absolute).
108 @param _sPrefixPath
109 A configuration path.<BR/>
110 If this path is absolute, <var>_sNestedPath</var> must be absolute;
111 If this path is relative, <var>_sNestedPath</var> must be relative;
112 If this path is empty, <var>_sNestedPath</var> may start with a '/',
113 which is stripped.
115 @returns
116 The remaining relative path from the target of <var>_sPrefixPath</var>
117 to the target of <var>_sNestedPath</var>.<BR/>
118 If <var>_sPrefixPath</var> is not a prefix of <var>_sNestedPath</var>,
119 <var>_sNestedPath</var> is returned unaltered.
122 UNOTOOLS_DLLPUBLIC OUString dropPrefixFromConfigurationPath(OUString const& _sNestedPath,
123 OUString const& _sPrefixPath);
125 /** Create a one-level relative configuration path from a set element name
126 without a known set element type.
128 @param _sElementName
129 An arbitrary string that is to be interpreted as
130 name of a configuration set element.
132 @returns
133 A one-level relative path to the element, of the form
134 "*['<Name>']", where <Name> is properly escaped.
137 UNOTOOLS_DLLPUBLIC OUString wrapConfigurationElementName(OUString const& _sElementName);
139 /** Create a one-level relative configuration path from a set element name
140 and a known set element type.
142 @param _sElementName
143 An arbitrary string that is to be interpreted as
144 name of a configuration set element.
146 @param _sTypeName
147 An string identifying the type of the element. Usually this is be
148 the name of the element-template of the set.<BR/>
150 @returns
151 A one-level relative path to the element, of the form
152 "<Type>['<Name>']", where <Name> is properly escaped.
155 OUString wrapConfigurationElementName(OUString const& _sElementName,
156 OUString const& _sTypeName);
158 } // namespace utl
160 #endif // INCLUDED_UNOTOOLS_CONFIGPATHS_HXX
162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */