2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package org
.openoffice
.xforms
;
21 import com
.sun
.star
.beans
.XPropertySet
;
22 import com
.sun
.star
.uno
.UnoRuntime
;
23 import com
.sun
.star
.xforms
.XFormsUIHelper1
;
24 import com
.sun
.star
.xforms
.XModel
;
25 import com
.sun
.star
.xml
.dom
.XNode
;
29 private final XModel m_model
;
30 private final XPropertySet m_modelProps
;
31 private final XFormsUIHelper1 m_helper
;
33 protected Model( Object _model
)
35 m_model
= UnoRuntime
.queryInterface( XModel
.class, _model
);
36 m_modelProps
= UnoRuntime
.queryInterface( XPropertySet
.class, _model
);
37 m_helper
= UnoRuntime
.queryInterface( XFormsUIHelper1
.class,
43 protected XFormsUIHelper1
getUIHelper()
48 public Instance
getDefaultInstance()
50 return new Instance( this, m_model
.getDefaultInstance() );
53 /** creates a binding for the given DOM node
55 * @param _node the DOM node to create a binding for
56 * @param _dataTypeClass the data type to be used for the binding
58 public XPropertySet
createBindingForNode( XNode _node
, short _dataTypeClass
)
60 XPropertySet binding
= m_helper
.getBindingForNode(_node
, true);
63 String basicTypeName
= (String
)m_model
.getDataTypeRepository().getBasicDataType( _dataTypeClass
).
64 getPropertyValue( "Name" );
65 binding
.setPropertyValue( "Type", basicTypeName
);
74 public void setIsDocumentInternalData( boolean _internalData
)
78 m_modelProps
.setPropertyValue("ExternalData", Boolean
.valueOf(!_internalData
));
86 public boolean getIsDocumentInternalData()
88 boolean isInternalData
= false;
91 isInternalData
= !((Boolean
)m_modelProps
.getPropertyValue( "ExternalData" )).booleanValue();
97 return isInternalData
;