merged tag ooo/OOO330_m14
[LibreOffice.git] / reportdesign / inc / conditionalexpression.hxx
blob372cb65a924b5dec7e1fc3379ef1f8e6734f74bb
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef CONDITIONALEXPRESSION_HXX
29 #define CONDITIONALEXPRESSION_HXX
31 #include "dllapi.h"
33 /** === begin UNO includes === **/
34 /** === end UNO includes === **/
36 #include <rtl/ustring.hxx>
38 #include <boost/shared_ptr.hpp>
40 #include <map>
42 //........................................................................
43 namespace rptui
45 //........................................................................
47 // =============================================================================
48 // = ConditionalExpression
49 // =============================================================================
50 class REPORTDESIGN_DLLPUBLIC ConditionalExpression
52 private:
53 const ::rtl::OUString m_sPattern;
55 public:
56 ConditionalExpression( const sal_Char* _pAsciiPattern );
58 /** assembles an expression string from a field data source, and one or two operands
60 ::rtl::OUString assembleExpression( const ::rtl::OUString& _rFieldDataSource, const ::rtl::OUString& _rLHS, const ::rtl::OUString& _rRHS ) const;
62 /** matches the given expression string to the expression pattern represented by the object
63 @param _rExpression
64 the expression to match
65 @param _rFieldDataSource
66 the field data source
67 @param _out_rLHS
68 output parameter taking the left hand side operand, if successful
69 @param _out_rRHS
70 output parameter taking the right hand side operand, if successful
71 @return
72 <TRUE/> if and only if the expression string could be successfully matched to
73 the pattern.
75 bool matchExpression( const ::rtl::OUString& _rExpression, const ::rtl::OUString& _rFieldDataSource, ::rtl::OUString& _out_rLHS, ::rtl::OUString& _out_rRHS ) const;
78 //========================================================================
79 //= ConditionType
80 //========================================================================
81 enum ConditionType
83 eFieldValueComparison = 0,
84 eExpression = 1
87 //========================================================================
88 //= ComparisonOperation
89 //========================================================================
90 enum ComparisonOperation
92 eBetween = 0,
93 eNotBetween = 1,
94 eEqualTo = 2,
95 eNotEqualTo = 3,
96 eGreaterThan = 4,
97 eLessThan = 5,
98 eGreaterOrEqual = 6,
99 eLessOrEqual = 7
102 typedef ::boost::shared_ptr< ConditionalExpression > PConditionalExpression;
103 typedef ::std::map< ComparisonOperation, PConditionalExpression > ConditionalExpressions;
105 // =============================================================================
106 // = ConditionalExpressionFactory
107 // =============================================================================
108 class REPORTDESIGN_DLLPUBLIC ConditionalExpressionFactory
110 public:
111 /// fills the given map with all ConditionalExpressions which we know
112 static size_t getKnownConditionalExpressions( ConditionalExpressions& _out_rCondExp );
114 private:
115 ConditionalExpressionFactory(); // never implemented
116 ConditionalExpressionFactory( const ConditionalExpressionFactory& ); // never implemented
117 ConditionalExpressionFactory& operator=( const ConditionalExpressionFactory& ); // never implemented
119 //........................................................................
120 } // namespace rptui
121 //........................................................................
123 #endif // CONDITIONALEXPRESSION_HXX