update dev300-m58
[ooovba.git] / forms / source / xforms / mip.cxx
blobf805b2b719ea72949ca4e949dc0b98e536c4cb89
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: mip.cxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_forms.hxx"
34 #include "mip.hxx"
37 namespace xforms
41 MIP::MIP()
43 resetReadonly();
44 resetRequired();
45 resetRelevant();
46 resetConstraint();
47 resetCalculate();
48 resetTypeName();
51 MIP::~MIP() {}
53 void MIP::inherit( const MIP& rMip )
55 if( ! mbHasReadonly )
57 mbHasReadonly = rMip.hasReadonly();
58 mbReadonly = rMip.isReadonly();
60 if( ! mbHasRequired )
62 mbHasRequired = rMip.hasRequired();
63 mbRequired = rMip.isRequired();
65 if( ! mbHasRelevant )
67 mbHasRelevant = rMip.hasRelevant();
68 mbRelevant = rMip.isRelevant();
70 if( ! mbHasConstraint )
72 mbHasConstraint = rMip.hasConstraint();
73 mbConstraint = rMip.isConstraint();
74 msConstraintExplanation = rMip.getConstraintExplanation();
76 if( ! mbHasCalculate )
78 mbHasCalculate = rMip.hasCalculate();
80 if( ! mbHasTypeName )
82 mbHasTypeName = rMip.hasTypeName();
83 msTypeName = rMip.getTypeName();
87 void MIP::join( const MIP& rMip )
89 // TODO: inherit only inheritable MIPs...
90 inherit( rMip );
93 bool MIP::hasReadonly() const { return mbHasReadonly; }
94 bool MIP::isReadonly() const { return mbHasReadonly ? mbReadonly : mbHasCalculate; }
95 void MIP::setReadonly( bool b ) { mbHasReadonly = true; mbReadonly = b; }
96 void MIP::resetReadonly() { mbHasReadonly = false; mbReadonly = false; }
98 bool MIP::hasRequired() const { return mbHasRequired; }
99 bool MIP::isRequired() const { return mbRequired; }
100 void MIP::setRequired( bool b ) { mbHasRequired = true; mbRequired = b; }
101 void MIP::resetRequired() { mbHasRequired = false; mbRequired = false; }
103 bool MIP::hasRelevant() const { return mbHasRelevant; }
104 bool MIP::isRelevant() const { return mbRelevant; }
105 void MIP::setRelevant( bool b ) { mbHasRelevant = true; mbRelevant = b; }
106 void MIP::resetRelevant() { mbHasRelevant = false; mbRelevant = true; }
108 bool MIP::hasConstraint() const { return mbHasConstraint; }
109 bool MIP::isConstraint() const { return mbConstraint; }
110 void MIP::setConstraint( bool b ) { mbHasConstraint = true; mbConstraint = b; msConstraintExplanation = rtl::OUString(); }
111 void MIP::resetConstraint() { mbHasConstraint = false; mbConstraint = true; msConstraintExplanation = rtl::OUString(); }
113 void MIP::setConstraintExplanation( const rtl::OUString& s ) { msConstraintExplanation = s; }
114 rtl::OUString MIP::getConstraintExplanation() const { return msConstraintExplanation; }
117 bool MIP::hasCalculate() const { return mbHasCalculate; }
118 void MIP::setHasCalculate( bool b ) { mbHasCalculate = b; }
119 void MIP::resetCalculate() { mbHasCalculate = false; }
121 bool MIP::hasTypeName() const { return mbHasTypeName; }
122 rtl::OUString MIP::getTypeName() const { return msTypeName; }
123 void MIP::setTypeName( const rtl::OUString& s ) { msTypeName = s; mbHasTypeName = true; }
124 void MIP::resetTypeName() { msTypeName = rtl::OUString(); mbHasTypeName = false; }
129 } // namespace xforms