Get the style color and number just once
[LibreOffice.git] / qadevOOo / runner / util / db / DatabaseDocument.java
blobf9c4913e7cc2e3ebaf051f634c20d76be88add78
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.sdb.XDocumentDataSource;
26 import com.sun.star.sdb.XOfficeDatabaseDocument;
27 import com.sun.star.uno.UnoRuntime;
29 /**
30 * encapsulates a css.sdb.DatabaseDocument
32 public class DatabaseDocument
34 protected DatabaseDocument( final DataSource _dataSource )
36 XDocumentDataSource docDataSource = UnoRuntime.queryInterface(
37 XDocumentDataSource.class, _dataSource.getDataSource() );
38 m_databaseDocument = UnoRuntime.queryInterface(XOfficeDatabaseDocument.class,
39 docDataSource.getDatabaseDocument() );
41 m_model = UnoRuntime.queryInterface( XModel.class, m_databaseDocument );
42 m_storeDoc = UnoRuntime.queryInterface( XStorable.class, m_databaseDocument );
45 public XOfficeDatabaseDocument getDatabaseDocument()
47 return m_databaseDocument;
50 /**
51 * passes through to XModel.getURL.
53 public String getURL()
55 return m_model.getURL();
58 /**
59 * simplified version (taking no arguments except the target URL) of XStorage.storeAsURL
60 * @param _url
61 * specifies the location to where to store the document
63 public void storeAsURL( final String _url ) throws IOException
65 m_storeDoc.storeAsURL( _url, new PropertyValue[] { } );
68 private final XOfficeDatabaseDocument m_databaseDocument;
69 private final XModel m_model;
70 private final XStorable m_storeDoc;