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