Update ooo320-m1
[ooovba.git] / reportdesign / inc / conditionalexpression.hxx
blob655c6a66b1082180fcb2994bdf78e127c6b56d89
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: conditionalexpression.hxx,v $
10 * $Revision: 1.3 $
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 CONDITIONALEXPRESSION_HXX
32 #define CONDITIONALEXPRESSION_HXX
34 #include "dllapi.h"
36 /** === begin UNO includes === **/
37 /** === end UNO includes === **/
39 #include <rtl/ustring.hxx>
41 #include <boost/shared_ptr.hpp>
43 #include <map>
45 //........................................................................
46 namespace rptui
48 //........................................................................
50 // =============================================================================
51 // = ConditionalExpression
52 // =============================================================================
53 class REPORTDESIGN_DLLPUBLIC ConditionalExpression
55 private:
56 const ::rtl::OUString m_sPattern;
58 public:
59 ConditionalExpression( const sal_Char* _pAsciiPattern );
61 /** assembles an expression string from a field data source, and one or two operands
63 ::rtl::OUString assembleExpression( const ::rtl::OUString& _rFieldDataSource, const ::rtl::OUString& _rLHS, const ::rtl::OUString& _rRHS ) const;
65 /** matches the given expression string to the expression pattern represented by the object
66 @param _rExpression
67 the expression to match
68 @param _rFieldDataSource
69 the field data source
70 @param _out_rLHS
71 output parameter taking the left hand side operand, if successful
72 @param _out_rRHS
73 output parameter taking the right hand side operand, if successful
74 @return
75 <TRUE/> if and only if the expression string could be successfully matched to
76 the pattern.
78 bool matchExpression( const ::rtl::OUString& _rExpression, const ::rtl::OUString& _rFieldDataSource, ::rtl::OUString& _out_rLHS, ::rtl::OUString& _out_rRHS ) const;
81 //========================================================================
82 //= ConditionType
83 //========================================================================
84 enum ConditionType
86 eFieldValueComparison = 0,
87 eExpression = 1
90 //========================================================================
91 //= ComparisonOperation
92 //========================================================================
93 enum ComparisonOperation
95 eBetween = 0,
96 eNotBetween = 1,
97 eEqualTo = 2,
98 eNotEqualTo = 3,
99 eGreaterThan = 4,
100 eLessThan = 5,
101 eGreaterOrEqual = 6,
102 eLessOrEqual = 7
105 typedef ::boost::shared_ptr< ConditionalExpression > PConditionalExpression;
106 typedef ::std::map< ComparisonOperation, PConditionalExpression > ConditionalExpressions;
108 // =============================================================================
109 // = ConditionalExpressionFactory
110 // =============================================================================
111 class REPORTDESIGN_DLLPUBLIC ConditionalExpressionFactory
113 public:
114 /// fills the given map with all ConditionalExpressions which we know
115 static size_t getKnownConditionalExpressions( ConditionalExpressions& _out_rCondExp );
117 private:
118 ConditionalExpressionFactory(); // never implemented
119 ConditionalExpressionFactory( const ConditionalExpressionFactory& ); // never implemented
120 ConditionalExpressionFactory& operator=( const ConditionalExpressionFactory& ); // never implemented
122 //........................................................................
123 } // namespace rptui
124 //........................................................................
126 #endif // CONDITIONALEXPRESSION_HXX