xref: /AOO41X/main/forms/source/xforms/mip.cxx (revision 3b8558fd12b4776aa3c54a9fb2322537ca2a5e4c)
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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_forms.hxx"
26 
27 #include "mip.hxx"
28 
29 
30 namespace xforms
31 {
32 
33 
34 MIP::MIP()
35 {
36     resetReadonly();
37     resetRequired();
38     resetRelevant();
39     resetConstraint();
40     resetCalculate();
41     resetTypeName();
42 }
43 
44 MIP::~MIP() {}
45 
46 void MIP::inherit( const MIP& rMip )
47 {
48     if( ! mbHasReadonly )
49     {
50         mbHasReadonly = rMip.hasReadonly();
51         mbReadonly = rMip.isReadonly();
52     }
53     if( ! mbHasRequired )
54     {
55         mbHasRequired = rMip.hasRequired();
56         mbRequired = rMip.isRequired();
57     }
58     if( ! mbHasRelevant )
59     {
60         mbHasRelevant = rMip.hasRelevant();
61         mbRelevant = rMip.isRelevant();
62     }
63     if( ! mbHasConstraint )
64     {
65         mbHasConstraint = rMip.hasConstraint();
66         mbConstraint = rMip.isConstraint();
67         msConstraintExplanation = rMip.getConstraintExplanation();
68     }
69     if( ! mbHasCalculate )
70     {
71         mbHasCalculate = rMip.hasCalculate();
72     }
73     if( ! mbHasTypeName )
74     {
75         mbHasTypeName = rMip.hasTypeName();
76         msTypeName = rMip.getTypeName();
77     }
78 }
79 
80 void MIP::join( const MIP& rMip )
81 {
82     // TODO: inherit only inheritable MIPs...
83     inherit( rMip );
84 }
85 
86 bool MIP::hasReadonly() const     { return mbHasReadonly; }
87 bool MIP::isReadonly() const      { return mbHasReadonly ? mbReadonly : mbHasCalculate; }
88 void MIP::setReadonly( bool b )   { mbHasReadonly = true; mbReadonly = b; }
89 void MIP::resetReadonly()         { mbHasReadonly = false; mbReadonly = false; }
90 
91 bool MIP::hasRequired() const     { return mbHasRequired; }
92 bool MIP::isRequired() const      { return mbRequired; }
93 void MIP::setRequired( bool b )   { mbHasRequired = true; mbRequired = b; }
94 void MIP::resetRequired()         { mbHasRequired = false; mbRequired = false; }
95 
96 bool MIP::hasRelevant() const     { return mbHasRelevant; }
97 bool MIP::isRelevant() const      { return mbRelevant; }
98 void MIP::setRelevant( bool b )   { mbHasRelevant = true; mbRelevant = b; }
99 void MIP::resetRelevant()         { mbHasRelevant = false; mbRelevant = true; }
100 
101 bool MIP::hasConstraint() const   { return mbHasConstraint; }
102 bool MIP::isConstraint() const    { return mbConstraint; }
103 void MIP::setConstraint( bool b ) { mbHasConstraint = true; mbConstraint = b; msConstraintExplanation = rtl::OUString(); }
104 void MIP::resetConstraint()       { mbHasConstraint = false; mbConstraint = true; msConstraintExplanation = rtl::OUString(); }
105 
106 void MIP::setConstraintExplanation( const rtl::OUString& s ) { msConstraintExplanation = s; }
107 rtl::OUString MIP::getConstraintExplanation() const { return msConstraintExplanation; }
108 
109 
110 bool MIP::hasCalculate() const    { return mbHasCalculate; }
111 void MIP::setHasCalculate( bool b ) { mbHasCalculate = b; }
112 void MIP::resetCalculate()        { mbHasCalculate = false; }
113 
114 bool MIP::hasTypeName() const     { return mbHasTypeName; }
115     rtl::OUString MIP::getTypeName() const      { return msTypeName; }
116 void MIP::setTypeName( const rtl::OUString& s ) { msTypeName = s; mbHasTypeName = true; }
117 void MIP::resetTypeName()         { msTypeName = rtl::OUString(); mbHasTypeName = false; }
118 
119 
120 
121 
122 } // namespace xforms
123