xref: /aoo41x/main/forms/source/xforms/mip.cxx (revision 24acc546)
1*24acc546SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*24acc546SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*24acc546SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*24acc546SAndrew Rist  * distributed with this work for additional information
6*24acc546SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*24acc546SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*24acc546SAndrew Rist  * "License"); you may not use this file except in compliance
9*24acc546SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*24acc546SAndrew Rist  *
11*24acc546SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*24acc546SAndrew Rist  *
13*24acc546SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*24acc546SAndrew Rist  * software distributed under the License is distributed on an
15*24acc546SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*24acc546SAndrew Rist  * KIND, either express or implied.  See the License for the
17*24acc546SAndrew Rist  * specific language governing permissions and limitations
18*24acc546SAndrew Rist  * under the License.
19*24acc546SAndrew Rist  *
20*24acc546SAndrew Rist  *************************************************************/
21*24acc546SAndrew Rist 
22*24acc546SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_forms.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "mip.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir 
30cdf0e10cSrcweir namespace xforms
31cdf0e10cSrcweir {
32cdf0e10cSrcweir 
33cdf0e10cSrcweir 
MIP()34cdf0e10cSrcweir MIP::MIP()
35cdf0e10cSrcweir {
36cdf0e10cSrcweir     resetReadonly();
37cdf0e10cSrcweir     resetRequired();
38cdf0e10cSrcweir     resetRelevant();
39cdf0e10cSrcweir     resetConstraint();
40cdf0e10cSrcweir     resetCalculate();
41cdf0e10cSrcweir     resetTypeName();
42cdf0e10cSrcweir }
43cdf0e10cSrcweir 
~MIP()44cdf0e10cSrcweir MIP::~MIP() {}
45cdf0e10cSrcweir 
inherit(const MIP & rMip)46cdf0e10cSrcweir void MIP::inherit( const MIP& rMip )
47cdf0e10cSrcweir {
48cdf0e10cSrcweir     if( ! mbHasReadonly )
49cdf0e10cSrcweir     {
50cdf0e10cSrcweir         mbHasReadonly = rMip.hasReadonly();
51cdf0e10cSrcweir         mbReadonly = rMip.isReadonly();
52cdf0e10cSrcweir     }
53cdf0e10cSrcweir     if( ! mbHasRequired )
54cdf0e10cSrcweir     {
55cdf0e10cSrcweir         mbHasRequired = rMip.hasRequired();
56cdf0e10cSrcweir         mbRequired = rMip.isRequired();
57cdf0e10cSrcweir     }
58cdf0e10cSrcweir     if( ! mbHasRelevant )
59cdf0e10cSrcweir     {
60cdf0e10cSrcweir         mbHasRelevant = rMip.hasRelevant();
61cdf0e10cSrcweir         mbRelevant = rMip.isRelevant();
62cdf0e10cSrcweir     }
63cdf0e10cSrcweir     if( ! mbHasConstraint )
64cdf0e10cSrcweir     {
65cdf0e10cSrcweir         mbHasConstraint = rMip.hasConstraint();
66cdf0e10cSrcweir         mbConstraint = rMip.isConstraint();
67cdf0e10cSrcweir         msConstraintExplanation = rMip.getConstraintExplanation();
68cdf0e10cSrcweir     }
69cdf0e10cSrcweir     if( ! mbHasCalculate )
70cdf0e10cSrcweir     {
71cdf0e10cSrcweir         mbHasCalculate = rMip.hasCalculate();
72cdf0e10cSrcweir     }
73cdf0e10cSrcweir     if( ! mbHasTypeName )
74cdf0e10cSrcweir     {
75cdf0e10cSrcweir         mbHasTypeName = rMip.hasTypeName();
76cdf0e10cSrcweir         msTypeName = rMip.getTypeName();
77cdf0e10cSrcweir     }
78cdf0e10cSrcweir }
79cdf0e10cSrcweir 
join(const MIP & rMip)80cdf0e10cSrcweir void MIP::join( const MIP& rMip )
81cdf0e10cSrcweir {
82cdf0e10cSrcweir     // TODO: inherit only inheritable MIPs...
83cdf0e10cSrcweir     inherit( rMip );
84cdf0e10cSrcweir }
85cdf0e10cSrcweir 
hasReadonly() const86cdf0e10cSrcweir bool MIP::hasReadonly() const     { return mbHasReadonly; }
isReadonly() const87cdf0e10cSrcweir bool MIP::isReadonly() const      { return mbHasReadonly ? mbReadonly : mbHasCalculate; }
setReadonly(bool b)88cdf0e10cSrcweir void MIP::setReadonly( bool b )   { mbHasReadonly = true; mbReadonly = b; }
resetReadonly()89cdf0e10cSrcweir void MIP::resetReadonly()         { mbHasReadonly = false; mbReadonly = false; }
90cdf0e10cSrcweir 
hasRequired() const91cdf0e10cSrcweir bool MIP::hasRequired() const     { return mbHasRequired; }
isRequired() const92cdf0e10cSrcweir bool MIP::isRequired() const      { return mbRequired; }
setRequired(bool b)93cdf0e10cSrcweir void MIP::setRequired( bool b )   { mbHasRequired = true; mbRequired = b; }
resetRequired()94cdf0e10cSrcweir void MIP::resetRequired()         { mbHasRequired = false; mbRequired = false; }
95cdf0e10cSrcweir 
hasRelevant() const96cdf0e10cSrcweir bool MIP::hasRelevant() const     { return mbHasRelevant; }
isRelevant() const97cdf0e10cSrcweir bool MIP::isRelevant() const      { return mbRelevant; }
setRelevant(bool b)98cdf0e10cSrcweir void MIP::setRelevant( bool b )   { mbHasRelevant = true; mbRelevant = b; }
resetRelevant()99cdf0e10cSrcweir void MIP::resetRelevant()         { mbHasRelevant = false; mbRelevant = true; }
100cdf0e10cSrcweir 
hasConstraint() const101cdf0e10cSrcweir bool MIP::hasConstraint() const   { return mbHasConstraint; }
isConstraint() const102cdf0e10cSrcweir bool MIP::isConstraint() const    { return mbConstraint; }
setConstraint(bool b)103cdf0e10cSrcweir void MIP::setConstraint( bool b ) { mbHasConstraint = true; mbConstraint = b; msConstraintExplanation = rtl::OUString(); }
resetConstraint()104cdf0e10cSrcweir void MIP::resetConstraint()       { mbHasConstraint = false; mbConstraint = true; msConstraintExplanation = rtl::OUString(); }
105cdf0e10cSrcweir 
setConstraintExplanation(const rtl::OUString & s)106cdf0e10cSrcweir void MIP::setConstraintExplanation( const rtl::OUString& s ) { msConstraintExplanation = s; }
getConstraintExplanation() const107cdf0e10cSrcweir rtl::OUString MIP::getConstraintExplanation() const { return msConstraintExplanation; }
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 
hasCalculate() const110cdf0e10cSrcweir bool MIP::hasCalculate() const    { return mbHasCalculate; }
setHasCalculate(bool b)111cdf0e10cSrcweir void MIP::setHasCalculate( bool b ) { mbHasCalculate = b; }
resetCalculate()112cdf0e10cSrcweir void MIP::resetCalculate()        { mbHasCalculate = false; }
113cdf0e10cSrcweir 
hasTypeName() const114cdf0e10cSrcweir bool MIP::hasTypeName() const     { return mbHasTypeName; }
getTypeName() const115cdf0e10cSrcweir     rtl::OUString MIP::getTypeName() const      { return msTypeName; }
setTypeName(const rtl::OUString & s)116cdf0e10cSrcweir void MIP::setTypeName( const rtl::OUString& s ) { msTypeName = s; mbHasTypeName = true; }
resetTypeName()117cdf0e10cSrcweir void MIP::resetTypeName()         { msTypeName = rtl::OUString(); mbHasTypeName = false; }
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 
122cdf0e10cSrcweir } // namespace xforms
123