summaryrefslogtreecommitdiff
path: root/wizards/com/sun/star/wizards/common/UCB.java
diff options
context:
space:
mode:
Diffstat (limited to 'wizards/com/sun/star/wizards/common/UCB.java')
-rw-r--r--wizards/com/sun/star/wizards/common/UCB.java66
1 files changed, 33 insertions, 33 deletions
diff --git a/wizards/com/sun/star/wizards/common/UCB.java b/wizards/com/sun/star/wizards/common/UCB.java
index 5e3ad00698df..e068f01eb9d7 100644
--- a/wizards/com/sun/star/wizards/common/UCB.java
+++ b/wizards/com/sun/star/wizards/common/UCB.java
@@ -2,7 +2,7 @@
************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -56,18 +56,18 @@ public class UCB
private Object ucb;
private FileAccess fa;
-
+
public UCB(XMultiServiceFactory xmsf) throws Exception
{
String[] keys = new String[2];
keys[ 0 ] = "Local";
keys[ 1 ] = "Office";
- ucb = xmsf.createInstanceWithArguments(
+ ucb = xmsf.createInstanceWithArguments(
"com.sun.star.ucb.UniversalContentBroker", keys );
fa = new FileAccess(xmsf);
}
-
- public void deleteDirContent(String dir)
+
+ public void deleteDirContent(String dir)
throws Exception
{
if (!fa.exists(dir,true))
@@ -80,18 +80,18 @@ public class UCB
delete(FileAccess.connectURLs(dir ,(String)l.get(i)));
}
}
-
+
public void delete(String filename) throws Exception
{
//System.out.println("UCB.delete(" + filename);
executeCommand( getContent(filename),"delete",Boolean.TRUE);
}
-
+
public void copy(String sourceDir, String targetDir) throws Exception
{
copy(sourceDir,targetDir,(Verifier)null);
}
-
+
public void copy(String sourceDir, String targetDir, Verifier verifier) throws Exception
{
List files = listFiles(sourceDir,verifier);
@@ -99,9 +99,9 @@ public class UCB
{
copy(sourceDir, (String)files.get(i), targetDir);
}
-
+
}
-
+
public void copy(String sourceDir, String filename, String targetDir, String targetName) throws Exception
{
if (!fa.exists(targetDir,true))
@@ -111,7 +111,7 @@ public class UCB
//System.out.println("UCB.copy(" + sourceDir + ", " + filename + ", " + targetDir+ ", " + targetName);
executeCommand(ucb, "globalTransfer", copyArg(sourceDir,filename, targetDir,targetName));
}
-
+
/**
* @deprecated
* @param sourceDir
@@ -134,7 +134,7 @@ public class UCB
*/
public GlobalTransferCommandArgument copyArg(String sourceDir, String sourceFilename, String targetDir, String targetFilename)
{
-
+
GlobalTransferCommandArgument aArg = new GlobalTransferCommandArgument();
aArg.Operation = TransferCommandOperation.COPY;
aArg.SourceURL = fa.getURL(sourceDir,sourceFilename);
@@ -144,10 +144,10 @@ public class UCB
aArg.NameClash = NameClash.OVERWRITE;
return aArg;
}
-
+
public Object executeCommand(Object xContent, String aCommandName, Object aArgument)
- throws com.sun.star.ucb.CommandAbortedException,
- com.sun.star.uno.Exception
+ throws com.sun.star.ucb.CommandAbortedException,
+ com.sun.star.uno.Exception
{
XCommandProcessor xCmdProcessor = (XCommandProcessor)UnoRuntime.queryInterface(
XCommandProcessor.class, xContent);
@@ -163,22 +163,22 @@ public class UCB
Object xContent = getContent(path);
OpenCommandArgument2 aArg = new OpenCommandArgument2();
- aArg.Mode = OpenMode.ALL;
- aArg.Priority = 32768;
+ aArg.Mode = OpenMode.ALL;
+ aArg.Priority = 32768;
// Fill info for the properties wanted.
aArg.Properties = new Property[] {new Property()};
-
+
aArg.Properties[0].Name = "Title";
aArg.Properties[0].Handle = -1;
-
+
XDynamicResultSet xSet;
xSet = (XDynamicResultSet)UnoRuntime.queryInterface(
XDynamicResultSet.class,executeCommand(xContent, "open", aArg));
XResultSet xResultSet = xSet.getStaticResultSet();
-
+
List files = new Vector();
if (xResultSet.first())
@@ -197,17 +197,17 @@ public class UCB
{
; //ignore
}
- else
+ else
{
files.add(aTitle);
}
}
while (xResultSet.next()); // next child
}
-
+
if (verifier != null)
{
- for (int i = 0; i<files.size(); i++)
+ for (int i = 0; i<files.size(); i++)
{
if (!verifier.verify(files.get(i)))
{
@@ -215,18 +215,18 @@ public class UCB
}
}
}
-
+
return files;
}
-
- public Object getContentProperty(Object content, String propName, Class type)
- throws Exception
+
+ public Object getContentProperty(Object content, String propName, Class type)
+ throws Exception
{
Property[] pv = new Property[1];
pv[0] = new Property();
pv[0].Name = propName;
pv[0].Handle = -1;
-
+
Object row = executeCommand(content,"getPropertyValues",pv);
XRow xrow = (XRow)UnoRuntime.queryInterface(XRow.class,row);
if (type.equals(String.class))
@@ -249,21 +249,21 @@ public class UCB
{
return null;
}
-
+
}
-
+
public Object getContent(String path) throws Exception
{
//System.out.println("Getting Content for : " + path);
XContentIdentifier id = ((XContentIdentifierFactory) UnoRuntime.queryInterface(XContentIdentifierFactory.class, ucb)).createContentIdentifier(path);
-
+
return ((XContentProvider)UnoRuntime.queryInterface(
XContentProvider.class,ucb)).queryContent(id);
}
-
+
public static interface Verifier
{
- public boolean verify(Object object);
+ public boolean verify(Object object);
}
}