2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
6 package org
.openoffice
.xforms
;
8 import com
.sun
.star
.beans
.PropertyVetoException
;
9 import com
.sun
.star
.beans
.UnknownPropertyException
;
10 import com
.sun
.star
.beans
.XPropertySet
;
11 import com
.sun
.star
.lang
.IllegalArgumentException
;
12 import com
.sun
.star
.lang
.WrappedTargetException
;
13 import com
.sun
.star
.uno
.UnoRuntime
;
14 import com
.sun
.star
.xforms
.XFormsUIHelper1
;
15 import com
.sun
.star
.xforms
.XModel
;
16 import com
.sun
.star
.xml
.dom
.XNode
;
18 /** encapsulates an XForms model
24 private XModel m_model
;
25 private XPropertySet m_modelProps
;
26 private XFormsUIHelper1 m_helper
;
28 protected Model( Object _model
)
30 m_model
= (XModel
)UnoRuntime
.queryInterface( XModel
.class, _model
);
31 m_modelProps
= (XPropertySet
)UnoRuntime
.queryInterface( XPropertySet
.class, _model
);
32 m_helper
= (XFormsUIHelper1
)UnoRuntime
.queryInterface( XFormsUIHelper1
.class,
36 protected XModel
getXModel()
41 protected XFormsUIHelper1
getUIHelper()
46 public Instance
getDefaultInstance()
48 return new Instance( this, m_model
.getDefaultInstance() );
51 /** creates a binding for the given DOM node
54 * the DOM node to create a binding for
56 * the data type to be used for the binding
59 public XPropertySet
createBindingForNode( XNode _node
, short _dataTypeClass
)
61 XPropertySet binding
= m_helper
.getBindingForNode(_node
, true);
64 String basicTypeName
= (String
)m_model
.getDataTypeRepository().getBasicDataType( _dataTypeClass
).
65 getPropertyValue( "Name" );
66 binding
.setPropertyValue( "Type", basicTypeName
);
75 public void setIsDocumentInternalData( boolean _internalData
)
79 m_modelProps
.setPropertyValue("ExternalData", new Boolean(!_internalData
));
87 public boolean getIsDocumentInternalData()
89 boolean isInternalData
= false;
92 isInternalData
= !((Boolean
)m_modelProps
.getPropertyValue( "ExternalData" )).booleanValue();
98 return isInternalData
;