API CHANGE: remove com.sun.star.document.XDocumentInfo
The following badly designed interfaces and services were deprecated
in OpenOffice.org 3.0 and are now remove from the API:
com.sun.star.document.DocumentInfo
com.sun.star.document.StandaloneDocumentInfo
com.sun.star.document.XDocumentInfo
com.sun.star.document.XDocumentInfoSupplier
com.sun.star.document.XStandaloneDocumentInfo
The supported replacements for these have been introduced in OOo 3.0:
com.sun.star.document.XDocumentProperties
com.sun.star.document.XDocumentPropertiesSupplier
com.sun.star.document.DocumentProperties
http://www.mail-archive.com/interface-announce@openoffice.org/msg00432.html
Remove the implementation of these interfaces and services in sfx2
(SfxBaseModel, objuno.cxx)
Also remove unit tests for these services in qadevOOo and sfx2.
Conflicts:
offapi/type_reference/types.rdb
Change-Id: Ib0b48a4e53a8079c82fac3bb49a829812f8e5256
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 6e85574..f01eb68 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -606,7 +606,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/datatra
X11DropTarget \
))
$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/document,\
DocumentInfo \
EventDescriptor \
Events \
ExportFilter \
@@ -622,7 +621,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/documen
OfficeDocument \
PDFDialog \
Settings \
StandaloneDocumentInfo \
TypeDetection \
XMLBasicExporter \
XMLBasicImporter \
@@ -2143,8 +2141,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/document,\
XCompatWriterDocProperties \
XDocumentEventBroadcaster \
XDocumentEventListener \
XDocumentInfo \
XDocumentInfoSupplier \
XDocumentInsertable \
XDocumentLanguages \
XDocumentProperties \
@@ -2172,7 +2168,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/document,\
XOOXMLDocumentPropertiesImporter \
XRedlinesSupplier \
XScriptInvocationContext \
XStandaloneDocumentInfo \
XStorageBasedDocument \
XStorageChangeListener \
XTypeDetection \
diff --git a/offapi/com/sun/star/document/DocumentInfo.idl b/offapi/com/sun/star/document/DocumentInfo.idl
deleted file mode 100644
index 7570b00..0000000
--- a/offapi/com/sun/star/document/DocumentInfo.idl
+++ /dev/null
@@ -1,214 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef __com_sun_star_document_DocumentInfo_idl__
#define __com_sun_star_document_DocumentInfo_idl__
#include <com/sun/star/document/XDocumentInfo.idl>
#include <com/sun/star/lang/XComponent.idl>
#include <com/sun/star/beans/XPropertySet.idl>
#include <com/sun/star/beans/XFastPropertySet.idl>
#include <com/sun/star/beans/XPropertyContainer.idl>
#include <com/sun/star/beans/NamedValue.idl>
#include <com/sun/star/util/DateTime.idl>
#include <com/sun/star/lang/Locale.idl>
module com { module sun { module star { module document {
/** this service provides document-specific information like the
author, creation date and user fields
<p>
Contrary to the service <type>StandaloneDocumentInfo</type> the document - which
contains such informations - must be loaded completely. As a result of that this
DocumentInfo service is available on an open document via the interface
<type>XDocumentInfoSupplier</type> only.
</p>
@deprecated Use <type>DocumentProperties</type> instead.
@see StandaloneDocumentInfo
@see XDocumentInfoSupplier
*/
published service DocumentInfo
{
/** provides access to the user fields for the information regarding the
document
<p>
These fields are additional to normal properties.
(see below)
</p>
*/
interface XDocumentInfo;
/** necessary to support normal properties
*/
interface com::sun::star::beans::XPropertySet;
/** supports faster access on well known properties by using index
*/
interface com::sun::star::beans::XFastPropertySet;
/** provides access to the user fields, which (instead to the user fields set
by the interface XDocumentInfo) will be typesafe.
<p>
These fields are additional to normal properties (see below) and
additional to the user fields set by the interface XDocumentInfo (see before).
</p>
*/
[optional] interface com::sun::star::beans::XPropertyContainer;
/** contains the initial author of the document
*/
[property] string Author;
/** @deprecated
*/
[property] boolean AutoloadEnabled;
/** contains the number of seconds after which a specified
URL is to be loaded after the document is loaded into a desktop
frame
*/
[property] long AutoloadSecs;
/** contains the URL to load automatically after a
specified time after the document is loaded into a desktop frame
*/
[property] string AutoloadURL;
/** contains the date and time of the first time the
document was stored
*/
[property] com::sun::star::util::DateTime CreationDate;
/** contains the name of the default frame into which
links should be loaded if no target is specified
<p>
This applies to the autoload feature too, but to others as well.
</p>
*/
[property] string DefaultTarget;
/** contains a multi-line comment of the document
<p>
Line delimiters can be UNIX, Macintosh or DOS style.
</p>
*/
[property] string Description;
/** contains some statistics about the document
<p>
The exact name and type of the values depends on the document type
</p>
*/
[property] sequence< com::sun::star::beans::NamedValue > DocumentStatistic;
/** describes how often the document was edited and saved
*/
[property] short EditingCycles;
/** contains the net time of editing the document (in seconds)
*/
[property] long EditingDuration;
/** identifies application was used to create or last modify the document
*/
[property] string Generator;
/** contains a comma separated list of keywords for
the document
*/
[property] string Keywords;
/** contains the MIME-type of the document's resource
<p>
The MIME-type is neither stored in the document information nor in
the document; it is sent within a protocol header or is
detected, thus it cannot be changed.
</p>
*/
[readonly, property] string MIMEType;
/** default language of the document
*/
[property] com::sun::star::lang::Locale Language;
/** contains the name of the editor who was the last
person to store this document
*/
[property] string ModifiedBy;
/** contains the date and time of the last time the
document was stored
*/
[property] com::sun::star::util::DateTime ModifyDate;
/** contains the date and time of when the document was
last printed
*/
[property] com::sun::star::util::DateTime PrintDate;
/** contains the name of the editor who was the last
person to print the document
*/
[property] string PrintedBy;
/** subject of document
*/
[property] string Subject;
/** contains logical name of the template from
which the document was created
<p>
The value is an empty string if the document was not created
from a template or if it was detached from the template.
</p>
*/
[property] string Template;
/** contains the file path name of the template from
which the document was created
*/
[property] string TemplateFileName;
/** contains the date and time of when the document
was created or updated from the template
*/
[property] com::sun::star::util::DateTime TemplateDate;
/** contains the title of the document
*/
[property] string Title;
};
}; }; }; };
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/document/OfficeDocument.idl b/offapi/com/sun/star/document/OfficeDocument.idl
index e6f2f6f..96de718 100644
--- a/offapi/com/sun/star/document/OfficeDocument.idl
+++ b/offapi/com/sun/star/document/OfficeDocument.idl
@@ -26,7 +26,6 @@
#include <com/sun/star/view/XPrintJobBroadcaster.idl>
#include <com/sun/star/document/XEventBroadcaster.idl>
#include <com/sun/star/document/XEventsSupplier.idl>
#include <com/sun/star/document/XDocumentInfoSupplier.idl>
#include <com/sun/star/document/XViewDataSupplier.idl>
#include <com/sun/star/document/XDocumentEventBroadcaster.idl>
#include <com/sun/star/document/XEmbeddedScripts.idl>
@@ -104,17 +103,6 @@ published service OfficeDocument
*/
[optional] interface XEventsSupplier;
/** document can provide a <type>DocumentInfo</type>
<p>
Instead of the <type>StandaloneDocumentInfo</type> service the <type>DocumentInfo</type>
will be available on an already opened document only.
</p>
@deprecated Use <type>XDocumentPropertiesSupplier</type> instead.
*/
[optional] interface XDocumentInfoSupplier;
/** access to some properties describing all open views to a document
*/
[optional] interface XViewDataSupplier;
diff --git a/offapi/com/sun/star/document/StandaloneDocumentInfo.idl b/offapi/com/sun/star/document/StandaloneDocumentInfo.idl
deleted file mode 100644
index 04084eaf..0000000
--- a/offapi/com/sun/star/document/StandaloneDocumentInfo.idl
+++ /dev/null
@@ -1,63 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef __com_sun_star_document_StandaloneDocumentInfo_idl__
#define __com_sun_star_document_StandaloneDocumentInfo_idl__
#include <com/sun/star/document/DocumentInfo.idl>
#include <com/sun/star/document/XStandaloneDocumentInfo.idl>
module com { module sun { module star { module document {
/** extends the service <type>DocumentInfo</type> to have access on such
document properties without loading the whole document
<p>
First action on this service must be to specify which document should be handled.
Otherwise all supported properties of <type>DocumentInfo</type> will be set to
void values. Loading of a document doesn't mean - loading all. It means reading
of special part only, which includes searched information. Same procedure for saving
of may changed values back to the document.
</p>
@deprecated Use <type>DocumentProperties</type> instead.
@see DocumentInfo
*/
published service StandaloneDocumentInfo
{
/** use it to specify resource or target of document info data
<p>
Must be the first action on this service. Otherwise all properties will be void.
</p>
*/
interface XStandaloneDocumentInfo;
/** access to document info data
*/
service DocumentInfo;
};
}; }; }; };
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/document/XDocumentInfo.idl b/offapi/com/sun/star/document/XDocumentInfo.idl
deleted file mode 100644
index b43bab7..0000000
--- a/offapi/com/sun/star/document/XDocumentInfo.idl
+++ /dev/null
@@ -1,128 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef __com_sun_star_document_XDocumentInfo_idl__
#define __com_sun_star_document_XDocumentInfo_idl__
#include <com/sun/star/uno/XInterface.idl>
#include <com/sun/star/lang/ArrayIndexOutOfBoundsException.idl>
module com { module sun { module star { module document {
/** provides access to the user fields for the information regarding the
document
<p>
These fields are special one of the set of available document properties.
Other ones are accessed as properties (by using the interface
<type scope="com::sun::star::beans">XPropertySet</type>) of service
<type>DocumentInfo</type>.
</p>
@deprecated Use <type>XDocumentProperties</type> instead.
@see DocumentInfo
@see StandaloneDocumentInfo
@see com::sun::star::beans::XPropertySet
*/
published interface XDocumentInfo: com::sun::star::uno::XInterface
{
/** provides information about count of available fields
<p>
This count marks the top range of possible requests for get/set
any of these fields. Range = [0..count-1]
</p>
@returns
current count
*/
short getUserFieldCount();
/** returns the name of an user field
@param Index
specifies the position of requested field
Range = [0..count-1]
@returns
the name of the requested field
@throws com::sun::star::lang::ArrayIndexOutOfBoundsException
if <var>Index</var> don't fit range of [0..count-1]
*/
string getUserFieldName( [in] short Index )
raises( com::sun::star::lang::ArrayIndexOutOfBoundsException );
/** returns the value of an user field
@param Index
specifies the position of requested field
Range = [0..count-1]
@returns
the value of the requested field
@throws com::sun::star::lang::ArrayIndexOutOfBoundsException
if <var>Index</var> don't fit range of [0..count-1]
*/
string getUserFieldValue( [in] short Index )
raises( com::sun::star::lang::ArrayIndexOutOfBoundsException );
/** changes the name of one of the user fields
@param Index
specifies the position of requested field
Range = [0..count-1]
@param Name
the new name for this field to be set
@throws com::sun::star::lang::ArrayIndexOutOfBoundsException
if <var>Index</var> don't fit range of [0..count-1]
*/
void setUserFieldName(
[in] short Index ,
[in] string Name )
raises( com::sun::star::lang::ArrayIndexOutOfBoundsException );
/** changes the value of one of the user fields
@param Index
specifies the position of requested field
Range = [0..count-1]
@param Value
the new value for this field to be set
@throws com::sun::star::lang::ArrayIndexOutOfBoundsException
if <var>Index</var> don't fit range of [0..count-1]
*/
void setUserFieldValue(
[in] short Index ,
[in] string Value )
raises( com::sun::star::lang::ArrayIndexOutOfBoundsException );
};
}; }; }; };
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/document/XDocumentInfoSupplier.idl b/offapi/com/sun/star/document/XDocumentInfoSupplier.idl
deleted file mode 100644
index 295d431..0000000
--- a/offapi/com/sun/star/document/XDocumentInfoSupplier.idl
+++ /dev/null
@@ -1,59 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef __com_sun_star_document_XDocumentInfoSupplier_idl__
#define __com_sun_star_document_XDocumentInfoSupplier_idl__
#include <com/sun/star/uno/XInterface.idl>
#include <com/sun/star/document/XDocumentInfo.idl>
module com { module sun { module star { module document {
/** through this interface documents can provide a <type>DocumentInfo</type>
<p>
A <type>DocumentInfo</type> is available on already opened documents only
and must be provides by this supplier interface.
Instead of that you can use the service <type>StandaloneDocumentInfo</type>
to have access to such informations without opening the whole file.
It read/write parts of the document, which include the required informations,
only.
</p>
@deprecated Use <type>XDocumentPropertiesSupplier</type> instead.
@see DocumentInfo
@see StandaloneDocumentInfo
*/
published interface XDocumentInfoSupplier: com::sun::star::uno::XInterface
{
/** provides the document information object
@returns
an object of type <type>DocumentInfo</type>
*/
XDocumentInfo getDocumentInfo();
};
}; }; }; };
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/document/XStandaloneDocumentInfo.idl b/offapi/com/sun/star/document/XStandaloneDocumentInfo.idl
deleted file mode 100644
index da5ae474..0000000
--- a/offapi/com/sun/star/document/XStandaloneDocumentInfo.idl
+++ /dev/null
@@ -1,89 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef __com_sun_star_document_XStandaloneDocumentInfo_idl__
#define __com_sun_star_document_XStandaloneDocumentInfo_idl__
#include <com/sun/star/document/XDocumentInfo.idl>
#include <com/sun/star/io/IOException.idl>
module com { module sun { module star { module document {
/** makes it possible to load document information from
a resource specified by a URL and to store it into a resource also
specified by a URL
<p>
Only the document information part of the resource is transferred.
Instead of <type>DocumentInfo</type> not the whole document will be opened.
Note: Without specifying the source or target of this info (the document)
nothing can work and will be handled as void (for reading) or ignored (for writing).
After specifying the source/target by using this interface,
the interface <type>XDocumentInfo</type> (which must be implemented on same
object then this one!) provides access to the info properties.
</p>
@deprecated Use <type>XDocumentProperties</type> instead.
@see DocumentInfo
@see StandaloneDocumentInfo
@see XDocumentInfo
*/
published interface XStandaloneDocumentInfo: XDocumentInfo
{
/** loads the document information from a file referred by an URL
<p>
After an unsuccessful call the contents of the document
information are undefined (void).
This method only works for storage file formats.
</p>
@param URL
specifies the source of information
@throws com::sun::star::io::IOException
if storage couldn't be found or opened
*/
void loadFromURL( [in] string URL )
raises( com::sun::star::io::IOException );
/** stores the document information into a file referred by a URL
<p>
Only the document information part of the document is overwritten.
This method only works for storage file formats.
</p>
@param URL
specifies the target for saving
@throws com::sun::star::io::IOException
if storage couldn't be found or opened
*/
void storeIntoURL( [in] string URL )
raises( com::sun::star::io::IOException );
};
}; }; }; };
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb
index 5991297..44d459d 100644
--- a/offapi/type_reference/types.rdb
+++ b/offapi/type_reference/types.rdb
Binary files differ
diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk
index d6c5c9e..998a794 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -410,15 +410,12 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/ifc/datatransfer/clipboard/_XFlushableClipboard \
qadevOOo/tests/java/ifc/datatransfer/_XDataFormatTranslator \
qadevOOo/tests/java/ifc/datatransfer/_XMimeContentTypeFactory \
qadevOOo/tests/java/ifc/document/_DocumentInfo \
qadevOOo/tests/java/ifc/document/_ExportFilter \
qadevOOo/tests/java/ifc/document/_ImportFilter \
qadevOOo/tests/java/ifc/document/_LinkTarget \
qadevOOo/tests/java/ifc/document/_OfficeDocument \
qadevOOo/tests/java/ifc/document/_Settings \
qadevOOo/tests/java/ifc/document/_XActionLockable \
qadevOOo/tests/java/ifc/document/_XDocumentInfo \
qadevOOo/tests/java/ifc/document/_XDocumentInfoSupplier \
qadevOOo/tests/java/ifc/document/_XDocumentInsertable \
qadevOOo/tests/java/ifc/document/_XEmbeddedObjectSupplier \
qadevOOo/tests/java/ifc/document/_XEventBroadcaster \
@@ -428,7 +425,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/ifc/document/_XImporter \
qadevOOo/tests/java/ifc/document/_XLinkTargetSupplier \
qadevOOo/tests/java/ifc/document/_XMimeTypeInfo \
qadevOOo/tests/java/ifc/document/_XStandaloneDocumentInfo \
qadevOOo/tests/java/ifc/document/_XTypeDetection \
qadevOOo/tests/java/ifc/document/_XViewDataSupplier \
qadevOOo/tests/java/ifc/drawing/_AreaShapeDescriptor \
@@ -1061,7 +1057,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/mod/_fwk/Desktop \
qadevOOo/tests/java/mod/_fwk/DispatchRecorder \
qadevOOo/tests/java/mod/_fwk/DispatchRecorderSupplier \
qadevOOo/tests/java/mod/_fwk/DocumentProperties \
qadevOOo/tests/java/mod/_fwk/FontMenuController \
qadevOOo/tests/java/mod/_fwk/FontSizeMenuController \
qadevOOo/tests/java/mod/_fwk/FooterMenuController \
@@ -1322,7 +1317,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/mod/_sfx/DocumentTemplates \
qadevOOo/tests/java/mod/_sfx/FrameLoader \
qadevOOo/tests/java/mod/_sfx/SfxMacroLoader \
qadevOOo/tests/java/mod/_sfx/StandaloneDocumentInfo \
qadevOOo/tests/java/mod/_shlibloader/uno/DLLComponentLoader \
qadevOOo/tests/java/mod/_simplereg/uno/SimpleRegistry \
qadevOOo/tests/java/mod/_simreg/SimpleRegistry \
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScModelObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScModelObj.csv
index c4da0da..cb7c6d1 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScModelObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScModelObj.csv
@@ -47,7 +47,6 @@
"ScModelObj";"com::sun::star::beans::XPropertySet#optional";"removePropertyChangeListener()"
"ScModelObj";"com::sun::star::beans::XPropertySet#optional";"addVetoableChangeListener()"
"ScModelObj";"com::sun::star::beans::XPropertySet#optional";"removeVetoableChangeListener()"
"ScModelObj";"com::sun::star::document::XDocumentInfoSupplier#optional";"getDocumentInfo()"
"ScModelObj";"com::sun::star::sheet::XDocumentAuditing";"refreshArrows()"
"ScModelObj";"com::sun::star::sheet::XGoalSeek";"seekGoal()"
"ScModelObj";"com::sun::star::sheet::SpreadsheetDocument";"NamedRanges"
diff --git a/qadevOOo/objdsc/sd/com.sun.star.comp.office.SdXImpressDocument.csv b/qadevOOo/objdsc/sd/com.sun.star.comp.office.SdXImpressDocument.csv
index 0e50db8f1c..fd2b766 100644
--- a/qadevOOo/objdsc/sd/com.sun.star.comp.office.SdXImpressDocument.csv
+++ b/qadevOOo/objdsc/sd/com.sun.star.comp.office.SdXImpressDocument.csv
@@ -40,7 +40,6 @@
"SdXImpressDocument";"com::sun::star::beans::XPropertySet";"removePropertyChangeListener()"
"SdXImpressDocument";"com::sun::star::beans::XPropertySet";"addVetoableChangeListener()"
"SdXImpressDocument";"com::sun::star::beans::XPropertySet";"removeVetoableChangeListener()"
"SdXImpressDocument";"com::sun::star::document::XDocumentInfoSupplier#optional";"getDocumentInfo()"
"SdXImpressDocument";"com::sun::star::document::OfficeDocument";"AutomaticControlFocus#optional"
"SdXImpressDocument";"com::sun::star::document::OfficeDocument";"ApplyFormDesignMode#optional"
"SdXImpressDocument";"com::sun::star::document::OfficeDocument";"RuntimeUID#optional"
diff --git a/qadevOOo/objdsc/sfx/com.sun.star.comp.sfx2.StandaloneDocumentInfo.csv b/qadevOOo/objdsc/sfx/com.sun.star.comp.sfx2.StandaloneDocumentInfo.csv
deleted file mode 100644
index d9b6e02..0000000
--- a/qadevOOo/objdsc/sfx/com.sun.star.comp.sfx2.StandaloneDocumentInfo.csv
+++ /dev/null
@@ -1,46 +0,0 @@
"StandaloneDocumentInfo";"com::sun::star::document::XStandaloneDocumentInfo";"loadFromURL()"
"StandaloneDocumentInfo";"com::sun::star::document::XStandaloneDocumentInfo";"storeIntoURL()"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Author"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Generator"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"CreationDate"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Title"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Subject"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Description"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Keywords"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"MIMEType"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Language"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"ModifiedBy"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"ModifyDate"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"PrintedBy"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"PrintDate"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Template"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"TemplateDate"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"AutoloadURL"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"AutoloadSecs"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"DefaultTarget"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"BlindCopiesTo"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"CopyTo"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"InReplyTo"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Newsgroups"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Original"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Priority"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Recipient"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"References"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"ReplyTo"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Theme"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"IsEncrypted"
"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"AutoloadEnabled"
"StandaloneDocumentInfo";"com::sun::star::document::XDocumentInfo";"getUserFieldCount()"
"StandaloneDocumentInfo";"com::sun::star::document::XDocumentInfo";"getUserFieldName()"
"StandaloneDocumentInfo";"com::sun::star::document::XDocumentInfo";"getUserFieldValue()"
"StandaloneDocumentInfo";"com::sun::star::document::XDocumentInfo";"setUserFieldName()"
"StandaloneDocumentInfo";"com::sun::star::document::XDocumentInfo";"setUserFieldValue()"
"StandaloneDocumentInfo";"com::sun::star::beans::XPropertySet";"getPropertySetInfo()"
"StandaloneDocumentInfo";"com::sun::star::beans::XPropertySet";"setPropertyValue()"
"StandaloneDocumentInfo";"com::sun::star::beans::XPropertySet";"getPropertyValue()"
"StandaloneDocumentInfo";"com::sun::star::beans::XPropertySet";"addPropertyChangeListener()"
"StandaloneDocumentInfo";"com::sun::star::beans::XPropertySet";"removePropertyChangeListener()"
"StandaloneDocumentInfo";"com::sun::star::beans::XPropertySet";"addVetoableChangeListener()"
"StandaloneDocumentInfo";"com::sun::star::beans::XPropertySet";"removeVetoableChangeListener()"
"StandaloneDocumentInfo";"com::sun::star::beans::XFastPropertySet";"setFastPropertyValue()"
"StandaloneDocumentInfo";"com::sun::star::beans::XFastPropertySet";"getFastPropertyValue()"
diff --git a/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXTextDocument.csv b/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXTextDocument.csv
index 09e9c91..dd21e26 100644
--- a/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXTextDocument.csv
+++ b/qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXTextDocument.csv
@@ -58,7 +58,6 @@
"SwXTextDocument";"com::sun::star::beans::XPropertySet#optional";"removePropertyChangeListener()"
"SwXTextDocument";"com::sun::star::beans::XPropertySet#optional";"addVetoableChangeListener()"
"SwXTextDocument";"com::sun::star::beans::XPropertySet#optional";"removeVetoableChangeListener()"
"SwXTextDocument";"com::sun::star::document::XDocumentInfoSupplier#optional";"getDocumentInfo()"
"SwXTextDocument";"com::sun::star::text::GenericTextDocument";"CharLocale#optional"
"SwXTextDocument";"com::sun::star::text::GenericTextDocument";"CharacterCount#optional"
"SwXTextDocument";"com::sun::star::text::GenericTextDocument";"ParagraphCount#optional"
diff --git a/qadevOOo/tests/java/ifc/document/_DocumentInfo.java b/qadevOOo/tests/java/ifc/document/_DocumentInfo.java
deleted file mode 100644
index 5809f3e..0000000
--- a/qadevOOo/tests/java/ifc/document/_DocumentInfo.java
+++ /dev/null
@@ -1,142 +0,0 @@
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package ifc.document;
import lib.MultiPropertyTest;
import com.sun.star.util.DateTime;
/**
* Testing <code>com.sun.star.document.DocumentInfo</code>
* service properties : <p>
* <ul>
* <li> <code> Author </code> </li>
* <li> <code> AutoloadEnabled </code> </li>
* <li> <code> AutoloadSecs </code> </li>
* <li> <code> AutoloadURL </code> </li>
* <li> <code> BlindCopiesTo </code> </li>
* <li> <code> CopyTo </code> </li>
* <li> <code> CreationDate </code> </li>
* <li> <code> DefaultTarget </code> </li>
* <li> <code> Description </code> </li>
* <li> <code> InReplyTo </code> </li>
* <li> <code> IsEncrypted </code> </li>
* <li> <code> Keywords </code> </li>
* <li> <code> MIMEType </code> </li>
* <li> <code> ModifiedBy </code> </li>
* <li> <code> ModifyDate </code> </li>
* <li> <code> Newsgroups </code> </li>
* <li> <code> Original </code> </li>
* <li> <code> PrintDate </code> </li>
* <li> <code> PrintedBy </code> </li>
* <li> <code> Priority </code> </li>
* <li> <code> Recipient </code> </li>
* <li> <code> References </code> </li>
* <li> <code> ReplyTo </code> </li>
* <li> <code> Template </code> </li>
* <li> <code> TemplateDate </code> </li>
* <li> <code> Theme </code> </li>
* <li> <code> Title </code> </li>
* </ul>
* Properties testing is automated by <code>lib.MultiPropertyTest</code>.
* @see com.sun.star.document.DocumentInfo
*/
public class _DocumentInfo extends MultiPropertyTest {
/**
* Overrides compare method. Can compare <code>DateTime</code>
* structures.
*/
protected boolean compare(Object ob1, Object ob2) {
if (ob1 instanceof DateTime && ob2 instanceof DateTime) {
DateTime dt1 = (DateTime)ob1;
DateTime dt2 = (DateTime)ob2;
return dt1.Year == dt2.Year
&& dt1.Month == dt2.Month
&& dt1.Day == dt2.Day
&& dt1.Hours == dt2.Hours
&& dt1.Minutes == dt2.Minutes
&& dt1.Seconds == dt2.Seconds
&& dt1.HundredthSeconds == dt2.HundredthSeconds;
} else {
return super.compare(ob1, ob2);
}
}
/**
* Prints DateTime.
*/
protected String toString(Object obj) {
if (obj instanceof DateTime) {
DateTime dt = (DateTime)obj;
return dt.Year + ":" + dt.Month + ":" + dt.Day
+ ":" + dt.Hours + ":" + dt.Minutes
+ ":" + dt.Seconds + ":" + dt.HundredthSeconds;
} else {
return super.toString(obj);
}
}
/**
* Tester for properties with <code>DateTime</code> type which
* creates new structure if old property value was null.
*/
class DatePropertyTester extends PropertyTester {
protected Object getNewValue(String propName,
Object oldValue) {
if (oldValue == null || util.utils.isVoid(oldValue)) {
DateTime dt = new DateTime();
dt.Year = 2000;
dt.Month = 10;
dt.Day = 18;
dt.Hours = 19;
dt.Minutes = 41;
return dt;
} else {
return super.getNewValue(propName, oldValue);
}
}
}
/**
* Can be void.
*/
public void _PrintDate() {
testProperty("PrintDate", new DatePropertyTester());
}
/**
* Can be void.
*/
public void _TemplateDate() {
testProperty("TemplateDate", new DatePropertyTester());
}
/**
* Can be void.
*/
public void _ModifyDate() {
testProperty("ModifyDate", new DatePropertyTester());
}
}
diff --git a/qadevOOo/tests/java/ifc/document/_XDocumentInfo.java b/qadevOOo/tests/java/ifc/document/_XDocumentInfo.java
deleted file mode 100644
index 02c371d..0000000
--- a/qadevOOo/tests/java/ifc/document/_XDocumentInfo.java
+++ /dev/null
@@ -1,215 +0,0 @@
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package ifc.document;
import lib.MultiMethodTest;
import com.sun.star.document.XDocumentInfo;
import com.sun.star.lang.ArrayIndexOutOfBoundsException;
/**
* Testing <code>com.sun.star.document.XDocumentInfo</code>
* interface methods :
* <ul>
* <li><code> getUserFieldCount()</code></li>
* <li><code> getUserFieldName()</code></li>
* <li><code> setUserFieldName()</code></li>
* <li><code> getUserFieldValue()</code></li>
* <li><code> setUserFieldValue()</code></li>
* </ul> <p>
* Test is <b> NOT </b> multithread compilant. <p>
* @see com.sun.star.document.XDocumentInfo
*/
public class _XDocumentInfo extends MultiMethodTest {
public XDocumentInfo oObj = null;
short fieldCount;
/**
* Gets user field count. <p>
* Has <b> OK </b> status if count is positive.
*/
public void _getUserFieldCount() {
fieldCount = oObj.getUserFieldCount();
tRes.tested("getUserFieldCount()", fieldCount >= 0);
}
String[] oldNames;
String[] oldValues;
/**
* Retrieves all user field names and stores them. <p>
* Has <b> OK </b> status if no exceptions were thrown and
* names returned are not <code>null</code> values. <p>
* The following method tests are to be completed successfully before :
* <ul>
* <li> <code> getUserFieldCount() </code> : to obtain number of
* fields </li>
* </ul>
*/
public void _getUserFieldName() {
requiredMethod("getUserFieldCount()");
oldNames = new String[fieldCount];
for (short i = 0; i < fieldCount; i++) {
try {
oldNames[i] = oObj.getUserFieldName(i);
if (oldNames[i] == null) {
tRes.tested("getUserFieldName()", false);
return;
}
} catch (ArrayIndexOutOfBoundsException e) {
log.println("Couldn't get an user field name at " + i);
tRes.tested("getUserFieldName()", false);
return;
}
}
tRes.tested("getUserFieldName()", true);
}
/**
* For each field its name changed and the checked if it's properly
* changed. Finally old names are restored.<p>
* Has <b> OK </b> status if names were properly changed. <p>
* The following method tests are to be completed successfully before :
* <ul>
* <li> <code> getUserFieldName() </code> : to retrieve old names </li>
* </ul>
*/
public void _setUserFieldName() {
requiredMethod("getUserFieldName()");
for (short i = 0; i < fieldCount; i++) {
String newName = oldNames[i] + "_new";
try {
oObj.setUserFieldName(i, newName);
} catch (ArrayIndexOutOfBoundsException e) {
log.println("Couldn't set an user field name at " + i);
tRes.tested("setUserFieldName()", false);
return;
}
try {
if (!newName.equals(oObj.getUserFieldName(i))) {
tRes.tested("setUserFieldName()", false);
return;
}
} catch (ArrayIndexOutOfBoundsException e) {
log.println("Couldn't set an user field name at " + i);
tRes.tested("setUserFieldName()", false);
return;
} finally {
try {
oObj.setUserFieldName(i, oldNames[i]);
} catch (ArrayIndexOutOfBoundsException e) {
log.println("Couldn't restore an user field name at " + i);
tRes.tested("setUserFieldName()", false);
return;
}
}
}
tRes.tested("setUserFieldName()", true);
}
/**
* Retrieves all user field values and stores them. <p>
* Has <b> OK </b> status if no exceptions were thrown and
* values returned are not <code>null</code> values. <p>
* The following method tests are to be completed successfully before :
* <ul>
* <li> <code> getUserFieldCount() </code> : to obtain number of
* fields </li>
* </ul>
*/
public void _getUserFieldValue() {
requiredMethod("getUserFieldCount()");
oldValues = new String[fieldCount];
for (short i = 0; i < fieldCount; i++) {
try {
oldValues[i] = oObj.getUserFieldValue(i);
if (oldValues[i] == null) {
tRes.tested("getUserFieldValue()", false);
return;
}
} catch (ArrayIndexOutOfBoundsException e) {
log.println("Couldn't get an user field value at " + i);
tRes.tested("getUserFieldValue()", false);
return;
}
}
tRes.tested("getUserFieldValue()", true);
}
/**
* For each field its value changed and the checked if it's properly
* changed. Finally old values are restored.<p>
* Has <b> OK </b> status if values were properly changed. <p>
* The following method tests are to be completed successfully before :
* <ul>
* <li> <code> getUserFieldValue() </code> : to retrieve old values. </li>
* </ul>
*/
public void _setUserFieldValue() {
requiredMethod("getUserFieldValue()");
for (short i = 0; i < fieldCount; i++) {
String newValue = oldValues[i] + "_new";
try {
oObj.setUserFieldValue(i, newValue);
} catch (ArrayIndexOutOfBoundsException e) {
log.println("Couldn't set an user field value at " + i);
tRes.tested("setUserFieldValue()", false);
return;
}
try {
if (!newValue.equals(oObj.getUserFieldValue(i))) {
tRes.tested("setUserFieldValue()", false);
return;
}
} catch (ArrayIndexOutOfBoundsException e) {
log.println("Couldn't set an user field value at " + i);
tRes.tested("setUserFieldValue()", false);
return;
} finally {
try {
oObj.setUserFieldValue(i, oldNames[i]);
} catch (ArrayIndexOutOfBoundsException e) {
log.println("Couldn't restore an user field value at " + i);
tRes.tested("setUserFieldValue()", false);
return;
}
}
}
tRes.tested("setUserFieldValue()", true);
}
} // finish class _XDocumentInfo
diff --git a/qadevOOo/tests/java/ifc/document/_XDocumentInfoSupplier.java b/qadevOOo/tests/java/ifc/document/_XDocumentInfoSupplier.java
deleted file mode 100644
index 5810ae8..0000000
--- a/qadevOOo/tests/java/ifc/document/_XDocumentInfoSupplier.java
+++ /dev/null
@@ -1,47 +0,0 @@
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package ifc.document;
import com.sun.star.beans.XPropertySet;
import com.sun.star.document.XDocumentInfo;
import com.sun.star.document.XDocumentInfoSupplier;
import com.sun.star.uno.UnoRuntime;
import lib.MultiMethodTest;
/**
* test the XDocumentInfoSupplier interface.
*/
public class _XDocumentInfoSupplier extends MultiMethodTest {
public XDocumentInfoSupplier oObj = null;
public void _getDocumentInfo() {
// returns a com.sun.star.document.DocumentInfo
XDocumentInfo info = oObj.getDocumentInfo();
XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, info);
String title = null;
try {
title = (String)xPropertySet.getPropertyValue("Title");
}
catch(Exception e) {
e.printStackTrace(log);
title = null;
}
log.println("Got document title: " + title);
tRes.tested("getDocumentInfo()", title != null);
}
}
diff --git a/qadevOOo/tests/java/ifc/document/_XStandaloneDocumentInfo.java b/qadevOOo/tests/java/ifc/document/_XStandaloneDocumentInfo.java
deleted file mode 100644
index 88f60d4..0000000
--- a/qadevOOo/tests/java/ifc/document/_XStandaloneDocumentInfo.java
+++ /dev/null
@@ -1,120 +0,0 @@
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package ifc.document;
import lib.MultiMethodTest;
import lib.Status;
import lib.StatusException;
import com.sun.star.beans.XPropertySet;
import com.sun.star.document.XStandaloneDocumentInfo;
import com.sun.star.io.IOException;
import com.sun.star.uno.UnoRuntime;
/**
* Testing <code>com.sun.star.document.XStandaloneDocumentInfo</code>
* interface methods. <p>
* This test needs the following object relations :
* <ul>
* <li> <code>'DOCURL'</code> (of type <code>String</code>):
* URL of document which info is loaded.</li>
* <ul> <p>
* Test is <b> NOT </b> multithread compilant. <p>
* @see com.sun.star.document.XStandaloneDocumentInfo
*/
public class _XStandaloneDocumentInfo extends MultiMethodTest {
public XStandaloneDocumentInfo oObj = null;
String url = null;
protected void before() {
url = (String)tEnv.getObjRelation("DOCURL");
if (url == null) {
throw new StatusException
(Status.failed("Relation 'DOCURL' not found"));
}
}
String oldProp = null;
String newProp = null;
/**
* Sets new value of the property 'Author' and calls the method. <p>
* Has <b> OK </b> status if no exception occurred.
*/
public void _storeIntoURL() {
try {
oObj.loadFromURL(url);
XPropertySet propSet = UnoRuntime.queryInterface(XPropertySet.class, oObj);
oldProp = (String)propSet.getPropertyValue("Author");
newProp = oldProp + "_";
propSet.setPropertyValue("Author", newProp);
oObj.storeIntoURL(url);
tRes.tested("storeIntoURL()", true);
} catch (IOException e) {
log.println("Couldn't store to " + url
+ " : " + e.getMessage());
e.printStackTrace(log);
tRes.tested("storeIntoURL()", false);
} catch(com.sun.star.lang.WrappedTargetException e) {
log.println("Couldn't get/set property 'Author':" + e);
tRes.tested("storeIntoURL()", false);
} catch(com.sun.star.beans.UnknownPropertyException e) {
log.println("Couldn't get/set property 'Author':" + e);
tRes.tested("storeIntoURL()", false);
} catch(com.sun.star.lang.IllegalArgumentException e) {
log.println("Couldn't get/set property 'Author':" + e);
tRes.tested("storeIntoURL()", false);
} catch(com.sun.star.beans.PropertyVetoException e) {
log.println("Couldn't get/set property 'Author':" + e);
tRes.tested("storeIntoURL()", false);
}
}
/**
* Calls the method and checks value of the property 'Author'. <p>
* Has <b> OK </b> status if no exception occurred and value of the property
* 'Author' is equal to value that was set in the method
* <code>storeIntoURL</code>.
*/
public void _loadFromURL() {
requiredMethod("storeIntoURL()");
try {
oObj.loadFromURL(url);
XPropertySet propSet = UnoRuntime.queryInterface(XPropertySet.class, oObj);
String resProp = (String)propSet.getPropertyValue("Author");
log.println("Was: '" + oldProp + "',Set: '" + newProp +
"', New: " + resProp + "'");
tRes.tested("loadFromURL()", resProp.equals(newProp) );
} catch (IOException e) {
log.println("Couldn't load from " + url
+ " : " + e.getMessage());
e.printStackTrace(log);
tRes.tested("loadFromURL()", false);
} catch(com.sun.star.lang.WrappedTargetException e) {
log.println("Couldn't get/set property 'Author':" + e);
tRes.tested("loadFromURL()", false);
} catch(com.sun.star.beans.UnknownPropertyException e) {
log.println("Couldn't get/set property 'Author':" + e);
tRes.tested("loadFromURL()", false);
}
}
} // finish class _XStandaloneDocumentInfo
diff --git a/qadevOOo/tests/java/mod/_fwk/DocumentProperties.java b/qadevOOo/tests/java/mod/_fwk/DocumentProperties.java
deleted file mode 100644
index 97ebe69..0000000
--- a/qadevOOo/tests/java/mod/_fwk/DocumentProperties.java
+++ /dev/null
@@ -1,120 +0,0 @@
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package mod._fwk;
import java.io.PrintWriter;
import lib.StatusException;
import lib.TestCase;
import lib.TestEnvironment;
import lib.TestParameters;
import util.SOfficeFactory;
import com.sun.star.document.XDocumentInfoSupplier;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.text.XTextDocument;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XInterface;
/**
* Test for object which is represented by service
* <code>com.sun.star.document.DocumentInfo</code>. <p>
* Object implements the following interfaces :
* <ul>
* <li><code>com::sun::star::beans::XFastPropertySet</code></li>
* <li><code>com::sun::star::beans::XPropertySet</code></li>
* <li><code>com::sun::star::document::XDocumentInfo</code></li>
* <li><code>com::sun::star::document::XStandaloneDocumentInfo</code></li>
* <li><code>com::sun::star::lang::XComponent</code></li>
* </ul><p>
* @see com.sun.star.beans.XFastPropertySet
* @see com.sun.star.beans.XPropertySet
* @see com.sun.star.document.XDocumentInfo
* @see com.sun.star.document.XStandaloneDocumentInfo
* @see com.sun.star.lang.XComponent
* @see ifc.beans._XFastPropertySet
* @see ifc.beans._XPropertySet
* @see ifc.document._XDocumentInfo
* @see ifc.document._XStandaloneDocumentInfo
* @see ifc.lang._XComponent
*/
public class DocumentProperties extends TestCase {
XTextDocument xTextDoc;
/**
* Disposes the document, if exists, created in
* <code>createTestEnvironment</code> method.
*/
protected void cleanup( TestParameters Param, PrintWriter log) {
log.println("disposing xTextDoc");
if (xTextDoc != null) {
xTextDoc.dispose();
}
}
/**
* Creates a text document.
* Obtains the property <code>'DocumentInfo'</code> of the created document.
*/
public TestEnvironment createTestEnvironment( TestParameters Param,
PrintWriter log ) throws StatusException {
XInterface oObj = null;
log.println( "creating a test environment" );
if (xTextDoc != null) xTextDoc.dispose();
// get a soffice factory object
SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)Param.getMSF());
try {
log.println( "creating a text document" );
xTextDoc = SOF.createTextDoc(null);
} catch ( com.sun.star.uno.Exception e ) {
// Some exception occures.FAILED
e.printStackTrace( log );
throw new StatusException( "Couldn't create document", e );
}
shortWait();
XDocumentInfoSupplier xdis = UnoRuntime.queryInterface(XDocumentInfoSupplier.class, xTextDoc);
//oObj = (XInterface)UnoRuntime.queryInterface(XInterface.class, docInfo);
oObj = xdis.getDocumentInfo();
TestEnvironment tEnv = new TestEnvironment( oObj );
return tEnv;
} // finish method getTestEnvironment
/**
* Sleeps for 0.5 sec. to allow StarOffice to react on <code>
* reset</code> call.
*/
private void shortWait() {
try {
Thread.sleep(500) ;
} catch (InterruptedException e) {
log.println("While waiting :" + e) ;
}
}
}
diff --git a/qadevOOo/tests/java/mod/_sfx/StandaloneDocumentInfo.java b/qadevOOo/tests/java/mod/_sfx/StandaloneDocumentInfo.java
deleted file mode 100644
index f3ec7a1..0000000
--- a/qadevOOo/tests/java/mod/_sfx/StandaloneDocumentInfo.java
+++ /dev/null
@@ -1,123 +0,0 @@
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package mod._sfx;
import java.io.PrintWriter;
import lib.StatusException;
import lib.TestCase;
import lib.TestEnvironment;
import lib.TestParameters;
import util.utils;
import com.sun.star.document.XStandaloneDocumentInfo;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XInterface;
/**
* Test for object which is represented by service
* <code>com.sun.star.document.StandaloneDocumentInfo</code>. <p>
* Object implements the following interfaces :
* <ul>
* <li> <code>com::sun::star::lang::XComponent</code></li>
* <li> <code>com::sun::star::document::DocumentInfo</code></li>
* <li> <code>com::sun::star::document::XDocumentInfo</code></li>
* <li> <code>com::sun::star::document::XStandaloneDocumentInfo</code></li>
* <li> <code>com::sun::star::beans::XFastPropertySet</code></li>
* <li> <code>com::sun::star::beans::XPropertySet</code></li>
* </ul> <p>
* The following files used by this test :
* <ul>
* <li><b> SfxStandaloneDocInfoObject.sdw </b> : is copied
* to SOffice temporary directory and is used to load and
* save its info. </li>
* </ul> <p>
* This object test <b> is NOT </b> designed to be run in several
* threads concurently.
*
* @see com.sun.star.lang.XComponent
* @see com.sun.star.document.DocumentInfo
* @see com.sun.star.document.XDocumentInfo
* @see com.sun.star.document.XStandaloneDocumentInfo
* @see com.sun.star.beans.XFastPropertySet
* @see com.sun.star.beans.XPropertySet
* @see ifc.lang._XComponent
* @see ifc.document._DocumentInfo
* @see ifc.document._XDocumentInfo
* @see ifc.document._XStandaloneDocumentInfo
* @see ifc.beans._XFastPropertySet
* @see ifc.beans._XPropertySet
*/
public class StandaloneDocumentInfo extends TestCase {
String destUrl = null ;
/**
* Copies file 'SfxStandaloneDocInfoObject.sdw' to tempopary
* location (overwriting the old file if exists).
*/
protected void initialize( TestParameters tParam, PrintWriter log ) {
String srcUrl = utils.getFullTestURL("SfxStandaloneDocInfoObject.sdw") ;
destUrl = utils.getOfficeTemp((XMultiServiceFactory)tParam.getMSF()) +
"SfxStandaloneDocInfoObject.sdw";
utils.doOverwriteFile((XMultiServiceFactory)tParam.getMSF(), srcUrl, destUrl) ;
}
/**
* Creating a Testenvironment for the interfaces to be tested.
* Creates an instance of the service
* <code>com.sun.star.document.StandaloneDocumentInfo</code>.
* Object relations created :
* <ul>
* <li> <code>'DOCURL'</code> for
* {@link ifc.document._XStandaloneDocumentInfo} :
* the Writer file URL in temporary location. </li>
* </ul>
*/
protected TestEnvironment createTestEnvironment
(TestParameters tParam, PrintWriter log) {
XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF();
XInterface oObj = null;
try {
oObj = (XInterface)xMSF.createInstance
("com.sun.star.document.StandaloneDocumentInfo");
} catch (com.sun.star.uno.Exception e) {
e.printStackTrace(log);
throw new StatusException("Unexpected exception", e);
}
String Iname = util.utils.getImplName(oObj);
log.println("Implementation Name: "+Iname);
TestEnvironment tEnv = new TestEnvironment(oObj);
XStandaloneDocumentInfo the_info = UnoRuntime.queryInterface(XStandaloneDocumentInfo.class, oObj);
try {
the_info.loadFromURL(destUrl);
} catch (com.sun.star.io.IOException e) {
e.printStackTrace(log);
throw new StatusException("Couldn't load document: " + destUrl,e);
}
tEnv.addObjRelation("DOCURL",destUrl);
return tEnv;
}
} // finish class TestCase
diff --git a/sfx2/JunitTest_sfx2_complex.mk b/sfx2/JunitTest_sfx2_complex.mk
index abe3616..cb77929 100644
--- a/sfx2/JunitTest_sfx2_complex.mk
+++ b/sfx2/JunitTest_sfx2_complex.mk
@@ -34,17 +34,12 @@ $(eval $(call gb_JunitTest_use_jars,sfx2_complex,\
))
$(eval $(call gb_JunitTest_add_sourcefiles,sfx2_complex,\
sfx2/qa/complex/sfx2/DocumentInfo \
sfx2/qa/complex/sfx2/DocumentMetadataAccess \
sfx2/qa/complex/sfx2/DocumentProperties \
sfx2/qa/complex/sfx2/GlobalEventBroadcaster \
sfx2/qa/complex/sfx2/StandaloneDocumentInfo \
sfx2/qa/complex/sfx2/UndoManager \
sfx2/qa/complex/sfx2/JUnitBasedTest \
sfx2/qa/complex/sfx2/DocumentEvents \
sfx2/qa/complex/sfx2/standalonedocinfo/StandaloneDocumentInfoTest \
sfx2/qa/complex/sfx2/standalonedocinfo/Test01 \
sfx2/qa/complex/sfx2/standalonedocinfo/TestHelper \
sfx2/qa/complex/sfx2/tools/DialogThread \
sfx2/qa/complex/sfx2/tools/TestDocument \
sfx2/qa/complex/sfx2/tools/WriterHelper \
@@ -59,7 +54,6 @@ $(eval $(call gb_JunitTest_add_sourcefiles,sfx2_complex,\
))
$(eval $(call gb_JunitTest_add_classes,sfx2_complex,\
complex.sfx2.DocumentInfo \
complex.sfx2.DocumentProperties \
complex.sfx2.DocumentMetadataAccess \
complex.sfx2.DocumentEvents \
@@ -69,7 +63,5 @@ $(eval $(call gb_JunitTest_add_classes,sfx2_complex,\
# complex.sfx2.UndoManager \
# #i115674# fails currently: misses some OnUnfocus event
# complex.sfx2.GlobalEventBroadcaster \
# breaks because binfilter export has been removed
# complex.sfx2.StandaloneDocumentInfo \
# vim: set noet sw=4 ts=4:
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index 8a12ad9..6cc8a1d 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -206,7 +206,6 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/doc/objmisc \
sfx2/source/doc/objserv \
sfx2/source/doc/objstor \
sfx2/source/doc/objuno \
sfx2/source/doc/objxtor \
sfx2/source/doc/oleprops \
sfx2/source/doc/ownsubfilterservice \
diff --git a/sfx2/inc/sfx2/objuno.hxx b/sfx2/inc/sfx2/objuno.hxx
deleted file mode 100644
index 3e18ad6..0000000
--- a/sfx2/inc/sfx2/objuno.hxx
+++ /dev/null
@@ -1,186 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef _SFX_OBJUNO_HXX
#define _SFX_OBJUNO_HXX
#include <com/sun/star/document/XDocumentInfo.hpp>
#include <com/sun/star/document/XStandaloneDocumentInfo.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <com/sun/star/util/XModifyListener.hpp>
#include <com/sun/star/util/XModifyBroadcaster.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XFastPropertySet.hpp>
#include <com/sun/star/beans/XVetoableChangeListener.hpp>
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
#include <com/sun/star/beans/XPropertyContainer.hpp>
#include <com/sun/star/beans/XPropertyAccess.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/util/XCloneable.hpp>
#include <com/sun/star/io/IOException.hpp>
#include <svl/itemprop.hxx>
#include <cppuhelper/implbase10.hxx>
#include "sfxuno.hxx"
// this is now just a wrapper around a XDocumentProperties instance
class SAL_DLLPRIVATE SfxDocumentInfoObject: public ::cppu::WeakImplHelper10<
::com::sun::star::document::XDocumentInfo,
::com::sun::star::lang::XComponent,
::com::sun::star::beans::XPropertySet,
::com::sun::star::beans::XFastPropertySet,
::com::sun::star::beans::XPropertyAccess,
::com::sun::star::beans::XPropertyContainer,
::com::sun::star::document::XDocumentPropertiesSupplier,
::com::sun::star::util::XModifyBroadcaster,
::com::sun::star::lang::XInitialization,
::com::sun::star::util::XCloneable>
{
protected:
struct SfxDocumentInfoObject_Impl* _pImp;
public:
SfxDocumentInfoObject();
~SfxDocumentInfoObject();
// XComponent
virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener) throw( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener) throw( ::com::sun::star::uno::RuntimeException );
// XPropertySet
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL setPropertyValue(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue) throw(
::com::sun::star::uno::RuntimeException,
::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::beans::PropertyVetoException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::lang::WrappedTargetException);
virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString& aPropertyName) throw(
::com::sun::star::uno::RuntimeException,
::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::lang::WrappedTargetException);
virtual void SAL_CALL addPropertyChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & aListener) throw(
::com::sun::star::uno::RuntimeException,
::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::lang::WrappedTargetException);
virtual void SAL_CALL removePropertyChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & aListener) throw(
::com::sun::star::uno::RuntimeException,
::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::lang::WrappedTargetException);
virtual void SAL_CALL addVetoableChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener) throw(
::com::sun::star::uno::RuntimeException,
::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::lang::WrappedTargetException);
virtual void SAL_CALL removeVetoableChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener) throw(
::com::sun::star::uno::RuntimeException,
::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::lang::WrappedTargetException);
// ::com::sun::star::beans::XFastPropertySet
virtual void SAL_CALL setFastPropertyValue(sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue) throw(
::com::sun::star::uno::RuntimeException,
::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::beans::PropertyVetoException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::lang::WrappedTargetException);
virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle) throw(
::com::sun::star::uno::RuntimeException,
::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::lang::WrappedTargetException);
// ::com::sun::star::beans::XPropertyAccess
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getPropertyValues() throw( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps ) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
// ::com::sun::star::beans::XPropertyContainer
virtual void SAL_CALL addProperty( const ::rtl::OUString& Name, ::sal_Int16 Attributes, const ::com::sun::star::uno::Any& DefaultValue ) throw (::com::sun::star::beans::PropertyExistException, ::com::sun::star::beans::IllegalTypeException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeProperty( const ::rtl::OUString& Name ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::NotRemoveableException, ::com::sun::star::uno::RuntimeException);
// ::com::sun::star::document::XDocumentInfo
virtual sal_Int16 SAL_CALL getUserFieldCount() throw( ::com::sun::star::uno::RuntimeException );
virtual ::rtl::OUString SAL_CALL getUserFieldName(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException );
virtual ::rtl::OUString SAL_CALL getUserFieldValue(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL setUserFieldName(sal_Int16 nIndex, const ::rtl::OUString& aName ) throw( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL setUserFieldValue(sal_Int16 nIndex, const ::rtl::OUString& aValue ) throw( ::com::sun::star::uno::RuntimeException );
// ::com::sun::star::document::XDocumentPropertiesSupplier
virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties >
SAL_CALL getDocumentProperties()
throw (::com::sun::star::uno::RuntimeException);
// ::com::sun::star::util::XModifiable
virtual sal_Bool SAL_CALL isModified() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setModified( sal_Bool bModified ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
// ::com::sun::star::util::XModifyBroadcaster
virtual void SAL_CALL addModifyListener( const com::sun::star::uno::Reference< com::sun::star::util::XModifyListener >& xListener ) throw( ::com::sun::star::uno::RuntimeException ) ;
virtual void SAL_CALL removeModifyListener( const com::sun::star::uno::Reference< com::sun::star::util::XModifyListener > & xListener) throw( ::com::sun::star::uno::RuntimeException ) ;
// ::com::sun::star::lang::XInitialization:
virtual void SAL_CALL initialize(
const com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > & aArguments)
throw (com::sun::star::uno::RuntimeException,
com::sun::star::uno::Exception);
// ::com::sun::star::util::XCloneable:
virtual com::sun::star::uno::Reference<com::sun::star::util::XCloneable> SAL_CALL createClone()
throw (com::sun::star::uno::RuntimeException);
const SfxDocumentInfoObject& operator=( const SfxDocumentInfoObject & rOther);
};
class SAL_DLLPRIVATE SfxStandaloneDocumentInfoObject: public SfxDocumentInfoObject,
public ::com::sun::star::lang::XServiceInfo,
public ::com::sun::star::document::XStandaloneDocumentInfo
{
::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > _xFactory;
public:
SfxStandaloneDocumentInfoObject( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
virtual ~SfxStandaloneDocumentInfoObject();
void Clear();
// XInterface, XTypeProvider, XServiceInfo
SFX_DECL_XINTERFACE_XTYPEPROVIDER_XSERVICEINFO
// ::com::sun::star::document::XDocumentInfo
virtual sal_Int16 SAL_CALL getUserFieldCount() throw( ::com::sun::star::uno::RuntimeException );
virtual ::rtl::OUString SAL_CALL getUserFieldName(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException );
virtual ::rtl::OUString SAL_CALL getUserFieldValue(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL setUserFieldName(sal_Int16 nIndex, const ::rtl::OUString& aName ) throw( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL setUserFieldValue(sal_Int16 nIndex, const ::rtl::OUString& aValue ) throw( ::com::sun::star::uno::RuntimeException );
// ::com::sun::star::document::XStandaloneDocumentInfo
virtual void SAL_CALL loadFromURL(const ::rtl::OUString& aURL) throw( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL storeIntoURL(const ::rtl::OUString& aURL) throw( ::com::sun::star::io::IOException );
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx
index 49e4dcae..486426a 100644
--- a/sfx2/inc/sfx2/sfxbasemodel.hxx
+++ b/sfx2/inc/sfx2/sfxbasemodel.hxx
@@ -33,8 +33,6 @@
#include <com/sun/star/container/XNameReplace.hpp>
#include <com/sun/star/frame/XController2.hpp>
#include <com/sun/star/document/XCmisDocument.hpp>
#include <com/sun/star/document/XDocumentInfo.hpp>
#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <com/sun/star/document/XDocumentRecovery.hpp>
#include <com/sun/star/document/XUndoManagerSupplier.hpp>
@@ -88,9 +86,9 @@
#include <com/sun/star/task/XInteractionHandler.hpp>
//________________________________________________________________________________________________________
#ifndef INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_33
#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_33
#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 33
#ifndef INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_32
#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_32
#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 32
#include <comphelper/implbase_var.hxx>
#endif
@@ -123,8 +121,6 @@
#define XNAMEREPLACE ::com::sun::star::container::XNameReplace
#define DOCEVENTOBJECT ::com::sun::star::document::EventObject
#define XDOCEVENTLISTENER ::com::sun::star::document::XEventListener
#define XDOCUMENTINFO ::com::sun::star::document::XDocumentInfo
#define XDOCUMENTINFOSUPPLIER ::com::sun::star::document::XDocumentInfoSupplier
#define XEVENTBROADCASTER ::com::sun::star::document::XEventBroadcaster
#define XDOCUMENTEVENTBROADCASTER ::com::sun::star::document::XDocumentEventBroadcaster
#define XEVENTSSUPPLIER ::com::sun::star::document::XEventsSupplier
@@ -191,7 +187,6 @@ namespace sfx { namespace intern {
@implements XChild
XComponent
XDocumentInfoSupplier
document::XDocumentPropertiesSupplier
rdf::XDocumentMetadataAccess
XEventListener
@@ -210,8 +205,7 @@ namespace sfx { namespace intern {
SfxListener
*/
typedef ::comphelper::WeakImplHelper33 < XCHILD
, XDOCUMENTINFOSUPPLIER
typedef ::comphelper::WeakImplHelper32 < XCHILD
, ::com::sun::star::document::XDocumentPropertiesSupplier
, ::com::sun::star::document::XCmisDocument
, ::com::sun::star::rdf::XDocumentMetadataAccess
@@ -492,25 +486,6 @@ public:
virtual void SAL_CALL removeEventListener(const REFERENCE< XEVENTLISTENER >& aListener ) throw (::com::sun::star::uno::RuntimeException);
//____________________________________________________________________________________________________
// XDocumentInfoSupplier
//____________________________________________________________________________________________________
/**___________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual REFERENCE< XDOCUMENTINFO > SAL_CALL getDocumentInfo() throw (::com::sun::star::uno::RuntimeException);
// XDocumentPropertiesSupplier
virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties >
SAL_CALL getDocumentProperties()
diff --git a/sfx2/qa/complex/sfx2/DocumentInfo.java b/sfx2/qa/complex/sfx2/DocumentInfo.java
deleted file mode 100644
index 1532a3c..0000000
--- a/sfx2/qa/complex/sfx2/DocumentInfo.java
+++ /dev/null
@@ -1,338 +0,0 @@
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package complex.sfx2;
import com.sun.star.beans.PropertyAttribute;
import com.sun.star.beans.Property;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertyContainer;
import com.sun.star.beans.XPropertySet;
import com.sun.star.beans.XPropertySetInfo;
import com.sun.star.document.XDocumentInfo;
import com.sun.star.document.XDocumentInfoSupplier;
import com.sun.star.frame.XComponentLoader;
import com.sun.star.frame.XStorable;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.text.XTextDocument;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.util.Date;
import util.DesktopTools;
import util.WriterTools;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openoffice.test.OfficeConnection;
import static org.junit.Assert.*;
public class DocumentInfo
{
XMultiServiceFactory m_xMSF = null;
XTextDocument xTextDoc = null;
XTextDocument xTextDocSecond = null;
@Test public void checkDocInfo() throws Exception
{
m_xMSF = getMSF();
System.out.println("check whether there is a valid MultiServiceFactory");
assertNotNull("## Couldn't get MultiServiceFactory make sure your Office is started", m_xMSF);
String tempdir = util.utils.getOfficeTemp/*Dir*/(m_xMSF);
String fs = System.getProperty("file.separator");
if (!tempdir.endsWith(fs))
{
tempdir += fs;
}
tempdir = util.utils.getFullURL(tempdir);
final String sTempDocument = tempdir + "DocInfo.oot";
if (true)
{
System.out.println("... done");
System.out.println("Opening a Writer document");
xTextDoc = WriterTools.createTextDoc(m_xMSF);
System.out.println("... done");
XDocumentInfoSupplier xDocInfoSup = UnoRuntime.queryInterface(XDocumentInfoSupplier.class, xTextDoc);
XDocumentInfo xDocInfo = xDocInfoSup.getDocumentInfo();
XPropertyContainer xPropContainer = UnoRuntime.queryInterface(XPropertyContainer.class, xDocInfo);
System.out.println("Trying to add a existing property");
boolean worked = addProperty(xPropContainer, "Author", (short) 0, "");
assertTrue("Could set an existing property", !worked);
System.out.println("...done");
System.out.println("Trying to add a integer property");
worked = addProperty(xPropContainer, "intValue", com.sun.star.beans.PropertyAttribute.READONLY, new Integer(17));
assertTrue("Couldn't set an integer property", worked);
System.out.println("...done");
System.out.println("Trying to add a double property");
worked = addProperty(xPropContainer, "doubleValue", com.sun.star.beans.PropertyAttribute.REMOVEABLE, new Double(17.7));
assertTrue("Couldn't set an double property", worked);
System.out.println("...done");
System.out.println("Trying to add a boolean property");
worked = addProperty(xPropContainer, "booleanValue", com.sun.star.beans.PropertyAttribute.REMOVEABLE, Boolean.TRUE);
assertTrue("Couldn't set an boolean property", worked);
System.out.println("...done");
System.out.println("Trying to add a date property");
worked = addProperty(xPropContainer, "dateValue", com.sun.star.beans.PropertyAttribute.REMOVEABLE, new Date());
assertTrue("Couldn't set an date property", worked);
System.out.println("...done");
System.out.println("trying to remove a read only Property");
try
{
xPropContainer.removeProperty("intValue");
fail("Could remove read only property");
}
catch (Exception e)
{
System.out.println("\tException was thrown " + e);
System.out.println("\t...OK");
}
System.out.println("...done");
XPropertySet xProps2 = UnoRuntime.queryInterface(XPropertySet.class, xPropContainer);
showPropertySet(xProps2);
System.out.println("Storing the document");
XStorable store = UnoRuntime.queryInterface(XStorable.class, xTextDoc);
store.storeToURL(sTempDocument, new PropertyValue[] {});
DesktopTools.closeDoc(xTextDoc);
System.out.println("...done");
}
if (true)
{
System.out.println("loading the document");
XComponentLoader xCL = UnoRuntime.queryInterface(XComponentLoader.class, m_xMSF.createInstance("com.sun.star.frame.Desktop"));
XComponent xComp = xCL.loadComponentFromURL(sTempDocument, "_blank", 0, new PropertyValue[] {});
xTextDocSecond = UnoRuntime.queryInterface(XTextDocument.class, xComp);
System.out.println("...done");
XDocumentInfoSupplier xDocInfoSup = UnoRuntime.queryInterface(XDocumentInfoSupplier.class, xTextDocSecond);
XDocumentInfo xDocInfo = xDocInfoSup.getDocumentInfo();
XPropertyContainer xPropContainer = UnoRuntime.queryInterface(XPropertyContainer.class, xDocInfo);
XPropertySet xProps = UnoRuntime.queryInterface(XPropertySet.class, xDocInfo);
showPropertySet(xProps);
assertTrue("Double doesn't work", checkType(xProps, "doubleValue", "java.lang.Double"));
assertTrue("Boolean doesn't work", checkType(xProps, "booleanValue", "java.lang.Boolean"));
// TODO: dateValue does not exist.
// assertTrue("Date doesn't work", checkType(xProps, "dateValue", "com.sun.star.util.DateTime"));
// TODO: is java.lang.Double
// assertTrue("Integer doesn't work", checkType(xProps, "intValue", "java.lang.Integer"));
xPropContainer = UnoRuntime.queryInterface(XPropertyContainer.class, xDocInfo);
System.out.println("trying to remove a not user defined Property");
try
{
xPropContainer.removeProperty("Author");
fail("Could remove non user defined property");
}
catch (Exception e)
{
System.out.println("\tException was thrown " + e);
System.out.println("\t...OK");
}
System.out.println("...done");
System.out.println("Trying to remove a user defined property");
try
{
xPropContainer.removeProperty("booleanValue");
System.out.println("\t...OK");
}
catch (Exception e)
{
System.out.println("\tException was thrown " + e);
System.out.println("\t...FAILED");
fail("Could not remove user defined property");
}
showPropertySet(xProps);
System.out.println("...done");
}
}
@After public void cleanup()
{
DesktopTools.closeDoc(xTextDocSecond);
DesktopTools.closeDoc(xTextDoc);
}
private void showPropertySet(XPropertySet xProps)
{
try
{
// get an XPropertySet, here the one of a text cursor
// XPropertySet xCursorProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, mxDocCursor);
// get the property info interface of this XPropertySet
XPropertySetInfo xPropsInfo = xProps.getPropertySetInfo();
// get all properties (NOT the values) from XPropertySetInfo
Property[] aProps = xPropsInfo.getProperties();
int i;
for (i = 0; i < aProps.length; ++i) {
// number of property within this info object
System.out.print("Property #" + i);
// name of property
System.out.print(": Name<" + aProps[i].Name);
// handle of property (only for XFastPropertySet)
System.out.print("> Handle<" + aProps[i].Handle);
// type of property
System.out.print("> " + aProps[i].Type.toString());
// attributes (flags)
System.out.print(" Attributes<");
short nAttribs = aProps[i].Attributes;
if ((nAttribs & PropertyAttribute.MAYBEVOID) != 0)
System.out.print("MAYBEVOID|");
if ((nAttribs & PropertyAttribute.BOUND) != 0)
System.out.print("BOUND|");
if ((nAttribs & PropertyAttribute.CONSTRAINED) != 0)
System.out.print("CONSTRAINED|");
if ((nAttribs & PropertyAttribute.READONLY) != 0)
System.out.print("READONLY|");
if ((nAttribs & PropertyAttribute.TRANSIENT) != 0)
System.out.print("TRANSIENT|");
if ((nAttribs & PropertyAttribute.MAYBEAMBIGUOUS ) != 0)
System.out.print("MAYBEAMBIGUOUS|");
if ((nAttribs & PropertyAttribute.MAYBEDEFAULT) != 0)
System.out.print("MAYBEDEFAULT|");
if ((nAttribs & PropertyAttribute.REMOVEABLE) != 0)
System.out.print("REMOVEABLE|");
System.out.println("0>");
}
} catch (Exception e) {
// If anything goes wrong, give the user a stack trace
e.printStackTrace(System.err);
}
}
private boolean checkType(XPropertySet xProps, String aName,
String expected)
{
boolean ret = true;
System.out.println("Checking " + expected);
String getting =
getPropertyByName(xProps, aName).getClass().getName();
if (!getting.equals(expected))
{
System.out.println("\t Expected: " + expected);
System.out.println("\t Getting: " + getting);
ret = false;
}
if (ret)
{
System.out.println("...OK");
}
return ret;
}
private Object getPropertyByName(XPropertySet xProps, String aName)
{
Object ret = null;
try
{
ret = xProps.getPropertyValue(aName);
}
catch (Exception e)
{
System.out.println("\tCouldn't get Property " + aName);
System.out.println("\tMessage " + e);
}
return ret;
}
private boolean addProperty(XPropertyContainer xPropContainer,
String aName, short attr, Object defaults)
{
boolean ret = true;
try
{
xPropContainer.addProperty(aName, attr, defaults);
}
catch (Exception e)
{
ret = false;
System.out.println("\tCouldn't get Property " + aName);
System.out.println("\tMessage " + e);
}
return ret;
}
private XMultiServiceFactory getMSF()
{
final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
return xMSF1;
}
// setup and close connections
@BeforeClass public static void setUpConnection() throws Exception
{
System.out.println( "------------------------------------------------------------" );
System.out.println( "starting class: " + DocumentInfo.class.getName() );
System.out.println( "------------------------------------------------------------" );
connection.setUp();
}
@AfterClass public static void tearDownConnection()
throws InterruptedException, com.sun.star.uno.Exception
{
System.out.println( "------------------------------------------------------------" );
System.out.println( "finishing class: " + DocumentInfo.class.getName() );
System.out.println( "------------------------------------------------------------" );
connection.tearDown();
}
private static final OfficeConnection connection = new OfficeConnection();
}
diff --git a/sfx2/qa/complex/sfx2/StandaloneDocumentInfo.java b/sfx2/qa/complex/sfx2/StandaloneDocumentInfo.java
deleted file mode 100644
index f7d9f67..0000000
--- a/sfx2/qa/complex/sfx2/StandaloneDocumentInfo.java
+++ /dev/null
@@ -1,90 +0,0 @@
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package complex.sfx2;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.UnoRuntime;
import complex.sfx2.standalonedocinfo.StandaloneDocumentInfoTest;
import complex.sfx2.standalonedocinfo.Test01;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openoffice.test.OfficeConnection;
import static org.junit.Assert.*;
/* Document here
*/
public class StandaloneDocumentInfo {
private XMultiServiceFactory m_xMSF = null;
@Before public void before() {
try {
m_xMSF = getMSF();
} catch(Exception e) {
fail( "Failed to create service factory!" );
}
if( m_xMSF ==null ) {
fail( "Failed to create service factory!" );
}
}
@After public void after() {
m_xMSF = null;
}
@Test public void ExecuteTest01() {
StandaloneDocumentInfoTest aTest = new Test01 (m_xMSF);
assertTrue( "Test01 failed!", aTest.test() );
}
private XMultiServiceFactory getMSF()
{
final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
return xMSF1;
}
// setup and close connections
@BeforeClass public static void setUpConnection() throws Exception
{
System.out.println( "------------------------------------------------------------" );
System.out.println( "starting class: " + StandaloneDocumentInfo.class.getName() );
System.out.println( "------------------------------------------------------------" );
connection.setUp();
}
@AfterClass public static void tearDownConnection()
throws InterruptedException, com.sun.star.uno.Exception
{
System.out.println( "------------------------------------------------------------" );
System.out.println( "finishing class: " + StandaloneDocumentInfo.class.getName() );
System.out.println( "------------------------------------------------------------" );
connection.tearDown();
}
private static final OfficeConnection connection = new OfficeConnection();
}
diff --git a/sfx2/qa/complex/sfx2/standalonedocinfo/StandaloneDocumentInfoTest.java b/sfx2/qa/complex/sfx2/standalonedocinfo/StandaloneDocumentInfoTest.java
deleted file mode 100644
index 83ba5bd..0000000
--- a/sfx2/qa/complex/sfx2/standalonedocinfo/StandaloneDocumentInfoTest.java
+++ /dev/null
@@ -1,22 +0,0 @@
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package complex.sfx2.standalonedocinfo;
public interface StandaloneDocumentInfoTest {
boolean test();
}
diff --git a/sfx2/qa/complex/sfx2/standalonedocinfo/Test01.java b/sfx2/qa/complex/sfx2/standalonedocinfo/Test01.java
deleted file mode 100644
index 66daa4f..0000000
--- a/sfx2/qa/complex/sfx2/standalonedocinfo/Test01.java
+++ /dev/null
@@ -1,135 +0,0 @@
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package complex.sfx2.standalonedocinfo;
import complex.sfx2.standalonedocinfo.TestHelper;
import complex.sfx2.standalonedocinfo.StandaloneDocumentInfoTest;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.document.XStandaloneDocumentInfo;
import com.sun.star.io.XTempFile;
import com.sun.star.frame.XLoadable;
import com.sun.star.frame.XStorable;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertySet;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.AnyConverter;
public class Test01 implements StandaloneDocumentInfoTest {
XMultiServiceFactory m_xMSF = null;
TestHelper m_aTestHelper = null;
public Test01 ( XMultiServiceFactory xMSF ) {
m_xMSF = xMSF;
m_aTestHelper = new TestHelper( "Test01: " );
}
public boolean test() {
try {
final String sDocTitle [] = new String [] {
"ODF_Doc", "OOo6_Doc", "old_binary_Doc" };
final String sFilterName [] = new String [] {
"writer8", "StarOffice XML (Writer)", "StarWriter 5.0" };
for (int i = 0; i < 3; ++i ) {
m_aTestHelper.Message ( "==============================" );
m_aTestHelper.Message ( sFilterName[i] );
m_aTestHelper.Message ( "==============================" );
//create a new temporary file
Object oTempFile = m_xMSF.createInstance ( "com.sun.star.io.TempFile" );
XTempFile xTempFile = UnoRuntime.queryInterface(XTempFile.class, oTempFile);
//create a text document and initiallize it
Object oTextDocument = m_xMSF.createInstance ( "com.sun.star.text.TextDocument" );
XLoadable xLoadable = UnoRuntime.queryInterface(XLoadable.class, oTextDocument);
xLoadable.initNew();
m_aTestHelper.Message ( "New document initialized." );
//store the instance to the temporary file URL
XStorable xStorable = UnoRuntime.queryInterface(XStorable.class, oTextDocument);
String sURL = AnyConverter.toString ( xTempFile.getUri () );
PropertyValue aProps[] = new PropertyValue[2];
aProps[0] = new PropertyValue();
aProps[0].Name = "DocumentTitle";
aProps[0].Value = sDocTitle[i];
aProps[1] = new PropertyValue();
aProps[1].Name = "FilterName";
aProps[1].Value = sFilterName[i];
m_aTestHelper.Message ( "Set title: " +
sDocTitle[i] );
xStorable.storeToURL ( sURL, aProps );
m_aTestHelper.Message ( "Document stored." );
//create StandaloneDocumentInfo object and load it from the file
Object oStandaloneDocInfo = m_xMSF.createInstance (
"com.sun.star.document.StandaloneDocumentInfo" );
XStandaloneDocumentInfo xStandaloneDocInfo =
UnoRuntime.queryInterface(XStandaloneDocumentInfo.class, oStandaloneDocInfo);
xStandaloneDocInfo.loadFromURL ( sURL );
m_aTestHelper.Message ( "StandaloneDocumentInfo loaded." );
//get the title from the object and check it
XPropertySet xPropSet =
UnoRuntime.queryInterface(XPropertySet.class, oStandaloneDocInfo);
String sTitle = xPropSet.getPropertyValue ( "Title" ).toString ();
m_aTestHelper.Message ( "Get title: " + sTitle );
if ( sTitle.compareTo ( sDocTitle[i] ) != 0 ) {
m_aTestHelper.Error ( "Title not match. Expected \""
+ sDocTitle[i] +
"\"" );
return false;
} else {
m_aTestHelper.Message ( "Title matched." );
}
//set a new title to the object
sTitle += "_new";
xPropSet.setPropertyValue ( "Title", sTitle );
m_aTestHelper.Message ( "Set new title: " + sTitle );
//store the object to the same file
xStandaloneDocInfo.storeIntoURL ( sURL );
m_aTestHelper.Message ( "Document info stored." );
//create a new StandaloneDocumentInfo object and load it from the file
Object oStandaloneDocInfo_ = m_xMSF.createInstance (
"com.sun.star.document.StandaloneDocumentInfo" );
XStandaloneDocumentInfo xStandaloneDocInfo_ =
UnoRuntime.queryInterface(XStandaloneDocumentInfo.class, oStandaloneDocInfo_);
xStandaloneDocInfo_.loadFromURL ( sURL );
m_aTestHelper.Message ( "New StandaloneDocumentInfo loaded." );
//get the title and check it
XPropertySet xPropSet_ = UnoRuntime.queryInterface(XPropertySet.class, oStandaloneDocInfo_);
String sTitle_ = xPropSet_.getPropertyValue ( "Title" ).toString ();
m_aTestHelper.Message ( "Get new title: " + sTitle_ );
if ( sTitle_.compareTo ( sTitle ) != 0 ) {
m_aTestHelper.Error ( "New title not matched. Expected: \"" + sTitle
+ "\"." );
return false;
} else {
m_aTestHelper.Message ( "New title matched." );
}
}
} catch ( Exception e ) {
m_aTestHelper.Error( "Exception: " + e );
return false;
}
return true;
}
}
diff --git a/sfx2/qa/complex/sfx2/standalonedocinfo/TestHelper.java b/sfx2/qa/complex/sfx2/standalonedocinfo/TestHelper.java
deleted file mode 100644
index 18e5d54..0000000
--- a/sfx2/qa/complex/sfx2/standalonedocinfo/TestHelper.java
+++ /dev/null
@@ -1,39 +0,0 @@
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package complex.sfx2.standalonedocinfo;
public class TestHelper {
String m_sTestPrefix;
/** Creates a new instance of TestHelper
* @param sTestPrefix
*/
public TestHelper ( String sTestPrefix ) {
m_sTestPrefix = sTestPrefix;
}
public void Error ( String sError ) {
System.out.println ( m_sTestPrefix + "Error: " + sError );
}
public void Message ( String sMessage ) {
System.out.println ( m_sTestPrefix + sMessage );
}
}
diff --git a/sfx2/qa/unoapi/sfx.sce b/sfx2/qa/unoapi/sfx.sce
index ce72c46..d75b95b 100644
--- a/sfx2/qa/unoapi/sfx.sce
+++ b/sfx2/qa/unoapi/sfx.sce
@@ -2,4 +2,3 @@
#i113306 -o sfx.DocumentTemplates
-o sfx.FrameLoader
-o sfx.SfxMacroLoader
#i111283 -o sfx.StandaloneDocumentInfo
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index ffb4853e..0138f41 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -105,7 +105,6 @@ using namespace ::com::sun::star::io;
#include "frmload.hxx"
#include <sfx2/frame.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/objuno.hxx>
#include <sfx2/unoctitm.hxx>
#include <sfx2/dispatch.hxx>
#include "doctemplates.hxx"
@@ -2218,7 +2217,6 @@ SFX2_DLLPUBLIC void* SAL_CALL sfx_component_getFactory(
IF_NAME_CREATECOMPONENTFACTORY( SfxGlobalEvents_Impl )
IF_NAME_CREATECOMPONENTFACTORY( SfxFrameLoader_Impl )
IF_NAME_CREATECOMPONENTFACTORY( SfxMacroLoader )
IF_NAME_CREATECOMPONENTFACTORY( SfxStandaloneDocumentInfoObject )
IF_NAME_CREATECOMPONENTFACTORY( SfxAppDispatchProvider )
IF_NAME_CREATECOMPONENTFACTORY( SfxDocTplService )
IF_NAME_CREATECOMPONENTFACTORY( ShutdownIcon )
diff --git a/sfx2/source/doc/objuno.cxx b/sfx2/source/doc/objuno.cxx
deleted file mode 100644
index 336affb..0000000
--- a/sfx2/source/doc/objuno.cxx
+++ /dev/null
@@ -1,1351 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/util/Date.hpp>
#include <com/sun/star/util/Time.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/beans/StringPair.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/xml/sax/XParser.hpp>
#include <com/sun/star/document/XImporter.hpp>
#include <com/sun/star/document/XExporter.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/util/XModifiable.hpp>
#include <com/sun/star/document/DocumentProperties.hpp>
#include <com/sun/star/document/XCompatWriterDocProperties.hpp>
#include <unotools/configmgr.hxx>
#include <unotools/bootstrap.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <osl/mutex.hxx>
#include <rtl/ustrbuf.hxx>
#include <vcl/svapp.hxx>
#include <tools/errcode.hxx>
#include <svl/cntwids.hrc>
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include <comphelper/sequenceasvector.hxx>
#include <comphelper/storagehelper.hxx>
#include <sot/storage.hxx>
#include <sfx2/objuno.hxx>
#include <sfx2/sfx.hrc>
#include <vector>
#include <algorithm>
#include "sfx2/sfxresid.hxx"
#include "doc.hrc"
using namespace ::com::sun::star;
// TODO/REFACTOR: provide service for MS formats
// TODO/REFACTOR: IsEncrypted is never set nor read
// Generator is not saved ATM; which value?!
// Generator handling must be implemented
// Deprecate "Theme", rework IDL
// AutoLoadEnabled is deprecated?!
// Reasonable defaults for DateTime
// MIMEType readonly?!
// Announce changes about Theme, Language, Generator, removed entries etc.
// IsEncrypted is necessary for binary formats!
// Open: When to call PrepareDocInfoForSave? Currently only called for own formats and HTML/Writer
// Open: How to load and save EditingTime to MS formats
// PPT-Export should use SavePropertySet
//=============================================================================
// The number of user defined fields handled by the evil XDocumentInfo
// interface. There are exactly 4. No more, no less.
#define FOUR 4
#define PROPERTY_UNBOUND 0
#define PROPERTY_MAYBEVOID ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
static const SfxItemPropertyMapEntry* lcl_GetDocInfoPropertyMap()
{
static SfxItemPropertyMapEntry aDocInfoPropertyMap_Impl[] =
{
{ "Author" , 6 , WID_FROM, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
{ "AutoloadEnabled" , 15, MID_DOCINFO_AUTOLOADENABLED, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 },
{ "AutoloadSecs" , 12, MID_DOCINFO_AUTOLOADSECS, &::getCppuType((const sal_Int32*)0), PROPERTY_UNBOUND, 0 },
{ "AutoloadURL" , 11, MID_DOCINFO_AUTOLOADURL, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
{ "Category" , 8 , MID_CATEGORY, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
{ "Company" , 7 , MID_COMPANY, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
{ "Manager" , 7 , MID_MANAGER, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
{ "CreationDate" , 12, WID_DATE_CREATED, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 },
{ "DefaultTarget" , 13, MID_DOCINFO_DEFAULTTARGET, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
{ "Description" , 11, MID_DOCINFO_DESCRIPTION, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
{ "DocumentStatistic", 17 , MID_DOCINFO_STATISTIC, &::getCppuType((const uno::Sequence< beans::NamedValue >*)0), PROPERTY_UNBOUND, 0 },
{ "EditingCycles" , 13, MID_DOCINFO_REVISION, &::getCppuType((const sal_Int16*)0), PROPERTY_UNBOUND, 0 },
{ "EditingDuration" , 15, MID_DOCINFO_EDITTIME, &::getCppuType((const sal_Int32*)0), PROPERTY_UNBOUND, 0 },
{ "Generator" , 9, SID_APPLICATION, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
{ "Keywords" , 8 , WID_KEYWORDS, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
{ "Language" , 8, MID_DOCINFO_CHARLOCALE, &::getCppuType((const lang::Locale*)0), PROPERTY_UNBOUND, 0 },
{ "MIMEType" , 8 , WID_CONTENT_TYPE, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND | ::com::sun::star::beans::PropertyAttribute::READONLY, 0 },
{ "ModifiedBy" , 10, MID_DOCINFO_MODIFICATIONAUTHOR, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
{ "ModifyDate" , 10, WID_DATE_MODIFIED, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 },
{ "PrintDate" , 9 , MID_DOCINFO_PRINTDATE, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 },
{ "PrintedBy" , 9 , MID_DOCINFO_PRINTEDBY, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
{ "Subject" , 7 , MID_DOCINFO_SUBJECT, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
{ "Template" , 8 , MID_DOCINFO_TEMPLATE, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
{ "TemplateFileName", 16, SID_TEMPLATE_NAME, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
{ "TemplateDate" , 12, MID_DOCINFO_TEMPLATEDATE, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 },
{ "Title" , 5 , WID_TITLE, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
{0,0,0,0,0,0}
};
return aDocInfoPropertyMap_Impl;
}
static sal_uInt16 aDaysInMonth[12] = { 31, 28, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31 };
inline sal_uInt16 DaysInMonth( sal_uInt16 nMonth, sal_uInt16 nYear )
{
if ( nMonth != 2 )
return aDaysInMonth[nMonth-1];
else
{
if ( (((nYear % 4) == 0) && ((nYear % 100) != 0)) ||
((nYear % 400) == 0) )
return aDaysInMonth[nMonth-1] + 1;
else
return aDaysInMonth[nMonth-1];
}
}
bool IsValidDateTime( const util::DateTime& rDT )
{
if ( !rDT.Month || (rDT.Month > 12) )
return false;
if ( !rDT.Day || (rDT.Day > DaysInMonth( rDT.Month, rDT.Year )) )
return false;
else if ( rDT.Year <= 1582 )
{
if ( rDT.Year < 1582 )
return false;
else if ( rDT.Month < 10 )
return false;
else if ( (rDT.Month == 10) && (rDT.Day < 15) )
return false;
}
return true;
}
struct OUStringHashCode
{
size_t operator()( const ::rtl::OUString& sString ) const
{
return sString.hashCode();
}
};
struct SfxExtendedItemPropertyMap : public SfxItemPropertyMapEntry
{
::com::sun::star::uno::Any aValue;
};
void Copy( const uno::Reference < document::XStandaloneDocumentInfo >& rSource, const uno::Reference < document::XStandaloneDocumentInfo >& rTarget )
{
try
{
uno::Reference< beans::XPropertySet > xSet( rSource, uno::UNO_QUERY );
uno::Reference< beans::XPropertySet > xTarget( rTarget, uno::UNO_QUERY );
uno::Reference< beans::XPropertySetInfo > xSetInfo = xSet->getPropertySetInfo();
uno::Reference< beans::XPropertyContainer > xContainer( rTarget, uno::UNO_QUERY );
uno::Sequence< beans::Property > lProps = xSetInfo->getProperties();
const beans::Property* pProps = lProps.getConstArray();
sal_Int32 c = lProps.getLength();
sal_Int32 i = 0;
for (i=0; i<c; ++i)
{
uno::Any aValue = xSet->getPropertyValue( pProps[i].Name );
if ( pProps[i].Attributes & ::com::sun::star::beans::PropertyAttribute::REMOVABLE )
// QUESTION: DefaultValue?!
xContainer->addProperty( pProps[i].Name, pProps[i].Attributes, aValue );
try
{
// it is possible that the propertysets from XML and binary files differ; we shouldn't break then
xTarget->setPropertyValue( pProps[i].Name, aValue );
}
catch ( const uno::Exception& ) {}
}
sal_Int16 nCount = rSource->getUserFieldCount();
sal_Int16 nSupportedCount = rTarget->getUserFieldCount();
for ( sal_Int16 nInd = 0; nInd < nCount && nInd < nSupportedCount; nInd++ )
{
::rtl::OUString aPropName = rSource->getUserFieldName( nInd );
rTarget->setUserFieldName( nInd, aPropName );
::rtl::OUString aPropVal = rSource->getUserFieldValue( nInd );
rTarget->setUserFieldValue( nInd, aPropVal );
}
}
catch ( const uno::Exception& ) {}
}
class MixedPropertySetInfo : public ::cppu::WeakImplHelper1< ::com::sun::star::beans::XPropertySetInfo >
{
private:
SfxItemPropertyMap _aPropertyMap;
::rtl::OUString* _pUserKeys;
uno::Reference<beans::XPropertySet> _xUDProps;
public:
MixedPropertySetInfo( const SfxItemPropertyMapEntry* pFixProps,
::rtl::OUString* pUserKeys,
uno::Reference<beans::XPropertySet> xUDProps);
virtual ~MixedPropertySetInfo();
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties( ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName( const ::rtl::OUString& aName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL hasPropertyByName( const ::rtl::OUString& Name ) throw (::com::sun::star::uno::RuntimeException);
};
//-----------------------------------------------------------------------------
MixedPropertySetInfo::MixedPropertySetInfo(const SfxItemPropertyMapEntry* pFixProps,
::rtl::OUString* pUserKeys,
uno::Reference<beans::XPropertySet> xUDProps)
: _aPropertyMap( pFixProps )
, _pUserKeys(pUserKeys)
, _xUDProps(xUDProps)
{
}
//-----------------------------------------------------------------------------
MixedPropertySetInfo::~MixedPropertySetInfo()
{
}
//-----------------------------------------------------------------------------
::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL MixedPropertySetInfo::getProperties()
throw(::com::sun::star::uno::RuntimeException)
{
::comphelper::SequenceAsVector< ::com::sun::star::beans::Property > lProps;
// copy "fix" props
//todo: os: this ugly thing should be replaced
const SfxItemPropertyMapEntry* pFixProp = lcl_GetDocInfoPropertyMap();
while(pFixProp && pFixProp->pName)
{
::com::sun::star::beans::Property aProp;
aProp.Name = ::rtl::OUString::createFromAscii(pFixProp->pName);
aProp.Handle = pFixProp->nWID;
aProp.Type = *(pFixProp->pType);
aProp.Attributes = (sal_Int16)(pFixProp->nFlags);
lProps.push_back(aProp);
++pFixProp;
}
// copy "dynamic" props
// NB: this is really ugly:
// The returned properties must _not_ include the 4 user-defined fields!
// These are _not_ properties of the XDocumentInfo interface.
// Some things rely on this, e.g. Copy would break otherwise.
// This will have interesting consequences if someone expects to insert
// a property with the same name as an user-defined key, but nobody
// sane does that.
uno::Sequence<beans::Property> udProps =
_xUDProps->getPropertySetInfo()->getProperties();
for (sal_Int32 i = 0; i < udProps.getLength(); ++i) {
if (std::find(_pUserKeys, _pUserKeys+FOUR, udProps[i].Name)
== _pUserKeys+FOUR) {
// #i100027#: handles from udProps are not valid here
udProps[i].Handle = -1;
lProps.push_back(udProps[i]);
}
}
return lProps.getAsConstList();
}
//-----------------------------------------------------------------------------
::com::sun::star::beans::Property SAL_CALL MixedPropertySetInfo::getPropertyByName(
const ::rtl::OUString& sName )
throw(::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::uno::RuntimeException )
{
::com::sun::star::beans::Property aProp;
// search it as "fix" prop
if( _aPropertyMap.hasPropertyByName( sName ) )
return _aPropertyMap.getPropertyByName( sName );
else
// search it as "dynamic" prop
return _xUDProps->getPropertySetInfo()->getPropertyByName(sName);
}
//-----------------------------------------------------------------------------
::sal_Bool SAL_CALL MixedPropertySetInfo::hasPropertyByName(const ::rtl::OUString& sName)
throw(::com::sun::star::uno::RuntimeException)
{
return _aPropertyMap.hasPropertyByName( sName ) ? // "fix" prop?
sal_True :
_xUDProps->getPropertySetInfo()->hasPropertyByName(sName); // "dynamic" prop?
}
//-----------------------------------------------------------------------------
struct SfxDocumentInfoObject_Impl
{
::osl::Mutex _aMutex;
::cppu::OInterfaceContainerHelper _aDisposeContainer;
sal_Bool bDisposed;
// this contains the names of the 4 user defined properties
// which are accessible via the evil XDocumentInfo interface
::rtl::OUString m_UserDefined[FOUR];
// the actual contents
uno::Reference<document::XDocumentProperties> m_xDocProps;
SfxItemPropertyMap m_aPropertyMap;
SfxDocumentInfoObject_Impl()
: _aDisposeContainer( _aMutex )
, bDisposed(sal_False)
, m_xDocProps()
, m_aPropertyMap( lcl_GetDocInfoPropertyMap() )
{
// the number of user fields is not changeable from the outside
// we can't set it too high because every name/value pair will be written to the file (even if empty)
// currently our dialog has only 4 user keys so 4 is still a reasonable number
}
/// the initialization function
void Reset(uno::Reference<document::XDocumentProperties> xDocProps, ::rtl::OUString* pUserDefined = 0);
};
void SfxDocumentInfoObject_Impl::Reset(uno::Reference<document::XDocumentProperties> xDocProps, ::rtl::OUString* pUserDefined)
{
if (pUserDefined == 0) {
// NB: this is an ugly hack; the "Properties" ui dialog displays
// exactly 4 user-defined fields and expects these to be available
// (should be redesigned), but I do not want to do this in
// DocumentProperties; do it here instead
uno::Reference<beans::XPropertyAccess> xPropAccess(
xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
uno::Reference<beans::XPropertyContainer> xPropContainer(
xPropAccess, uno::UNO_QUERY_THROW);
uno::Sequence< beans::PropertyValue >
props = xPropAccess->getPropertyValues();
sal_Int32 oldLength = props.getLength();
if (oldLength < FOUR) {
std::vector< ::rtl::OUString > names;
for (sal_Int32 i = 0; i < oldLength; ++i) {
names.push_back(props[i].Name);
}
const ::rtl::OUString sInfo(
SfxResId(STR_DOCINFO_INFOFIELD).toString());
for (sal_Int32 i = oldLength; i < FOUR; ++i) {
::rtl::OUString sName(sInfo);
sal_Int32 idx = sName.indexOfAsciiL("%1", 2);
::rtl::OUString name = (idx > 0)
? sName.replaceAt(idx, 2, ::rtl::OUString::valueOf(i+1))
: sName + ::rtl::OUString::valueOf(i+1);
while (std::find(names.begin(), names.end(), name)
!= names.end()) {
name += ::rtl::OUString("'");
}
// FIXME there is a race condition here
try {
xPropContainer->addProperty(name,
beans::PropertyAttribute::REMOVEABLE,
uno::makeAny(::rtl::OUString("")));
} catch (const uno::RuntimeException&) {
throw;
} catch (const uno::Exception&) {
// ignore
}
}
}
props = xPropAccess->getPropertyValues();
for (sal_Int32 i = 0; i < FOUR; ++i) {
m_UserDefined[i] = props[i].Name;
}
} else {
std::copy(pUserDefined, pUserDefined+FOUR, m_UserDefined);
}
m_xDocProps = xDocProps;
}
//-----------------------------------------------------------------------------
SfxDocumentInfoObject::SfxDocumentInfoObject()
: _pImp( new SfxDocumentInfoObject_Impl() )
{
}
//-----------------------------------------------------------------------------
SfxDocumentInfoObject::~SfxDocumentInfoObject()
{
delete _pImp;
}
//-----------------------------------------------------------------------------
// ::com::sun::star::lang::XInitialization:
void SAL_CALL
SfxDocumentInfoObject::initialize(const uno::Sequence< uno::Any > & aArguments)
throw (uno::RuntimeException, uno::Exception)
{
if (aArguments.getLength() >= 1) {
uno::Any any = aArguments[0];
uno::Reference<document::XDocumentProperties> xDoc;
if (!(any >>= xDoc) || !xDoc.is()) throw lang::IllegalArgumentException(
::rtl::OUString(
"SfxDocumentInfoObject::initialize: no XDocumentProperties given"),
*this, 0);
_pImp->Reset(xDoc);
} else {
throw lang::IllegalArgumentException(
::rtl::OUString(
"SfxDocumentInfoObject::initialize: no argument given"),
*this, 0);
}
}
// ::com::sun::star::util::XCloneable:
uno::Reference<util::XCloneable> SAL_CALL
SfxDocumentInfoObject::createClone() throw (uno::RuntimeException)
{
SfxDocumentInfoObject *pNew = new SfxDocumentInfoObject;
uno::Reference< util::XCloneable >
xCloneable(_pImp->m_xDocProps, uno::UNO_QUERY_THROW);
uno::Reference<document::XDocumentProperties> xDocProps(
xCloneable->createClone(), uno::UNO_QUERY_THROW);
pNew->_pImp->Reset(xDocProps, _pImp->m_UserDefined);
return pNew;
}
// ::com::sun::star::document::XDocumentProperties:
uno::Reference< document::XDocumentProperties > SAL_CALL
SfxDocumentInfoObject::getDocumentProperties()
throw(::com::sun::star::uno::RuntimeException)
{
return _pImp->m_xDocProps;
}
//-----------------------------------------------------------------------------
const SfxDocumentInfoObject& SfxDocumentInfoObject::operator=( const SfxDocumentInfoObject & rOther)
{
uno::Reference< util::XCloneable >
xCloneable(rOther._pImp->m_xDocProps, uno::UNO_QUERY_THROW);
uno::Reference<document::XDocumentProperties> xDocProps(
xCloneable->createClone(), uno::UNO_QUERY_THROW);
_pImp->Reset(xDocProps, rOther._pImp->m_UserDefined);
return *this;
}
//-----------------------------------------------------------------------------
void SAL_CALL SfxDocumentInfoObject::dispose() throw( ::com::sun::star::uno::RuntimeException )
{
::com::sun::star::lang::EventObject aEvent( (::cppu::OWeakObject *)this );
_pImp->_aDisposeContainer.disposeAndClear( aEvent );
::osl::MutexGuard aGuard( _pImp->_aMutex );
_pImp->m_xDocProps = 0;
// NB: do not call m_xDocProps->dispose(), there could be other refs
_pImp->bDisposed = sal_True;
}
//-----------------------------------------------------------------------------
void SAL_CALL SfxDocumentInfoObject::addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException )
{
_pImp->_aDisposeContainer.addInterface( aListener );
}
//-----------------------------------------------------------------------------
void SAL_CALL SfxDocumentInfoObject::removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException )
{
_pImp->_aDisposeContainer.removeInterface( aListener );
}
//-----------------------------------------------------------------------------
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL SfxDocumentInfoObject::getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException )
{
::osl::MutexGuard aGuard( _pImp->_aMutex );
uno::Reference<beans::XPropertySet> xPropSet(
_pImp->m_xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
MixedPropertySetInfo* pInfo = new MixedPropertySetInfo( lcl_GetDocInfoPropertyMap(), _pImp->m_UserDefined, xPropSet);
uno::Reference< beans::XPropertySetInfo > xInfo(
static_cast< beans::XPropertySetInfo* >(pInfo), uno::UNO_QUERY_THROW);
return xInfo;
}
//-----------------------------------------------------------------------------
void SAL_CALL SfxDocumentInfoObject::setPropertyValue(const ::rtl::OUString& aPropertyName, const uno::Any& aValue) throw (
uno::RuntimeException, beans::UnknownPropertyException,
beans::PropertyVetoException, lang::IllegalArgumentException,
lang::WrappedTargetException)
{
const SfxItemPropertySimpleEntry* pEntry = _pImp->m_aPropertyMap.getByName( aPropertyName );
// fix prop!
if ( pEntry )
setFastPropertyValue( pEntry->nWID, aValue );
else
// dynamic prop!
{
uno::Reference<beans::XPropertySet> xPropSet(
_pImp->m_xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
return xPropSet->setPropertyValue(aPropertyName, aValue);
}
}
//-----------------------------------------------------------------------------
uno::Any SAL_CALL SfxDocumentInfoObject::getPropertyValue(const ::rtl::OUString& aPropertyName) throw(
uno::RuntimeException, beans::UnknownPropertyException,
lang::WrappedTargetException)
{
const SfxItemPropertySimpleEntry* pEntry = _pImp->m_aPropertyMap.getByName( aPropertyName );
// fix prop!
if ( pEntry )
return getFastPropertyValue( pEntry->nWID );
else
// dynamic prop!
{
uno::Reference<beans::XPropertySet> xPropSet(
_pImp->m_xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
return xPropSet->getPropertyValue(aPropertyName);
}
}
sal_Bool SAL_CALL SfxDocumentInfoObject::isModified() throw(::com::sun::star::uno::RuntimeException)
{
uno::Reference<util::XModifiable> xModif(
_pImp->m_xDocProps, uno::UNO_QUERY_THROW);
return xModif->isModified();
}
void SAL_CALL SfxDocumentInfoObject::setModified( sal_Bool bModified )
throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException)
{
uno::Reference<util::XModifiable> xModif(
_pImp->m_xDocProps, uno::UNO_QUERY_THROW);
return xModif->setModified(bModified);
}
void SAL_CALL SfxDocumentInfoObject::addModifyListener( const uno::Reference< util::XModifyListener >& xListener) throw( uno::RuntimeException )
{
uno::Reference<util::XModifiable> xModif(
_pImp->m_xDocProps, uno::UNO_QUERY_THROW);
return xModif->addModifyListener(xListener);
}
void SAL_CALL SfxDocumentInfoObject::removeModifyListener( const uno::Reference< util::XModifyListener >& xListener) throw( uno::RuntimeException )
{
uno::Reference<util::XModifiable> xModif(
_pImp->m_xDocProps, uno::UNO_QUERY_THROW);
return xModif->removeModifyListener(xListener);
}
//-----------------------------------------------------------------------------
void SAL_CALL SfxDocumentInfoObject::addPropertyChangeListener(const ::rtl::OUString&, const uno::Reference< beans::XPropertyChangeListener > & ) throw(
uno::RuntimeException, beans::UnknownPropertyException,
lang::WrappedTargetException)
{}
//-----------------------------------------------------------------------------
void SAL_CALL SfxDocumentInfoObject::removePropertyChangeListener(const ::rtl::OUString&, const uno::Reference< beans::XPropertyChangeListener > & ) throw(
uno::RuntimeException, beans::UnknownPropertyException,
lang::WrappedTargetException)
{}
//-----------------------------------------------------------------------------
void SAL_CALL SfxDocumentInfoObject::addVetoableChangeListener(const ::rtl::OUString&, const uno::Reference< beans::XVetoableChangeListener > & ) throw(
uno::RuntimeException, beans::UnknownPropertyException,
lang::WrappedTargetException)
{}
//-----------------------------------------------------------------------------
void SAL_CALL SfxDocumentInfoObject::removeVetoableChangeListener(const ::rtl::OUString&, const uno::Reference< beans::XVetoableChangeListener > & ) throw(
uno::RuntimeException, beans::UnknownPropertyException,
lang::WrappedTargetException)
{}
uno::Sequence< beans::PropertyValue > SAL_CALL SfxDocumentInfoObject::getPropertyValues( void ) throw( uno::RuntimeException )
{
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo = getPropertySetInfo();
::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > aProps = xInfo->getProperties();
const ::com::sun::star::beans::Property* pProps = aProps.getConstArray();
sal_uInt32 nCount = aProps.getLength();
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >aSeq( nCount );
::com::sun::star::beans::PropertyValue* pValues = aSeq.getArray();
for ( sal_uInt32 n = 0; n < nCount; ++n )
{
::com::sun::star::beans::PropertyValue& rCurrValue = pValues[n];
const ::com::sun::star::beans::Property& rCurrProp = pProps[n];
rCurrValue.Name = rCurrProp.Name;
rCurrValue.Handle = rCurrProp.Handle;
rCurrValue.Value = getPropertyValue( rCurrProp.Name );
}
return aSeq;
}
void SAL_CALL SfxDocumentInfoObject::setPropertyValues( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps )
throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException )
{
const ::com::sun::star::beans::PropertyValue* pProps = aProps.getConstArray();
sal_uInt32 nCount = aProps.getLength();
for ( sal_uInt32 n = 0; n < nCount; ++n )
{
const ::com::sun::star::beans::PropertyValue& rProp = pProps[n];
setPropertyValue( rProp.Name, rProp.Value );
}
}
void SAL_CALL SfxDocumentInfoObject::addProperty(const ::rtl::OUString& sName ,
sal_Int16 nAttributes ,
const ::com::sun::star::uno::Any& aDefaultValue)
throw(::com::sun::star::beans::PropertyExistException ,
::com::sun::star::beans::IllegalTypeException ,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException )
{
// clash with "fix" properties ?
sal_Bool bFixProp = _pImp->m_aPropertyMap.getByName( sName ) != 0;
if ( bFixProp )
{
::rtl::OUStringBuffer sMsg(256);
sMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM("The property \""));
sMsg.append(sName);
sMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM("\" "));
if ( bFixProp )
sMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM(" already exists as a fix property. Please have a look into the IDL documentation of the DocumentInfo service."));
throw ::com::sun::star::beans::PropertyExistException(
sMsg.makeStringAndClear(),
static_cast< ::cppu::OWeakObject* >(this));
}
uno::Reference<beans::XPropertyContainer> xPropSet(
_pImp->m_xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
return xPropSet->addProperty(sName, nAttributes, aDefaultValue);
}
void SAL_CALL SfxDocumentInfoObject::removeProperty(const ::rtl::OUString& sName)
throw(::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::beans::NotRemoveableException ,
::com::sun::star::uno::RuntimeException )
{
// clash with "fix" properties ?
sal_Bool bFixProp = _pImp->m_aPropertyMap.getByName( sName ) != 0;
if ( bFixProp )
{
::rtl::OUStringBuffer sMsg(256);
sMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM("The property \""));
sMsg.append(sName);
sMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM("\" cant be removed. Its a fix property of the DocumentInfo service."));
throw ::com::sun::star::beans::NotRemoveableException(
sMsg.makeStringAndClear(),
static_cast< ::cppu::OWeakObject* >(this));
}
uno::Reference<beans::XPropertyContainer> xPropSet(
_pImp->m_xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
return xPropSet->removeProperty(sName);
}
sal_Bool equalsDateTime( const util::DateTime& D1, const util::DateTime& D2 )
{
return D1.HundredthSeconds == D2.HundredthSeconds &&
D1.Seconds == D2.Seconds &&
D1.Minutes == D2.Minutes &&
D1.Hours == D2.Hours &&
D1.Day == D2.Day &&
D1.Month == D2.Month &&
D1.Year == D2.Year;
}
void SAL_CALL SfxDocumentInfoObject::setFastPropertyValue(sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue) throw(
uno::RuntimeException, beans::UnknownPropertyException,
beans::PropertyVetoException, lang::IllegalArgumentException,
lang::WrappedTargetException)
{
// Attention: Only fix properties should be provided by this method.
// Dynamic properties has no handle in real ... because it cant be used inside multithreaded environments :-)
::osl::ClearableMutexGuard aGuard( _pImp->_aMutex );
if ( aValue.getValueType() == ::getCppuType((const ::rtl::OUString*)0) )
{
::rtl::OUString sTemp ;
aValue >>= sTemp ;
switch ( nHandle )
{
case SID_APPLICATION :
_pImp->m_xDocProps->setGenerator(sTemp);
break;
case WID_FROM :
{
if ( _pImp->m_xDocProps->getAuthor() != sTemp )
_pImp->m_xDocProps->setAuthor(sTemp);
break;
}
case MID_DOCINFO_PRINTEDBY:
if ( _pImp->m_xDocProps->getPrintedBy() != sTemp )
_pImp->m_xDocProps->setPrintedBy(sTemp);
break;
case MID_DOCINFO_MODIFICATIONAUTHOR:
if ( _pImp->m_xDocProps->getModifiedBy() != sTemp )
_pImp->m_xDocProps->setModifiedBy(sTemp);
break;
case WID_TITLE :
{
if ( _pImp->m_xDocProps->getTitle() != sTemp )
_pImp->m_xDocProps->setTitle(sTemp);
break;
}
case MID_DOCINFO_SUBJECT :
if ( _pImp->m_xDocProps->getSubject() != sTemp )
_pImp->m_xDocProps->setSubject(sTemp);
break;
case WID_KEYWORDS :
{
_pImp->m_xDocProps->setKeywords(
::comphelper::string::convertCommaSeparated(sTemp));
}
break;
case MID_DOCINFO_TEMPLATE:
if ( _pImp->m_xDocProps->getTemplateName() != sTemp )
_pImp->m_xDocProps->setTemplateName(sTemp);
break;
case SID_TEMPLATE_NAME:
if ( _pImp->m_xDocProps->getTemplateURL() != sTemp )
_pImp->m_xDocProps->setTemplateURL(sTemp);
break;
case MID_DOCINFO_DESCRIPTION:
if ( _pImp->m_xDocProps->getDescription() != sTemp )
_pImp->m_xDocProps->setDescription(sTemp);
break;
case MID_DOCINFO_AUTOLOADURL:
if ( _pImp->m_xDocProps->getAutoloadURL() != sTemp )
_pImp->m_xDocProps->setAutoloadURL(sTemp);
break;
case MID_DOCINFO_DEFAULTTARGET:
if ( _pImp->m_xDocProps->getDefaultTarget() != sTemp )
_pImp->m_xDocProps->setDefaultTarget(sTemp);
break;
case MID_CATEGORY:
case MID_MANAGER:
case MID_COMPANY:
{
uno::Reference< document::XCompatWriterDocProperties > xWriterProps( _pImp->m_xDocProps, uno::UNO_QUERY );
if ( xWriterProps.is() )
{
if ( nHandle == MID_CATEGORY )
xWriterProps->setCategory( sTemp );
else if ( nHandle == MID_MANAGER )
xWriterProps->setManager( sTemp );
else
xWriterProps->setCompany( sTemp );
break;
}
}
default:
break;
}
}
else if ( aValue.getValueType() == ::getCppuType((const ::com::sun::star::util::DateTime*)0) )
{
com::sun::star::util::DateTime aTemp;
aValue >>= aTemp ;
switch ( nHandle )
{
case WID_DATE_CREATED :
{
if ( !equalsDateTime(_pImp->m_xDocProps->getCreationDate(), aTemp ) )
{
_pImp->m_xDocProps->setCreationDate(aTemp);
}
break;
}
case WID_DATE_MODIFIED :
{
if ( !equalsDateTime(_pImp->m_xDocProps->getModificationDate(), aTemp ) )
{
_pImp->m_xDocProps->setModificationDate(aTemp);
}
break;
}
case MID_DOCINFO_PRINTDATE :
{
if ( !equalsDateTime(_pImp->m_xDocProps->getPrintDate(), aTemp ) )
{
_pImp->m_xDocProps->setPrintDate(aTemp);
}
break;
}
case MID_DOCINFO_TEMPLATEDATE :
{
if ( !equalsDateTime(_pImp->m_xDocProps->getTemplateDate(), aTemp ) )
{
_pImp->m_xDocProps->setTemplateDate(aTemp);
}
break;
}
default:
break;
}
}
else if ( aValue.getValueType() == ::getBooleanCppuType() )
{
sal_Bool bBoolVal = false;
aValue >>= bBoolVal ;
switch ( nHandle )
{
case MID_DOCINFO_AUTOLOADENABLED:
// NB: this property does not exist any more
// it is emulated as enabled iff delay > 0
if ( bBoolVal && (0 == _pImp->m_xDocProps->getAutoloadSecs()) ) {
_pImp->m_xDocProps->setAutoloadSecs(60); // default
} else if ( !bBoolVal && (0 != _pImp->m_xDocProps->getAutoloadSecs()) ) {
_pImp->m_xDocProps->setAutoloadSecs(0);
_pImp->m_xDocProps->setAutoloadURL(::rtl::OUString(""));
}
break;
default:
break;
}
}
else if ( aValue.getValueType() == ::getCppuType((const sal_Int32*)0) )
{
sal_Int32 nIntVal = 0;
aValue >>= nIntVal ;
switch ( nHandle )
{
case MID_DOCINFO_AUTOLOADSECS:
if ( nIntVal != _pImp->m_xDocProps->getAutoloadSecs())
_pImp->m_xDocProps->setAutoloadSecs(nIntVal);
break;
case MID_DOCINFO_EDITTIME:
if ( nIntVal != _pImp->m_xDocProps->getEditingDuration())
_pImp->m_xDocProps->setEditingDuration(nIntVal);
break;
default:
break;
}
}
else if ( aValue.getValueType() == ::getCppuType((const sal_Int16*)0) )
{
short nIntVal = 0;
aValue >>= nIntVal ;
switch ( nHandle )
{
case MID_DOCINFO_REVISION:
if ( nIntVal != _pImp->m_xDocProps->getEditingCycles())
_pImp->m_xDocProps->setEditingCycles(nIntVal);
break;
default:
break;
}
}
else if ( aValue.getValueType() == ::getCppuType((const uno::Sequence< beans::NamedValue >*)0) )
{
if ( nHandle == MID_DOCINFO_STATISTIC )
{
uno::Sequence < beans::NamedValue > aData;
aValue >>= aData;
{
_pImp->m_xDocProps->setDocumentStatistics(aData);
}
}
}
else if ( aValue.getValueType() == ::getCppuType((const lang::Locale*)0) )
{
if ( nHandle == MID_DOCINFO_CHARLOCALE )
{
lang::Locale aLocale;
aValue >>= aLocale;
lang::Locale oldLocale = _pImp->m_xDocProps->getLanguage();
if ( aLocale.Language != oldLocale.Language ||
aLocale.Country != oldLocale.Country ||
aLocale.Variant != oldLocale.Variant )
{
_pImp->m_xDocProps->setLanguage(aLocale);
}
}
}
}
//-----------------------------------------------------------------------------
::com::sun::star::uno::Any SAL_CALL SfxDocumentInfoObject::getFastPropertyValue(sal_Int32 nHandle) throw(
uno::RuntimeException, beans::UnknownPropertyException,
lang::WrappedTargetException)
{
// Attention: Only fix properties should be provided by this method.
// Dynamic properties has no handle in real ... because it cant be used inside multithreaded environments :-)
::osl::MutexGuard aGuard( _pImp->_aMutex );
::com::sun::star::uno::Any aValue;
switch ( nHandle )
{
case SID_APPLICATION :
aValue <<= _pImp->m_xDocProps->getGenerator();
break;
case WID_CONTENT_TYPE :
// FIXME this is not available anymore
aValue <<= ::rtl::OUString();
break;
case MID_DOCINFO_REVISION :
aValue <<= _pImp->m_xDocProps->getEditingCycles();
break;
case MID_DOCINFO_EDITTIME :
aValue <<= _pImp->m_xDocProps->getEditingDuration();
break;
case WID_FROM :
aValue <<= _pImp->m_xDocProps->getAuthor();
break;
case WID_DATE_CREATED :
if ( IsValidDateTime( _pImp->m_xDocProps->getCreationDate() ) )
aValue <<= _pImp->m_xDocProps->getCreationDate();
break;
case WID_TITLE :
aValue <<= _pImp->m_xDocProps->getTitle();
break;
case MID_DOCINFO_SUBJECT:
aValue <<= _pImp->m_xDocProps->getSubject();
break;
case MID_DOCINFO_MODIFICATIONAUTHOR:
aValue <<= _pImp->m_xDocProps->getModifiedBy();
break;
case WID_DATE_MODIFIED :
if ( IsValidDateTime( _pImp->m_xDocProps->getModificationDate() ) )
aValue <<= _pImp->m_xDocProps->getModificationDate();
break;
case MID_DOCINFO_PRINTEDBY:
aValue <<= _pImp->m_xDocProps->getPrintedBy();
break;
case MID_DOCINFO_PRINTDATE:
if ( IsValidDateTime( _pImp->m_xDocProps->getPrintDate() ) )
aValue <<= _pImp->m_xDocProps->getPrintDate();
break;
case WID_KEYWORDS :
aValue <<= ::comphelper::string::convertCommaSeparated(
_pImp->m_xDocProps->getKeywords());
break;
case MID_DOCINFO_DESCRIPTION:
aValue <<= _pImp->m_xDocProps->getDescription();
break;
case MID_DOCINFO_TEMPLATE:
aValue <<= _pImp->m_xDocProps->getTemplateName();
break;
case SID_TEMPLATE_NAME:
aValue <<= _pImp->m_xDocProps->getTemplateURL();
break;
case MID_DOCINFO_TEMPLATEDATE:
if ( IsValidDateTime( _pImp->m_xDocProps->getTemplateDate() ) )
aValue <<= _pImp->m_xDocProps->getTemplateDate();
break;
case MID_DOCINFO_AUTOLOADENABLED:
aValue <<= static_cast<sal_Bool>
( (_pImp->m_xDocProps->getAutoloadSecs() != 0)
|| !_pImp->m_xDocProps->getAutoloadURL().isEmpty());
break;
case MID_DOCINFO_AUTOLOADURL:
aValue <<= _pImp->m_xDocProps->getAutoloadURL();
break;
case MID_DOCINFO_AUTOLOADSECS:
aValue <<= _pImp->m_xDocProps->getAutoloadSecs();
break;
case MID_DOCINFO_DEFAULTTARGET:
aValue <<= _pImp->m_xDocProps->getDefaultTarget();
break;
case MID_DOCINFO_STATISTIC:
aValue <<= _pImp->m_xDocProps->getDocumentStatistics();
break;
case MID_DOCINFO_CHARLOCALE:
aValue <<= _pImp->m_xDocProps->getLanguage();
break;
case MID_CATEGORY:
case MID_MANAGER:
case MID_COMPANY:
{
uno::Reference< document::XCompatWriterDocProperties > xWriterProps( _pImp->m_xDocProps, uno::UNO_QUERY );
if ( xWriterProps.is() )
{
if ( nHandle == MID_CATEGORY )
aValue <<= xWriterProps->getCategory();
else if ( nHandle == MID_MANAGER )
aValue <<= xWriterProps->getManager();
else
aValue <<= xWriterProps->getCompany();
break;
}
}
default:
aValue <<= ::rtl::OUString();
break;
}
return aValue;
}
//-----------------------------------------------------------------------------
sal_Int16 SAL_CALL SfxDocumentInfoObject::getUserFieldCount() throw( ::com::sun::star::uno::RuntimeException )
{
return FOUR;
}
//-----------------------------------------------------------------------------
::rtl::OUString SAL_CALL SfxDocumentInfoObject::getUserFieldName(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException )
{
::osl::MutexGuard aGuard( _pImp->_aMutex );
if (nIndex < FOUR)
return _pImp->m_UserDefined[nIndex];
else
return ::rtl::OUString();
}
//-----------------------------------------------------------------------------
::rtl::OUString SAL_CALL SfxDocumentInfoObject::getUserFieldValue(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException )
{
::osl::MutexGuard aGuard( _pImp->_aMutex );
if (nIndex < FOUR) {
::rtl::OUString name = _pImp->m_UserDefined[nIndex];
uno::Reference<beans::XPropertySet> xPropSet(
_pImp->m_xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
::rtl::OUString val;
try {
xPropSet->getPropertyValue(name) >>= val;
return val;
} catch (const uno::RuntimeException &) {
throw;
} catch (const uno::Exception &) {
return ::rtl::OUString(); // ignore
}
} else
return ::rtl::OUString();
}
//-----------------------------------------------------------------------------
void SAL_CALL SfxDocumentInfoObject::setUserFieldName(sal_Int16 nIndex, const ::rtl::OUString& aName ) throw( ::com::sun::star::uno::RuntimeException )
{
::osl::ClearableMutexGuard aGuard( _pImp->_aMutex );
if (nIndex < FOUR) // yes, four!
{
// FIXME this is full of race conditions because the PropertyBag
// can be accessed from clients of the DocumentProperties!
::rtl::OUString name = _pImp->m_UserDefined[nIndex];
if (name != aName) {
uno::Reference<beans::XPropertySet> xPropSet(
_pImp->m_xDocProps->getUserDefinedProperties(),
uno::UNO_QUERY_THROW);
uno::Reference<beans::XPropertyContainer> xPropContainer(
_pImp->m_xDocProps->getUserDefinedProperties(),
uno::UNO_QUERY_THROW);
uno::Any value;
try {
value = xPropSet->getPropertyValue(name);
xPropContainer->removeProperty(name);
xPropContainer->addProperty(aName,
beans::PropertyAttribute::REMOVEABLE, value);
_pImp->m_UserDefined[nIndex] = aName;
} catch (const beans::UnknownPropertyException&) {
try {
xPropContainer->addProperty(aName,
beans::PropertyAttribute::REMOVEABLE,
uno::makeAny(::rtl::OUString("")));
_pImp->m_UserDefined[nIndex] = aName;
} catch (const beans::PropertyExistException&) {
_pImp->m_UserDefined[nIndex] = aName;
// ignore
}
} catch (const beans::PropertyExistException&) {
try {
xPropContainer->addProperty(name,
beans::PropertyAttribute::REMOVEABLE, value);
} catch (const beans::PropertyExistException&) {
// bugger...
}
} catch (const uno::RuntimeException &) {
throw;
} catch (const uno::Exception &) {
// ignore everything else; xPropSet _may_ be corrupted
}
}
}
}
//-----------------------------------------------------------------------------
void SAL_CALL SfxDocumentInfoObject::setUserFieldValue( sal_Int16 nIndex, const ::rtl::OUString& aValue ) throw( ::com::sun::star::uno::RuntimeException )
{
::osl::ClearableMutexGuard aGuard( _pImp->_aMutex );
if (nIndex < FOUR) // yes, four!
{
::rtl::OUString name = _pImp->m_UserDefined[nIndex];
uno::Reference<beans::XPropertySet> xPropSet(
_pImp->m_xDocProps->getUserDefinedProperties(),
uno::UNO_QUERY_THROW);
uno::Reference<beans::XPropertyContainer> xPropContainer(
_pImp->m_xDocProps->getUserDefinedProperties(),
uno::UNO_QUERY_THROW);
uno::Any aAny;
aAny <<= aValue;
try {
uno::Any value = xPropSet->getPropertyValue(name);
if (value != aAny) {
xPropSet->setPropertyValue(name, aAny);
}
} catch (const beans::UnknownPropertyException&) {
try {
// someone removed it, add it back again
xPropContainer->addProperty(name,
beans::PropertyAttribute::REMOVEABLE, aAny);
} catch (const uno::RuntimeException &) {
throw;
} catch (const uno::Exception &) {
// ignore everything else
}
} catch (const uno::RuntimeException &) {
throw;
} catch (const uno::Exception &) {
// ignore everything else
}
}
}
//-----------------------------------------------------------------------------
SFX_IMPL_XINTERFACE_2( SfxStandaloneDocumentInfoObject, SfxDocumentInfoObject, ::com::sun::star::lang::XServiceInfo, ::com::sun::star::document::XStandaloneDocumentInfo )
SFX_IMPL_XTYPEPROVIDER_10( SfxStandaloneDocumentInfoObject, ::com::sun::star::document::XDocumentInfo, ::com::sun::star::lang::XComponent,
::com::sun::star::beans::XPropertySet, ::com::sun::star::beans::XFastPropertySet, ::com::sun::star::beans::XPropertyAccess,
::com::sun::star::beans::XPropertyContainer, ::com::sun::star::util::XModifiable, ::com::sun::star::util::XModifyBroadcaster,
::com::sun::star::document::XStandaloneDocumentInfo, ::com::sun::star::lang::XServiceInfo )
SFX_IMPL_XSERVICEINFO( SfxStandaloneDocumentInfoObject, "com.sun.star.document.StandaloneDocumentInfo", "com.sun.star.comp.sfx2.StandaloneDocumentInfo" )
SFX_IMPL_SINGLEFACTORY( SfxStandaloneDocumentInfoObject )
SfxStandaloneDocumentInfoObject::SfxStandaloneDocumentInfoObject( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory )
: SfxDocumentInfoObject()
, _xFactory( xFactory )
{
uno::Reference< lang::XInitialization > xDocProps(
document::DocumentProperties::create(comphelper::getComponentContext(_xFactory)),
uno::UNO_QUERY_THROW);
uno::Any a;
a <<= xDocProps;
uno::Sequence<uno::Any> args(1);
args[0] = a;
initialize(args);
}
//-----------------------------------------------------------------------------
SfxStandaloneDocumentInfoObject::~SfxStandaloneDocumentInfoObject()
{
}
//-----------------------------------------------------------------------------
uno::Reference< embed::XStorage > GetStorage_Impl( const ::rtl::OUString& rName, sal_Bool bWrite, uno::Reference < lang::XMultiServiceFactory >& xFactory )
{
// catch unexpected exceptions under solaris
// Client code checks the returned reference but is not interested on error details.
try
{
SolarMutexGuard aSolarGuard;
return ::comphelper::OStorageHelper::GetStorageFromURL(
rName,
bWrite ? embed::ElementModes::READWRITE : embed::ElementModes::READ,
xFactory );
}
catch(const uno::Exception&)
{}
return uno::Reference< embed::XStorage >();
}
//-----------------------------------------------------------------------------
sal_Int16 SAL_CALL SfxStandaloneDocumentInfoObject::getUserFieldCount() throw( ::com::sun::star::uno::RuntimeException )
{
return SfxDocumentInfoObject::getUserFieldCount();
}
//-----------------------------------------------------------------------------
::rtl::OUString SAL_CALL SfxStandaloneDocumentInfoObject::getUserFieldName(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException )
{
return SfxDocumentInfoObject::getUserFieldName(nIndex);
}
//-----------------------------------------------------------------------------
::rtl::OUString SAL_CALL SfxStandaloneDocumentInfoObject::getUserFieldValue(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException )
{
return SfxDocumentInfoObject::getUserFieldValue(nIndex);
}
//-----------------------------------------------------------------------------
void SAL_CALL SfxStandaloneDocumentInfoObject::setUserFieldName(sal_Int16 nIndex, const ::rtl::OUString& aName ) throw( ::com::sun::star::uno::RuntimeException )
{
SfxDocumentInfoObject::setUserFieldName( nIndex, aName );
}
//-----------------------------------------------------------------------------
void SAL_CALL SfxStandaloneDocumentInfoObject::setUserFieldValue( sal_Int16 nIndex, const ::rtl::OUString& aValue ) throw( ::com::sun::star::uno::RuntimeException )
{
SfxDocumentInfoObject::setUserFieldValue( nIndex, aValue );
}
//-----------------------------------------------------------------------------
void SAL_CALL SfxStandaloneDocumentInfoObject::loadFromURL(const ::rtl::OUString& aURL)
throw( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException )
{
sal_Bool bOK = sal_False;
::osl::ClearableMutexGuard aGuard( _pImp->_aMutex );
uno::Reference< document::XDocumentProperties > xDocProps(
document::DocumentProperties::create(comphelper::getComponentContext(_xFactory)) );
_pImp->Reset(xDocProps);
aGuard.clear();
uno::Reference< embed::XStorage > xStorage = GetStorage_Impl( aURL, sal_False, _xFactory );
if ( xStorage.is() )
{
try
{
uno::Sequence<beans::PropertyValue> medium(2);
medium[0].Name = ::rtl::OUString("DocumentBaseURL");
medium[0].Value <<= aURL;
medium[1].Name = ::rtl::OUString("URL");
medium[1].Value <<= aURL;
_pImp->m_xDocProps->loadFromStorage(xStorage, medium);
_pImp->Reset(_pImp->m_xDocProps);
bOK = sal_True;
}
catch( const uno::Exception& )
{
}
}
else
{
uno::Reference < document::XStandaloneDocumentInfo > xBinary( _xFactory->createInstance(
::rtl::OUString("com.sun.star.document.BinaryStandaloneDocumentInfo" ) ), uno::UNO_QUERY );
if ( xBinary.is() )
{
xBinary->loadFromURL( aURL );
bOK = sal_True;
uno::Reference < document::XStandaloneDocumentInfo > xTarget( static_cast < document::XStandaloneDocumentInfo*> (this), uno::UNO_QUERY );
Copy( xBinary, xTarget );
}
}
if ( !bOK )
throw task::ErrorCodeIOException( ::rtl::OUString(), uno::Reference< uno::XInterface >(), ERRCODE_IO_CANTREAD );
}
//-----------------------------------------------------------------------------
void SAL_CALL SfxStandaloneDocumentInfoObject::storeIntoURL(const ::rtl::OUString& aURL) throw( ::com::sun::star::io::IOException )
{
sal_Bool bOK = sal_False;
uno::Reference< embed::XStorage > xStorage = GetStorage_Impl( aURL, sal_True, _xFactory );
if ( xStorage.is() )
{
try
{
uno::Sequence<beans::PropertyValue> medium(2);
medium[0].Name = ::rtl::OUString("DocumentBaseURL");
medium[0].Value <<= aURL;
medium[1].Name = ::rtl::OUString("URL");
medium[1].Value <<= aURL;
_pImp->m_xDocProps->storeToStorage(xStorage, medium);
bOK = sal_True;
}
catch( const io::IOException & )
{
throw;
}
catch( const uno::RuntimeException& )
{
throw;
}
catch( const uno::Exception& )
{
}
}
else
{
uno::Reference < document::XStandaloneDocumentInfo > xBinary( _xFactory->createInstance(
::rtl::OUString("com.sun.star.document.BinaryStandaloneDocumentInfo" ) ), uno::UNO_QUERY );
if ( xBinary.is() )
{
Copy( this, xBinary );
xBinary->storeIntoURL( aURL );
bOK = sal_True;
}
}
if ( !bOK )
throw task::ErrorCodeIOException( ::rtl::OUString(), uno::Reference< uno::XInterface >(), ERRCODE_IO_CANTWRITE );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 276b1b7..57e8f27 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -46,6 +46,7 @@
#include <com/sun/star/document/DocumentProperties.hpp>
#include <com/sun/star/frame/XTransientDocumentsDocumentContentFactory.hpp>
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <com/sun/star/util/XCloneable.hpp>
#include <comphelper/enumhelper.hxx> // can be removed when this is a "real" service
#include <cppuhelper/interfacecontainer.hxx>
@@ -91,7 +92,6 @@
#include <sfx2/docfile.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/request.hxx>
#include <sfx2/objuno.hxx>
#include <sfx2/printer.hxx>
#include <sfx2/basmgr.hxx>
#include <sfx2/event.hxx>
@@ -187,7 +187,6 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument
::cppu::OMultiTypeInterfaceContainerHelper m_aInterfaceContainer ;
uno::Reference< uno::XInterface > m_xParent ;
uno::Reference< frame::XController > m_xCurrent ;
uno::Reference< document::XDocumentInfo > m_xDocumentInfo ;
uno::Reference< document::XDocumentProperties > m_xDocumentProperties;
uno::Reference< script::XStarBasicAccess > m_xStarBasicAccess ;
uno::Reference< container::XNameReplace > m_xEvents ;
@@ -813,13 +812,6 @@ void SAL_CALL SfxBaseModel::dispose() throw(::com::sun::star::uno::RuntimeExcept
lang::EventObject aEvent( (frame::XModel *)this );
m_pData->m_aInterfaceContainer.disposeAndClear( aEvent );
if ( m_pData->m_xDocumentInfo.is() )
{
// as long as an SfxObjectShell is assigned to an SfxBaseModel it is still existing here
// so we can't dispose the shared DocumentInfoObject here
m_pData->m_xDocumentInfo = 0;
}
m_pData->m_xDocumentProperties.clear();
m_pData->m_xDocumentMetadata.clear();
@@ -859,53 +851,6 @@ void SAL_CALL SfxBaseModel::removeEventListener( const uno::Reference< XEVENTLIS
m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const uno::Reference< XEVENTLISTENER >*)0), aListener );
}
//________________________________________________________________________________________________________
// document::XDocumentInfoSupplier
//________________________________________________________________________________________________________
uno::Reference< document::XDocumentInfo > SAL_CALL SfxBaseModel::getDocumentInfo() throw(::com::sun::star::uno::RuntimeException)
{
SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING );
if ( !m_pData->m_xDocumentInfo.is() )
{
// WARNING: this will only work if (when loading a document) the
// document meta-data has already been read and completely written
// into the XDocumentProperties at this point
// ==> DO NOT call getDocumentInfo before document info has been read!
uno::Reference< document::XDocumentInfo > xDocInfo =
new SfxDocumentInfoObject;
uno::Reference< document::XDocumentProperties > xDocProps =
getDocumentProperties();
uno::Sequence< uno::Any > args(1);
args[0] <<= xDocProps;
uno::Reference< lang::XInitialization > xInit(
xDocInfo, uno::UNO_QUERY_THROW);
try {
xInit->initialize(args);
((SfxBaseModel*)this)->m_pData->m_xDocumentInfo = xDocInfo;
} catch (uno::RuntimeException &) {
throw;
} catch (const uno::Exception & e) {
throw lang::WrappedTargetRuntimeException(::rtl::OUString(
"SfxBaseModel::getDocumentInfo: cannot initialize"), *this,
uno::makeAny(e));
}
try {
rtl::OUString aName("MediaType");
uno::Reference < beans::XPropertySet > xSet(
getDocumentStorage(), uno::UNO_QUERY_THROW );
uno::Any aMediaType = xSet->getPropertyValue( aName );
uno::Reference < beans::XPropertySet > xDocSet(
m_pData->m_xDocumentInfo, uno::UNO_QUERY_THROW );
xDocSet->setPropertyValue( aName, aMediaType );
} catch (uno::Exception &) {
//ignore
}
}
return m_pData->m_xDocumentInfo;
}
void
IMPL_SfxBaseModel_DataContainer::impl_setDocumentProperties(
const uno::Reference< document::XDocumentProperties >& rxNewDocProps)
@@ -3086,47 +3031,28 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL
uno::Sequence< beans::PropertyValue > aOldModifyPasswordInfo = m_pData->m_pObjectShell->GetModifyPasswordInfo();
m_pData->m_pObjectShell->SetModifyPasswordInfo( aModifyPasswordInfo );
// since saving a document modifies its DocumentInfo, the current
// DocumentInfo must be saved on "SaveTo", so it can be restored
// since saving a document modifies its DocumentProperties, the current
// DocumentProperties must be saved on "SaveTo", so it can be restored
// after saving
sal_Bool bCopyTo = bSaveTo ||
m_pData->m_pObjectShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED;
uno::Reference<document::XDocumentProperties> xOldDocProps;
uno::Reference<document::XDocumentInfo> xOldDocInfo;
if ( bCopyTo )
{
xOldDocProps = getDocumentProperties();
if (m_pData->m_xDocumentInfo.is())
{
xOldDocInfo = getDocumentInfo();
const Reference<util::XCloneable> xCloneable(xOldDocInfo,
UNO_QUERY_THROW);
const Reference<document::XDocumentInfo> xNewDocInfo(
xCloneable->createClone(), UNO_QUERY_THROW);
const Reference<document::XDocumentPropertiesSupplier> xDPS(
xNewDocInfo, UNO_QUERY_THROW);
const Reference<document::XDocumentProperties> xNewDocProps(
xDPS->getDocumentProperties());
m_pData->m_xDocumentProperties = xNewDocProps;
m_pData->m_xDocumentInfo = xNewDocInfo;
}
else // try not to create DocumentInfo if it does not exist...
{
const Reference<util::XCloneable> xCloneable(xOldDocProps,
UNO_QUERY_THROW);
const Reference<document::XDocumentProperties> xNewDocProps(
xCloneable->createClone(), UNO_QUERY_THROW);
m_pData->m_xDocumentProperties = xNewDocProps;
}
const Reference<util::XCloneable> xCloneable(xOldDocProps,
UNO_QUERY_THROW);
const Reference<document::XDocumentProperties> xNewDocProps(
xCloneable->createClone(), UNO_QUERY_THROW);
m_pData->m_xDocumentProperties = xNewDocProps;
}
sal_Bool bRet = m_pData->m_pObjectShell->APISaveAs_Impl( sURL, aParams );
if ( bCopyTo )
{
// restore DocumentInfo if a copy was created
// restore DocumentProperties if a copy was created
m_pData->m_xDocumentProperties = xOldDocProps;
m_pData->m_xDocumentInfo = xOldDocInfo;
}
uno::Reference < task::XInteractionHandler > xHandler;
diff --git a/sfx2/util/sfx.component b/sfx2/util/sfx.component
index b05a673..567e10a 100644
--- a/sfx2/util/sfx.component
+++ b/sfx2/util/sfx.component
@@ -63,7 +63,4 @@
<implementation name="com.sun.star.comp.sfx2.SfxMacroLoader">
<service name="com.sun.star.frame.ProtocolHandler"/>
</implementation>
<implementation name="com.sun.star.comp.sfx2.StandaloneDocumentInfo">
<service name="com.sun.star.document.StandaloneDocumentInfo"/>
</implementation>
</component>
diff --git a/sfx2/util/sfx.xml b/sfx2/util/sfx.xml
index 6607445..b188878 100644
--- a/sfx2/util/sfx.xml
+++ b/sfx2/util/sfx.xml
@@ -70,18 +70,6 @@
<supported-service> com.sun.star.frame.ProtocolHandler </supported-service>
</component-description>
<component-description>
<author> Mathias Bauer </author>
<name> com.sun.star.comp.sfx2.StandaloneDocumentInfo </name>
<description>
StandaloneDocumentInfo.
</description>
<loader-name> com.sun.star.loader.SharedLibrary </loader-name>
<language> c++ </language>
<status value="final"/>
<supported-service> com.sun.star.document.StandaloneDocumentInfo </supported-service>
</component-description>
<project-build-dependency> cppu </project-build-dependency>
<project-build-dependency> cppuhelper </project-build-dependency>
<project-build-dependency> sal </project-build-dependency>