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()34MIP::MIP() 35 { 36 resetReadonly(); 37 resetRequired(); 38 resetRelevant(); 39 resetConstraint(); 40 resetCalculate(); 41 resetTypeName(); 42 } 43 ~MIP()44MIP::~MIP() {} 45 inherit(const MIP & rMip)46void 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)80void MIP::join( const MIP& rMip ) 81 { 82 // TODO: inherit only inheritable MIPs... 83 inherit( rMip ); 84 } 85 hasReadonly() const86bool MIP::hasReadonly() const { return mbHasReadonly; } isReadonly() const87bool MIP::isReadonly() const { return mbHasReadonly ? mbReadonly : mbHasCalculate; } setReadonly(bool b)88void MIP::setReadonly( bool b ) { mbHasReadonly = true; mbReadonly = b; } resetReadonly()89void MIP::resetReadonly() { mbHasReadonly = false; mbReadonly = false; } 90 hasRequired() const91bool MIP::hasRequired() const { return mbHasRequired; } isRequired() const92bool MIP::isRequired() const { return mbRequired; } setRequired(bool b)93void MIP::setRequired( bool b ) { mbHasRequired = true; mbRequired = b; } resetRequired()94void MIP::resetRequired() { mbHasRequired = false; mbRequired = false; } 95 hasRelevant() const96bool MIP::hasRelevant() const { return mbHasRelevant; } isRelevant() const97bool MIP::isRelevant() const { return mbRelevant; } setRelevant(bool b)98void MIP::setRelevant( bool b ) { mbHasRelevant = true; mbRelevant = b; } resetRelevant()99void MIP::resetRelevant() { mbHasRelevant = false; mbRelevant = true; } 100 hasConstraint() const101bool MIP::hasConstraint() const { return mbHasConstraint; } isConstraint() const102bool MIP::isConstraint() const { return mbConstraint; } setConstraint(bool b)103void MIP::setConstraint( bool b ) { mbHasConstraint = true; mbConstraint = b; msConstraintExplanation = rtl::OUString(); } resetConstraint()104void MIP::resetConstraint() { mbHasConstraint = false; mbConstraint = true; msConstraintExplanation = rtl::OUString(); } 105 setConstraintExplanation(const rtl::OUString & s)106void MIP::setConstraintExplanation( const rtl::OUString& s ) { msConstraintExplanation = s; } getConstraintExplanation() const107rtl::OUString MIP::getConstraintExplanation() const { return msConstraintExplanation; } 108 109 hasCalculate() const110bool MIP::hasCalculate() const { return mbHasCalculate; } setHasCalculate(bool b)111void MIP::setHasCalculate( bool b ) { mbHasCalculate = b; } resetCalculate()112void MIP::resetCalculate() { mbHasCalculate = false; } 113 hasTypeName() const114bool MIP::hasTypeName() const { return mbHasTypeName; } getTypeName() const115 rtl::OUString MIP::getTypeName() const { return msTypeName; } setTypeName(const rtl::OUString & s)116void MIP::setTypeName( const rtl::OUString& s ) { msTypeName = s; mbHasTypeName = true; } resetTypeName()117void MIP::resetTypeName() { msTypeName = rtl::OUString(); mbHasTypeName = false; } 118 119 120 121 122 } // namespace xforms 123