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: kcondition.hxx,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 _CONNECTIVITY_KAB_CONDITION_HXX_
32 #define _CONNECTIVITY_KAB_CONDITION_HXX_
34 #ifndef _COMPHELPER_TYPES_H_
35 #include <comphelper/types.hxx>
37 #include <vcl/kde_headers.h>
38 #include <connectivity/dbexception.hxx>
40 namespace connectivity
44 // -----------------------------------------------------------------------------
48 virtual ~KabCondition();
49 virtual sal_Bool
isAlwaysTrue() const = 0;
50 virtual sal_Bool
isAlwaysFalse() const = 0;
51 virtual sal_Bool
eval(const ::KABC::Addressee
&aAddressee
) const = 0;
53 // -----------------------------------------------------------------------------
54 class KabConditionConstant
: public KabCondition
60 KabConditionConstant(const sal_Bool bValue
);
61 virtual sal_Bool
isAlwaysTrue() const;
62 virtual sal_Bool
isAlwaysFalse() const;
63 virtual sal_Bool
eval(const ::KABC::Addressee
&aAddressee
) const;
65 // -----------------------------------------------------------------------------
66 class KabConditionColumn
: public KabCondition
69 sal_Int32 m_nFieldNumber
;
71 QString
value(const ::KABC::Addressee
&aAddressee
) const;
75 const ::rtl::OUString
&sColumnName
) throw(::com::sun::star::sdbc::SQLException
);
76 virtual sal_Bool
isAlwaysTrue() const;
77 virtual sal_Bool
isAlwaysFalse() const;
79 // -----------------------------------------------------------------------------
80 class KabConditionNull
: public KabConditionColumn
84 const ::rtl::OUString
&sColumnName
) throw(::com::sun::star::sdbc::SQLException
);
85 virtual sal_Bool
eval(const ::KABC::Addressee
&aAddressee
) const;
87 // -----------------------------------------------------------------------------
88 class KabConditionNotNull
: public KabConditionColumn
92 const ::rtl::OUString
&sColumnName
) throw(::com::sun::star::sdbc::SQLException
);
93 virtual sal_Bool
eval(const ::KABC::Addressee
&aAddressee
) const;
95 // -----------------------------------------------------------------------------
96 class KabConditionCompare
: public KabConditionColumn
99 const ::rtl::OUString m_sMatchString
;
103 const ::rtl::OUString
&sColumnName
,
104 const ::rtl::OUString
&sMatchString
) throw(::com::sun::star::sdbc::SQLException
);
106 // -----------------------------------------------------------------------------
107 class KabConditionEqual
: public KabConditionCompare
111 const ::rtl::OUString
&sColumnName
,
112 const ::rtl::OUString
&sMatchString
) throw(::com::sun::star::sdbc::SQLException
);
113 virtual sal_Bool
eval(const ::KABC::Addressee
&aAddressee
) const;
115 // -----------------------------------------------------------------------------
116 class KabConditionDifferent
: public KabConditionCompare
119 KabConditionDifferent(
120 const ::rtl::OUString
&sColumnName
,
121 const ::rtl::OUString
&sMatchString
) throw(::com::sun::star::sdbc::SQLException
);
122 virtual sal_Bool
eval(const ::KABC::Addressee
&aAddressee
) const;
124 // -----------------------------------------------------------------------------
125 class KabConditionSimilar
: public KabConditionCompare
129 const ::rtl::OUString
&sColumnName
,
130 const ::rtl::OUString
&sMatchString
) throw(::com::sun::star::sdbc::SQLException
);
131 virtual sal_Bool
eval(const ::KABC::Addressee
&aAddressee
) const;
133 // -----------------------------------------------------------------------------
134 class KabConditionBoolean
: public KabCondition
137 KabCondition
*m_pLeft
, *m_pRight
;
140 KabConditionBoolean(KabCondition
*pLeft
, KabCondition
*pRight
);
141 virtual ~KabConditionBoolean();
143 // -----------------------------------------------------------------------------
144 class KabConditionOr
: public KabConditionBoolean
147 KabConditionOr(KabCondition
*pLeft
, KabCondition
*pRight
);
148 virtual sal_Bool
isAlwaysTrue() const;
149 virtual sal_Bool
isAlwaysFalse() const;
150 virtual sal_Bool
eval(const ::KABC::Addressee
&aAddressee
) const;
152 // -----------------------------------------------------------------------------
153 class KabConditionAnd
: public KabConditionBoolean
156 KabConditionAnd(KabCondition
*pLeft
, KabCondition
*pRight
);
157 virtual sal_Bool
isAlwaysTrue() const;
158 virtual sal_Bool
isAlwaysFalse() const;
159 virtual sal_Bool
eval(const ::KABC::Addressee
&addressee
) const;
161 // -----------------------------------------------------------------------------
165 #endif // _CONNECTIVITY_KAB_CONDITION_HXX_