bump product version to 4.1.6.2
[LibreOffice.git] / qadevOOo / runner / util / db / DatabaseDocument.java
blobf67ad90485e1027ad97cc6978b8e4217eb573960
1 /*
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 util.db;
21 import com.sun.star.beans.PropertyValue;
22 import com.sun.star.frame.XModel;
23 import com.sun.star.frame.XStorable;
24 import com.sun.star.io.IOException;
25 import com.sun.star.lang.XMultiServiceFactory;
26 import com.sun.star.sdb.XDocumentDataSource;
27 import com.sun.star.sdb.XOfficeDatabaseDocument;
28 import com.sun.star.uno.UnoRuntime;
30 /**
31 * encapsulates a css.sdb.DatabaseDocument
33 public class DatabaseDocument
35 protected DatabaseDocument( final XMultiServiceFactory _orb, final DataSource _dataSource )
37 m_dataSource = _dataSource;
39 XDocumentDataSource docDataSource = UnoRuntime.queryInterface(
40 XDocumentDataSource.class, m_dataSource.getDataSource() );
41 m_databaseDocument = UnoRuntime.queryInterface(XOfficeDatabaseDocument.class,
42 docDataSource.getDatabaseDocument() );
44 m_model = UnoRuntime.queryInterface( XModel.class, m_databaseDocument );
45 m_storeDoc = UnoRuntime.queryInterface( XStorable.class, m_databaseDocument );
48 public DataSource getDataSource()
50 return m_dataSource;
53 public XOfficeDatabaseDocument getDatabaseDocument()
55 return m_databaseDocument;
58 /**
59 * passes through to XModel.getURL.
61 public String getURL()
63 return m_model.getURL();
66 /**
67 * simplified version (taking no arguments except the target URL) of XStorage.storeAsURL
68 * @param _url
69 * specifies the location to where to store the document
71 public void storeAsURL( final String _url ) throws IOException
73 m_storeDoc.storeAsURL( _url, new PropertyValue[] { } );
76 private DataSource m_dataSource;
77 private XOfficeDatabaseDocument m_databaseDocument;
78 private XModel m_model;
79 private XStorable m_storeDoc;