xref: /aoo41x/main/forms/source/xforms/mip.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
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.
14  *
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).
20  *
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.
25  *
26  ************************************************************************/
27 
28 #ifndef _MIP_HXX
29 #define _MIP_HXX
30 
31 #include <rtl/ustring.hxx>
32 
33 namespace xforms
34 {
35 
36 /** represents the XForms *m*odel *i*tem *p*roperties (MIPs) for a
37  * given XNode in the instance data at a given point in time.  The
38  * values will not be updated; for updated values new MIP objects have
39  * to be created/queried. */
40 class MIP
41 {
42     bool mbHasReadonly;
43     bool mbReadonly;
44 
45     bool mbHasRequired;
46     bool mbRequired;
47 
48     bool mbHasRelevant;
49     bool mbRelevant;
50 
51     bool mbHasConstraint;
52     bool mbConstraint;
53 
54     bool mbHasCalculate;
55 
56     bool mbHasTypeName;
57     rtl::OUString msTypeName;
58 
59     rtl::OUString msConstraintExplanation;
60 
61 public:
62     MIP();
63     ~MIP();
64 
65     /// inherit from upper-level MIPs
66     void inherit( const MIP& );
67 
68     /// join with same-level MIPs
69     void join( const MIP& );
70 
71 
72     // - type (static; default: xsd:string)
73     //        (currently default implemented as empty string)
74     bool hasTypeName() const;
75     rtl::OUString getTypeName() const;
76     void setTypeName( const rtl::OUString& );
77     void resetTypeName();
78 
79     // - readonly (computed XPath; default: false; true if calculate exists)
80     bool hasReadonly() const;
81     bool isReadonly() const;
82     void setReadonly( bool );
83     void resetReadonly();
84 
85     // - required (computed XPath; default: false)
86     bool hasRequired() const;
87     bool isRequired() const;
88     void setRequired( bool );
89     void resetRequired();
90 
91     // - relevant (computed XPath; default: true)
92     bool hasRelevant() const;
93     bool isRelevant() const;
94     void setRelevant( bool );
95     void resetRelevant();
96 
97     // - constraing (computed XPath; default: true)
98     bool hasConstraint() const;
99     bool isConstraint() const;
100     void setConstraint( bool );
101     void resetConstraint();
102 
103     // explain _why_ a constraint failed
104     void setConstraintExplanation( const rtl::OUString& );
105     rtl::OUString getConstraintExplanation() const;
106 
107     // - calculate (computed XPath; default: has none (false))
108     //   (for calculate, we only store whether a calculate MIP is present;
109     //    the actual calculate value is handled my changing the instance
110     //    directly)
111     bool hasCalculate() const;
112     void setHasCalculate( bool );
113     void resetCalculate();
114 
115     // - minOccurs/maxOccurs (computed XPath; default: 0/inf)
116     // - p3ptype (static; no default)
117 
118 };
119 
120 } // namespace xforms
121 
122 #endif
123