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::isReadonly() const { return mbHasReadonly ? mbReadonly : mbHasCalculate; }
81 0 : void MIP::setReadonly( bool b ) { mbHasReadonly = true; mbReadonly = b; }
82 0 : void MIP::resetReadonly() { mbHasReadonly = false; mbReadonly = false; }
83 :
84 0 : void MIP::setRequired( bool b ) { mbHasRequired = true; mbRequired = b; }
85 0 : void MIP::resetRequired() { mbHasRequired = false; mbRequired = false; }
86 :
87 0 : void MIP::setRelevant( bool b ) { mbHasRelevant = true; mbRelevant = b; }
88 0 : void MIP::resetRelevant() { mbHasRelevant = false; mbRelevant = true; }
89 :
90 0 : void MIP::setConstraint( bool b ) { mbHasConstraint = true; mbConstraint = b; msConstraintExplanation.clear(); }
91 0 : void MIP::resetConstraint() { mbHasConstraint = false; mbConstraint = true; msConstraintExplanation.clear(); }
92 :
93 0 : void MIP::setConstraintExplanation( const OUString& s ) { msConstraintExplanation = s; }
94 :
95 :
96 0 : void MIP::setHasCalculate( bool b ) { mbHasCalculate = b; }
97 0 : void MIP::resetCalculate() { mbHasCalculate = false; }
98 :
99 0 : void MIP::setTypeName( const OUString& s ) { msTypeName = s; mbHasTypeName = true; }
100 0 : void MIP::resetTypeName() { msTypeName.clear(); mbHasTypeName = false; }
101 :
102 :
103 :
104 :
105 : } // namespace xforms
106 :
107 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|