Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 :
21 : #include "mip.hxx"
22 :
23 :
24 : namespace xforms
25 : {
26 :
27 :
28 0 : MIP::MIP()
29 : {
30 0 : resetReadonly();
31 0 : resetRequired();
32 0 : resetRelevant();
33 0 : resetConstraint();
34 0 : resetCalculate();
35 0 : resetTypeName();
36 0 : }
37 :
38 0 : MIP::~MIP() {}
39 :
40 0 : void MIP::inherit( const MIP& rMip )
41 : {
42 0 : if( ! mbHasReadonly )
43 : {
44 0 : mbHasReadonly = rMip.hasReadonly();
45 0 : mbReadonly = rMip.isReadonly();
46 : }
47 0 : if( ! mbHasRequired )
48 : {
49 0 : mbHasRequired = rMip.hasRequired();
50 0 : mbRequired = rMip.isRequired();
51 : }
52 0 : if( ! mbHasRelevant )
53 : {
54 0 : mbHasRelevant = rMip.hasRelevant();
55 0 : mbRelevant = rMip.isRelevant();
56 : }
57 0 : if( ! mbHasConstraint )
58 : {
59 0 : mbHasConstraint = rMip.hasConstraint();
60 0 : mbConstraint = rMip.isConstraint();
61 0 : msConstraintExplanation = rMip.getConstraintExplanation();
62 : }
63 0 : if( ! mbHasCalculate )
64 : {
65 0 : mbHasCalculate = rMip.hasCalculate();
66 : }
67 0 : if( ! mbHasTypeName )
68 : {
69 0 : mbHasTypeName = rMip.hasTypeName();
70 0 : msTypeName = rMip.getTypeName();
71 : }
72 0 : }
73 :
74 0 : void MIP::join( const MIP& rMip )
75 : {
76 : // TODO: inherit only inheritable MIPs...
77 0 : inherit( rMip );
78 0 : }
79 :
80 0 : bool MIP::hasReadonly() const { return mbHasReadonly; }
81 0 : bool MIP::isReadonly() const { return mbHasReadonly ? mbReadonly : mbHasCalculate; }
82 0 : void MIP::setReadonly( bool b ) { mbHasReadonly = true; mbReadonly = b; }
83 0 : void MIP::resetReadonly() { mbHasReadonly = false; mbReadonly = false; }
84 :
85 0 : bool MIP::hasRequired() const { return mbHasRequired; }
86 0 : bool MIP::isRequired() const { return mbRequired; }
87 0 : void MIP::setRequired( bool b ) { mbHasRequired = true; mbRequired = b; }
88 0 : void MIP::resetRequired() { mbHasRequired = false; mbRequired = false; }
89 :
90 0 : bool MIP::hasRelevant() const { return mbHasRelevant; }
91 0 : bool MIP::isRelevant() const { return mbRelevant; }
92 0 : void MIP::setRelevant( bool b ) { mbHasRelevant = true; mbRelevant = b; }
93 0 : void MIP::resetRelevant() { mbHasRelevant = false; mbRelevant = true; }
94 :
95 0 : bool MIP::hasConstraint() const { return mbHasConstraint; }
96 0 : bool MIP::isConstraint() const { return mbConstraint; }
97 0 : void MIP::setConstraint( bool b ) { mbHasConstraint = true; mbConstraint = b; msConstraintExplanation = OUString(); }
98 0 : void MIP::resetConstraint() { mbHasConstraint = false; mbConstraint = true; msConstraintExplanation = OUString(); }
99 :
100 0 : void MIP::setConstraintExplanation( const OUString& s ) { msConstraintExplanation = s; }
101 0 : OUString MIP::getConstraintExplanation() const { return msConstraintExplanation; }
102 :
103 :
104 0 : bool MIP::hasCalculate() const { return mbHasCalculate; }
105 0 : void MIP::setHasCalculate( bool b ) { mbHasCalculate = b; }
106 0 : void MIP::resetCalculate() { mbHasCalculate = false; }
107 :
108 0 : bool MIP::hasTypeName() const { return mbHasTypeName; }
109 0 : OUString MIP::getTypeName() const { return msTypeName; }
110 0 : void MIP::setTypeName( const OUString& s ) { msTypeName = s; mbHasTypeName = true; }
111 0 : void MIP::resetTypeName() { msTypeName = OUString(); mbHasTypeName = false; }
112 :
113 :
114 :
115 :
116 : } // namespace xforms
117 :
118 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|