xref: /aoo41x/main/forms/source/xforms/mip.cxx (revision 24acc546)
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 
MIP()34 MIP::MIP()
35 {
36     resetReadonly();
37     resetRequired();
38     resetRelevant();
39     resetConstraint();
40     resetCalculate();
41     resetTypeName();
42 }
43 
~MIP()44 MIP::~MIP() {}
45 
inherit(const MIP & rMip)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 
join(const MIP & rMip)80 void MIP::join( const MIP& rMip )
81 {
82     // TODO: inherit only inheritable MIPs...
83     inherit( rMip );
84 }
85 
hasReadonly() const86 bool MIP::hasReadonly() const     { return mbHasReadonly; }
isReadonly() const87 bool MIP::isReadonly() const      { return mbHasReadonly ? mbReadonly : mbHasCalculate; }
setReadonly(bool b)88 void MIP::setReadonly( bool b )   { mbHasReadonly = true; mbReadonly = b; }
resetReadonly()89 void MIP::resetReadonly()         { mbHasReadonly = false; mbReadonly = false; }
90 
hasRequired() const91 bool MIP::hasRequired() const     { return mbHasRequired; }
isRequired() const92 bool MIP::isRequired() const      { return mbRequired; }
setRequired(bool b)93 void MIP::setRequired( bool b )   { mbHasRequired = true; mbRequired = b; }
resetRequired()94 void MIP::resetRequired()         { mbHasRequired = false; mbRequired = false; }
95 
hasRelevant() const96 bool MIP::hasRelevant() const     { return mbHasRelevant; }
isRelevant() const97 bool MIP::isRelevant() const      { return mbRelevant; }
setRelevant(bool b)98 void MIP::setRelevant( bool b )   { mbHasRelevant = true; mbRelevant = b; }
resetRelevant()99 void MIP::resetRelevant()         { mbHasRelevant = false; mbRelevant = true; }
100 
hasConstraint() const101 bool MIP::hasConstraint() const   { return mbHasConstraint; }
isConstraint() const102 bool MIP::isConstraint() const    { return mbConstraint; }
setConstraint(bool b)103 void MIP::setConstraint( bool b ) { mbHasConstraint = true; mbConstraint = b; msConstraintExplanation = rtl::OUString(); }
resetConstraint()104 void MIP::resetConstraint()       { mbHasConstraint = false; mbConstraint = true; msConstraintExplanation = rtl::OUString(); }
105 
setConstraintExplanation(const rtl::OUString & s)106 void MIP::setConstraintExplanation( const rtl::OUString& s ) { msConstraintExplanation = s; }
getConstraintExplanation() const107 rtl::OUString MIP::getConstraintExplanation() const { return msConstraintExplanation; }
108 
109 
hasCalculate() const110 bool MIP::hasCalculate() const    { return mbHasCalculate; }
setHasCalculate(bool b)111 void MIP::setHasCalculate( bool b ) { mbHasCalculate = b; }
resetCalculate()112 void MIP::resetCalculate()        { mbHasCalculate = false; }
113 
hasTypeName() const114 bool MIP::hasTypeName() const     { return mbHasTypeName; }
getTypeName() const115     rtl::OUString MIP::getTypeName() const      { return msTypeName; }
setTypeName(const rtl::OUString & s)116 void MIP::setTypeName( const rtl::OUString& s ) { msTypeName = s; mbHasTypeName = true; }
resetTypeName()117 void MIP::resetTypeName()         { msTypeName = rtl::OUString(); mbHasTypeName = false; }
118 
119 
120 
121 
122 } // namespace xforms
123