update dev300-m58
[ooovba.git] / qadevOOo / runner / graphical / OpenOfficeDatabaseReportExtractor.java
blob7b8c2b01f1b5b392cb5f29aab1e7db0eb23ee6df
1 /*
2 * ************************************************************************
3 *
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * Copyright 2008 by Sun Microsystems, Inc.
7 *
8 * OpenOffice.org - a multi-platform office productivity suite
9 *
10 * $RCSfile: OpenOfficeDatabaseReportExtractor.java,v $
11 * $Revision: 1.1.2.3 $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 * ***********************************************************************
33 package graphical;
35 import com.sun.star.beans.PropertyValue;
36 import com.sun.star.beans.XPropertySet;
37 import com.sun.star.container.XNameAccess;
38 import com.sun.star.frame.FrameSearchFlag;
39 import com.sun.star.frame.XComponentLoader;
40 import com.sun.star.frame.XDesktop;
41 import com.sun.star.frame.XModel;
42 import com.sun.star.frame.XStorable;
43 import com.sun.star.lang.XComponent;
44 import com.sun.star.lang.XMultiServiceFactory;
45 import com.sun.star.lang.XServiceInfo;
46 import com.sun.star.sdb.XOfficeDatabaseDocument;
47 import com.sun.star.sdb.XReportDocumentsSupplier;
48 import com.sun.star.sdb.application.XDatabaseDocumentUI;
49 import com.sun.star.uno.UnoRuntime;
50 import com.sun.star.uno.XInterface;
51 import com.sun.star.util.XCloseable;
52 import complexlib.Assurance;
53 // import complexlib.ComplexTestCase.AssureException;
54 import helper.OfficeProvider;
55 import helper.PropertyHelper;
56 import helper.URLHelper;
57 import java.io.File;
58 import java.util.ArrayList;
60 /**
62 * @author ll93751
65 class PropertySetHelper
67 XPropertySet m_xPropertySet;
68 public PropertySetHelper(Object _aObj)
70 m_xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, _aObj);
73 /**
74 get a property and don't convert it
75 @param _sName the string name of the property
76 @return the object value of the property without any conversion
78 public Object getPropertyValueAsObject(String _sName)
80 Object aObject = null;
82 if (m_xPropertySet != null)
84 try
86 aObject = m_xPropertySet.getPropertyValue(_sName);
88 catch (com.sun.star.beans.UnknownPropertyException e)
90 System.out.println("ERROR: UnknownPropertyException caught. '" + _sName + "'");
91 System.out.println("Message: " + e.getMessage());
93 catch (com.sun.star.lang.WrappedTargetException e)
95 System.out.println("ERROR: WrappedTargetException caught.");
96 System.out.println("Message: " + e.getMessage());
99 return aObject;
103 public class OpenOfficeDatabaseReportExtractor extends Assurance
105 private ParameterHelper m_aParameterHelper;
107 public OpenOfficeDatabaseReportExtractor(ParameterHelper _aParameter)
109 m_aParameterHelper = _aParameter;
112 private XDesktop m_xDesktop = null;
113 private XDesktop getXDesktop()
116 if (m_xDesktop == null)
118 try
120 XInterface xInterface = (XInterface) getMultiServiceFactory().createInstance( "com.sun.star.frame.Desktop" );
121 m_xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, xInterface);
123 catch (com.sun.star.uno.Exception e)
125 GlobalLogWriter.get().println("ERROR: uno.Exception caught");
126 GlobalLogWriter.get().println("Message: " + e.getMessage());
129 return m_xDesktop;
132 private void showElements(XNameAccess _xNameAccess)
134 if (_xNameAccess != null)
136 String[] sElementNames = _xNameAccess.getElementNames();
137 for(int i=0;i<sElementNames.length; i++)
139 System.out.println("Value: [" + i + "] := " + sElementNames[i]);
142 else
144 System.out.println("Warning: Given object is null.");
149 private OfficeProvider m_aProvider = null;
150 private XMultiServiceFactory m_xMultiServiceFactory = null;
151 private XMultiServiceFactory getMultiServiceFactory()
153 if (m_xMultiServiceFactory == null)
155 m_xMultiServiceFactory = (XMultiServiceFactory)m_aParameterHelper.getMultiServiceFactory();
157 return m_xMultiServiceFactory;
159 // private void startOffice()
160 // {
161 // // int tempTime = m_aParameterHelper.getTestParameters().getInt("SingleTimeOut");
162 // param.put("TimeOut", new Integer(300000));
163 // System.out.println("TimeOut: " + param.getInt("TimeOut"));
164 // System.out.println("ThreadTimeOut: " + param.getInt("ThreadTimeOut"));
166 // // OfficeProvider aProvider = null;
167 // m_aProvider = new OfficeProvider();
168 // m_xXMultiServiceFactory = (XMultiServiceFactory) m_aProvider.getManager(param);
169 // param.put("ServiceFactory", m_xXMultiServiceFactory);
170 // }
172 // private void stopOffice()
173 // {
174 // if (m_aProvider != null)
175 // {
176 // m_aProvider.closeExistingOffice(param, true);
177 // m_aProvider = null;
178 // }
179 // TimeHelper.waitInSeconds(2, "Give close Office some time.");
180 // }
182 private String m_sMailAddress = null;
183 private String m_sParentDistinct = null;
185 // private String m_sUPDMinor;
186 // private String m_sCWS_WORK_STAMP;
188 private static String m_sSourceVersion;
189 private static String m_sDestinationVersion;
190 private static String m_sSourceName;
191 private static String m_sDestinationName;
193 private static final int WRITER = 1;
194 private static final int CALC = 2;
197 * This is the main test Function of current ReportDesignerTest
199 // public void load(String _sDocumentName)
200 // {
201 // // convwatch.GlobalLogWriter.set(log);
203 // // GlobalLogWriter.get().println("Set office watcher");
204 // // OfficeWatcher aWatcher = (OfficeWatcher)m_aParameterHelper.getTestParameters().get("Watcher");
205 // // GlobalLogWriter.get().setWatcher(aWatcher);
207 // try
208 // {
210 // // -------------------- preconditions, try to find an office --------------------
212 //// String sAppExecutionCommand = (String) m_aParameterHelper.getTestParameters().get("AppExecutionCommand");
213 //// GlobalLogWriter.get().println("sAppExecutionCommand='" + sAppExecutionCommand + "'");
214 ////
215 //// String sUser = System.getProperty("user.name");
216 //// GlobalLogWriter.get().println("user.name='" + sUser + "'");
217 ////
218 //// // String sVCSID = System.getProperty("VCSID");
219 //// // GlobalLogWriter.get().println("VCSID='" + sVCSID + "'");
220 //// // m_sMailAddress = sVCSID + "@openoffice.org";
221 //// m_sMailAddress = System.getProperty("MailAddress");
222 //// GlobalLogWriter.get().println("Assumed mail address: " + m_sMailAddress);
223 ////
224 //// m_sParentDistinct = System.getProperty("ParentDistinct");
225 ////
226 //// m_sSourceVersion = System.getProperty("SourceVersion");
227 //// m_sSourceName = System.getProperty("SourceName");
228 //// m_sDestinationVersion = System.getProperty("DestinationVersion");
229 //// m_sDestinationName = System.getProperty("DestinationName");
230 //// // createDBEntry();
231 //// // GlobalLogWriter.get().println("Current CWS: " + m_sCWS_WORK_STAMP);
232 //// // GlobalLogWriter.get().println("Current MWS: " + m_sUPDMinor);
233 ////
234 //// if (m_sSourceVersion == null)
235 //// {
236 //// System.out.println("Error, Sourceversion is null.");
237 //// System.exit(1);
238 //// }
239 ////
240 //// sAppExecutionCommand = sAppExecutionCommand.replaceAll( "\\$\\{USERNAME\\}", sUser);
241 //// GlobalLogWriter.get().println("sAppExecutionCommand='" + sAppExecutionCommand + "'");
243 // // an other way to replace strings
244 // // sAppExecutionCommand = utils.replaceAll13(sAppExecutionCommand, "${USERNAME}", sUser);
246 // // checkIfOfficeExists(sAppExecutionCommand);
247 // // param.put("AppExecutionCommand", new String(sAppExecutionCommand));
249 // // System.exit(1);
251 // // --------------------------- Start the given Office ---------------------------
253 // // startOffice();
255 // // ------------------------------ Start a test run ------------------------------
257 // // String sCurrentDirectory = System.getProperty("user.dir");
258 // // GlobalLogWriter.get().println("Current Dir: " + sCurrentDirectory);
259 //// String sDocument = (String) m_aParameterHelper.getTestParameters().get(convwatch.PropertyName.DOC_COMPARATOR_INPUT_PATH);
260 //// sDocument = helper.StringHelper.removeQuoteIfExists( sDocument );
261 // startTestForFile(_sDocumentName);
262 // // if (sDocument.toLowerCase().indexOf("writer") >= 0)
263 // // {
264 // // startTestForFile(sDocument, WRITER);
265 // // }
266 // // else if (sDocument.toLowerCase().indexOf("calc") >= 0)
267 // // {
268 // // startTestForFile(sDocument, CALC);
269 // // }
270 // // else
271 // // {
272 // // assure("Can't identify the document no 'writer' nor 'calc' in it's name given.", false);
273 // // }
274 // }
275 // catch (AssureException e)
276 // {
277 // // stopOffice();
278 // // throw new AssureException(e.getMessage());
279 // }
281 // // ------------------------------ Office shutdown ------------------------------
282 // // stopOffice();
283 // }
285 // -----------------------------------------------------------------------------
286 public ArrayList load(String _sDocument /*, int _nType*/)
288 // We need to copy the database file to a place where we have write access, NEVER use the docpool for this
289 String sOutputPath = m_aParameterHelper.getOutputPath();
290 File aOutputPath = new File(sOutputPath);
291 aOutputPath.mkdirs();
293 String sFilename = FileHelper.getBasename(_sDocument);
294 String sDestinationFile = FileHelper.appendPath(sOutputPath, sFilename);
295 FileHelper.copy(_sDocument, sDestinationFile);
297 // now the fix reference of the AbsoluteReferenceFile should exist.
298 assure("There exists no file: " + sDestinationFile, FileHelper.exists(sDestinationFile));
300 String sFileURL = URLHelper.getFileURLFromSystemPath(sDestinationFile);
301 GlobalLogWriter.get().println("File URL: " + sFileURL);
303 ArrayList aPropertyList = new ArrayList();
305 // FYI: it is not allowed to open the document read only
306 // PropertyValue aReadOnly = new PropertyValue(); // always overwrite already exist files
307 // aReadOnly.Name = "ReadOnly";
308 // aReadOnly.Value = Boolean.TRUE;
309 // aPropertyList.add(aReadOnly);
311 XComponent xDocComponent = loadComponent(sFileURL, getXDesktop(), aPropertyList);
313 GlobalLogWriter.get().println("Load done");
314 // context = createUnoService("com.sun.star.sdb.DatabaseContext")
315 // oDataBase = context.getByName("hh")
316 // oDBDoc = oDataBase.DatabaseDocument
318 // dim args(1) as new com.sun.star.beans.PropertyValue
319 // args(0).Name = "ActiveConnection"
320 // args(0).Value = oDBDoc.getCurrentController().getPropertyValue("ActiveConnection")
321 // reportContainer = oDBDoc.getReportDocuments()
322 // report = reportContainer.loadComponentFromURL("Report40","",0,args)
324 ArrayList aList = null;
327 // XInterface x = (XInterface)getMultiServiceFactory().createInstance("com.sun.star.sdb.DatabaseContext");
328 // assure("can't create instance of com.sun.star.sdb.DatabaseContext", x != null);
329 // GlobalLogWriter.get().println("createInstance com.sun.star.sdb.DatabaseContext done");
331 // XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, x);
332 // showElements(xNameAccess);
333 // Object aObj = xNameAccess.getByName(sFileURL);
334 // GlobalLogWriter.get().println("1");
336 // PropertySetHelper aHelper = new PropertySetHelper(aObj);
337 // XDocumentDataSource xDataSource = (XDocumentDataSource)UnoRuntime.queryInterface(XDocumentDataSource.class, aObj);
338 // Object aDatabaseDocument = aHelper.getPropertyValueAsObject("DatabaseDocument");
339 // XOfficeDatabaseDocument xOfficeDBDoc = xDataSource.getDatabaseDocument();
341 XOfficeDatabaseDocument xOfficeDBDoc = (XOfficeDatabaseDocument)UnoRuntime.queryInterface(XOfficeDatabaseDocument.class, xDocComponent);
343 // XOfficeDatabaseDocument xOfficeDBDoc = (XOfficeDatabaseDocument)UnoRuntime.queryInterface(XOfficeDatabaseDocument.class, xDataSource);
344 assure("can't access DatabaseDocument", xOfficeDBDoc != null);
345 // GlobalLogWriter.get().println("2");
347 XModel xDBSource = (XModel)UnoRuntime.queryInterface(XModel.class, xOfficeDBDoc);
348 Object aController = xDBSource.getCurrentController();
349 assure("Controller of xOfficeDatabaseDocument is empty!", aController != null);
350 // GlobalLogWriter.get().println("3");
352 XDatabaseDocumentUI aDBDocUI = (XDatabaseDocumentUI)UnoRuntime.queryInterface(XDatabaseDocumentUI.class, aController);
353 aDBDocUI.connect();
354 boolean isConnect = aDBDocUI.isConnected();
355 if (isConnect)
357 GlobalLogWriter.println("Connection is true");
359 else
361 GlobalLogWriter.println("Connection is false");
364 // aHelper = new PropertySetHelper(aController);
366 XReportDocumentsSupplier xSupplier = (XReportDocumentsSupplier)UnoRuntime.queryInterface(XReportDocumentsSupplier.class, xOfficeDBDoc);
367 XNameAccess xNameAccess = xSupplier.getReportDocuments();
368 assure("xOfficeDatabaseDocument returns no Report Document", xNameAccess != null);
369 // GlobalLogWriter.get().println("5");
371 showElements(xNameAccess);
373 // Object aActiveConnectionObj = aHelper.getPropertyValueAsObject("ActiveConnection");
374 Object aActiveConnectionObj = aDBDocUI.getActiveConnection();
375 assure("ActiveConnection is empty", aActiveConnectionObj != null);
376 // GlobalLogWriter.get().println("5");
378 ArrayList aPropertyList2 = new ArrayList();
380 PropertyValue aActiveConnection = new PropertyValue();
381 aActiveConnection.Name = "ActiveConnection";
382 aActiveConnection.Value = aActiveConnectionObj;
383 aPropertyList2.add(aActiveConnection);
385 aList = loadAndStoreReports(xNameAccess, aPropertyList2 /*, _nType*/ );
386 createDBEntry(/*_nType*/);
388 catch(Exception/*com.sun.star.uno.Exception*/ e)
390 GlobalLogWriter.get().println("ERROR: Exception caught");
391 GlobalLogWriter.get().println("Message: " + e.getMessage());
394 // String mTestDocumentPath = (String) param.get("TestDocumentPath");
395 // System.out.println("mTestDocumentPath: '" + mTestDocumentPath + "'");
396 // // workaround for issue using deprecated "DOCPTH" prop
397 // System.setProperty("DOCPTH", mTestDocumentPath);
399 // Close the document
400 // util.utils.shortWait(2000);
402 closeComponent(xDocComponent);
403 return aList;
406 private String getDocumentPoolName(/*int _nType*/)
408 return "AutogenReportDesignTest";
409 // return getFileFormat(_nType);
412 // -----------------------------------------------------------------------------
413 private void createDBEntry(/*int _nType*/)
415 // try to connect the database
416 String sDBConnection = (String)m_aParameterHelper.getTestParameters().get( convwatch.PropertyName.DB_CONNECTION_STRING );
417 if (sDBConnection != null && sDBConnection.length() > 0)
419 GlobalLogWriter.get().println("DBConnection: " + sDBConnection);
420 // TODO: DB
421 // DB.init(sDBConnection);
423 // String sFixRefSubDirectory = "ReportDesign_qa_complex_" + getFileFormat(_nType);
424 String sFixRefSubDirectory = "ReportDesignFixRef";
426 String sSourceVersion = m_sSourceVersion;
427 // String sSourceVersion = sFixRefSubDirectory;
428 String sSourceName = m_sSourceName;
429 // String sSourceCreatorType = "fixref";
430 String sSourceCreatorType = "";
431 String sDestinationVersion = m_sDestinationVersion;
432 // if (sDestinationVersion.length() == 0)
433 // {
434 // sDestinationVersion = m_sUPDMinor;
435 // }
436 String sDestinationName = m_sDestinationName;
437 String sDestinationCreatorType = "";
438 String sDocumentPoolDir = getOutputPath(/*_nType*/);
439 String sDocumentPoolName = getDocumentPoolName(/*_nType*/);
440 String sSpecial = "";
442 // TODO: DB
443 // DB.insertinto_documentcompare(sSourceVersion, sSourceName, sSourceCreatorType,
444 // m_sDestinationVersion, sDestinationName, sDestinationCreatorType,
445 // sDocumentPoolDir, sDocumentPoolName, m_sMailAddress,
446 // sSpecial, m_sParentDistinct);
447 TimeHelper.waitInSeconds(1, "wait for DB.");
448 // DB.test();
449 // System.exit(1);
453 private ArrayList loadAndStoreReports(XNameAccess _xNameAccess, ArrayList _aPropertyList /*, int _nType*/ )
455 ArrayList aList = new ArrayList();
456 if (_xNameAccess != null)
458 String[] sElementNames = _xNameAccess.getElementNames();
459 for(int i=0;i<sElementNames.length; i++)
461 String sReportName = sElementNames[i];
462 XComponent xDoc = loadComponent(sReportName, _xNameAccess, _aPropertyList);
463 // util.utils.shortWait(1000);
464 // print? or store?
465 String sDocumentPathName = storeComponent(sReportName, xDoc /*, _nType*/);
466 aList.add(sDocumentPathName);
467 // util.utils.shortWait(1000);
468 closeComponent(xDoc);
469 // util.utils.shortWait(1000);
470 // sBackPath contains the path where to find the extracted ODB Document
473 return aList;
476 private String getFormatExtension(Object _xComponent /* int _nType*/ )
478 String sExtension;
479 XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface( XServiceInfo.class, _xComponent );
480 if ( xServiceInfo.supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) )
482 // calc
483 sExtension = ".ods";
485 else if (xServiceInfo.supportsService("com.sun.star.text.TextDocument"))
487 //writer
488 sExtension = ".odt";
490 else
492 sExtension = ".UNKNOWN";
494 return sExtension;
497 // switch(_nType)
498 // {
499 // case WRITER:
500 // sExtension = ".odt";
501 // break;
502 // case CALC:
503 // sExtension = ".ods";
504 // break;
505 // default:
506 // sExtension = ".UNKNOWN";
507 // }
508 // return sExtension;
509 // }
510 // private String getFileFormat(int _nType)
511 // {
512 // String sFileType;
513 // switch(_nType)
514 // {
515 // case WRITER:
516 // sFileType = "writer8";
517 // break;
518 // case CALC:
519 // sFileType = "calc8";
520 // break;
521 // default:
522 // sFileType = "UNKNOWN";
523 // }
524 // return sFileType;
525 // }
527 private String m_sOutputPath = null;
529 private String getOutputPath(/*int _nType*/)
531 if (m_sOutputPath == null)
533 String sOutputPath = (String)m_aParameterHelper.getTestParameters().get( convwatch.PropertyName.DOC_COMPARATOR_OUTPUT_PATH );
534 sOutputPath = helper.StringHelper.removeQuoteIfExists(sOutputPath);
536 // sOutputPath += "tmp_123";
537 sOutputPath = FileHelper.appendPath(sOutputPath, DateHelper.getDateTimeForFilename());
538 // sOutputPath += System.getProperty("file.separator");
540 // sOutputPath += getFileFormat(_nType);
541 // sOutputPath += System.getProperty("file.separator");
543 File aOutputFile = new File(sOutputPath); // create the directory of the given output path
544 aOutputFile.mkdirs();
545 m_sOutputPath = sOutputPath;
547 return m_sOutputPath;
551 store given _xComponent under the given Name in DOC_COMPARATOR_INPUTPATH
553 private String storeComponent(String _sName, Object _xComponent /*, int _nType*/ )
555 String sOutputPath = getOutputPath(/*_nType*/);
557 // // add DocumentPoolName
558 // sOutputPath = FileHelper.appendPath(sOutputPath, getDocumentPoolName(/*_nType*/));
559 // // sOutputPath += System.getProperty("file.separator");
561 // File aOutputFile = new File(sOutputPath); // create the directory of the given output path
562 // aOutputFile.mkdirs();
565 String sName = _sName + getFormatExtension(_xComponent /*_nType*/);
566 sOutputPath = FileHelper.appendPath(sOutputPath, sName);
568 // we need the name and path
569 String sBackPathName = sOutputPath;
571 String sOutputURL = URLHelper.getFileURLFromSystemPath(sOutputPath);
573 ArrayList aPropertyList = new ArrayList(); // set some properties for storeAsURL
575 // PropertyValue aFileFormat = new PropertyValue();
576 // aFileFormat.Name = "FilterName";
577 // aFileFormat.Value = getFileFormat(_nType);
578 // aPropertyList.add(aFileFormat);
580 PropertyValue aOverwrite = new PropertyValue(); // always overwrite already exist files
581 aOverwrite.Name = "Overwrite";
582 aOverwrite.Value = Boolean.TRUE;
583 aPropertyList.add(aOverwrite);
585 // store the document in an other directory
586 XStorable aStorable = (XStorable) UnoRuntime.queryInterface( XStorable.class, _xComponent);
587 if (aStorable != null)
589 GlobalLogWriter.get().println("store document as URL: '" + sOutputURL + "'");
592 aStorable.storeAsURL(sOutputURL, PropertyHelper.createPropertyValueArrayFormArrayList(aPropertyList));
594 catch (com.sun.star.io.IOException e)
596 GlobalLogWriter.get().println("ERROR: Exception caught");
597 GlobalLogWriter.get().println("Can't write document URL: '" + sOutputURL + "'");
598 GlobalLogWriter.get().println("Message: " + e.getMessage());
601 return sBackPathName;
604 private XComponent loadComponent(String _sName, Object _xComponent, ArrayList _aPropertyList)
606 XComponent xDocComponent = null;
607 XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface( XComponentLoader.class, _xComponent );
611 PropertyValue[] aLoadProperties = PropertyHelper.createPropertyValueArrayFormArrayList(_aPropertyList);
612 GlobalLogWriter.get().println("Load component: '" + _sName + "'");
613 xDocComponent = xComponentLoader.loadComponentFromURL(_sName, "_blank", FrameSearchFlag.ALL, aLoadProperties);
614 GlobalLogWriter.get().println("Load component: '" + _sName + "' done");
616 catch (com.sun.star.io.IOException e)
618 GlobalLogWriter.get().println("ERROR: Exception caught");
619 GlobalLogWriter.get().println("Can't load document '" + _sName + "'");
620 GlobalLogWriter.get().println("Message: " + e.getMessage());
622 catch (com.sun.star.lang.IllegalArgumentException e)
624 GlobalLogWriter.get().println("ERROR: Exception caught");
625 GlobalLogWriter.get().println("Illegal Arguments given to loadComponentFromURL.");
626 GlobalLogWriter.get().println("Message: " + e.getMessage());
628 return xDocComponent;
631 private void closeComponent(XComponent _xDoc)
633 // Close the document
634 XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, _xDoc);
637 xCloseable.close(true);
639 catch (com.sun.star.util.CloseVetoException e)
641 GlobalLogWriter.get().println("ERROR: CloseVetoException caught");
642 GlobalLogWriter.get().println("CloseVetoException occured Can't close document.");
643 GlobalLogWriter.get().println("Message: " + e.getMessage());