xref: /trunk/main/forms/source/xforms/mip.hxx (revision 2d785d7e)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _MIP_HXX
25 #define _MIP_HXX
26 
27 #include <rtl/ustring.hxx>
28 
29 namespace xforms
30 {
31 
32 /** represents the XForms *m*odel *i*tem *p*roperties (MIPs) for a
33  * given XNode in the instance data at a given point in time.  The
34  * values will not be updated; for updated values new MIP objects have
35  * to be created/queried. */
36 class MIP
37 {
38     bool mbHasReadonly;
39     bool mbReadonly;
40 
41     bool mbHasRequired;
42     bool mbRequired;
43 
44     bool mbHasRelevant;
45     bool mbRelevant;
46 
47     bool mbHasConstraint;
48     bool mbConstraint;
49 
50     bool mbHasCalculate;
51 
52     bool mbHasTypeName;
53     rtl::OUString msTypeName;
54 
55     rtl::OUString msConstraintExplanation;
56 
57 public:
58     MIP();
59     ~MIP();
60 
61     /// inherit from upper-level MIPs
62     void inherit( const MIP& );
63 
64     /// join with same-level MIPs
65     void join( const MIP& );
66 
67 
68     // - type (static; default: xsd:string)
69     //        (currently default implemented as empty string)
70     bool hasTypeName() const;
71     rtl::OUString getTypeName() const;
72     void setTypeName( const rtl::OUString& );
73     void resetTypeName();
74 
75     // - readonly (computed XPath; default: false; true if calculate exists)
76     bool hasReadonly() const;
77     bool isReadonly() const;
78     void setReadonly( bool );
79     void resetReadonly();
80 
81     // - required (computed XPath; default: false)
82     bool hasRequired() const;
83     bool isRequired() const;
84     void setRequired( bool );
85     void resetRequired();
86 
87     // - relevant (computed XPath; default: true)
88     bool hasRelevant() const;
89     bool isRelevant() const;
90     void setRelevant( bool );
91     void resetRelevant();
92 
93     // - constraing (computed XPath; default: true)
94     bool hasConstraint() const;
95     bool isConstraint() const;
96     void setConstraint( bool );
97     void resetConstraint();
98 
99     // explain _why_ a constraint failed
100     void setConstraintExplanation( const rtl::OUString& );
101     rtl::OUString getConstraintExplanation() const;
102 
103     // - calculate (computed XPath; default: has none (false))
104     //   (for calculate, we only store whether a calculate MIP is present;
105     //    the actual calculate value is handled my changing the instance
106     //    directly)
107     bool hasCalculate() const;
108     void setHasCalculate( bool );
109     void resetCalculate();
110 
111     // - minOccurs/maxOccurs (computed XPath; default: 0/inf)
112     // - p3ptype (static; no default)
113 
114 };
115 
116 } // namespace xforms
117 
118 #endif
119