Update git submodules
[LibreOffice.git] / forms / source / xforms / mip.cxx
blobb1759ecbe77e5c53dd846d4a04540682e7c1aef8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include "mip.hxx"
23 namespace xforms
26 MIP::MIP()
28 resetReadonly();
29 resetRequired();
30 resetRelevant();
31 resetConstraint();
32 mbHasCalculate = false;
33 resetTypeName();
36 void MIP::inherit( const MIP& rMip )
38 if( ! mbHasReadonly )
40 mbHasReadonly = rMip.mbHasReadonly;
41 mbReadonly = rMip.isReadonly();
43 if( ! mbHasRequired )
45 mbHasRequired = rMip.mbHasRequired;
46 mbRequired = rMip.isRequired();
48 if( ! mbHasRelevant )
50 mbHasRelevant = rMip.mbHasRelevant;
51 mbRelevant = rMip.isRelevant();
53 if( ! mbHasConstraint )
55 mbHasConstraint = rMip.mbHasConstraint;
56 mbConstraint = rMip.isConstraint();
57 msConstraintExplanation = rMip.getConstraintExplanation();
59 if( ! mbHasCalculate )
61 mbHasCalculate = rMip.mbHasCalculate;
63 if( ! mbHasTypeName )
65 mbHasTypeName = rMip.mbHasTypeName;
66 msTypeName = rMip.getTypeName();
70 void MIP::join( const MIP& rMip )
72 // TODO: inherit only inheritable MIPs...
73 inherit( rMip );
76 bool MIP::isReadonly() const { return mbHasReadonly ? mbReadonly : mbHasCalculate; }
77 void MIP::setReadonly( bool b ) { mbHasReadonly = true; mbReadonly = b; }
78 void MIP::resetReadonly() { mbHasReadonly = false; mbReadonly = false; }
80 void MIP::setRequired( bool b ) { mbHasRequired = true; mbRequired = b; }
81 void MIP::resetRequired() { mbHasRequired = false; mbRequired = false; }
83 void MIP::setRelevant( bool b ) { mbHasRelevant = true; mbRelevant = b; }
84 void MIP::resetRelevant() { mbHasRelevant = false; mbRelevant = true; }
86 void MIP::setConstraint( bool b ) { mbHasConstraint = true; mbConstraint = b; msConstraintExplanation.clear(); }
87 void MIP::resetConstraint() { mbHasConstraint = false; mbConstraint = true; msConstraintExplanation.clear(); }
89 void MIP::setConstraintExplanation( const OUString& s ) { msConstraintExplanation = s; }
91 void MIP::setHasCalculate( bool b ) { mbHasCalculate = b; }
93 void MIP::setTypeName( const OUString& s ) { msTypeName = s; mbHasTypeName = true; }
94 void MIP::resetTypeName() { msTypeName.clear(); mbHasTypeName = false; }
96 } // namespace xforms
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */