summaryrefslogtreecommitdiff
path: root/odk/examples/java/Inspector/TDocSupplier.java
diff options
context:
space:
mode:
Diffstat (limited to 'odk/examples/java/Inspector/TDocSupplier.java')
-rw-r--r--odk/examples/java/Inspector/TDocSupplier.java54
1 files changed, 27 insertions, 27 deletions
diff --git a/odk/examples/java/Inspector/TDocSupplier.java b/odk/examples/java/Inspector/TDocSupplier.java
index 1022507eb387..81d8ca05e533 100644
--- a/odk/examples/java/Inspector/TDocSupplier.java
+++ b/odk/examples/java/Inspector/TDocSupplier.java
@@ -3,7 +3,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -30,7 +30,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.beans.Property;
@@ -55,31 +55,31 @@ import javax.swing.JOptionPane;
public class TDocSupplier {
private XMultiComponentFactory m_xMultiComponentFactory;
private XComponentContext m_xComponentContext;
-
-
+
+
/** Creates a new instance of TDocSupplier */
public TDocSupplier(XComponentContext _xComponentContext) {
m_xComponentContext = _xComponentContext;
m_xMultiComponentFactory = m_xComponentContext.getServiceManager();
}
-
-
+
+
protected XComponentContext getXComponentContext(){
return m_xComponentContext;
}
-
-
+
+
protected XMultiComponentFactory getXMultiComponentFactory(){
return m_xMultiComponentFactory;
}
-
+
public XModel getXModelByTDocUrl(String _sTDocUrl){
try{
XRow xRow = getXRowOfTDocUrl(_sTDocUrl, "DocumentModel");
if (xRow != null){
Object oModel = xRow.getObject(1, null);
XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, oModel);
- return xModel;
+ return xModel;
}
}catch(Exception exception){
exception.printStackTrace(System.out);
@@ -87,8 +87,8 @@ public class TDocSupplier {
JOptionPane.showMessageDialog(new javax.swing.JFrame(), "The selected Document could not be opened!", "Object Inspector", JOptionPane.ERROR_MESSAGE);
return null;
}
-
-
+
+
public String getTitleByTDocUrl(String _sTDocUrl){
try{
XRow xRow = this.getXRowOfTDocUrl(_sTDocUrl, "Title");
@@ -101,18 +101,18 @@ public class TDocSupplier {
JOptionPane.showMessageDialog(new javax.swing.JFrame(), "The selected Document could not be opened!", "Object Inspector", JOptionPane.ERROR_MESSAGE);
return "";
}
-
-
+
+
private XRow getXRowOfTDocUrl(String _sTDocUrl, String _sPropertyName){
try{
String[] keys = new String[2];
keys[ 0 ] = "Local";
keys[ 1 ] = "Office";
- Object oUCB = getXMultiComponentFactory().createInstanceWithArgumentsAndContext( "com.sun.star.ucb.UniversalContentBroker", keys, getXComponentContext() );
+ Object oUCB = getXMultiComponentFactory().createInstanceWithArgumentsAndContext( "com.sun.star.ucb.UniversalContentBroker", keys, getXComponentContext() );
XContentIdentifierFactory xIdFactory = (XContentIdentifierFactory)UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB);
XContentProvider xProvider = (XContentProvider)UnoRuntime.queryInterface(XContentProvider.class, oUCB);
XContentIdentifier xId = xIdFactory.createContentIdentifier(_sTDocUrl);
- XContent xContent = xProvider.queryContent(xId);
+ XContent xContent = xProvider.queryContent(xId);
XCommandProcessor xCmdProcessor = (XCommandProcessor) UnoRuntime.queryInterface(XCommandProcessor.class, xContent);
Property aProperty = new Property();
aProperty.Name = _sPropertyName; // "DocumentModel"; //DocumentModel
@@ -127,8 +127,8 @@ public class TDocSupplier {
exception.printStackTrace(System.out);
return null;
}}
-
-
+
+
protected String[] getTDocTitles(String[] _sTDocUrls){
String[] sTitles = new String[_sTDocUrls.length];
for (int i = 0; i < _sTDocUrls.length; i++){
@@ -136,33 +136,33 @@ public class TDocSupplier {
}
return sTitles;
}
-
-
+
+
protected String[] getTDocUrls(){
try{
Object oSimpleFileAccess = getXMultiComponentFactory().createInstanceWithContext("com.sun.star.ucb.SimpleFileAccess", getXComponentContext());
XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) UnoRuntime.queryInterface(XSimpleFileAccess.class, oSimpleFileAccess);
String[] sContent = xSimpleFileAccess.getFolderContents("vnd.sun.star.tdoc:/", false);
- return sContent;
+ return sContent;
} catch( Exception e ) {
System.err.println( e );
return new String[]{};
}}
-
-
+
+
public XComponent openEmptyDocument(String _sUrl){
try{
PropertyValue[] aPropertyValues = new PropertyValue[1];
aPropertyValues[0] = new PropertyValue();
aPropertyValues[0].Name = "Hidden";
- aPropertyValues[0].Value = Boolean.TRUE;
+ aPropertyValues[0].Value = Boolean.TRUE;
Object oDesktop = getXMultiComponentFactory().createInstanceWithContext("com.sun.star.frame.Desktop", getXComponentContext());
XComponentLoader xCL = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, oDesktop);
- return xCL.loadComponentFromURL(_sUrl, "_default", 0, aPropertyValues);
+ return xCL.loadComponentFromURL(_sUrl, "_default", 0, aPropertyValues);
}
catch( Exception exception ) {
System.err.println( exception );
return null;
- }}
-
+ }}
+
}