1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: XStringSubstitution.idl,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef __com_sun_star_util_XStringSubstitution_idl__
32 #define __com_sun_star_util_XStringSubstitution_idl__
34 #ifndef __com_sun_star_uno_XInterface_idl__
35 #include
<com
/sun
/star
/uno
/XInterface.idl
>
38 #ifndef __com_sun_star_container_NoSuchElementException_idl__
39 #include
<com
/sun
/star
/container
/NoSuchElementException.idl
>
42 //=============================================================================
44 module com
{ module sun
{ module star
{ module util
{
46 //=============================================================================
47 /** A common interface for substituting string variables with
51 The substitution algorithm and the syntax for a string variable are
52 not part of this interface definition. Please look at the documentation
53 of the implementation that must specify these parameters.
58 published
interface XStringSubstitution
: com
::sun
::star
::uno
::XInterface
60 //-------------------------------------------------------------------------
61 /** Exchanges variables inside a given text with a substitution text
62 defined for the variables.
65 The method iterates through it's internal variables list to match the
66 variables in the given string. A match replaces the variable with the
67 string defined for this variable. If no variable can be found in the string
68 it will be returned unchanged. The behavior if a variable is found in
69 the string but it is unknown for the implementation depends on the parameter
74 A string containing variables that should be substituted.
77 Specifies if a successfull substitution is required. The
78 function throws a <type scope="com::sun::star::container">NoSuchElementException</type>
79 if it finds a variable that is unknown. In this case it is possible
80 that the returned string would not be what the caller expected!
83 Returns a string based on <var>aText</var> where all variables were
84 exchanged with their value defined at calling time.
86 string substituteVariables
( [in] string aText
, [in] boolean bSubstRequired
)
87 raises
( com
::sun
::star
::container
::NoSuchElementException
);
89 //-------------------------------------------------------------------------
90 /** Tries to replace parts of aText with variables that represents
94 The method iterates through it's internal variable list and tries to match
95 parts of the given string Tries to replace parts of <var>aText</var> with
96 variables that represents these sub strings.If more than one variable
97 matches the one with the longest matching sub string will be chosen.
101 A string where known substrings should be replaced by variables.
104 Returns the resubstituted string with variables for all parts
105 that could be replaced. The unchanged argument will be returned
106 if nothing can be resubtituted.
109 string reSubstituteVariables
( [in] string aText
);
111 //-------------------------------------------------------------------------
112 /** Returns the current value of a variable.
115 The method iterates through it's internal variable list and tries to
116 find the given variable. If the variable is unkown a
117 <type scope="com::sun::star::container">NoSuchElementException</type>
122 The name of a variable.
125 Returns a string that represents the variable. If the
126 variable is unknown a <type scope="com::sun::star::container">NoSuchElementException</type>
129 string getSubstituteVariableValue
( [in] string variable
)
130 raises
(::com
::sun
::star
::container
::NoSuchElementException
);
133 //=============================================================================