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 : #ifndef INCLUDED_FORMS_SOURCE_XFORMS_MIP_HXX
21 : #define INCLUDED_FORMS_SOURCE_XFORMS_MIP_HXX
22 :
23 : #include <rtl/ustring.hxx>
24 :
25 : namespace xforms
26 : {
27 :
28 : /** represents the XForms *m*odel *i*tem *p*roperties (MIPs) for a
29 : * given XNode in the instance data at a given point in time. The
30 : * values will not be updated; for updated values new MIP objects have
31 : * to be created/queried. */
32 0 : class MIP
33 : {
34 : bool mbHasReadonly;
35 : bool mbReadonly;
36 :
37 : bool mbHasRequired;
38 : bool mbRequired;
39 :
40 : bool mbHasRelevant;
41 : bool mbRelevant;
42 :
43 : bool mbHasConstraint;
44 : bool mbConstraint;
45 :
46 : bool mbHasCalculate;
47 :
48 : bool mbHasTypeName;
49 : OUString msTypeName;
50 :
51 : OUString msConstraintExplanation;
52 :
53 : public:
54 : MIP();
55 : ~MIP();
56 :
57 : /// inherit from upper-level MIPs
58 : void inherit( const MIP& );
59 :
60 : /// join with same-level MIPs
61 : void join( const MIP& );
62 :
63 :
64 : // - type (static; default: xsd:string)
65 : // (currently default implemented as empty string)
66 0 : bool hasTypeName() const { return mbHasTypeName; }
67 0 : OUString getTypeName() const { return msTypeName; }
68 : void setTypeName( const OUString& );
69 : void resetTypeName();
70 :
71 : // - readonly (computed XPath; default: false; true if calculate exists)
72 0 : bool hasReadonly() const { return mbHasReadonly; }
73 : bool isReadonly() const;
74 : void setReadonly( bool );
75 : void resetReadonly();
76 :
77 : // - required (computed XPath; default: false)
78 0 : bool hasRequired() const { return mbHasRequired; }
79 0 : bool isRequired() const { return mbRequired; }
80 : void setRequired( bool );
81 : void resetRequired();
82 :
83 : // - relevant (computed XPath; default: true)
84 0 : bool hasRelevant() const { return mbHasRelevant; }
85 0 : bool isRelevant() const { return mbRelevant; }
86 : void setRelevant( bool );
87 : void resetRelevant();
88 :
89 : // - constraing (computed XPath; default: true)
90 0 : bool hasConstraint() const { return mbHasConstraint; }
91 0 : bool isConstraint() const { return mbConstraint; }
92 : void setConstraint( bool );
93 : void resetConstraint();
94 :
95 : // explain _why_ a constraint failed
96 : void setConstraintExplanation( const OUString& );
97 0 : OUString getConstraintExplanation() const { return msConstraintExplanation; }
98 :
99 : // - calculate (computed XPath; default: has none (false))
100 : // (for calculate, we only store whether a calculate MIP is present;
101 : // the actual calculate value is handled my changing the instance
102 : // directly)
103 0 : bool hasCalculate() const { return mbHasCalculate; }
104 : void setHasCalculate( bool );
105 : void resetCalculate();
106 :
107 : // - minOccurs/maxOccurs (computed XPath; default: 0/inf)
108 : // - p3ptype (static; no default)
109 :
110 : };
111 :
112 : } // namespace xforms
113 :
114 : #endif
115 :
116 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|