summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-11-22 11:26:49 +0100
committerMichael Stahl <mstahl@redhat.com>2012-11-26 23:14:33 +0100
commite6f81b1898a59280f41177206b777a7a0d32f3fc (patch)
treec8047f94d0e647630ce45f8159600fdad7ebad48
parent31170413ae3786bf44564e813d7291354e939a77 (diff)
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
-rw-r--r--offapi/UnoApi_offapi.mk5
-rw-r--r--offapi/com/sun/star/document/DocumentInfo.idl214
-rw-r--r--offapi/com/sun/star/document/OfficeDocument.idl12
-rw-r--r--offapi/com/sun/star/document/StandaloneDocumentInfo.idl63
-rw-r--r--offapi/com/sun/star/document/XDocumentInfo.idl128
-rw-r--r--offapi/com/sun/star/document/XDocumentInfoSupplier.idl59
-rw-r--r--offapi/com/sun/star/document/XStandaloneDocumentInfo.idl89
-rw-r--r--offapi/type_reference/types.rdbbin7655424 -> 7655424 bytes
-rw-r--r--qadevOOo/Jar_OOoRunner.mk6
-rw-r--r--qadevOOo/objdsc/sc/com.sun.star.comp.office.ScModelObj.csv1
-rw-r--r--qadevOOo/objdsc/sd/com.sun.star.comp.office.SdXImpressDocument.csv1
-rw-r--r--qadevOOo/objdsc/sfx/com.sun.star.comp.sfx2.StandaloneDocumentInfo.csv46
-rw-r--r--qadevOOo/objdsc/sw/com.sun.star.comp.office.SwXTextDocument.csv1
-rw-r--r--qadevOOo/tests/java/ifc/document/_DocumentInfo.java142
-rw-r--r--qadevOOo/tests/java/ifc/document/_XDocumentInfo.java215
-rw-r--r--qadevOOo/tests/java/ifc/document/_XDocumentInfoSupplier.java47
-rw-r--r--qadevOOo/tests/java/ifc/document/_XStandaloneDocumentInfo.java120
-rw-r--r--qadevOOo/tests/java/mod/_fwk/DocumentProperties.java120
-rw-r--r--qadevOOo/tests/java/mod/_sfx/StandaloneDocumentInfo.java123
-rw-r--r--sfx2/JunitTest_sfx2_complex.mk8
-rw-r--r--sfx2/Library_sfx.mk1
-rw-r--r--sfx2/inc/sfx2/objuno.hxx186
-rw-r--r--sfx2/inc/sfx2/sfxbasemodel.hxx33
-rw-r--r--sfx2/qa/complex/sfx2/DocumentInfo.java338
-rw-r--r--sfx2/qa/complex/sfx2/StandaloneDocumentInfo.java90
-rw-r--r--sfx2/qa/complex/sfx2/standalonedocinfo/StandaloneDocumentInfoTest.java22
-rw-r--r--sfx2/qa/complex/sfx2/standalonedocinfo/Test01.java135
-rw-r--r--sfx2/qa/complex/sfx2/standalonedocinfo/TestHelper.java39
-rw-r--r--sfx2/qa/unoapi/sfx.sce1
-rw-r--r--sfx2/source/appl/appuno.cxx2
-rw-r--r--sfx2/source/doc/objuno.cxx1351
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx92
-rw-r--r--sfx2/util/sfx.component3
-rw-r--r--sfx2/util/sfx.xml12
34 files changed, 13 insertions, 3692 deletions
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 6e85574e5e99..f01eb68f88d3 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
606 X11DropTarget \ 606 X11DropTarget \
607)) 607))
608$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/document,\ 608$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/document,\
609 DocumentInfo \
610 EventDescriptor \ 609 EventDescriptor \
611 Events \ 610 Events \
612 ExportFilter \ 611 ExportFilter \
@@ -622,7 +621,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/documen
622 OfficeDocument \ 621 OfficeDocument \
623 PDFDialog \ 622 PDFDialog \
624 Settings \ 623 Settings \
625 StandaloneDocumentInfo \
626 TypeDetection \ 624 TypeDetection \
627 XMLBasicExporter \ 625 XMLBasicExporter \
628 XMLBasicImporter \ 626 XMLBasicImporter \
@@ -2143,8 +2141,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/document,\
2143 XCompatWriterDocProperties \ 2141 XCompatWriterDocProperties \
2144 XDocumentEventBroadcaster \ 2142 XDocumentEventBroadcaster \
2145 XDocumentEventListener \ 2143 XDocumentEventListener \
2146 XDocumentInfo \
2147 XDocumentInfoSupplier \
2148 XDocumentInsertable \ 2144 XDocumentInsertable \
2149 XDocumentLanguages \ 2145 XDocumentLanguages \
2150 XDocumentProperties \ 2146 XDocumentProperties \
@@ -2172,7 +2168,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/document,\
2172 XOOXMLDocumentPropertiesImporter \ 2168 XOOXMLDocumentPropertiesImporter \
2173 XRedlinesSupplier \ 2169 XRedlinesSupplier \
2174 XScriptInvocationContext \ 2170 XScriptInvocationContext \
2175 XStandaloneDocumentInfo \
2176 XStorageBasedDocument \ 2171 XStorageBasedDocument \
2177 XStorageChangeListener \ 2172 XStorageChangeListener \
2178 XTypeDetection \ 2173 XTypeDetection \
diff --git a/offapi/com/sun/star/document/DocumentInfo.idl b/offapi/com/sun/star/document/DocumentInfo.idl
deleted file mode 100644
index 7570b00100f6..000000000000
--- a/offapi/com/sun/star/document/DocumentInfo.idl
+++ /dev/null
@@ -1,214 +0,0 @@
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19#ifndef __com_sun_star_document_DocumentInfo_idl__
20#define __com_sun_star_document_DocumentInfo_idl__
21
22#include <com/sun/star/document/XDocumentInfo.idl>
23#include <com/sun/star/lang/XComponent.idl>
24#include <com/sun/star/beans/XPropertySet.idl>
25#include <com/sun/star/beans/XFastPropertySet.idl>
26#include <com/sun/star/beans/XPropertyContainer.idl>
27#include <com/sun/star/beans/NamedValue.idl>
28#include <com/sun/star/util/DateTime.idl>
29#include <com/sun/star/lang/Locale.idl>
30
31
32 module com { module sun { module star { module document {
33
34/** this service provides document-specific information like the
35 author, creation date and user fields
36
37 <p>
38 Contrary to the service <type>StandaloneDocumentInfo</type> the document - which
39 contains such informations - must be loaded completely. As a result of that this
40 DocumentInfo service is available on an open document via the interface
41 <type>XDocumentInfoSupplier</type> only.
42 </p>
43
44 @deprecated Use <type>DocumentProperties</type> instead.
45
46 @see StandaloneDocumentInfo
47 @see XDocumentInfoSupplier
48 */
49published service DocumentInfo
50{
51 /** provides access to the user fields for the information regarding the
52 document
53
54 <p>
55 These fields are additional to normal properties.
56 (see below)
57 </p>
58 */
59 interface XDocumentInfo;
60
61 /** necessary to support normal properties
62 */
63 interface com::sun::star::beans::XPropertySet;
64
65 /** supports faster access on well known properties by using index
66 */
67 interface com::sun::star::beans::XFastPropertySet;
68
69 /** provides access to the user fields, which (instead to the user fields set
70 by the interface XDocumentInfo) will be typesafe.
71
72 <p>
73 These fields are additional to normal properties (see below) and
74 additional to the user fields set by the interface XDocumentInfo (see before).
75 </p>
76 */
77 [optional] interface com::sun::star::beans::XPropertyContainer;
78
79 /** contains the initial author of the document
80 */
81 [property] string Author;
82
83 /** @deprecated
84 */
85 [property] boolean AutoloadEnabled;
86
87 /** contains the number of seconds after which a specified
88 URL is to be loaded after the document is loaded into a desktop
89 frame
90 */
91 [property] long AutoloadSecs;
92
93 /** contains the URL to load automatically after a
94 specified time after the document is loaded into a desktop frame
95 */
96 [property] string AutoloadURL;
97
98 /** contains the date and time of the first time the
99 document was stored
100 */
101 [property] com::sun::star::util::DateTime CreationDate;
102
103 /** contains the name of the default frame into which
104 links should be loaded if no target is specified
105
106 <p>
107 This applies to the autoload feature too, but to others as well.
108 </p>
109 */
110 [property] string DefaultTarget;
111
112 /** contains a multi-line comment of the document
113
114 <p>
115 Line delimiters can be UNIX, Macintosh or DOS style.
116 </p>
117 */
118 [property] string Description;
119
120 /** contains some statistics about the document
121
122 <p>
123 The exact name and type of the values depends on the document type
124 </p>
125 */
126 [property] sequence< com::sun::star::beans::NamedValue > DocumentStatistic;
127
128 /** describes how often the document was edited and saved
129 */
130 [property] short EditingCycles;
131
132 /** contains the net time of editing the document (in seconds)
133 */
134 [property] long EditingDuration;
135
136 /** identifies application was used to create or last modify the document
137 */
138 [property] string Generator;
139
140 /** contains a comma separated list of keywords for
141 the document
142 */
143 [property] string Keywords;
144
145 /** contains the MIME-type of the document's resource
146
147 <p>
148 The MIME-type is neither stored in the document information nor in
149 the document; it is sent within a protocol header or is
150 detected, thus it cannot be changed.
151 </p>
152 */
153 [readonly, property] string MIMEType;
154
155 /** default language of the document
156 */
157 [property] com::sun::star::lang::Locale Language;
158
159 /** contains the name of the editor who was the last
160 person to store this document
161 */
162 [property] string ModifiedBy;
163
164 /** contains the date and time of the last time the
165 document was stored
166 */
167 [property] com::sun::star::util::DateTime ModifyDate;
168
169 /** contains the date and time of when the document was
170 last printed
171 */
172 [property] com::sun::star::util::DateTime PrintDate;
173
174 /** contains the name of the editor who was the last
175 person to print the document
176 */
177 [property] string PrintedBy;
178
179 /** subject of document
180 */
181 [property] string Subject;
182
183 /** contains logical name of the template from
184 which the document was created
185
186 <p>
187 The value is an empty string if the document was not created
188 from a template or if it was detached from the template.
189 </p>
190 */
191 [property] string Template;
192
193 /** contains the file path name of the template from
194 which the document was created
195 */
196 [property] string TemplateFileName;
197
198 /** contains the date and time of when the document
199 was created or updated from the template
200 */
201 [property] com::sun::star::util::DateTime TemplateDate;
202
203 /** contains the title of the document
204 */
205 [property] string Title;
206
207};
208
209
210}; }; }; };
211
212#endif
213
214/* 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 e6f2f6f1a174..96de71875c5b 100644
--- a/offapi/com/sun/star/document/OfficeDocument.idl
+++ b/offapi/com/sun/star/document/OfficeDocument.idl
@@ -26,7 +26,6 @@
26#include <com/sun/star/view/XPrintJobBroadcaster.idl> 26#include <com/sun/star/view/XPrintJobBroadcaster.idl>
27#include <com/sun/star/document/XEventBroadcaster.idl> 27#include <com/sun/star/document/XEventBroadcaster.idl>
28#include <com/sun/star/document/XEventsSupplier.idl> 28#include <com/sun/star/document/XEventsSupplier.idl>
29#include <com/sun/star/document/XDocumentInfoSupplier.idl>
30#include <com/sun/star/document/XViewDataSupplier.idl> 29#include <com/sun/star/document/XViewDataSupplier.idl>
31#include <com/sun/star/document/XDocumentEventBroadcaster.idl> 30#include <com/sun/star/document/XDocumentEventBroadcaster.idl>
32#include <com/sun/star/document/XEmbeddedScripts.idl> 31#include <com/sun/star/document/XEmbeddedScripts.idl>
@@ -104,17 +103,6 @@ published service OfficeDocument
104 */ 103 */
105 [optional] interface XEventsSupplier; 104 [optional] interface XEventsSupplier;
106 105
107 /** document can provide a <type>DocumentInfo</type>
108
109 <p>
110 Instead of the <type>StandaloneDocumentInfo</type> service the <type>DocumentInfo</type>
111 will be available on an already opened document only.
112 </p>
113
114 @deprecated Use <type>XDocumentPropertiesSupplier</type> instead.
115 */
116 [optional] interface XDocumentInfoSupplier;
117
118 /** access to some properties describing all open views to a document 106 /** access to some properties describing all open views to a document
119 */ 107 */
120 [optional] interface XViewDataSupplier; 108 [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 04084eafb5c2..000000000000
--- a/offapi/com/sun/star/document/StandaloneDocumentInfo.idl
+++ /dev/null
@@ -1,63 +0,0 @@
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19#ifndef __com_sun_star_document_StandaloneDocumentInfo_idl__
20#define __com_sun_star_document_StandaloneDocumentInfo_idl__
21
22#include <com/sun/star/document/DocumentInfo.idl>
23#include <com/sun/star/document/XStandaloneDocumentInfo.idl>
24
25
26 module com { module sun { module star { module document {
27
28/** extends the service <type>DocumentInfo</type> to have access on such
29 document properties without loading the whole document
30
31 <p>
32 First action on this service must be to specify which document should be handled.
33 Otherwise all supported properties of <type>DocumentInfo</type> will be set to
34 void values. Loading of a document doesn't mean - loading all. It means reading
35 of special part only, which includes searched information. Same procedure for saving
36 of may changed values back to the document.
37 </p>
38
39 @deprecated Use <type>DocumentProperties</type> instead.
40
41 @see DocumentInfo
42 */
43published service StandaloneDocumentInfo
44{
45 /** use it to specify resource or target of document info data
46
47 <p>
48 Must be the first action on this service. Otherwise all properties will be void.
49 </p>
50 */
51 interface XStandaloneDocumentInfo;
52
53 /** access to document info data
54 */
55 service DocumentInfo;
56};
57
58
59}; }; }; };
60
61#endif
62
63/* 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 b43bab79f212..000000000000
--- a/offapi/com/sun/star/document/XDocumentInfo.idl
+++ /dev/null
@@ -1,128 +0,0 @@
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19#ifndef __com_sun_star_document_XDocumentInfo_idl__
20#define __com_sun_star_document_XDocumentInfo_idl__
21
22#include <com/sun/star/uno/XInterface.idl>
23#include <com/sun/star/lang/ArrayIndexOutOfBoundsException.idl>
24
25
26module com { module sun { module star { module document {
27
28/** provides access to the user fields for the information regarding the
29 document
30
31 <p>
32 These fields are special one of the set of available document properties.
33 Other ones are accessed as properties (by using the interface
34 <type scope="com::sun::star::beans">XPropertySet</type>) of service
35 <type>DocumentInfo</type>.
36 </p>
37
38 @deprecated Use <type>XDocumentProperties</type> instead.
39
40 @see DocumentInfo
41 @see StandaloneDocumentInfo
42 @see com::sun::star::beans::XPropertySet
43 */
44published interface XDocumentInfo: com::sun::star::uno::XInterface
45{
46 /** provides information about count of available fields
47
48 <p>
49 This count marks the top range of possible requests for get/set
50 any of these fields. Range = [0..count-1]
51 </p>
52
53 @returns
54 current count
55 */
56 short getUserFieldCount();
57
58 /** returns the name of an user field
59
60 @param Index
61 specifies the position of requested field
62 Range = [0..count-1]
63
64 @returns
65 the name of the requested field
66
67 @throws com::sun::star::lang::ArrayIndexOutOfBoundsException
68 if <var>Index</var> don't fit range of [0..count-1]
69 */
70 string getUserFieldName( [in] short Index )
71 raises( com::sun::star::lang::ArrayIndexOutOfBoundsException );
72
73 /** returns the value of an user field
74
75 @param Index
76 specifies the position of requested field
77 Range = [0..count-1]
78
79 @returns
80 the value of the requested field
81
82 @throws com::sun::star::lang::ArrayIndexOutOfBoundsException
83 if <var>Index</var> don't fit range of [0..count-1]
84 */
85 string getUserFieldValue( [in] short Index )
86 raises( com::sun::star::lang::ArrayIndexOutOfBoundsException );
87
88 /** changes the name of one of the user fields
89
90 @param Index
91 specifies the position of requested field
92 Range = [0..count-1]
93
94 @param Name
95 the new name for this field to be set
96
97 @throws com::sun::star::lang::ArrayIndexOutOfBoundsException
98 if <var>Index</var> don't fit range of [0..count-1]
99 */
100 void setUserFieldName(
101 [in] short Index ,
102 [in] string Name )
103 raises( com::sun::star::lang::ArrayIndexOutOfBoundsException );
104
105 /** changes the value of one of the user fields
106
107 @param Index
108 specifies the position of requested field
109 Range = [0..count-1]
110
111 @param Value
112 the new value for this field to be set
113
114 @throws com::sun::star::lang::ArrayIndexOutOfBoundsException
115 if <var>Index</var> don't fit range of [0..count-1]
116 */
117 void setUserFieldValue(
118 [in] short Index ,
119 [in] string Value )
120 raises( com::sun::star::lang::ArrayIndexOutOfBoundsException );
121};
122
123
124}; }; }; };
125
126#endif
127
128/* 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 295d431dca04..000000000000
--- a/offapi/com/sun/star/document/XDocumentInfoSupplier.idl
+++ /dev/null
@@ -1,59 +0,0 @@
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19#ifndef __com_sun_star_document_XDocumentInfoSupplier_idl__
20#define __com_sun_star_document_XDocumentInfoSupplier_idl__
21
22#include <com/sun/star/uno/XInterface.idl>
23#include <com/sun/star/document/XDocumentInfo.idl>
24
25
26module com { module sun { module star { module document {
27
28/** through this interface documents can provide a <type>DocumentInfo</type>
29
30 <p>
31 A <type>DocumentInfo</type> is available on already opened documents only
32 and must be provides by this supplier interface.
33 Instead of that you can use the service <type>StandaloneDocumentInfo</type>
34 to have access to such informations without opening the whole file.
35 It read/write parts of the document, which include the required informations,
36 only.
37 </p>
38
39 @deprecated Use <type>XDocumentPropertiesSupplier</type> instead.
40
41 @see DocumentInfo
42 @see StandaloneDocumentInfo
43 */
44published interface XDocumentInfoSupplier: com::sun::star::uno::XInterface
45{
46 /** provides the document information object
47
48 @returns
49 an object of type <type>DocumentInfo</type>
50 */
51 XDocumentInfo getDocumentInfo();
52};
53
54
55}; }; }; };
56
57#endif
58
59/* 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 da5ae47406e8..000000000000
--- a/offapi/com/sun/star/document/XStandaloneDocumentInfo.idl
+++ /dev/null
@@ -1,89 +0,0 @@
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19#ifndef __com_sun_star_document_XStandaloneDocumentInfo_idl__
20#define __com_sun_star_document_XStandaloneDocumentInfo_idl__
21
22#include <com/sun/star/document/XDocumentInfo.idl>
23#include <com/sun/star/io/IOException.idl>
24
25
26module com { module sun { module star { module document {
27
28/** makes it possible to load document information from
29 a resource specified by a URL and to store it into a resource also
30 specified by a URL
31
32 <p>
33 Only the document information part of the resource is transferred.
34 Instead of <type>DocumentInfo</type> not the whole document will be opened.
35 Note: Without specifying the source or target of this info (the document)
36 nothing can work and will be handled as void (for reading) or ignored (for writing).
37 After specifying the source/target by using this interface,
38 the interface <type>XDocumentInfo</type> (which must be implemented on same
39 object then this one!) provides access to the info properties.
40 </p>
41
42 @deprecated Use <type>XDocumentProperties</type> instead.
43
44 @see DocumentInfo
45 @see StandaloneDocumentInfo
46 @see XDocumentInfo
47 */
48published interface XStandaloneDocumentInfo: XDocumentInfo
49{
50 /** loads the document information from a file referred by an URL
51
52 <p>
53 After an unsuccessful call the contents of the document
54 information are undefined (void).
55 This method only works for storage file formats.
56 </p>
57
58 @param URL
59 specifies the source of information
60
61 @throws com::sun::star::io::IOException
62 if storage couldn't be found or opened
63 */
64 void loadFromURL( [in] string URL )
65 raises( com::sun::star::io::IOException );
66
67 /** stores the document information into a file referred by a URL
68
69 <p>
70 Only the document information part of the document is overwritten.
71 This method only works for storage file formats.
72 </p>
73
74 @param URL
75 specifies the target for saving
76
77 @throws com::sun::star::io::IOException
78 if storage couldn't be found or opened
79 */
80 void storeIntoURL( [in] string URL )
81 raises( com::sun::star::io::IOException );
82};
83
84
85}; }; }; };
86
87#endif
88
89/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb
index 59912974bf58..44d459d5dbee 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 d6c5c9eceb9e..998a794c25a2 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -410,15 +410,12 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
410 qadevOOo/tests/java/ifc/datatransfer/clipboard/_XFlushableClipboard \ 410 qadevOOo/tests/java/ifc/datatransfer/clipboard/_XFlushableClipboard \
411 qadevOOo/tests/java/ifc/datatransfer/_XDataFormatTranslator \ 411 qadevOOo/tests/java/ifc/datatransfer/_XDataFormatTranslator \
412 qadevOOo/tests/java/ifc/datatransfer/_XMimeContentTypeFactory \ 412 qadevOOo/tests/java/ifc/datatransfer/_XMimeContentTypeFactory \
413 qadevOOo/tests/java/ifc/document/_DocumentInfo \
414 qadevOOo/tests/java/ifc/document/_ExportFilter \ 413 qadevOOo/tests/java/ifc/document/_ExportFilter \
415 qadevOOo/tests/java/ifc/document/_ImportFilter \ 414 qadevOOo/tests/java/ifc/document/_ImportFilter \
416 qadevOOo/tests/java/ifc/document/_LinkTarget \ 415 qadevOOo/tests/java/ifc/document/_LinkTarget \
417 qadevOOo/tests/java/ifc/document/_OfficeDocument \ 416 qadevOOo/tests/java/ifc/document/_OfficeDocument \
418 qadevOOo/tests/java/ifc/document/_Settings \ 417 qadevOOo/tests/java/ifc/document/_Settings \
419 qadevOOo/tests/java/ifc/document/_XActionLockable \ 418 qadevOOo/tests/java/ifc/document/_XActionLockable \
420 qadevOOo/tests/java/ifc/document/_XDocumentInfo \
421 qadevOOo/tests/java/ifc/document/_XDocumentInfoSupplier \
422 qadevOOo/tests/java/ifc/document/_XDocumentInsertable \ 419 qadevOOo/tests/java/ifc/document/_XDocumentInsertable \
423 qadevOOo/tests/java/ifc/document/_XEmbeddedObjectSupplier \ 420 qadevOOo/tests/java/ifc/document/_XEmbeddedObjectSupplier \
424 qadevOOo/tests/java/ifc/document/_XEventBroadcaster \ 421 qadevOOo/tests/java/ifc/document/_XEventBroadcaster \
@@ -428,7 +425,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
428 qadevOOo/tests/java/ifc/document/_XImporter \ 425 qadevOOo/tests/java/ifc/document/_XImporter \
429 qadevOOo/tests/java/ifc/document/_XLinkTargetSupplier \ 426 qadevOOo/tests/java/ifc/document/_XLinkTargetSupplier \
430 qadevOOo/tests/java/ifc/document/_XMimeTypeInfo \ 427 qadevOOo/tests/java/ifc/document/_XMimeTypeInfo \
431 qadevOOo/tests/java/ifc/document/_XStandaloneDocumentInfo \
432 qadevOOo/tests/java/ifc/document/_XTypeDetection \ 428 qadevOOo/tests/java/ifc/document/_XTypeDetection \
433 qadevOOo/tests/java/ifc/document/_XViewDataSupplier \ 429 qadevOOo/tests/java/ifc/document/_XViewDataSupplier \
434 qadevOOo/tests/java/ifc/drawing/_AreaShapeDescriptor \ 430 qadevOOo/tests/java/ifc/drawing/_AreaShapeDescriptor \
@@ -1061,7 +1057,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
1061 qadevOOo/tests/java/mod/_fwk/Desktop \ 1057 qadevOOo/tests/java/mod/_fwk/Desktop \
1062 qadevOOo/tests/java/mod/_fwk/DispatchRecorder \ 1058 qadevOOo/tests/java/mod/_fwk/DispatchRecorder \
1063 qadevOOo/tests/java/mod/_fwk/DispatchRecorderSupplier \ 1059 qadevOOo/tests/java/mod/_fwk/DispatchRecorderSupplier \
1064 qadevOOo/tests/java/mod/_fwk/DocumentProperties \
1065 qadevOOo/tests/java/mod/_fwk/FontMenuController \ 1060 qadevOOo/tests/java/mod/_fwk/FontMenuController \
1066 qadevOOo/tests/java/mod/_fwk/FontSizeMenuController \ 1061 qadevOOo/tests/java/mod/_fwk/FontSizeMenuController \
1067 qadevOOo/tests/java/mod/_fwk/FooterMenuController \ 1062 qadevOOo/tests/java/mod/_fwk/FooterMenuController \
@@ -1322,7 +1317,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
1322 qadevOOo/tests/java/mod/_sfx/DocumentTemplates \ 1317 qadevOOo/tests/java/mod/_sfx/DocumentTemplates \
1323 qadevOOo/tests/java/mod/_sfx/FrameLoader \ 1318 qadevOOo/tests/java/mod/_sfx/FrameLoader \
1324 qadevOOo/tests/java/mod/_sfx/SfxMacroLoader \ 1319 qadevOOo/tests/java/mod/_sfx/SfxMacroLoader \
1325 qadevOOo/tests/java/mod/_sfx/StandaloneDocumentInfo \
1326 qadevOOo/tests/java/mod/_shlibloader/uno/DLLComponentLoader \ 1320 qadevOOo/tests/java/mod/_shlibloader/uno/DLLComponentLoader \
1327 qadevOOo/tests/java/mod/_simplereg/uno/SimpleRegistry \ 1321 qadevOOo/tests/java/mod/_simplereg/uno/SimpleRegistry \
1328 qadevOOo/tests/java/mod/_simreg/SimpleRegistry \ 1322 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 c4da0da4f5a5..cb7c6d1de96b 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 @@
47"ScModelObj";"com::sun::star::beans::XPropertySet#optional";"removePropertyChangeListener()" 47"ScModelObj";"com::sun::star::beans::XPropertySet#optional";"removePropertyChangeListener()"
48"ScModelObj";"com::sun::star::beans::XPropertySet#optional";"addVetoableChangeListener()" 48"ScModelObj";"com::sun::star::beans::XPropertySet#optional";"addVetoableChangeListener()"
49"ScModelObj";"com::sun::star::beans::XPropertySet#optional";"removeVetoableChangeListener()" 49"ScModelObj";"com::sun::star::beans::XPropertySet#optional";"removeVetoableChangeListener()"
50"ScModelObj";"com::sun::star::document::XDocumentInfoSupplier#optional";"getDocumentInfo()"
51"ScModelObj";"com::sun::star::sheet::XDocumentAuditing";"refreshArrows()" 50"ScModelObj";"com::sun::star::sheet::XDocumentAuditing";"refreshArrows()"
52"ScModelObj";"com::sun::star::sheet::XGoalSeek";"seekGoal()" 51"ScModelObj";"com::sun::star::sheet::XGoalSeek";"seekGoal()"
53"ScModelObj";"com::sun::star::sheet::SpreadsheetDocument";"NamedRanges" 52"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 0e50db8f1c42..fd2b76673ca2 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 @@
40"SdXImpressDocument";"com::sun::star::beans::XPropertySet";"removePropertyChangeListener()" 40"SdXImpressDocument";"com::sun::star::beans::XPropertySet";"removePropertyChangeListener()"
41"SdXImpressDocument";"com::sun::star::beans::XPropertySet";"addVetoableChangeListener()" 41"SdXImpressDocument";"com::sun::star::beans::XPropertySet";"addVetoableChangeListener()"
42"SdXImpressDocument";"com::sun::star::beans::XPropertySet";"removeVetoableChangeListener()" 42"SdXImpressDocument";"com::sun::star::beans::XPropertySet";"removeVetoableChangeListener()"
43"SdXImpressDocument";"com::sun::star::document::XDocumentInfoSupplier#optional";"getDocumentInfo()"
44"SdXImpressDocument";"com::sun::star::document::OfficeDocument";"AutomaticControlFocus#optional" 43"SdXImpressDocument";"com::sun::star::document::OfficeDocument";"AutomaticControlFocus#optional"
45"SdXImpressDocument";"com::sun::star::document::OfficeDocument";"ApplyFormDesignMode#optional" 44"SdXImpressDocument";"com::sun::star::document::OfficeDocument";"ApplyFormDesignMode#optional"
46"SdXImpressDocument";"com::sun::star::document::OfficeDocument";"RuntimeUID#optional" 45"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 d9b6e02696c3..000000000000
--- a/qadevOOo/objdsc/sfx/com.sun.star.comp.sfx2.StandaloneDocumentInfo.csv
+++ /dev/null
@@ -1,46 +0,0 @@
1"StandaloneDocumentInfo";"com::sun::star::document::XStandaloneDocumentInfo";"loadFromURL()"
2"StandaloneDocumentInfo";"com::sun::star::document::XStandaloneDocumentInfo";"storeIntoURL()"
3"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Author"
4"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Generator"
5"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"CreationDate"
6"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Title"
7"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Subject"
8"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Description"
9"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Keywords"
10"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"MIMEType"
11"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Language"
12"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"ModifiedBy"
13"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"ModifyDate"
14"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"PrintedBy"
15"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"PrintDate"
16"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Template"
17"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"TemplateDate"
18"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"AutoloadURL"
19"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"AutoloadSecs"
20"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"DefaultTarget"
21"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"BlindCopiesTo"
22"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"CopyTo"
23"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"InReplyTo"
24"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Newsgroups"
25"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Original"
26"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Priority"
27"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Recipient"
28"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"References"
29"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"ReplyTo"
30"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"Theme"
31"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"IsEncrypted"
32"StandaloneDocumentInfo";"com::sun::star::document::DocumentInfo";"AutoloadEnabled"
33"StandaloneDocumentInfo";"com::sun::star::document::XDocumentInfo";"getUserFieldCount()"
34"StandaloneDocumentInfo";"com::sun::star::document::XDocumentInfo";"getUserFieldName()"
35"StandaloneDocumentInfo";"com::sun::star::document::XDocumentInfo";"getUserFieldValue()"
36"StandaloneDocumentInfo";"com::sun::star::document::XDocumentInfo";"setUserFieldName()"
37"StandaloneDocumentInfo";"com::sun::star::document::XDocumentInfo";"setUserFieldValue()"
38"StandaloneDocumentInfo";"com::sun::star::beans::XPropertySet";"getPropertySetInfo()"
39"StandaloneDocumentInfo";"com::sun::star::beans::XPropertySet";"setPropertyValue()"
40"StandaloneDocumentInfo";"com::sun::star::beans::XPropertySet";"getPropertyValue()"
41"StandaloneDocumentInfo";"com::sun::star::beans::XPropertySet";"addPropertyChangeListener()"
42"StandaloneDocumentInfo";"com::sun::star::beans::XPropertySet";"removePropertyChangeListener()"
43"StandaloneDocumentInfo";"com::sun::star::beans::XPropertySet";"addVetoableChangeListener()"
44"StandaloneDocumentInfo";"com::sun::star::beans::XPropertySet";"removeVetoableChangeListener()"
45"StandaloneDocumentInfo";"com::sun::star::beans::XFastPropertySet";"setFastPropertyValue()"
46"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 09e9c91ca3ef..dd21e266c688 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 @@
58"SwXTextDocument";"com::sun::star::beans::XPropertySet#optional";"removePropertyChangeListener()" 58"SwXTextDocument";"com::sun::star::beans::XPropertySet#optional";"removePropertyChangeListener()"
59"SwXTextDocument";"com::sun::star::beans::XPropertySet#optional";"addVetoableChangeListener()" 59"SwXTextDocument";"com::sun::star::beans::XPropertySet#optional";"addVetoableChangeListener()"
60"SwXTextDocument";"com::sun::star::beans::XPropertySet#optional";"removeVetoableChangeListener()" 60"SwXTextDocument";"com::sun::star::beans::XPropertySet#optional";"removeVetoableChangeListener()"
61"SwXTextDocument";"com::sun::star::document::XDocumentInfoSupplier#optional";"getDocumentInfo()"
62"SwXTextDocument";"com::sun::star::text::GenericTextDocument";"CharLocale#optional" 61"SwXTextDocument";"com::sun::star::text::GenericTextDocument";"CharLocale#optional"
63"SwXTextDocument";"com::sun::star::text::GenericTextDocument";"CharacterCount#optional" 62"SwXTextDocument";"com::sun::star::text::GenericTextDocument";"CharacterCount#optional"
64"SwXTextDocument";"com::sun::star::text::GenericTextDocument";"ParagraphCount#optional" 63"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 5809f3e56eda..000000000000
--- a/qadevOOo/tests/java/ifc/document/_DocumentInfo.java
+++ /dev/null
@@ -1,142 +0,0 @@
1/*
2 * This file is part of the LibreOffice project.
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 *
8 * This file incorporates work covered by the following license notice:
9 *
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
17 */
18
19package ifc.document;
20
21import lib.MultiPropertyTest;
22
23import com.sun.star.util.DateTime;
24
25/**
26* Testing <code>com.sun.star.document.DocumentInfo</code>
27* service properties : <p>
28* <ul>
29* <li> <code> Author </code> </li>
30* <li> <code> AutoloadEnabled </code> </li>
31* <li> <code> AutoloadSecs </code> </li>
32* <li> <code> AutoloadURL </code> </li>
33* <li> <code> BlindCopiesTo </code> </li>
34* <li> <code> CopyTo </code> </li>
35* <li> <code> CreationDate </code> </li>
36* <li> <code> DefaultTarget </code> </li>
37* <li> <code> Description </code> </li>
38* <li> <code> InReplyTo </code> </li>
39* <li> <code> IsEncrypted </code> </li>
40* <li> <code> Keywords </code> </li>
41* <li> <code> MIMEType </code> </li>
42* <li> <code> ModifiedBy </code> </li>
43* <li> <code> ModifyDate </code> </li>
44* <li> <code> Newsgroups </code> </li>
45* <li> <code> Original </code> </li>
46* <li> <code> PrintDate </code> </li>
47* <li> <code> PrintedBy </code> </li>
48* <li> <code> Priority </code> </li>
49* <li> <code> Recipient </code> </li>
50* <li> <code> References </code> </li>
51* <li> <code> ReplyTo </code> </li>
52* <li> <code> Template </code> </li>
53* <li> <code> TemplateDate </code> </li>
54* <li> <code> Theme </code> </li>
55* <li> <code> Title </code> </li>
56* </ul>
57* Properties testing is automated by <code>lib.MultiPropertyTest</code>.
58* @see com.sun.star.document.DocumentInfo
59*/
60public class _DocumentInfo extends MultiPropertyTest {
61
62 /**
63 * Overrides compare method. Can compare <code>DateTime</code>
64 * structures.
65 */
66 protected boolean compare(Object ob1, Object ob2) {
67 if (ob1 instanceof DateTime && ob2 instanceof DateTime) {
68 DateTime dt1 = (DateTime)ob1;
69 DateTime dt2 = (DateTime)ob2;
70
71 return dt1.Year == dt2.Year
72 && dt1.Month == dt2.Month
73 && dt1.Day == dt2.Day
74 && dt1.Hours == dt2.Hours
75 && dt1.Minutes == dt2.Minutes
76 && dt1.Seconds == dt2.Seconds
77 && dt1.HundredthSeconds == dt2.HundredthSeconds;
78 } else {
79 return super.compare(ob1, ob2);
80 }
81 }
82
83 /**
84 * Prints DateTime.
85 */
86 protected String toString(Object obj) {
87 if (obj instanceof DateTime) {
88 DateTime dt = (DateTime)obj;
89
90 return dt.Year + ":" + dt.Month + ":" + dt.Day
91 + ":" + dt.Hours + ":" + dt.Minutes
92 + ":" + dt.Seconds + ":" + dt.HundredthSeconds;
93 } else {
94 return super.toString(obj);
95 }
96 }
97
98 /**
99 * Tester for properties with <code>DateTime</code> type which
100 * creates new structure if old property value was null.
101 */
102 class DatePropertyTester extends PropertyTester {
103 protected Object getNewValue(String propName,
104 Object oldValue) {
105 if (oldValue == null || util.utils.isVoid(oldValue)) {
106 DateTime dt = new DateTime();
107
108 dt.Year = 2000;
109 dt.Month = 10;
110 dt.Day = 18;
111 dt.Hours = 19;
112 dt.Minutes = 41;
113
114 return dt;
115 } else {
116 return super.getNewValue(propName, oldValue);
117 }
118 }
119 }
120
121 /**
122 * Can be void.
123 */
124 public void _PrintDate() {
125 testProperty("PrintDate", new DatePropertyTester());
126 }
127
128 /**
129 * Can be void.
130 */
131 public void _TemplateDate() {
132 testProperty("TemplateDate", new DatePropertyTester());
133 }
134
135 /**
136 * Can be void.
137 */
138 public void _ModifyDate() {
139 testProperty("ModifyDate", new DatePropertyTester());
140 }
141}
142
diff --git a/qadevOOo/tests/java/ifc/document/_XDocumentInfo.java b/qadevOOo/tests/java/ifc/document/_XDocumentInfo.java
deleted file mode 100644
index 02c371df261b..000000000000
--- a/qadevOOo/tests/java/ifc/document/_XDocumentInfo.java
+++ /dev/null
@@ -1,215 +0,0 @@
1/*
2 * This file is part of the LibreOffice project.
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 *
8 * This file incorporates work covered by the following license notice:
9 *
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
17 */
18
19package ifc.document;
20
21import lib.MultiMethodTest;
22
23import com.sun.star.document.XDocumentInfo;
24import com.sun.star.lang.ArrayIndexOutOfBoundsException;
25
26/**
27* Testing <code>com.sun.star.document.XDocumentInfo</code>
28* interface methods :
29* <ul>
30* <li><code> getUserFieldCount()</code></li>
31* <li><code> getUserFieldName()</code></li>
32* <li><code> setUserFieldName()</code></li>
33* <li><code> getUserFieldValue()</code></li>
34* <li><code> setUserFieldValue()</code></li>
35* </ul> <p>
36* Test is <b> NOT </b> multithread compilant. <p>
37* @see com.sun.star.document.XDocumentInfo
38*/
39public class _XDocumentInfo extends MultiMethodTest {
40
41 public XDocumentInfo oObj = null;
42
43 short fieldCount;
44
45 /**
46 * Gets user field count. <p>
47 * Has <b> OK </b> status if count is positive.
48 */
49 public void _getUserFieldCount() {
50 fieldCount = oObj.getUserFieldCount();
51 tRes.tested("getUserFieldCount()", fieldCount >= 0);
52 }
53
54 String[] oldNames;
55 String[] oldValues;
56
57 /**
58 * Retrieves all user field names and stores them. <p>
59 * Has <b> OK </b> status if no exceptions were thrown and
60 * names returned are not <code>null</code> values. <p>
61 * The following method tests are to be completed successfully before :
62 * <ul>
63 * <li> <code> getUserFieldCount() </code> : to obtain number of
64 * fields </li>
65 * </ul>
66 */
67 public void _getUserFieldName() {
68 requiredMethod("getUserFieldCount()");
69
70 oldNames = new String[fieldCount];
71
72 for (short i = 0; i < fieldCount; i++) {
73 try {
74 oldNames[i] = oObj.getUserFieldName(i);
75 if (oldNames[i] == null) {
76 tRes.tested("getUserFieldName()", false);
77 return;
78 }
79 } catch (ArrayIndexOutOfBoundsException e) {
80 log.println("Couldn't get an user field name at " + i);
81 tRes.tested("getUserFieldName()", false);
82 return;
83 }
84 }
85
86 tRes.tested("getUserFieldName()", true);
87 }
88
89 /**
90 * For each field its name changed and the checked if it's properly
91 * changed. Finally old names are restored.<p>
92 * Has <b> OK </b> status if names were properly changed. <p>
93 * The following method tests are to be completed successfully before :
94 * <ul>
95 * <li> <code> getUserFieldName() </code> : to retrieve old names </li>
96 * </ul>
97 */
98 public void _setUserFieldName() {
99 requiredMethod("getUserFieldName()");
100
101 for (short i = 0; i < fieldCount; i++) {
102 String newName = oldNames[i] + "_new";
103
104 try {
105 oObj.setUserFieldName(i, newName);
106 } catch (ArrayIndexOutOfBoundsException e) {
107 log.println("Couldn't set an user field name at " + i);
108 tRes.tested("setUserFieldName()", false);
109 return;
110 }
111
112 try {
113 if (!newName.equals(oObj.getUserFieldName(i))) {
114 tRes.tested("setUserFieldName()", false);
115 return;
116 }
117 } catch (ArrayIndexOutOfBoundsException e) {
118 log.println("Couldn't set an user field name at " + i);
119 tRes.tested("setUserFieldName()", false);
120 return;
121 } finally {
122 try {
123 oObj.setUserFieldName(i, oldNames[i]);
124 } catch (ArrayIndexOutOfBoundsException e) {
125 log.println("Couldn't restore an user field name at " + i);
126 tRes.tested("setUserFieldName()", false);
127 return;
128 }
129 }
130 }
131
132 tRes.tested("setUserFieldName()", true);
133 }
134
135
136 /**
137 * Retrieves all user field values and stores them. <p>
138 * Has <b> OK </b> status if no exceptions were thrown and
139 * values returned are not <code>null</code> values. <p>
140 * The following method tests are to be completed successfully before :
141 * <ul>
142 * <li> <code> getUserFieldCount() </code> : to obtain number of
143 * fields </li>
144 * </ul>
145 */
146 public void _getUserFieldValue() {
147 requiredMethod("getUserFieldCount()");
148
149 oldValues = new String[fieldCount];
150
151 for (short i = 0; i < fieldCount; i++) {
152 try {
153 oldValues[i] = oObj.getUserFieldValue(i);
154 if (oldValues[i] == null) {
155 tRes.tested("getUserFieldValue()", false);
156 return;
157 }
158 } catch (ArrayIndexOutOfBoundsException e) {
159 log.println("Couldn't get an user field value at " + i);
160 tRes.tested("getUserFieldValue()", false);
161 return;
162 }
163 }
164
165 tRes.tested("getUserFieldValue()", true);
166 }
167
168 /**
169 * For each field its value changed and the checked if it's properly
170 * changed. Finally old values are restored.<p>
171 * Has <b> OK </b> status if values were properly changed. <p>
172 * The following method tests are to be completed successfully before :
173 * <ul>
174 * <li> <code> getUserFieldValue() </code> : to retrieve old values. </li>
175 * </ul>
176 */
177 public void _setUserFieldValue() {
178 requiredMethod("getUserFieldValue()");
179
180 for (short i = 0; i < fieldCount; i++) {
181 String newValue = oldValues[i] + "_new";
182
183 try {
184 oObj.setUserFieldValue(i, newValue);
185 } catch (ArrayIndexOutOfBoundsException e) {
186 log.println("Couldn't set an user field value at " + i);
187 tRes.tested("setUserFieldValue()", false);
188 return;
189 }
190
191 try {
192 if (!newValue.equals(oObj.getUserFieldValue(i))) {
193 tRes.tested("setUserFieldValue()", false);
194 return;
195 }
196 } catch (ArrayIndexOutOfBoundsException e) {
197 log.println("Couldn't set an user field value at " + i);
198 tRes.tested("setUserFieldValue()", false);
199 return;
200 } finally {
201 try {
202 oObj.setUserFieldValue(i, oldNames[i]);
203 } catch (ArrayIndexOutOfBoundsException e) {
204 log.println("Couldn't restore an user field value at " + i);
205 tRes.tested("setUserFieldValue()", false);
206 return;
207 }
208 }
209 }
210
211 tRes.tested("setUserFieldValue()", true);
212 }
213
214} // finish class _XDocumentInfo
215
diff --git a/qadevOOo/tests/java/ifc/document/_XDocumentInfoSupplier.java b/qadevOOo/tests/java/ifc/document/_XDocumentInfoSupplier.java
deleted file mode 100644
index 5810ae83dabf..000000000000
--- a/qadevOOo/tests/java/ifc/document/_XDocumentInfoSupplier.java
+++ /dev/null
@@ -1,47 +0,0 @@
1/*
2 * This file is part of the LibreOffice project.
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 *
8 * This file incorporates work covered by the following license notice:
9 *
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
17 */
18package ifc.document;
19
20import com.sun.star.beans.XPropertySet;
21import com.sun.star.document.XDocumentInfo;
22import com.sun.star.document.XDocumentInfoSupplier;
23import com.sun.star.uno.UnoRuntime;
24import lib.MultiMethodTest;
25
26/**
27 * test the XDocumentInfoSupplier interface.
28 */
29public class _XDocumentInfoSupplier extends MultiMethodTest {
30 public XDocumentInfoSupplier oObj = null;
31
32 public void _getDocumentInfo() {
33 // returns a com.sun.star.document.DocumentInfo
34 XDocumentInfo info = oObj.getDocumentInfo();
35 XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, info);
36 String title = null;
37 try {
38 title = (String)xPropertySet.getPropertyValue("Title");
39 }
40 catch(Exception e) {
41 e.printStackTrace(log);
42 title = null;
43 }
44 log.println("Got document title: " + title);
45 tRes.tested("getDocumentInfo()", title != null);
46 }
47}
diff --git a/qadevOOo/tests/java/ifc/document/_XStandaloneDocumentInfo.java b/qadevOOo/tests/java/ifc/document/_XStandaloneDocumentInfo.java
deleted file mode 100644
index 88f60d43573a..000000000000
--- a/qadevOOo/tests/java/ifc/document/_XStandaloneDocumentInfo.java
+++ /dev/null
@@ -1,120 +0,0 @@
1/*
2 * This file is part of the LibreOffice project.
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 *
8 * This file incorporates work covered by the following license notice:
9 *
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
17 */
18
19package ifc.document;
20
21import lib.MultiMethodTest;
22import lib.Status;
23import lib.StatusException;
24
25import com.sun.star.beans.XPropertySet;
26import com.sun.star.document.XStandaloneDocumentInfo;
27import com.sun.star.io.IOException;
28import com.sun.star.uno.UnoRuntime;
29
30/**
31* Testing <code>com.sun.star.document.XStandaloneDocumentInfo</code>
32* interface methods. <p>
33* This test needs the following object relations :
34* <ul>
35* <li> <code>'DOCURL'</code> (of type <code>String</code>):
36* URL of document which info is loaded.</li>
37* <ul> <p>
38* Test is <b> NOT </b> multithread compilant. <p>
39* @see com.sun.star.document.XStandaloneDocumentInfo
40*/
41public class _XStandaloneDocumentInfo extends MultiMethodTest {
42
43 public XStandaloneDocumentInfo oObj = null;
44 String url = null;
45
46 protected void before() {
47 url = (String)tEnv.getObjRelation("DOCURL");
48 if (url == null) {
49 throw new StatusException
50 (Status.failed("Relation 'DOCURL' not found"));
51 }
52 }
53
54 String oldProp = null;
55 String newProp = null;
56 /**
57 * Sets new value of the property 'Author' and calls the method. <p>
58 * Has <b> OK </b> status if no exception occurred.
59 */
60 public void _storeIntoURL() {
61 try {
62 oObj.loadFromURL(url);
63 XPropertySet propSet = UnoRuntime.queryInterface(XPropertySet.class, oObj);
64 oldProp = (String)propSet.getPropertyValue("Author");
65 newProp = oldProp + "_";
66 propSet.setPropertyValue("Author", newProp);
67
68 oObj.storeIntoURL(url);
69 tRes.tested("storeIntoURL()", true);
70 } catch (IOException e) {
71 log.println("Couldn't store to " + url
72 + " : " + e.getMessage());
73 e.printStackTrace(log);
74 tRes.tested("storeIntoURL()", false);
75 } catch(com.sun.star.lang.WrappedTargetException e) {
76 log.println("Couldn't get/set property 'Author':" + e);
77 tRes.tested("storeIntoURL()", false);
78 } catch(com.sun.star.beans.UnknownPropertyException e) {
79 log.println("Couldn't get/set property 'Author':" + e);
80 tRes.tested("storeIntoURL()", false);
81 } catch(com.sun.star.lang.IllegalArgumentException e) {
82 log.println("Couldn't get/set property 'Author':" + e);
83 tRes.tested("storeIntoURL()", false);
84 } catch(com.sun.star.beans.PropertyVetoException e) {
85 log.println("Couldn't get/set property 'Author':" + e);
86 tRes.tested("storeIntoURL()", false);
87 }
88 }
89
90 /**
91 * Calls the method and checks value of the property 'Author'. <p>
92 * Has <b> OK </b> status if no exception occurred and value of the property
93 * 'Author' is equal to value that was set in the method
94 * <code>storeIntoURL</code>.
95 */
96 public void _loadFromURL() {
97 requiredMethod("storeIntoURL()");
98 try {
99 oObj.loadFromURL(url);
100 XPropertySet propSet = UnoRuntime.queryInterface(XPropertySet.class, oObj);
101 String resProp = (String)propSet.getPropertyValue("Author");
102 log.println("Was: '" + oldProp + "',Set: '" + newProp +
103 "', New: " + resProp + "'");
104 tRes.tested("loadFromURL()", resProp.equals(newProp) );
105 } catch (IOException e) {
106 log.println("Couldn't load from " + url
107 + " : " + e.getMessage());
108 e.printStackTrace(log);
109 tRes.tested("loadFromURL()", false);
110 } catch(com.sun.star.lang.WrappedTargetException e) {
111 log.println("Couldn't get/set property 'Author':" + e);
112 tRes.tested("loadFromURL()", false);
113 } catch(com.sun.star.beans.UnknownPropertyException e) {
114 log.println("Couldn't get/set property 'Author':" + e);
115 tRes.tested("loadFromURL()", false);
116 }
117 }
118
119} // finish class _XStandaloneDocumentInfo
120
diff --git a/qadevOOo/tests/java/mod/_fwk/DocumentProperties.java b/qadevOOo/tests/java/mod/_fwk/DocumentProperties.java
deleted file mode 100644
index 97ebe692a24f..000000000000
--- a/qadevOOo/tests/java/mod/_fwk/DocumentProperties.java
+++ /dev/null
@@ -1,120 +0,0 @@
1/*
2 * This file is part of the LibreOffice project.
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 *
8 * This file incorporates work covered by the following license notice:
9 *
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
17 */
18
19package mod._fwk;
20
21import java.io.PrintWriter;
22
23import lib.StatusException;
24import lib.TestCase;
25import lib.TestEnvironment;
26import lib.TestParameters;
27import util.SOfficeFactory;
28
29import com.sun.star.document.XDocumentInfoSupplier;
30import com.sun.star.lang.XMultiServiceFactory;
31import com.sun.star.text.XTextDocument;
32import com.sun.star.uno.UnoRuntime;
33import com.sun.star.uno.XInterface;
34
35/**
36* Test for object which is represented by service
37* <code>com.sun.star.document.DocumentInfo</code>. <p>
38* Object implements the following interfaces :
39* <ul>
40* <li><code>com::sun::star::beans::XFastPropertySet</code></li>
41* <li><code>com::sun::star::beans::XPropertySet</code></li>
42* <li><code>com::sun::star::document::XDocumentInfo</code></li>
43* <li><code>com::sun::star::document::XStandaloneDocumentInfo</code></li>
44* <li><code>com::sun::star::lang::XComponent</code></li>
45* </ul><p>
46* @see com.sun.star.beans.XFastPropertySet
47* @see com.sun.star.beans.XPropertySet
48* @see com.sun.star.document.XDocumentInfo
49* @see com.sun.star.document.XStandaloneDocumentInfo
50* @see com.sun.star.lang.XComponent
51* @see ifc.beans._XFastPropertySet
52* @see ifc.beans._XPropertySet
53* @see ifc.document._XDocumentInfo
54* @see ifc.document._XStandaloneDocumentInfo
55* @see ifc.lang._XComponent
56*/
57public class DocumentProperties extends TestCase {
58
59 XTextDocument xTextDoc;
60
61 /**
62 * Disposes the document, if exists, created in
63 * <code>createTestEnvironment</code> method.
64 */
65 protected void cleanup( TestParameters Param, PrintWriter log) {
66
67 log.println("disposing xTextDoc");
68
69 if (xTextDoc != null) {
70 xTextDoc.dispose();
71 }
72 }
73
74 /**
75 * Creates a text document.
76 * Obtains the property <code>'DocumentInfo'</code> of the created document.
77 */
78 public TestEnvironment createTestEnvironment( TestParameters Param,
79 PrintWriter log ) throws StatusException {
80
81 XInterface oObj = null;
82
83 log.println( "creating a test environment" );
84
85 if (xTextDoc != null) xTextDoc.dispose();
86
87 // get a soffice factory object
88 SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)Param.getMSF());
89
90 try {
91 log.println( "creating a text document" );
92 xTextDoc = SOF.createTextDoc(null);
93 } catch ( com.sun.star.uno.Exception e ) {
94 // Some exception occures.FAILED
95 e.printStackTrace( log );
96 throw new StatusException( "Couldn't create document", e );
97 }
98
99 shortWait();
100
101 XDocumentInfoSupplier xdis = UnoRuntime.queryInterface(XDocumentInfoSupplier.class, xTextDoc);
102 //oObj = (XInterface)UnoRuntime.queryInterface(XInterface.class, docInfo);
103 oObj = xdis.getDocumentInfo();
104 TestEnvironment tEnv = new TestEnvironment( oObj );
105
106 return tEnv;
107 } // finish method getTestEnvironment
108
109 /**
110 * Sleeps for 0.5 sec. to allow StarOffice to react on <code>
111 * reset</code> call.
112 */
113 private void shortWait() {
114 try {
115 Thread.sleep(500) ;
116 } catch (InterruptedException e) {
117 log.println("While waiting :" + e) ;
118 }
119 }
120}
diff --git a/qadevOOo/tests/java/mod/_sfx/StandaloneDocumentInfo.java b/qadevOOo/tests/java/mod/_sfx/StandaloneDocumentInfo.java
deleted file mode 100644
index f3ec7a1cbe6a..000000000000
--- a/qadevOOo/tests/java/mod/_sfx/StandaloneDocumentInfo.java
+++ /dev/null
@@ -1,123 +0,0 @@
1/*
2 * This file is part of the LibreOffice project.
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 *
8 * This file incorporates work covered by the following license notice:
9 *
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
17 */
18
19package mod._sfx;
20
21import java.io.PrintWriter;
22
23import lib.StatusException;
24import lib.TestCase;
25import lib.TestEnvironment;
26import lib.TestParameters;
27import util.utils;
28
29import com.sun.star.document.XStandaloneDocumentInfo;
30import com.sun.star.lang.XMultiServiceFactory;
31import com.sun.star.uno.UnoRuntime;
32import com.sun.star.uno.XInterface;
33
34/**
35 * Test for object which is represented by service
36 * <code>com.sun.star.document.StandaloneDocumentInfo</code>. <p>
37 * Object implements the following interfaces :
38 * <ul>
39 * <li> <code>com::sun::star::lang::XComponent</code></li>
40 * <li> <code>com::sun::star::document::DocumentInfo</code></li>
41 * <li> <code>com::sun::star::document::XDocumentInfo</code></li>
42 * <li> <code>com::sun::star::document::XStandaloneDocumentInfo</code></li>
43 * <li> <code>com::sun::star::beans::XFastPropertySet</code></li>
44 * <li> <code>com::sun::star::beans::XPropertySet</code></li>
45 * </ul> <p>
46 * The following files used by this test :
47 * <ul>
48 * <li><b> SfxStandaloneDocInfoObject.sdw </b> : is copied
49 * to SOffice temporary directory and is used to load and
50 * save its info. </li>
51 * </ul> <p>
52 * This object test <b> is NOT </b> designed to be run in several
53 * threads concurently.
54 *
55 * @see com.sun.star.lang.XComponent
56 * @see com.sun.star.document.DocumentInfo
57 * @see com.sun.star.document.XDocumentInfo
58 * @see com.sun.star.document.XStandaloneDocumentInfo
59 * @see com.sun.star.beans.XFastPropertySet
60 * @see com.sun.star.beans.XPropertySet
61 * @see ifc.lang._XComponent
62 * @see ifc.document._DocumentInfo
63 * @see ifc.document._XDocumentInfo
64 * @see ifc.document._XStandaloneDocumentInfo
65 * @see ifc.beans._XFastPropertySet
66 * @see ifc.beans._XPropertySet
67 */
68public class StandaloneDocumentInfo extends TestCase {
69
70 String destUrl = null ;
71
72 /**
73 * Copies file 'SfxStandaloneDocInfoObject.sdw' to tempopary
74 * location (overwriting the old file if exists).
75 */
76 protected void initialize( TestParameters tParam, PrintWriter log ) {
77 String srcUrl = utils.getFullTestURL("SfxStandaloneDocInfoObject.sdw") ;
78 destUrl = utils.getOfficeTemp((XMultiServiceFactory)tParam.getMSF()) +
79 "SfxStandaloneDocInfoObject.sdw";
80
81 utils.doOverwriteFile((XMultiServiceFactory)tParam.getMSF(), srcUrl, destUrl) ;
82 }
83
84 /**
85 * Creating a Testenvironment for the interfaces to be tested.
86 * Creates an instance of the service
87 * <code>com.sun.star.document.StandaloneDocumentInfo</code>.
88 * Object relations created :
89 * <ul>
90 * <li> <code>'DOCURL'</code> for
91 * {@link ifc.document._XStandaloneDocumentInfo} :
92 * the Writer file URL in temporary location. </li>
93 * </ul>
94 */
95 protected TestEnvironment createTestEnvironment
96 (TestParameters tParam, PrintWriter log) {
97 XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF();
98 XInterface oObj = null;
99
100 try {
101 oObj = (XInterface)xMSF.createInstance
102 ("com.sun.star.document.StandaloneDocumentInfo");
103 } catch (com.sun.star.uno.Exception e) {
104 e.printStackTrace(log);
105 throw new StatusException("Unexpected exception", e);
106 }
107
108 String Iname = util.utils.getImplName(oObj);
109 log.println("Implementation Name: "+Iname);
110 TestEnvironment tEnv = new TestEnvironment(oObj);
111 XStandaloneDocumentInfo the_info = UnoRuntime.queryInterface(XStandaloneDocumentInfo.class, oObj);
112 try {
113 the_info.loadFromURL(destUrl);
114 } catch (com.sun.star.io.IOException e) {
115 e.printStackTrace(log);
116 throw new StatusException("Couldn't load document: " + destUrl,e);
117 }
118 tEnv.addObjRelation("DOCURL",destUrl);
119 return tEnv;
120 }
121
122} // finish class TestCase
123
diff --git a/sfx2/JunitTest_sfx2_complex.mk b/sfx2/JunitTest_sfx2_complex.mk
index abe36164b2d8..cb77929c3632 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,\
34)) 34))
35 35
36$(eval $(call gb_JunitTest_add_sourcefiles,sfx2_complex,\ 36$(eval $(call gb_JunitTest_add_sourcefiles,sfx2_complex,\
37 sfx2/qa/complex/sfx2/DocumentInfo \
38 sfx2/qa/complex/sfx2/DocumentMetadataAccess \ 37 sfx2/qa/complex/sfx2/DocumentMetadataAccess \
39 sfx2/qa/complex/sfx2/DocumentProperties \ 38 sfx2/qa/complex/sfx2/DocumentProperties \
40 sfx2/qa/complex/sfx2/GlobalEventBroadcaster \ 39 sfx2/qa/complex/sfx2/GlobalEventBroadcaster \
41 sfx2/qa/complex/sfx2/StandaloneDocumentInfo \
42 sfx2/qa/complex/sfx2/UndoManager \ 40 sfx2/qa/complex/sfx2/UndoManager \
43 sfx2/qa/complex/sfx2/JUnitBasedTest \ 41 sfx2/qa/complex/sfx2/JUnitBasedTest \
44 sfx2/qa/complex/sfx2/DocumentEvents \ 42 sfx2/qa/complex/sfx2/DocumentEvents \
45 sfx2/qa/complex/sfx2/standalonedocinfo/StandaloneDocumentInfoTest \
46 sfx2/qa/complex/sfx2/standalonedocinfo/Test01 \
47 sfx2/qa/complex/sfx2/standalonedocinfo/TestHelper \
48 sfx2/qa/complex/sfx2/tools/DialogThread \ 43 sfx2/qa/complex/sfx2/tools/DialogThread \
49 sfx2/qa/complex/sfx2/tools/TestDocument \ 44 sfx2/qa/complex/sfx2/tools/TestDocument \
50 sfx2/qa/complex/sfx2/tools/WriterHelper \ 45 sfx2/qa/complex/sfx2/tools/WriterHelper \
@@ -59,7 +54,6 @@ $(eval $(call gb_JunitTest_add_sourcefiles,sfx2_complex,\
59)) 54))
60 55
61$(eval $(call gb_JunitTest_add_classes,sfx2_complex,\ 56$(eval $(call gb_JunitTest_add_classes,sfx2_complex,\
62 complex.sfx2.DocumentInfo \
63 complex.sfx2.DocumentProperties \ 57 complex.sfx2.DocumentProperties \
64 complex.sfx2.DocumentMetadataAccess \ 58 complex.sfx2.DocumentMetadataAccess \
65 complex.sfx2.DocumentEvents \ 59 complex.sfx2.DocumentEvents \
@@ -69,7 +63,5 @@ $(eval $(call gb_JunitTest_add_classes,sfx2_complex,\
69# complex.sfx2.UndoManager \ 63# complex.sfx2.UndoManager \
70# #i115674# fails currently: misses some OnUnfocus event 64# #i115674# fails currently: misses some OnUnfocus event
71# complex.sfx2.GlobalEventBroadcaster \ 65# complex.sfx2.GlobalEventBroadcaster \
72# breaks because binfilter export has been removed
73# complex.sfx2.StandaloneDocumentInfo \
74 66
75# vim: set noet sw=4 ts=4: 67# vim: set noet sw=4 ts=4:
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index 8a12ad9e9911..6cc8a1d5a64e 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -206,7 +206,6 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
206 sfx2/source/doc/objmisc \ 206 sfx2/source/doc/objmisc \
207 sfx2/source/doc/objserv \ 207 sfx2/source/doc/objserv \
208 sfx2/source/doc/objstor \ 208 sfx2/source/doc/objstor \
209 sfx2/source/doc/objuno \
210 sfx2/source/doc/objxtor \ 209 sfx2/source/doc/objxtor \
211 sfx2/source/doc/oleprops \ 210 sfx2/source/doc/oleprops \
212 sfx2/source/doc/ownsubfilterservice \ 211 sfx2/source/doc/ownsubfilterservice \
diff --git a/sfx2/inc/sfx2/objuno.hxx b/sfx2/inc/sfx2/objuno.hxx
deleted file mode 100644
index 3e18ad61527b..000000000000
--- a/sfx2/inc/sfx2/objuno.hxx
+++ /dev/null
@@ -1,186 +0,0 @@
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19#ifndef _SFX_OBJUNO_HXX
20#define _SFX_OBJUNO_HXX
21
22#include <com/sun/star/document/XDocumentInfo.hpp>
23#include <com/sun/star/document/XStandaloneDocumentInfo.hpp>
24#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
25#include <com/sun/star/util/XModifyListener.hpp>
26#include <com/sun/star/util/XModifyBroadcaster.hpp>
27#include <com/sun/star/beans/XPropertySet.hpp>
28#include <com/sun/star/beans/PropertyValue.hpp>
29#include <com/sun/star/beans/XFastPropertySet.hpp>
30#include <com/sun/star/beans/XVetoableChangeListener.hpp>
31#include <com/sun/star/beans/XPropertyChangeListener.hpp>
32#include <com/sun/star/beans/XPropertyContainer.hpp>
33#include <com/sun/star/beans/XPropertyAccess.hpp>
34#include <com/sun/star/lang/XEventListener.hpp>
35#include <com/sun/star/lang/XServiceInfo.hpp>
36#include <com/sun/star/embed/XStorage.hpp>
37#include <com/sun/star/lang/XComponent.hpp>
38#include <com/sun/star/lang/XInitialization.hpp>
39#include <com/sun/star/util/XCloneable.hpp>
40
41#include <com/sun/star/io/IOException.hpp>
42
43#include <svl/itemprop.hxx>
44#include <cppuhelper/implbase10.hxx>
45
46#include "sfxuno.hxx"
47
48
49// this is now just a wrapper around a XDocumentProperties instance
50
51class SAL_DLLPRIVATE SfxDocumentInfoObject: public ::cppu::WeakImplHelper10<
52 ::com::sun::star::document::XDocumentInfo,
53 ::com::sun::star::lang::XComponent,
54 ::com::sun::star::beans::XPropertySet,
55 ::com::sun::star::beans::XFastPropertySet,
56 ::com::sun::star::beans::XPropertyAccess,
57 ::com::sun::star::beans::XPropertyContainer,
58 ::com::sun::star::document::XDocumentPropertiesSupplier,
59 ::com::sun::star::util::XModifyBroadcaster,
60 ::com::sun::star::lang::XInitialization,
61 ::com::sun::star::util::XCloneable>
62{
63protected:
64 struct SfxDocumentInfoObject_Impl* _pImp;
65
66public:
67 SfxDocumentInfoObject();
68 ~SfxDocumentInfoObject();
69
70 // XComponent
71 virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException );
72 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener) throw( ::com::sun::star::uno::RuntimeException );
73 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener) throw( ::com::sun::star::uno::RuntimeException );
74
75 // XPropertySet
76 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException );
77 virtual void SAL_CALL setPropertyValue(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue) throw(
78 ::com::sun::star::uno::RuntimeException,
79 ::com::sun::star::beans::UnknownPropertyException,
80 ::com::sun::star::beans::PropertyVetoException,
81 ::com::sun::star::lang::IllegalArgumentException,
82 ::com::sun::star::lang::WrappedTargetException);
83 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString& aPropertyName) throw(
84 ::com::sun::star::uno::RuntimeException,
85 ::com::sun::star::beans::UnknownPropertyException,
86 ::com::sun::star::lang::WrappedTargetException);
87 virtual void SAL_CALL addPropertyChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & aListener) throw(
88 ::com::sun::star::uno::RuntimeException,
89 ::com::sun::star::beans::UnknownPropertyException,
90 ::com::sun::star::lang::WrappedTargetException);
91 virtual void SAL_CALL removePropertyChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & aListener) throw(
92 ::com::sun::star::uno::RuntimeException,
93 ::com::sun::star::beans::UnknownPropertyException,
94 ::com::sun::star::lang::WrappedTargetException);
95 virtual void SAL_CALL addVetoableChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener) throw(
96 ::com::sun::star::uno::RuntimeException,
97 ::com::sun::star::beans::UnknownPropertyException,
98 ::com::sun::star::lang::WrappedTargetException);
99 virtual void SAL_CALL removeVetoableChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener) throw(
100 ::com::sun::star::uno::RuntimeException,
101 ::com::sun::star::beans::UnknownPropertyException,
102 ::com::sun::star::lang::WrappedTargetException);
103
104 // ::com::sun::star::beans::XFastPropertySet
105 virtual void SAL_CALL setFastPropertyValue(sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue) throw(
106 ::com::sun::star::uno::RuntimeException,
107 ::com::sun::star::beans::UnknownPropertyException,
108 ::com::sun::star::beans::PropertyVetoException,
109 ::com::sun::star::lang::IllegalArgumentException,
110 ::com::sun::star::lang::WrappedTargetException);
111 virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle) throw(
112 ::com::sun::star::uno::RuntimeException,
113 ::com::sun::star::beans::UnknownPropertyException,
114 ::com::sun::star::lang::WrappedTargetException);
115
116 // ::com::sun::star::beans::XPropertyAccess
117 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getPropertyValues() throw( ::com::sun::star::uno::RuntimeException );
118 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 );
119
120 // ::com::sun::star::beans::XPropertyContainer
121 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);
122 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);
123
124 // ::com::sun::star::document::XDocumentInfo
125 virtual sal_Int16 SAL_CALL getUserFieldCount() throw( ::com::sun::star::uno::RuntimeException );
126 virtual ::rtl::OUString SAL_CALL getUserFieldName(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException );
127 virtual ::rtl::OUString SAL_CALL getUserFieldValue(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException );
128 virtual void SAL_CALL setUserFieldName(sal_Int16 nIndex, const ::rtl::OUString& aName ) throw( ::com::sun::star::uno::RuntimeException );
129 virtual void SAL_CALL setUserFieldValue(sal_Int16 nIndex, const ::rtl::OUString& aValue ) throw( ::com::sun::star::uno::RuntimeException );
130
131 // ::com::sun::star::document::XDocumentPropertiesSupplier
132 virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties >
133 SAL_CALL getDocumentProperties()
134 throw (::com::sun::star::uno::RuntimeException);
135
136 // ::com::sun::star::util::XModifiable
137 virtual sal_Bool SAL_CALL isModified() throw (::com::sun::star::uno::RuntimeException);
138 virtual void SAL_CALL setModified( sal_Bool bModified ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
139
140 // ::com::sun::star::util::XModifyBroadcaster
141 virtual void SAL_CALL addModifyListener( const com::sun::star::uno::Reference< com::sun::star::util::XModifyListener >& xListener ) throw( ::com::sun::star::uno::RuntimeException ) ;
142 virtual void SAL_CALL removeModifyListener( const com::sun::star::uno::Reference< com::sun::star::util::XModifyListener > & xListener) throw( ::com::sun::star::uno::RuntimeException ) ;
143
144 // ::com::sun::star::lang::XInitialization:
145 virtual void SAL_CALL initialize(
146 const com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > & aArguments)
147 throw (com::sun::star::uno::RuntimeException,
148 com::sun::star::uno::Exception);
149
150 // ::com::sun::star::util::XCloneable:
151 virtual com::sun::star::uno::Reference<com::sun::star::util::XCloneable> SAL_CALL createClone()
152 throw (com::sun::star::uno::RuntimeException);
153
154 const SfxDocumentInfoObject& operator=( const SfxDocumentInfoObject & rOther);
155};
156
157class SAL_DLLPRIVATE SfxStandaloneDocumentInfoObject: public SfxDocumentInfoObject,
158 public ::com::sun::star::lang::XServiceInfo,
159 public ::com::sun::star::document::XStandaloneDocumentInfo
160{
161 ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > _xFactory;
162
163public:
164 SfxStandaloneDocumentInfoObject( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
165 virtual ~SfxStandaloneDocumentInfoObject();
166
167 void Clear();
168
169 // XInterface, XTypeProvider, XServiceInfo
170 SFX_DECL_XINTERFACE_XTYPEPROVIDER_XSERVICEINFO
171
172 // ::com::sun::star::document::XDocumentInfo
173 virtual sal_Int16 SAL_CALL getUserFieldCount() throw( ::com::sun::star::uno::RuntimeException );
174 virtual ::rtl::OUString SAL_CALL getUserFieldName(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException );
175 virtual ::rtl::OUString SAL_CALL getUserFieldValue(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException );
176 virtual void SAL_CALL setUserFieldName(sal_Int16 nIndex, const ::rtl::OUString& aName ) throw( ::com::sun::star::uno::RuntimeException );
177 virtual void SAL_CALL setUserFieldValue(sal_Int16 nIndex, const ::rtl::OUString& aValue ) throw( ::com::sun::star::uno::RuntimeException );
178
179 // ::com::sun::star::document::XStandaloneDocumentInfo
180 virtual void SAL_CALL loadFromURL(const ::rtl::OUString& aURL) throw( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException );
181 virtual void SAL_CALL storeIntoURL(const ::rtl::OUString& aURL) throw( ::com::sun::star::io::IOException );
182};
183
184#endif
185
186/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx
index 49e4dcae72be..486426a5879e 100644
--- a/sfx2/inc/sfx2/sfxbasemodel.hxx
+++ b/sfx2/inc/sfx2/sfxbasemodel.hxx
@@ -33,8 +33,6 @@
33#include <com/sun/star/container/XNameReplace.hpp> 33#include <com/sun/star/container/XNameReplace.hpp>
34#include <com/sun/star/frame/XController2.hpp> 34#include <com/sun/star/frame/XController2.hpp>
35#include <com/sun/star/document/XCmisDocument.hpp> 35#include <com/sun/star/document/XCmisDocument.hpp>
36#include <com/sun/star/document/XDocumentInfo.hpp>
37#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
38#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> 36#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
39#include <com/sun/star/document/XDocumentRecovery.hpp> 37#include <com/sun/star/document/XDocumentRecovery.hpp>
40#include <com/sun/star/document/XUndoManagerSupplier.hpp> 38#include <com/sun/star/document/XUndoManagerSupplier.hpp>
@@ -88,9 +86,9 @@
88#include <com/sun/star/task/XInteractionHandler.hpp> 86#include <com/sun/star/task/XInteractionHandler.hpp>
89 87
90//________________________________________________________________________________________________________ 88//________________________________________________________________________________________________________
91#ifndef INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_33 89#ifndef INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_32
92#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_33 90#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_32
93#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 33 91#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 32
94#include <comphelper/implbase_var.hxx> 92#include <comphelper/implbase_var.hxx>
95#endif 93#endif
96 94
@@ -123,8 +121,6 @@
123#define XNAMEREPLACE ::com::sun::star::container::XNameReplace 121#define XNAMEREPLACE ::com::sun::star::container::XNameReplace
124#define DOCEVENTOBJECT ::com::sun::star::document::EventObject 122#define DOCEVENTOBJECT ::com::sun::star::document::EventObject
125#define XDOCEVENTLISTENER ::com::sun::star::document::XEventListener 123#define XDOCEVENTLISTENER ::com::sun::star::document::XEventListener
126#define XDOCUMENTINFO ::com::sun::star::document::XDocumentInfo
127#define XDOCUMENTINFOSUPPLIER ::com::sun::star::document::XDocumentInfoSupplier
128#define XEVENTBROADCASTER ::com::sun::star::document::XEventBroadcaster 124#define XEVENTBROADCASTER ::com::sun::star::document::XEventBroadcaster
129#define XDOCUMENTEVENTBROADCASTER ::com::sun::star::document::XDocumentEventBroadcaster 125#define XDOCUMENTEVENTBROADCASTER ::com::sun::star::document::XDocumentEventBroadcaster
130#define XEVENTSSUPPLIER ::com::sun::star::document::XEventsSupplier 126#define XEVENTSSUPPLIER ::com::sun::star::document::XEventsSupplier
@@ -191,7 +187,6 @@ namespace sfx { namespace intern {
191 187
192 @implements XChild 188 @implements XChild
193 XComponent 189 XComponent
194 XDocumentInfoSupplier
195 document::XDocumentPropertiesSupplier 190 document::XDocumentPropertiesSupplier
196 rdf::XDocumentMetadataAccess 191 rdf::XDocumentMetadataAccess
197 XEventListener 192 XEventListener
@@ -210,8 +205,7 @@ namespace sfx { namespace intern {
210 SfxListener 205 SfxListener
211*/ 206*/
212 207
213typedef ::comphelper::WeakImplHelper33 < XCHILD 208typedef ::comphelper::WeakImplHelper32 < XCHILD
214 , XDOCUMENTINFOSUPPLIER
215 , ::com::sun::star::document::XDocumentPropertiesSupplier 209 , ::com::sun::star::document::XDocumentPropertiesSupplier
216 , ::com::sun::star::document::XCmisDocument 210 , ::com::sun::star::document::XCmisDocument
217 , ::com::sun::star::rdf::XDocumentMetadataAccess 211 , ::com::sun::star::rdf::XDocumentMetadataAccess
@@ -492,25 +486,6 @@ public:
492 486
493 virtual void SAL_CALL removeEventListener(const REFERENCE< XEVENTLISTENER >& aListener ) throw (::com::sun::star::uno::RuntimeException); 487 virtual void SAL_CALL removeEventListener(const REFERENCE< XEVENTLISTENER >& aListener ) throw (::com::sun::star::uno::RuntimeException);
494 488
495 //____________________________________________________________________________________________________
496 // XDocumentInfoSupplier
497 //____________________________________________________________________________________________________
498
499 /**___________________________________________________________________________________________________
500 @short -
501 @descr -
502
503 @seealso -
504
505 @param -
506
507 @return -
508
509 @onerror -
510 */
511
512 virtual REFERENCE< XDOCUMENTINFO > SAL_CALL getDocumentInfo() throw (::com::sun::star::uno::RuntimeException);
513
514 // XDocumentPropertiesSupplier 489 // XDocumentPropertiesSupplier
515 virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties > 490 virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties >
516 SAL_CALL getDocumentProperties() 491 SAL_CALL getDocumentProperties()
diff --git a/sfx2/qa/complex/sfx2/DocumentInfo.java b/sfx2/qa/complex/sfx2/DocumentInfo.java
deleted file mode 100644
index 1532a3cc14c4..000000000000
--- a/sfx2/qa/complex/sfx2/DocumentInfo.java
+++ /dev/null
@@ -1,338 +0,0 @@
1/*
2 * This file is part of the LibreOffice project.
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 *
8 * This file incorporates work covered by the following license notice:
9 *
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
17 */
18package complex.sfx2;
19
20import com.sun.star.beans.PropertyAttribute;
21import com.sun.star.beans.Property;
22import com.sun.star.beans.PropertyValue;
23import com.sun.star.beans.XPropertyContainer;
24import com.sun.star.beans.XPropertySet;
25import com.sun.star.beans.XPropertySetInfo;
26import com.sun.star.document.XDocumentInfo;
27import com.sun.star.document.XDocumentInfoSupplier;
28import com.sun.star.frame.XComponentLoader;
29import com.sun.star.frame.XStorable;
30import com.sun.star.lang.XComponent;
31import com.sun.star.lang.XMultiServiceFactory;
32import com.sun.star.text.XTextDocument;
33import com.sun.star.uno.UnoRuntime;
34import com.sun.star.util.Date;
35
36
37
38import util.DesktopTools;
39import util.WriterTools;
40
41import org.junit.After;
42import org.junit.AfterClass;
43import org.junit.BeforeClass;
44import org.junit.Test;
45import org.openoffice.test.OfficeConnection;
46import static org.junit.Assert.*;
47
48public class DocumentInfo
49{
50 XMultiServiceFactory m_xMSF = null;
51 XTextDocument xTextDoc = null;
52 XTextDocument xTextDocSecond = null;
53
54 @Test public void checkDocInfo() throws Exception
55 {
56 m_xMSF = getMSF();
57
58 System.out.println("check whether there is a valid MultiServiceFactory");
59
60 assertNotNull("## Couldn't get MultiServiceFactory make sure your Office is started", m_xMSF);
61
62 String tempdir = util.utils.getOfficeTemp/*Dir*/(m_xMSF);
63 String fs = System.getProperty("file.separator");
64
65 if (!tempdir.endsWith(fs))
66 {
67 tempdir += fs;
68 }
69 tempdir = util.utils.getFullURL(tempdir);
70 final String sTempDocument = tempdir + "DocInfo.oot";
71
72 if (true)
73 {
74 System.out.println("... done");
75
76
77 System.out.println("Opening a Writer document");
78 xTextDoc = WriterTools.createTextDoc(m_xMSF);
79 System.out.println("... done");
80
81 XDocumentInfoSupplier xDocInfoSup = UnoRuntime.queryInterface(XDocumentInfoSupplier.class, xTextDoc);
82 XDocumentInfo xDocInfo = xDocInfoSup.getDocumentInfo();
83 XPropertyContainer xPropContainer = UnoRuntime.queryInterface(XPropertyContainer.class, xDocInfo);
84
85 System.out.println("Trying to add a existing property");
86
87 boolean worked = addProperty(xPropContainer, "Author", (short) 0, "");
88 assertTrue("Could set an existing property", !worked);
89 System.out.println("...done");
90
91 System.out.println("Trying to add a integer property");
92 worked = addProperty(xPropContainer, "intValue", com.sun.star.beans.PropertyAttribute.READONLY, new Integer(17));
93 assertTrue("Couldn't set an integer property", worked);
94 System.out.println("...done");
95
96 System.out.println("Trying to add a double property");
97 worked = addProperty(xPropContainer, "doubleValue", com.sun.star.beans.PropertyAttribute.REMOVEABLE, new Double(17.7));
98 assertTrue("Couldn't set an double property", worked);
99 System.out.println("...done");
100
101 System.out.println("Trying to add a boolean property");
102 worked = addProperty(xPropContainer, "booleanValue", com.sun.star.beans.PropertyAttribute.REMOVEABLE, Boolean.TRUE);
103 assertTrue("Couldn't set an boolean property", worked);
104 System.out.println("...done");
105
106 System.out.println("Trying to add a date property");
107 worked = addProperty(xPropContainer, "dateValue", com.sun.star.beans.PropertyAttribute.REMOVEABLE, new Date());
108 assertTrue("Couldn't set an date property", worked);
109 System.out.println("...done");
110
111 System.out.println("trying to remove a read only Property");
112 try
113 {
114 xPropContainer.removeProperty("intValue");
115 fail("Could remove read only property");
116 }
117 catch (Exception e)
118 {
119 System.out.println("\tException was thrown " + e);
120 System.out.println("\t...OK");
121 }
122 System.out.println("...done");
123
124 XPropertySet xProps2 = UnoRuntime.queryInterface(XPropertySet.class, xPropContainer);
125 showPropertySet(xProps2);
126
127
128 System.out.println("Storing the document");
129 XStorable store = UnoRuntime.queryInterface(XStorable.class, xTextDoc);
130 store.storeToURL(sTempDocument, new PropertyValue[] {});
131 DesktopTools.closeDoc(xTextDoc);
132
133 System.out.println("...done");
134 }
135
136
137 if (true)
138 {
139 System.out.println("loading the document");
140
141 XComponentLoader xCL = UnoRuntime.queryInterface(XComponentLoader.class, m_xMSF.createInstance("com.sun.star.frame.Desktop"));
142 XComponent xComp = xCL.loadComponentFromURL(sTempDocument, "_blank", 0, new PropertyValue[] {});
143 xTextDocSecond = UnoRuntime.queryInterface(XTextDocument.class, xComp);
144
145 System.out.println("...done");
146
147 XDocumentInfoSupplier xDocInfoSup = UnoRuntime.queryInterface(XDocumentInfoSupplier.class, xTextDocSecond);
148 XDocumentInfo xDocInfo = xDocInfoSup.getDocumentInfo();
149 XPropertyContainer xPropContainer = UnoRuntime.queryInterface(XPropertyContainer.class, xDocInfo);
150
151 XPropertySet xProps = UnoRuntime.queryInterface(XPropertySet.class, xDocInfo);
152 showPropertySet(xProps);
153
154 assertTrue("Double doesn't work", checkType(xProps, "doubleValue", "java.lang.Double"));
155 assertTrue("Boolean doesn't work", checkType(xProps, "booleanValue", "java.lang.Boolean"));
156
157 // TODO: dateValue does not exist.
158 // assertTrue("Date doesn't work", checkType(xProps, "dateValue", "com.sun.star.util.DateTime"));
159
160 // TODO: is java.lang.Double
161 // assertTrue("Integer doesn't work", checkType(xProps, "intValue", "java.lang.Integer"));
162
163 xPropContainer = UnoRuntime.queryInterface(XPropertyContainer.class, xDocInfo);
164
165 System.out.println("trying to remove a not user defined Property");
166 try
167 {
168 xPropContainer.removeProperty("Author");
169 fail("Could remove non user defined property");
170 }
171 catch (Exception e)
172 {
173 System.out.println("\tException was thrown " + e);
174 System.out.println("\t...OK");
175 }
176 System.out.println("...done");
177
178
179 System.out.println("Trying to remove a user defined property");
180 try
181 {
182 xPropContainer.removeProperty("booleanValue");
183 System.out.println("\t...OK");
184 }
185 catch (Exception e)
186 {
187 System.out.println("\tException was thrown " + e);
188 System.out.println("\t...FAILED");
189 fail("Could not remove user defined property");
190 }
191 showPropertySet(xProps);
192 System.out.println("...done");
193 }
194 }
195
196 @After public void cleanup()
197 {
198 DesktopTools.closeDoc(xTextDocSecond);
199 DesktopTools.closeDoc(xTextDoc);
200 }
201
202 private void showPropertySet(XPropertySet xProps)
203 {
204 try
205 {
206 // get an XPropertySet, here the one of a text cursor
207 // XPropertySet xCursorProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, mxDocCursor);
208
209 // get the property info interface of this XPropertySet
210 XPropertySetInfo xPropsInfo = xProps.getPropertySetInfo();
211
212 // get all properties (NOT the values) from XPropertySetInfo
213 Property[] aProps = xPropsInfo.getProperties();
214 int i;
215 for (i = 0; i < aProps.length; ++i) {
216 // number of property within this info object
217 System.out.print("Property #" + i);
218
219 // name of property
220 System.out.print(": Name<" + aProps[i].Name);
221
222 // handle of property (only for XFastPropertySet)
223 System.out.print("> Handle<" + aProps[i].Handle);
224
225 // type of property
226 System.out.print("> " + aProps[i].Type.toString());
227
228 // attributes (flags)
229 System.out.print(" Attributes<");
230 short nAttribs = aProps[i].Attributes;
231 if ((nAttribs & PropertyAttribute.MAYBEVOID) != 0)
232 System.out.print("MAYBEVOID|");
233 if ((nAttribs & PropertyAttribute.BOUND) != 0)
234 System.out.print("BOUND|");
235 if ((nAttribs & PropertyAttribute.CONSTRAINED) != 0)
236 System.out.print("CONSTRAINED|");
237 if ((nAttribs & PropertyAttribute.READONLY) != 0)
238 System.out.print("READONLY|");
239 if ((nAttribs & PropertyAttribute.TRANSIENT) != 0)
240 System.out.print("TRANSIENT|");
241 if ((nAttribs & PropertyAttribute.MAYBEAMBIGUOUS ) != 0)
242 System.out.print("MAYBEAMBIGUOUS|");
243 if ((nAttribs & PropertyAttribute.MAYBEDEFAULT) != 0)
244 System.out.print("MAYBEDEFAULT|");
245 if ((nAttribs & PropertyAttribute.REMOVEABLE) != 0)
246 System.out.print("REMOVEABLE|");
247 System.out.println("0>");
248 }
249 } catch (Exception e) {
250 // If anything goes wrong, give the user a stack trace
251 e.printStackTrace(System.err);
252 }
253 }
254
255 private boolean checkType(XPropertySet xProps, String aName,
256 String expected)
257 {
258 boolean ret = true;
259 System.out.println("Checking " + expected);
260
261 String getting =
262 getPropertyByName(xProps, aName).getClass().getName();
263
264 if (!getting.equals(expected))
265 {
266 System.out.println("\t Expected: " + expected);
267 System.out.println("\t Getting: " + getting);
268 ret = false;
269 }
270
271 if (ret)
272 {
273 System.out.println("...OK");
274 }
275 return ret;
276 }
277
278 private Object getPropertyByName(XPropertySet xProps, String aName)
279 {
280 Object ret = null;
281
282 try
283 {
284 ret = xProps.getPropertyValue(aName);
285 }
286 catch (Exception e)
287 {
288 System.out.println("\tCouldn't get Property " + aName);
289 System.out.println("\tMessage " + e);
290 }
291
292 return ret;
293 }
294
295 private boolean addProperty(XPropertyContainer xPropContainer,
296 String aName, short attr, Object defaults)
297 {
298 boolean ret = true;
299
300 try
301 {
302 xPropContainer.addProperty(aName, attr, defaults);
303 }
304 catch (Exception e)
305 {
306 ret = false;
307 System.out.println("\tCouldn't get Property " + aName);
308 System.out.println("\tMessage " + e);
309 }
310
311 return ret;
312 }
313
314 private XMultiServiceFactory getMSF()
315 {
316 final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
317 return xMSF1;
318 }
319
320 // setup and close connections
321 @BeforeClass public static void setUpConnection() throws Exception
322 {
323 System.out.println( "------------------------------------------------------------" );
324 System.out.println( "starting class: " + DocumentInfo.class.getName() );
325 System.out.println( "------------------------------------------------------------" );
326 connection.setUp();
327 }
328
329 @AfterClass public static void tearDownConnection()
330 throws InterruptedException, com.sun.star.uno.Exception
331 {
332 System.out.println( "------------------------------------------------------------" );
333 System.out.println( "finishing class: " + DocumentInfo.class.getName() );
334 System.out.println( "------------------------------------------------------------" );
335 connection.tearDown();
336 }
337 private static final OfficeConnection connection = new OfficeConnection();
338}
diff --git a/sfx2/qa/complex/sfx2/StandaloneDocumentInfo.java b/sfx2/qa/complex/sfx2/StandaloneDocumentInfo.java
deleted file mode 100644
index f7d9f679e8b0..000000000000
--- a/sfx2/qa/complex/sfx2/StandaloneDocumentInfo.java
+++ /dev/null
@@ -1,90 +0,0 @@
1/*
2 * This file is part of the LibreOffice project.
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 *
8 * This file incorporates work covered by the following license notice:
9 *
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
17 */
18package complex.sfx2;
19
20import com.sun.star.lang.XMultiServiceFactory;
21import com.sun.star.uno.UnoRuntime;
22import complex.sfx2.standalonedocinfo.StandaloneDocumentInfoTest;
23import complex.sfx2.standalonedocinfo.Test01;
24
25import org.junit.After;
26import org.junit.AfterClass;
27import org.junit.Before;
28import org.junit.BeforeClass;
29import org.junit.Test;
30import org.openoffice.test.OfficeConnection;
31import static org.junit.Assert.*;
32
33/* Document here
34*/
35
36public class StandaloneDocumentInfo {
37 private XMultiServiceFactory m_xMSF = null;
38
39 @Before public void before() {
40 try {
41 m_xMSF = getMSF();
42 } catch(Exception e) {
43 fail( "Failed to create service factory!" );
44 }
45 if( m_xMSF ==null ) {
46 fail( "Failed to create service factory!" );
47 }
48 }
49
50 @After public void after() {
51 m_xMSF = null;
52 }
53
54 @Test public void ExecuteTest01() {
55 StandaloneDocumentInfoTest aTest = new Test01 (m_xMSF);
56 assertTrue( "Test01 failed!", aTest.test() );
57 }
58
59
60
61
62 private XMultiServiceFactory getMSF()
63 {
64 final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
65 return xMSF1;
66 }
67
68 // setup and close connections
69 @BeforeClass public static void setUpConnection() throws Exception
70 {
71 System.out.println( "------------------------------------------------------------" );
72 System.out.println( "starting class: " + StandaloneDocumentInfo.class.getName() );
73 System.out.println( "------------------------------------------------------------" );
74 connection.setUp();
75 }
76
77 @AfterClass public static void tearDownConnection()
78 throws InterruptedException, com.sun.star.uno.Exception
79 {
80 System.out.println( "------------------------------------------------------------" );
81 System.out.println( "finishing class: " + StandaloneDocumentInfo.class.getName() );
82 System.out.println( "------------------------------------------------------------" );
83 connection.tearDown();
84 }
85
86 private static final OfficeConnection connection = new OfficeConnection();
87
88}
89
90
diff --git a/sfx2/qa/complex/sfx2/standalonedocinfo/StandaloneDocumentInfoTest.java b/sfx2/qa/complex/sfx2/standalonedocinfo/StandaloneDocumentInfoTest.java
deleted file mode 100644
index 83ba5bda80a5..000000000000
--- a/sfx2/qa/complex/sfx2/standalonedocinfo/StandaloneDocumentInfoTest.java
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * This file is part of the LibreOffice project.
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 *
8 * This file incorporates work covered by the following license notice:
9 *
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
17 */
18package complex.sfx2.standalonedocinfo;
19
20public interface StandaloneDocumentInfoTest {
21 boolean test();
22}
diff --git a/sfx2/qa/complex/sfx2/standalonedocinfo/Test01.java b/sfx2/qa/complex/sfx2/standalonedocinfo/Test01.java
deleted file mode 100644
index 66daa4fec787..000000000000
--- a/sfx2/qa/complex/sfx2/standalonedocinfo/Test01.java
+++ /dev/null
@@ -1,135 +0,0 @@
1/*
2 * This file is part of the LibreOffice project.
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 *
8 * This file incorporates work covered by the following license notice:
9 *
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
17 */
18package complex.sfx2.standalonedocinfo;
19
20import complex.sfx2.standalonedocinfo.TestHelper;
21import complex.sfx2.standalonedocinfo.StandaloneDocumentInfoTest;
22import com.sun.star.lang.XMultiServiceFactory;
23import com.sun.star.document.XStandaloneDocumentInfo;
24import com.sun.star.io.XTempFile;
25import com.sun.star.frame.XLoadable;
26import com.sun.star.frame.XStorable;
27import com.sun.star.beans.PropertyValue;
28import com.sun.star.beans.XPropertySet;
29import com.sun.star.uno.UnoRuntime;
30import com.sun.star.uno.AnyConverter;
31
32
33public class Test01 implements StandaloneDocumentInfoTest {
34 XMultiServiceFactory m_xMSF = null;
35 TestHelper m_aTestHelper = null;
36
37 public Test01 ( XMultiServiceFactory xMSF ) {
38 m_xMSF = xMSF;
39 m_aTestHelper = new TestHelper( "Test01: " );
40 }
41
42 public boolean test() {
43 try {
44 final String sDocTitle [] = new String [] {
45 "ODF_Doc", "OOo6_Doc", "old_binary_Doc" };
46 final String sFilterName [] = new String [] {
47 "writer8", "StarOffice XML (Writer)", "StarWriter 5.0" };
48
49 for (int i = 0; i < 3; ++i ) {
50 m_aTestHelper.Message ( "==============================" );
51 m_aTestHelper.Message ( sFilterName[i] );
52 m_aTestHelper.Message ( "==============================" );
53 //create a new temporary file
54 Object oTempFile = m_xMSF.createInstance ( "com.sun.star.io.TempFile" );
55 XTempFile xTempFile = UnoRuntime.queryInterface(XTempFile.class, oTempFile);
56
57 //create a text document and initiallize it
58 Object oTextDocument = m_xMSF.createInstance ( "com.sun.star.text.TextDocument" );
59 XLoadable xLoadable = UnoRuntime.queryInterface(XLoadable.class, oTextDocument);
60 xLoadable.initNew();
61 m_aTestHelper.Message ( "New document initialized." );
62
63 //store the instance to the temporary file URL
64 XStorable xStorable = UnoRuntime.queryInterface(XStorable.class, oTextDocument);
65 String sURL = AnyConverter.toString ( xTempFile.getUri () );
66 PropertyValue aProps[] = new PropertyValue[2];
67 aProps[0] = new PropertyValue();
68 aProps[0].Name = "DocumentTitle";
69 aProps[0].Value = sDocTitle[i];
70 aProps[1] = new PropertyValue();
71 aProps[1].Name = "FilterName";
72 aProps[1].Value = sFilterName[i];
73 m_aTestHelper.Message ( "Set title: " +
74 sDocTitle[i] );
75 xStorable.storeToURL ( sURL, aProps );
76 m_aTestHelper.Message ( "Document stored." );
77
78 //create StandaloneDocumentInfo object and load it from the file
79 Object oStandaloneDocInfo = m_xMSF.createInstance (
80 "com.sun.star.document.StandaloneDocumentInfo" );
81 XStandaloneDocumentInfo xStandaloneDocInfo =
82 UnoRuntime.queryInterface(XStandaloneDocumentInfo.class, oStandaloneDocInfo);
83 xStandaloneDocInfo.loadFromURL ( sURL );
84 m_aTestHelper.Message ( "StandaloneDocumentInfo loaded." );
85
86 //get the title from the object and check it
87 XPropertySet xPropSet =
88 UnoRuntime.queryInterface(XPropertySet.class, oStandaloneDocInfo);
89 String sTitle = xPropSet.getPropertyValue ( "Title" ).toString ();
90 m_aTestHelper.Message ( "Get title: " + sTitle );
91 if ( sTitle.compareTo ( sDocTitle[i] ) != 0 ) {
92 m_aTestHelper.Error ( "Title not match. Expected \""
93 + sDocTitle[i] +
94 "\"" );
95 return false;
96 } else {
97 m_aTestHelper.Message ( "Title matched." );
98 }
99
100 //set a new title to the object
101 sTitle += "_new";
102 xPropSet.setPropertyValue ( "Title", sTitle );
103 m_aTestHelper.Message ( "Set new title: " + sTitle );
104
105 //store the object to the same file
106 xStandaloneDocInfo.storeIntoURL ( sURL );
107 m_aTestHelper.Message ( "Document info stored." );
108
109 //create a new StandaloneDocumentInfo object and load it from the file
110 Object oStandaloneDocInfo_ = m_xMSF.createInstance (
111 "com.sun.star.document.StandaloneDocumentInfo" );
112 XStandaloneDocumentInfo xStandaloneDocInfo_ =
113 UnoRuntime.queryInterface(XStandaloneDocumentInfo.class, oStandaloneDocInfo_);
114 xStandaloneDocInfo_.loadFromURL ( sURL );
115 m_aTestHelper.Message ( "New StandaloneDocumentInfo loaded." );
116
117 //get the title and check it
118 XPropertySet xPropSet_ = UnoRuntime.queryInterface(XPropertySet.class, oStandaloneDocInfo_);
119 String sTitle_ = xPropSet_.getPropertyValue ( "Title" ).toString ();
120 m_aTestHelper.Message ( "Get new title: " + sTitle_ );
121 if ( sTitle_.compareTo ( sTitle ) != 0 ) {
122 m_aTestHelper.Error ( "New title not matched. Expected: \"" + sTitle
123 + "\"." );
124 return false;
125 } else {
126 m_aTestHelper.Message ( "New title matched." );
127 }
128 }
129 } catch ( Exception e ) {
130 m_aTestHelper.Error( "Exception: " + e );
131 return false;
132 }
133 return true;
134 }
135}
diff --git a/sfx2/qa/complex/sfx2/standalonedocinfo/TestHelper.java b/sfx2/qa/complex/sfx2/standalonedocinfo/TestHelper.java
deleted file mode 100644
index 18e5d5402cf7..000000000000
--- a/sfx2/qa/complex/sfx2/standalonedocinfo/TestHelper.java
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * This file is part of the LibreOffice project.
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 *
8 * This file incorporates work covered by the following license notice:
9 *
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
17 */
18package complex.sfx2.standalonedocinfo;
19
20
21public class TestHelper {
22
23 String m_sTestPrefix;
24
25 /** Creates a new instance of TestHelper
26 * @param sTestPrefix
27 */
28 public TestHelper ( String sTestPrefix ) {
29 m_sTestPrefix = sTestPrefix;
30 }
31
32 public void Error ( String sError ) {
33 System.out.println ( m_sTestPrefix + "Error: " + sError );
34 }
35
36 public void Message ( String sMessage ) {
37 System.out.println ( m_sTestPrefix + sMessage );
38 }
39}
diff --git a/sfx2/qa/unoapi/sfx.sce b/sfx2/qa/unoapi/sfx.sce
index ce72c463ee55..d75b95b31b56 100644
--- a/sfx2/qa/unoapi/sfx.sce
+++ b/sfx2/qa/unoapi/sfx.sce
@@ -2,4 +2,3 @@
2#i113306 -o sfx.DocumentTemplates 2#i113306 -o sfx.DocumentTemplates
3-o sfx.FrameLoader 3-o sfx.FrameLoader
4-o sfx.SfxMacroLoader 4-o sfx.SfxMacroLoader
5#i111283 -o sfx.StandaloneDocumentInfo
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index ffb4853e7ec1..0138f4168a00 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -105,7 +105,6 @@ using namespace ::com::sun::star::io;
105#include "frmload.hxx" 105#include "frmload.hxx"
106#include <sfx2/frame.hxx> 106#include <sfx2/frame.hxx>
107#include <sfx2/objsh.hxx> 107#include <sfx2/objsh.hxx>
108#include <sfx2/objuno.hxx>
109#include <sfx2/unoctitm.hxx> 108#include <sfx2/unoctitm.hxx>
110#include <sfx2/dispatch.hxx> 109#include <sfx2/dispatch.hxx>
111#include "doctemplates.hxx" 110#include "doctemplates.hxx"
@@ -2218,7 +2217,6 @@ SFX2_DLLPUBLIC void* SAL_CALL sfx_component_getFactory(
2218 IF_NAME_CREATECOMPONENTFACTORY( SfxGlobalEvents_Impl ) 2217 IF_NAME_CREATECOMPONENTFACTORY( SfxGlobalEvents_Impl )
2219 IF_NAME_CREATECOMPONENTFACTORY( SfxFrameLoader_Impl ) 2218 IF_NAME_CREATECOMPONENTFACTORY( SfxFrameLoader_Impl )
2220 IF_NAME_CREATECOMPONENTFACTORY( SfxMacroLoader ) 2219 IF_NAME_CREATECOMPONENTFACTORY( SfxMacroLoader )
2221 IF_NAME_CREATECOMPONENTFACTORY( SfxStandaloneDocumentInfoObject )
2222 IF_NAME_CREATECOMPONENTFACTORY( SfxAppDispatchProvider ) 2220 IF_NAME_CREATECOMPONENTFACTORY( SfxAppDispatchProvider )
2223 IF_NAME_CREATECOMPONENTFACTORY( SfxDocTplService ) 2221 IF_NAME_CREATECOMPONENTFACTORY( SfxDocTplService )
2224 IF_NAME_CREATECOMPONENTFACTORY( ShutdownIcon ) 2222 IF_NAME_CREATECOMPONENTFACTORY( ShutdownIcon )
diff --git a/sfx2/source/doc/objuno.cxx b/sfx2/source/doc/objuno.cxx
deleted file mode 100644
index 336affb2f2ba..000000000000
--- a/sfx2/source/doc/objuno.cxx
+++ /dev/null
@@ -1,1351 +0,0 @@
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20
21#include <com/sun/star/lang/DisposedException.hpp>
22#include <com/sun/star/util/DateTime.hpp>
23#include <com/sun/star/util/Date.hpp>
24#include <com/sun/star/util/Time.hpp>
25#include <com/sun/star/beans/PropertyAttribute.hpp>
26#include <com/sun/star/beans/NamedValue.hpp>
27#include <com/sun/star/beans/StringPair.hpp>
28#include <com/sun/star/embed/ElementModes.hpp>
29#include <com/sun/star/xml/sax/XParser.hpp>
30#include <com/sun/star/document/XImporter.hpp>
31#include <com/sun/star/document/XExporter.hpp>
32#include <com/sun/star/io/XActiveDataSource.hpp>
33#include <com/sun/star/document/XFilter.hpp>
34#include <com/sun/star/embed/XTransactedObject.hpp>
35#include <com/sun/star/lang/Locale.hpp>
36#include <com/sun/star/util/XModifiable.hpp>
37#include <com/sun/star/document/DocumentProperties.hpp>
38#include <com/sun/star/document/XCompatWriterDocProperties.hpp>
39
40#include <unotools/configmgr.hxx>
41#include <unotools/bootstrap.hxx>
42#include <cppuhelper/interfacecontainer.hxx>
43#include <osl/mutex.hxx>
44#include <rtl/ustrbuf.hxx>
45#include <vcl/svapp.hxx>
46
47#include <tools/errcode.hxx>
48#include <svl/cntwids.hrc>
49#include <comphelper/processfactory.hxx>
50#include <comphelper/string.hxx>
51#include <comphelper/sequenceasvector.hxx>
52#include <comphelper/storagehelper.hxx>
53#include <sot/storage.hxx>
54
55#include <sfx2/objuno.hxx>
56#include <sfx2/sfx.hrc>
57
58#include <vector>
59#include <algorithm>
60
61#include "sfx2/sfxresid.hxx"
62#include "doc.hrc"
63
64using namespace ::com::sun::star;
65
66// TODO/REFACTOR: provide service for MS formats
67// TODO/REFACTOR: IsEncrypted is never set nor read
68// Generator is not saved ATM; which value?!
69// Generator handling must be implemented
70// Deprecate "Theme", rework IDL
71// AutoLoadEnabled is deprecated?!
72// Reasonable defaults for DateTime
73// MIMEType readonly?!
74// Announce changes about Theme, Language, Generator, removed entries etc.
75// IsEncrypted is necessary for binary formats!
76// Open: When to call PrepareDocInfoForSave? Currently only called for own formats and HTML/Writer
77// Open: How to load and save EditingTime to MS formats
78// PPT-Export should use SavePropertySet
79
80//=============================================================================
81
82// The number of user defined fields handled by the evil XDocumentInfo
83// interface. There are exactly 4. No more, no less.
84#define FOUR 4
85
86#define PROPERTY_UNBOUND 0
87#define PROPERTY_MAYBEVOID ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
88
89static const SfxItemPropertyMapEntry* lcl_GetDocInfoPropertyMap()
90{
91 static SfxItemPropertyMapEntry aDocInfoPropertyMap_Impl[] =
92 {
93 { "Author" , 6 , WID_FROM, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
94 { "AutoloadEnabled" , 15, MID_DOCINFO_AUTOLOADENABLED, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 },
95 { "AutoloadSecs" , 12, MID_DOCINFO_AUTOLOADSECS, &::getCppuType((const sal_Int32*)0), PROPERTY_UNBOUND, 0 },
96 { "AutoloadURL" , 11, MID_DOCINFO_AUTOLOADURL, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
97 { "Category" , 8 , MID_CATEGORY, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
98 { "Company" , 7 , MID_COMPANY, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
99 { "Manager" , 7 , MID_MANAGER, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
100 { "CreationDate" , 12, WID_DATE_CREATED, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 },
101 { "DefaultTarget" , 13, MID_DOCINFO_DEFAULTTARGET, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
102 { "Description" , 11, MID_DOCINFO_DESCRIPTION, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
103 { "DocumentStatistic", 17 , MID_DOCINFO_STATISTIC, &::getCppuType((const uno::Sequence< beans::NamedValue >*)0), PROPERTY_UNBOUND, 0 },
104 { "EditingCycles" , 13, MID_DOCINFO_REVISION, &::getCppuType((const sal_Int16*)0), PROPERTY_UNBOUND, 0 },
105 { "EditingDuration" , 15, MID_DOCINFO_EDITTIME, &::getCppuType((const sal_Int32*)0), PROPERTY_UNBOUND, 0 },
106 { "Generator" , 9, SID_APPLICATION, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
107 { "Keywords" , 8 , WID_KEYWORDS, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
108 { "Language" , 8, MID_DOCINFO_CHARLOCALE, &::getCppuType((const lang::Locale*)0), PROPERTY_UNBOUND, 0 },
109 { "MIMEType" , 8 , WID_CONTENT_TYPE, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND | ::com::sun::star::beans::PropertyAttribute::READONLY, 0 },
110 { "ModifiedBy" , 10, MID_DOCINFO_MODIFICATIONAUTHOR, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
111 { "ModifyDate" , 10, WID_DATE_MODIFIED, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 },
112 { "PrintDate" , 9 , MID_DOCINFO_PRINTDATE, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 },
113 { "PrintedBy" , 9 , MID_DOCINFO_PRINTEDBY, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
114 { "Subject" , 7 , MID_DOCINFO_SUBJECT, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
115 { "Template" , 8 , MID_DOCINFO_TEMPLATE, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
116 { "TemplateFileName", 16, SID_TEMPLATE_NAME, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
117 { "TemplateDate" , 12, MID_DOCINFO_TEMPLATEDATE, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 },
118 { "Title" , 5 , WID_TITLE, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
119 {0,0,0,0,0,0}
120 };
121 return aDocInfoPropertyMap_Impl;
122}
123
124static sal_uInt16 aDaysInMonth[12] = { 31, 28, 31, 30, 31, 30,
125 31, 31, 30, 31, 30, 31 };
126
127inline sal_uInt16 DaysInMonth( sal_uInt16 nMonth, sal_uInt16 nYear )
128{
129 if ( nMonth != 2 )
130 return aDaysInMonth[nMonth-1];
131 else
132 {
133 if ( (((nYear % 4) == 0) && ((nYear % 100) != 0)) ||
134 ((nYear % 400) == 0) )
135 return aDaysInMonth[nMonth-1] + 1;
136 else
137 return aDaysInMonth[nMonth-1];
138 }
139}
140
141bool IsValidDateTime( const util::DateTime& rDT )
142{
143 if ( !rDT.Month || (rDT.Month > 12) )
144 return false;
145 if ( !rDT.Day || (rDT.Day > DaysInMonth( rDT.Month, rDT.Year )) )
146 return false;
147 else if ( rDT.Year <= 1582 )
148 {
149 if ( rDT.Year < 1582 )
150 return false;
151 else if ( rDT.Month < 10 )
152 return false;
153 else if ( (rDT.Month == 10) && (rDT.Day < 15) )
154 return false;
155 }
156
157 return true;
158}
159
160struct OUStringHashCode
161{
162 size_t operator()( const ::rtl::OUString& sString ) const
163 {
164 return sString.hashCode();
165 }
166};
167
168struct SfxExtendedItemPropertyMap : public SfxItemPropertyMapEntry
169{
170 ::com::sun::star::uno::Any aValue;
171};
172
173void Copy( const uno::Reference < document::XStandaloneDocumentInfo >& rSource, const uno::Reference < document::XStandaloneDocumentInfo >& rTarget )
174{
175 try
176 {
177 uno::Reference< beans::XPropertySet > xSet( rSource, uno::UNO_QUERY );
178 uno::Reference< beans::XPropertySet > xTarget( rTarget, uno::UNO_QUERY );
179 uno::Reference< beans::XPropertySetInfo > xSetInfo = xSet->getPropertySetInfo();
180 uno::Reference< beans::XPropertyContainer > xContainer( rTarget, uno::UNO_QUERY );
181 uno::Sequence< beans::Property > lProps = xSetInfo->getProperties();
182 const beans::Property* pProps = lProps.getConstArray();
183 sal_Int32 c = lProps.getLength();
184 sal_Int32 i = 0;
185 for (i=0; i<c; ++i)
186 {
187 uno::Any aValue = xSet->getPropertyValue( pProps[i].Name );
188 if ( pProps[i].Attributes & ::com::sun::star::beans::PropertyAttribute::REMOVABLE )
189 // QUESTION: DefaultValue?!
190 xContainer->addProperty( pProps[i].Name, pProps[i].Attributes, aValue );
191 try
192 {
193 // it is possible that the propertysets from XML and binary files differ; we shouldn't break then
194 xTarget->setPropertyValue( pProps[i].Name, aValue );
195 }
196 catch ( const uno::Exception& ) {}
197 }
198
199 sal_Int16 nCount = rSource->getUserFieldCount();
200 sal_Int16 nSupportedCount = rTarget->getUserFieldCount();
201 for ( sal_Int16 nInd = 0; nInd < nCount && nInd < nSupportedCount; nInd++ )
202 {
203 ::rtl::OUString aPropName = rSource->getUserFieldName( nInd );
204 rTarget->setUserFieldName( nInd, aPropName );
205 ::rtl::OUString aPropVal = rSource->getUserFieldValue( nInd );
206 rTarget->setUserFieldValue( nInd, aPropVal );
207 }
208 }
209 catch ( const uno::Exception& ) {}
210}
211
212class MixedPropertySetInfo : public ::cppu::WeakImplHelper1< ::com::sun::star::beans::XPropertySetInfo >
213{
214 private:
215
216 SfxItemPropertyMap _aPropertyMap;
217 ::rtl::OUString* _pUserKeys;
218 uno::Reference<beans::XPropertySet> _xUDProps;
219
220 public:
221
222 MixedPropertySetInfo( const SfxItemPropertyMapEntry* pFixProps,
223 ::rtl::OUString* pUserKeys,
224 uno::Reference<beans::XPropertySet> xUDProps);
225
226 virtual ~MixedPropertySetInfo();
227
228 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties( ) throw (::com::sun::star::uno::RuntimeException);
229 virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName( const ::rtl::OUString& aName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
230 virtual ::sal_Bool SAL_CALL hasPropertyByName( const ::rtl::OUString& Name ) throw (::com::sun::star::uno::RuntimeException);
231};
232
233//-----------------------------------------------------------------------------
234
235MixedPropertySetInfo::MixedPropertySetInfo(const SfxItemPropertyMapEntry* pFixProps,
236 ::rtl::OUString* pUserKeys,
237 uno::Reference<beans::XPropertySet> xUDProps)
238 : _aPropertyMap( pFixProps )
239 , _pUserKeys(pUserKeys)
240 , _xUDProps(xUDProps)
241{
242}
243
244//-----------------------------------------------------------------------------
245
246MixedPropertySetInfo::~MixedPropertySetInfo()
247{
248}
249
250//-----------------------------------------------------------------------------
251
252::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL MixedPropertySetInfo::getProperties()
253 throw(::com::sun::star::uno::RuntimeException)
254{
255 ::comphelper::SequenceAsVector< ::com::sun::star::beans::Property > lProps;
256
257 // copy "fix" props
258 //todo: os: this ugly thing should be replaced
259 const SfxItemPropertyMapEntry* pFixProp = lcl_GetDocInfoPropertyMap();
260
261 while(pFixProp && pFixProp->pName)
262 {
263 ::com::sun::star::beans::Property aProp;
264
265 aProp.Name = ::rtl::OUString::createFromAscii(pFixProp->pName);
266 aProp.Handle = pFixProp->nWID;
267 aProp.Type = *(pFixProp->pType);
268 aProp.Attributes = (sal_Int16)(pFixProp->nFlags);
269
270 lProps.push_back(aProp);
271 ++pFixProp;
272 }
273
274 // copy "dynamic" props
275
276 // NB: this is really ugly:
277 // The returned properties must _not_ include the 4 user-defined fields!
278 // These are _not_ properties of the XDocumentInfo interface.
279 // Some things rely on this, e.g. Copy would break otherwise.
280 // This will have interesting consequences if someone expects to insert
281 // a property with the same name as an user-defined key, but nobody
282 // sane does that.
283 uno::Sequence<beans::Property> udProps =
284 _xUDProps->getPropertySetInfo()->getProperties();
285 for (sal_Int32 i = 0; i < udProps.getLength(); ++i) {
286 if (std::find(_pUserKeys, _pUserKeys+FOUR, udProps[i].Name)
287 == _pUserKeys+FOUR) {
288 // #i100027#: handles from udProps are not valid here
289 udProps[i].Handle = -1;
290 lProps.push_back(udProps[i]);
291 }
292 }
293
294 return lProps.getAsConstList();
295}
296
297//-----------------------------------------------------------------------------
298
299::com::sun::star::beans::Property SAL_CALL MixedPropertySetInfo::getPropertyByName(
300 const ::rtl::OUString& sName )
301 throw(::com::sun::star::beans::UnknownPropertyException,
302 ::com::sun::star::uno::RuntimeException )
303{
304 ::com::sun::star::beans::Property aProp;
305
306 // search it as "fix" prop
307 if( _aPropertyMap.hasPropertyByName( sName ) )
308 return _aPropertyMap.getPropertyByName( sName );
309 else
310 // search it as "dynamic" prop
311 return _xUDProps->getPropertySetInfo()->getPropertyByName(sName);
312}
313
314//-----------------------------------------------------------------------------
315
316::sal_Bool SAL_CALL MixedPropertySetInfo::hasPropertyByName(const ::rtl::OUString& sName)
317 throw(::com::sun::star::uno::RuntimeException)
318{
319 return _aPropertyMap.hasPropertyByName( sName ) ? // "fix" prop?
320 sal_True :
321 _xUDProps->getPropertySetInfo()->hasPropertyByName(sName); // "dynamic" prop?
322}
323
324//-----------------------------------------------------------------------------
325
326struct SfxDocumentInfoObject_Impl
327{
328 ::osl::Mutex _aMutex;
329 ::cppu::OInterfaceContainerHelper _aDisposeContainer;
330
331 sal_Bool bDisposed;
332
333 // this contains the names of the 4 user defined properties
334 // which are accessible via the evil XDocumentInfo interface
335 ::rtl::OUString m_UserDefined[FOUR];
336
337 // the actual contents
338 uno::Reference<document::XDocumentProperties> m_xDocProps;
339 SfxItemPropertyMap m_aPropertyMap;
340
341 SfxDocumentInfoObject_Impl()
342 : _aDisposeContainer( _aMutex )
343 , bDisposed(sal_False)
344 , m_xDocProps()
345 , m_aPropertyMap( lcl_GetDocInfoPropertyMap() )
346 {
347 // the number of user fields is not changeable from the outside
348 // we can't set it too high because every name/value pair will be written to the file (even if empty)
349 // currently our dialog has only 4 user keys so 4 is still a reasonable number
350 }
351
352 /// the initialization function
353 void Reset(uno::Reference<document::XDocumentProperties> xDocProps, ::rtl::OUString* pUserDefined = 0);
354};
355
356void SfxDocumentInfoObject_Impl::Reset(uno::Reference<document::XDocumentProperties> xDocProps, ::rtl::OUString* pUserDefined)
357{
358 if (pUserDefined == 0) {
359 // NB: this is an ugly hack; the "Properties" ui dialog displays
360 // exactly 4 user-defined fields and expects these to be available
361 // (should be redesigned), but I do not want to do this in
362 // DocumentProperties; do it here instead
363 uno::Reference<beans::XPropertyAccess> xPropAccess(
364 xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
365 uno::Reference<beans::XPropertyContainer> xPropContainer(
366 xPropAccess, uno::UNO_QUERY_THROW);
367 uno::Sequence< beans::PropertyValue >
368 props = xPropAccess->getPropertyValues();
369 sal_Int32 oldLength = props.getLength();
370 if (oldLength < FOUR) {
371 std::vector< ::rtl::OUString > names;
372 for (sal_Int32 i = 0; i < oldLength; ++i) {
373 names.push_back(props[i].Name);
374 }
375 const ::rtl::OUString sInfo(
376 SfxResId(STR_DOCINFO_INFOFIELD).toString());
377 for (sal_Int32 i = oldLength; i < FOUR; ++i) {
378 ::rtl::OUString sName(sInfo);
379 sal_Int32 idx = sName.indexOfAsciiL("%1", 2);
380 ::rtl::OUString name = (idx > 0)
381 ? sName.replaceAt(idx, 2, ::rtl::OUString::valueOf(i+1))
382 : sName + ::rtl::OUString::valueOf(i+1);
383 while (std::find(names.begin(), names.end(), name)
384 != names.end()) {
385 name += ::rtl::OUString("'");
386 }
387 // FIXME there is a race condition here
388 try {
389 xPropContainer->addProperty(name,
390 beans::PropertyAttribute::REMOVEABLE,
391 uno::makeAny(::rtl::OUString("")));
392 } catch (const uno::RuntimeException&) {
393 throw;
394 } catch (const uno::Exception&) {
395 // ignore
396 }
397 }
398 }
399 props = xPropAccess->getPropertyValues();
400 for (sal_Int32 i = 0; i < FOUR; ++i) {
401 m_UserDefined[i] = props[i].Name;
402 }
403 } else {
404 std::copy(pUserDefined, pUserDefined+FOUR, m_UserDefined);
405 }
406 m_xDocProps = xDocProps;
407}
408
409//-----------------------------------------------------------------------------
410
411SfxDocumentInfoObject::SfxDocumentInfoObject()
412 : _pImp( new SfxDocumentInfoObject_Impl() )
413{
414}
415
416//-----------------------------------------------------------------------------
417
418SfxDocumentInfoObject::~SfxDocumentInfoObject()
419{
420 delete _pImp;
421}
422
423//-----------------------------------------------------------------------------
424
425// ::com::sun::star::lang::XInitialization:
426void SAL_CALL
427SfxDocumentInfoObject::initialize(const uno::Sequence< uno::Any > & aArguments)
428 throw (uno::RuntimeException, uno::Exception)
429{
430 if (aArguments.getLength() >= 1) {
431 uno::Any any = aArguments[0];
432 uno::Reference<document::XDocumentProperties> xDoc;
433 if (!(any >>= xDoc) || !xDoc.is()) throw lang::IllegalArgumentException(
434 ::rtl::OUString(
435 "SfxDocumentInfoObject::initialize: no XDocumentProperties given"),
436 *this, 0);
437 _pImp->Reset(xDoc);
438 } else {
439 throw lang::IllegalArgumentException(
440 ::rtl::OUString(
441 "SfxDocumentInfoObject::initialize: no argument given"),
442 *this, 0);
443 }
444}
445
446// ::com::sun::star::util::XCloneable:
447uno::Reference<util::XCloneable> SAL_CALL
448SfxDocumentInfoObject::createClone() throw (uno::RuntimeException)
449{
450 SfxDocumentInfoObject *pNew = new SfxDocumentInfoObject;
451 uno::Reference< util::XCloneable >
452 xCloneable(_pImp->m_xDocProps, uno::UNO_QUERY_THROW);
453 uno::Reference<document::XDocumentProperties> xDocProps(
454 xCloneable->createClone(), uno::UNO_QUERY_THROW);
455 pNew->_pImp->Reset(xDocProps, _pImp->m_UserDefined);
456 return pNew;
457}
458
459// ::com::sun::star::document::XDocumentProperties:
460uno::Reference< document::XDocumentProperties > SAL_CALL
461SfxDocumentInfoObject::getDocumentProperties()
462 throw(::com::sun::star::uno::RuntimeException)
463{
464 return _pImp->m_xDocProps;
465}
466
467//-----------------------------------------------------------------------------
468
469const SfxDocumentInfoObject& SfxDocumentInfoObject::operator=( const SfxDocumentInfoObject & rOther)
470{
471 uno::Reference< util::XCloneable >
472 xCloneable(rOther._pImp->m_xDocProps, uno::UNO_QUERY_THROW);
473 uno::Reference<document::XDocumentProperties> xDocProps(
474 xCloneable->createClone(), uno::UNO_QUERY_THROW);
475 _pImp->Reset(xDocProps, rOther._pImp->m_UserDefined);
476 return *this;
477}
478
479//-----------------------------------------------------------------------------
480
481void SAL_CALL SfxDocumentInfoObject::dispose() throw( ::com::sun::star::uno::RuntimeException )
482{
483 ::com::sun::star::lang::EventObject aEvent( (::cppu::OWeakObject *)this );
484 _pImp->_aDisposeContainer.disposeAndClear( aEvent );
485 ::osl::MutexGuard aGuard( _pImp->_aMutex );
486 _pImp->m_xDocProps = 0;
487 // NB: do not call m_xDocProps->dispose(), there could be other refs
488 _pImp->bDisposed = sal_True;
489}
490
491//-----------------------------------------------------------------------------
492
493void SAL_CALL SfxDocumentInfoObject::addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException )
494{
495 _pImp->_aDisposeContainer.addInterface( aListener );
496}
497
498//-----------------------------------------------------------------------------
499
500void SAL_CALL SfxDocumentInfoObject::removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException )
501{
502 _pImp->_aDisposeContainer.removeInterface( aListener );
503}
504//-----------------------------------------------------------------------------
505
506::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL SfxDocumentInfoObject::getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException )
507{
508 ::osl::MutexGuard aGuard( _pImp->_aMutex );
509
510 uno::Reference<beans::XPropertySet> xPropSet(
511 _pImp->m_xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
512 MixedPropertySetInfo* pInfo = new MixedPropertySetInfo( lcl_GetDocInfoPropertyMap(), _pImp->m_UserDefined, xPropSet);
513 uno::Reference< beans::XPropertySetInfo > xInfo(
514 static_cast< beans::XPropertySetInfo* >(pInfo), uno::UNO_QUERY_THROW);
515 return xInfo;
516}
517
518//-----------------------------------------------------------------------------
519
520void SAL_CALL SfxDocumentInfoObject::setPropertyValue(const ::rtl::OUString& aPropertyName, const uno::Any& aValue) throw (
521 uno::RuntimeException, beans::UnknownPropertyException,
522 beans::PropertyVetoException, lang::IllegalArgumentException,
523 lang::WrappedTargetException)
524{
525 const SfxItemPropertySimpleEntry* pEntry = _pImp->m_aPropertyMap.getByName( aPropertyName );
526 // fix prop!
527 if ( pEntry )
528 setFastPropertyValue( pEntry->nWID, aValue );
529 else
530 // dynamic prop!
531 {
532 uno::Reference<beans::XPropertySet> xPropSet(
533 _pImp->m_xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
534 return xPropSet->setPropertyValue(aPropertyName, aValue);
535 }
536}
537
538//-----------------------------------------------------------------------------
539
540uno::Any SAL_CALL SfxDocumentInfoObject::getPropertyValue(const ::rtl::OUString& aPropertyName) throw(
541 uno::RuntimeException, beans::UnknownPropertyException,
542 lang::WrappedTargetException)
543{
544 const SfxItemPropertySimpleEntry* pEntry = _pImp->m_aPropertyMap.getByName( aPropertyName );
545 // fix prop!
546 if ( pEntry )
547 return getFastPropertyValue( pEntry->nWID );
548 else
549 // dynamic prop!
550 {
551 uno::Reference<beans::XPropertySet> xPropSet(
552 _pImp->m_xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
553 return xPropSet->getPropertyValue(aPropertyName);
554 }
555}
556
557sal_Bool SAL_CALL SfxDocumentInfoObject::isModified() throw(::com::sun::star::uno::RuntimeException)
558{
559 uno::Reference<util::XModifiable> xModif(
560 _pImp->m_xDocProps, uno::UNO_QUERY_THROW);
561 return xModif->isModified();
562}
563
564void SAL_CALL SfxDocumentInfoObject::setModified( sal_Bool bModified )
565 throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException)
566{
567 uno::Reference<util::XModifiable> xModif(
568 _pImp->m_xDocProps, uno::UNO_QUERY_THROW);
569 return xModif->setModified(bModified);
570}
571
572void SAL_CALL SfxDocumentInfoObject::addModifyListener( const uno::Reference< util::XModifyListener >& xListener) throw( uno::RuntimeException )
573{
574 uno::Reference<util::XModifiable> xModif(
575 _pImp->m_xDocProps, uno::UNO_QUERY_THROW);
576 return xModif->addModifyListener(xListener);
577}
578
579void SAL_CALL SfxDocumentInfoObject::removeModifyListener( const uno::Reference< util::XModifyListener >& xListener) throw( uno::RuntimeException )
580{
581 uno::Reference<util::XModifiable> xModif(
582 _pImp->m_xDocProps, uno::UNO_QUERY_THROW);
583 return xModif->removeModifyListener(xListener);
584}
585
586//-----------------------------------------------------------------------------
587
588void SAL_CALL SfxDocumentInfoObject::addPropertyChangeListener(const ::rtl::OUString&, const uno::Reference< beans::XPropertyChangeListener > & ) throw(
589 uno::RuntimeException, beans::UnknownPropertyException,
590 lang::WrappedTargetException)
591{}
592
593//-----------------------------------------------------------------------------
594
595void SAL_CALL SfxDocumentInfoObject::removePropertyChangeListener(const ::rtl::OUString&, const uno::Reference< beans::XPropertyChangeListener > & ) throw(
596 uno::RuntimeException, beans::UnknownPropertyException,
597 lang::WrappedTargetException)
598{}
599
600//-----------------------------------------------------------------------------
601
602void SAL_CALL SfxDocumentInfoObject::addVetoableChangeListener(const ::rtl::OUString&, const uno::Reference< beans::XVetoableChangeListener > & ) throw(
603 uno::RuntimeException, beans::UnknownPropertyException,
604 lang::WrappedTargetException)
605{}
606
607//-----------------------------------------------------------------------------
608
609void SAL_CALL SfxDocumentInfoObject::removeVetoableChangeListener(const ::rtl::OUString&, const uno::Reference< beans::XVetoableChangeListener > & ) throw(
610 uno::RuntimeException, beans::UnknownPropertyException,
611 lang::WrappedTargetException)
612{}
613
614uno::Sequence< beans::PropertyValue > SAL_CALL SfxDocumentInfoObject::getPropertyValues( void ) throw( uno::RuntimeException )
615{
616 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo = getPropertySetInfo();
617 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > aProps = xInfo->getProperties();
618
619 const ::com::sun::star::beans::Property* pProps = aProps.getConstArray();
620 sal_uInt32 nCount = aProps.getLength();
621
622 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >aSeq( nCount );
623 ::com::sun::star::beans::PropertyValue* pValues = aSeq.getArray();
624
625 for ( sal_uInt32 n = 0; n < nCount; ++n )
626 {
627 ::com::sun::star::beans::PropertyValue& rCurrValue = pValues[n];
628 const ::com::sun::star::beans::Property& rCurrProp = pProps[n];
629
630 rCurrValue.Name = rCurrProp.Name;
631 rCurrValue.Handle = rCurrProp.Handle;
632 rCurrValue.Value = getPropertyValue( rCurrProp.Name );
633 }
634
635 return aSeq;
636}
637
638void SAL_CALL SfxDocumentInfoObject::setPropertyValues( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps )
639 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 )
640{
641 const ::com::sun::star::beans::PropertyValue* pProps = aProps.getConstArray();
642 sal_uInt32 nCount = aProps.getLength();
643
644 for ( sal_uInt32 n = 0; n < nCount; ++n )
645 {
646 const ::com::sun::star::beans::PropertyValue& rProp = pProps[n];
647 setPropertyValue( rProp.Name, rProp.Value );
648 }
649}
650
651void SAL_CALL SfxDocumentInfoObject::addProperty(const ::rtl::OUString& sName ,
652 sal_Int16 nAttributes ,
653 const ::com::sun::star::uno::Any& aDefaultValue)
654 throw(::com::sun::star::beans::PropertyExistException ,
655 ::com::sun::star::beans::IllegalTypeException ,
656 ::com::sun::star::lang::IllegalArgumentException,
657 ::com::sun::star::uno::RuntimeException )
658{
659 // clash with "fix" properties ?
660 sal_Bool bFixProp = _pImp->m_aPropertyMap.getByName( sName ) != 0;
661 if ( bFixProp )
662 {
663 ::rtl::OUStringBuffer sMsg(256);
664 sMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM("The property \""));
665 sMsg.append(sName);
666 sMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM("\" "));
667 if ( bFixProp )
668 sMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM(" already exists as a fix property. Please have a look into the IDL documentation of the DocumentInfo service."));
669
670 throw ::com::sun::star::beans::PropertyExistException(
671 sMsg.makeStringAndClear(),
672 static_cast< ::cppu::OWeakObject* >(this));
673 }
674
675 uno::Reference<beans::XPropertyContainer> xPropSet(
676 _pImp->m_xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
677 return xPropSet->addProperty(sName, nAttributes, aDefaultValue);
678}
679
680void SAL_CALL SfxDocumentInfoObject::removeProperty(const ::rtl::OUString& sName)
681 throw(::com::sun::star::beans::UnknownPropertyException,
682 ::com::sun::star::beans::NotRemoveableException ,
683 ::com::sun::star::uno::RuntimeException )
684{
685 // clash with "fix" properties ?
686 sal_Bool bFixProp = _pImp->m_aPropertyMap.getByName( sName ) != 0;
687 if ( bFixProp )
688 {
689 ::rtl::OUStringBuffer sMsg(256);
690 sMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM("The property \""));
691 sMsg.append(sName);
692 sMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM("\" cant be removed. Its a fix property of the DocumentInfo service."));
693
694 throw ::com::sun::star::beans::NotRemoveableException(
695 sMsg.makeStringAndClear(),
696 static_cast< ::cppu::OWeakObject* >(this));
697 }
698
699 uno::Reference<beans::XPropertyContainer> xPropSet(
700 _pImp->m_xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
701 return xPropSet->removeProperty(sName);
702}
703
704sal_Bool equalsDateTime( const util::DateTime& D1, const util::DateTime& D2 )
705{
706 return D1.HundredthSeconds == D2.HundredthSeconds &&
707 D1.Seconds == D2.Seconds &&
708 D1.Minutes == D2.Minutes &&
709 D1.Hours == D2.Hours &&
710 D1.Day == D2.Day &&
711 D1.Month == D2.Month &&
712 D1.Year == D2.Year;
713}
714
715void SAL_CALL SfxDocumentInfoObject::setFastPropertyValue(sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue) throw(
716 uno::RuntimeException, beans::UnknownPropertyException,
717 beans::PropertyVetoException, lang::IllegalArgumentException,
718 lang::WrappedTargetException)
719{
720 // Attention: Only fix properties should be provided by this method.
721 // Dynamic properties has no handle in real ... because it cant be used inside multithreaded environments :-)
722
723 ::osl::ClearableMutexGuard aGuard( _pImp->_aMutex );
724
725 if ( aValue.getValueType() == ::getCppuType((const ::rtl::OUString*)0) )
726 {
727 ::rtl::OUString sTemp ;
728 aValue >>= sTemp ;
729 switch ( nHandle )
730 {
731 case SID_APPLICATION :
732 _pImp->m_xDocProps->setGenerator(sTemp);
733 break;
734 case WID_FROM :
735 {
736 if ( _pImp->m_xDocProps->getAuthor() != sTemp )
737 _pImp->m_xDocProps->setAuthor(sTemp);
738 break;
739 }
740 case MID_DOCINFO_PRINTEDBY:
741 if ( _pImp->m_xDocProps->getPrintedBy() != sTemp )
742 _pImp->m_xDocProps->setPrintedBy(sTemp);
743 break;
744 case MID_DOCINFO_MODIFICATIONAUTHOR:
745 if ( _pImp->m_xDocProps->getModifiedBy() != sTemp )
746 _pImp->m_xDocProps->setModifiedBy(sTemp);
747 break;
748 case WID_TITLE :
749 {
750 if ( _pImp->m_xDocProps->getTitle() != sTemp )
751 _pImp->m_xDocProps->setTitle(sTemp);
752 break;
753 }
754 case MID_DOCINFO_SUBJECT :
755 if ( _pImp->m_xDocProps->getSubject() != sTemp )
756 _pImp->m_xDocProps->setSubject(sTemp);
757 break;
758 case WID_KEYWORDS :
759 {
760 _pImp->m_xDocProps->setKeywords(
761 ::comphelper::string::convertCommaSeparated(sTemp));
762 }
763 break;
764 case MID_DOCINFO_TEMPLATE:
765 if ( _pImp->m_xDocProps->getTemplateName() != sTemp )
766 _pImp->m_xDocProps->setTemplateName(sTemp);
767 break;
768 case SID_TEMPLATE_NAME:
769 if ( _pImp->m_xDocProps->getTemplateURL() != sTemp )
770 _pImp->m_xDocProps->setTemplateURL(sTemp);
771 break;
772 case MID_DOCINFO_DESCRIPTION:
773 if ( _pImp->m_xDocProps->getDescription() != sTemp )
774 _pImp->m_xDocProps->setDescription(sTemp);
775 break;
776 case MID_DOCINFO_AUTOLOADURL:
777 if ( _pImp->m_xDocProps->getAutoloadURL() != sTemp )
778 _pImp->m_xDocProps->setAutoloadURL(sTemp);
779 break;
780 case MID_DOCINFO_DEFAULTTARGET:
781 if ( _pImp->m_xDocProps->getDefaultTarget() != sTemp )
782 _pImp->m_xDocProps->setDefaultTarget(sTemp);
783 break;
784 case MID_CATEGORY:
785 case MID_MANAGER:
786 case MID_COMPANY:
787 {
788 uno::Reference< document::XCompatWriterDocProperties > xWriterProps( _pImp->m_xDocProps, uno::UNO_QUERY );
789 if ( xWriterProps.is() )
790 {
791 if ( nHandle == MID_CATEGORY )
792 xWriterProps->setCategory( sTemp );
793 else if ( nHandle == MID_MANAGER )
794 xWriterProps->setManager( sTemp );
795 else
796 xWriterProps->setCompany( sTemp );
797 break;
798 }
799 }
800 default:
801 break;
802 }
803 }
804 else if ( aValue.getValueType() == ::getCppuType((const ::com::sun::star::util::DateTime*)0) )
805 {
806 com::sun::star::util::DateTime aTemp;
807 aValue >>= aTemp ;
808 switch ( nHandle )
809 {
810 case WID_DATE_CREATED :
811 {
812 if ( !equalsDateTime(_pImp->m_xDocProps->getCreationDate(), aTemp ) )
813 {
814 _pImp->m_xDocProps->setCreationDate(aTemp);
815 }
816 break;
817 }
818 case WID_DATE_MODIFIED :
819 {
820 if ( !equalsDateTime(_pImp->m_xDocProps->getModificationDate(), aTemp ) )
821 {
822 _pImp->m_xDocProps->setModificationDate(aTemp);
823 }
824 break;
825 }
826 case MID_DOCINFO_PRINTDATE :
827 {
828 if ( !equalsDateTime(_pImp->m_xDocProps->getPrintDate(), aTemp ) )
829 {
830 _pImp->m_xDocProps->setPrintDate(aTemp);
831 }
832 break;
833 }
834 case MID_DOCINFO_TEMPLATEDATE :
835 {
836 if ( !equalsDateTime(_pImp->m_xDocProps->getTemplateDate(), aTemp ) )
837 {
838 _pImp->m_xDocProps->setTemplateDate(aTemp);
839 }
840 break;
841 }
842 default:
843 break;
844 }
845 }
846
847 else if ( aValue.getValueType() == ::getBooleanCppuType() )
848 {
849 sal_Bool bBoolVal = false;
850 aValue >>= bBoolVal ;
851 switch ( nHandle )
852 {
853 case MID_DOCINFO_AUTOLOADENABLED:
854 // NB: this property does not exist any more
855 // it is emulated as enabled iff delay > 0
856 if ( bBoolVal && (0 == _pImp->m_xDocProps->getAutoloadSecs()) ) {
857 _pImp->m_xDocProps->setAutoloadSecs(60); // default
858 } else if ( !bBoolVal && (0 != _pImp->m_xDocProps->getAutoloadSecs()) ) {
859 _pImp->m_xDocProps->setAutoloadSecs(0);
860 _pImp->m_xDocProps->setAutoloadURL(::rtl::OUString(""));
861 }
862 break;
863 default:
864 break;
865 }
866 }
867 else if ( aValue.getValueType() == ::getCppuType((const sal_Int32*)0) )
868 {
869 sal_Int32 nIntVal = 0;
870 aValue >>= nIntVal ;
871 switch ( nHandle )
872 {
873 case MID_DOCINFO_AUTOLOADSECS:
874 if ( nIntVal != _pImp->m_xDocProps->getAutoloadSecs())
875 _pImp->m_xDocProps->setAutoloadSecs(nIntVal);
876 break;
877 case MID_DOCINFO_EDITTIME:
878 if ( nIntVal != _pImp->m_xDocProps->getEditingDuration())
879 _pImp->m_xDocProps->setEditingDuration(nIntVal);
880 break;
881 default:
882 break;
883 }
884 }
885 else if ( aValue.getValueType() == ::getCppuType((const sal_Int16*)0) )
886 {
887 short nIntVal = 0;
888 aValue >>= nIntVal ;
889 switch ( nHandle )
890 {
891 case MID_DOCINFO_REVISION:
892 if ( nIntVal != _pImp->m_xDocProps->getEditingCycles())
893 _pImp->m_xDocProps->setEditingCycles(nIntVal);
894 break;
895 default:
896 break;
897 }
898 }
899 else if ( aValue.getValueType() == ::getCppuType((const uno::Sequence< beans::NamedValue >*)0) )
900 {
901 if ( nHandle == MID_DOCINFO_STATISTIC )
902 {
903 uno::Sequence < beans::NamedValue > aData;
904 aValue >>= aData;
905 {
906 _pImp->m_xDocProps->setDocumentStatistics(aData);
907 }
908 }
909 }
910 else if ( aValue.getValueType() == ::getCppuType((const lang::Locale*)0) )
911 {
912 if ( nHandle == MID_DOCINFO_CHARLOCALE )
913 {
914 lang::Locale aLocale;
915 aValue >>= aLocale;
916 lang::Locale oldLocale = _pImp->m_xDocProps->getLanguage();
917 if ( aLocale.Language != oldLocale.Language ||
918 aLocale.Country != oldLocale.Country ||
919 aLocale.Variant != oldLocale.Variant )
920 {
921 _pImp->m_xDocProps->setLanguage(aLocale);
922 }
923 }
924 }
925}
926
927//-----------------------------------------------------------------------------
928
929::com::sun::star::uno::Any SAL_CALL SfxDocumentInfoObject::getFastPropertyValue(sal_Int32 nHandle) throw(
930 uno::RuntimeException, beans::UnknownPropertyException,
931 lang::WrappedTargetException)
932{
933 // Attention: Only fix properties should be provided by this method.
934 // Dynamic properties has no handle in real ... because it cant be used inside multithreaded environments :-)
935
936 ::osl::MutexGuard aGuard( _pImp->_aMutex );
937 ::com::sun::star::uno::Any aValue;
938 switch ( nHandle )
939 {
940 case SID_APPLICATION :
941 aValue <<= _pImp->m_xDocProps->getGenerator();
942 break;
943 case WID_CONTENT_TYPE :
944// FIXME this is not available anymore
945 aValue <<= ::rtl::OUString();
946 break;
947 case MID_DOCINFO_REVISION :
948 aValue <<= _pImp->m_xDocProps->getEditingCycles();
949 break;
950 case MID_DOCINFO_EDITTIME :
951 aValue <<= _pImp->m_xDocProps->getEditingDuration();
952 break;
953 case WID_FROM :
954 aValue <<= _pImp->m_xDocProps->getAuthor();
955 break;
956 case WID_DATE_CREATED :
957 if ( IsValidDateTime( _pImp->m_xDocProps->getCreationDate() ) )
958 aValue <<= _pImp->m_xDocProps->getCreationDate();
959 break;
960 case WID_TITLE :
961 aValue <<= _pImp->m_xDocProps->getTitle();
962 break;
963 case MID_DOCINFO_SUBJECT:
964 aValue <<= _pImp->m_xDocProps->getSubject();
965 break;
966 case MID_DOCINFO_MODIFICATIONAUTHOR:
967 aValue <<= _pImp->m_xDocProps->getModifiedBy();
968 break;
969 case WID_DATE_MODIFIED :
970 if ( IsValidDateTime( _pImp->m_xDocProps->getModificationDate() ) )
971 aValue <<= _pImp->m_xDocProps->getModificationDate();
972 break;
973 case MID_DOCINFO_PRINTEDBY:
974 aValue <<= _pImp->m_xDocProps->getPrintedBy();
975 break;
976 case MID_DOCINFO_PRINTDATE:
977 if ( IsValidDateTime( _pImp->m_xDocProps->getPrintDate() ) )
978 aValue <<= _pImp->m_xDocProps->getPrintDate();
979 break;
980 case WID_KEYWORDS :
981 aValue <<= ::comphelper::string::convertCommaSeparated(
982 _pImp->m_xDocProps->getKeywords());
983 break;
984 case MID_DOCINFO_DESCRIPTION:
985 aValue <<= _pImp->m_xDocProps->getDescription();
986 break;
987 case MID_DOCINFO_TEMPLATE:
988 aValue <<= _pImp->m_xDocProps->getTemplateName();
989 break;
990 case SID_TEMPLATE_NAME:
991 aValue <<= _pImp->m_xDocProps->getTemplateURL();
992 break;
993 case MID_DOCINFO_TEMPLATEDATE:
994 if ( IsValidDateTime( _pImp->m_xDocProps->getTemplateDate() ) )
995 aValue <<= _pImp->m_xDocProps->getTemplateDate();
996 break;
997 case MID_DOCINFO_AUTOLOADENABLED:
998 aValue <<= static_cast<sal_Bool>
999 ( (_pImp->m_xDocProps->getAutoloadSecs() != 0)
1000 || !_pImp->m_xDocProps->getAutoloadURL().isEmpty());
1001 break;
1002 case MID_DOCINFO_AUTOLOADURL:
1003 aValue <<= _pImp->m_xDocProps->getAutoloadURL();
1004 break;
1005 case MID_DOCINFO_AUTOLOADSECS:
1006 aValue <<= _pImp->m_xDocProps->getAutoloadSecs();
1007 break;
1008 case MID_DOCINFO_DEFAULTTARGET:
1009 aValue <<= _pImp->m_xDocProps->getDefaultTarget();
1010 break;
1011 case MID_DOCINFO_STATISTIC:
1012 aValue <<= _pImp->m_xDocProps->getDocumentStatistics();
1013 break;
1014 case MID_DOCINFO_CHARLOCALE:
1015 aValue <<= _pImp->m_xDocProps->getLanguage();
1016 break;
1017 case MID_CATEGORY:
1018 case MID_MANAGER:
1019 case MID_COMPANY:
1020 {
1021 uno::Reference< document::XCompatWriterDocProperties > xWriterProps( _pImp->m_xDocProps, uno::UNO_QUERY );
1022 if ( xWriterProps.is() )
1023 {
1024 if ( nHandle == MID_CATEGORY )
1025 aValue <<= xWriterProps->getCategory();
1026 else if ( nHandle == MID_MANAGER )
1027 aValue <<= xWriterProps->getManager();
1028 else
1029 aValue <<= xWriterProps->getCompany();
1030 break;
1031 }
1032 }
1033
1034 default:
1035 aValue <<= ::rtl::OUString();
1036 break;
1037 }
1038
1039 return aValue;
1040}
1041
1042//-----------------------------------------------------------------------------
1043
1044sal_Int16 SAL_CALL SfxDocumentInfoObject::getUserFieldCount() throw( ::com::sun::star::uno::RuntimeException )
1045{
1046 return FOUR;
1047}
1048
1049//-----------------------------------------------------------------------------
1050
1051::rtl::OUString SAL_CALL SfxDocumentInfoObject::getUserFieldName(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException )
1052{
1053 ::osl::MutexGuard aGuard( _pImp->_aMutex );
1054 if (nIndex < FOUR)
1055 return _pImp->m_UserDefined[nIndex];
1056 else
1057 return ::rtl::OUString();
1058}
1059
1060//-----------------------------------------------------------------------------
1061
1062::rtl::OUString SAL_CALL SfxDocumentInfoObject::getUserFieldValue(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException )
1063{
1064 ::osl::MutexGuard aGuard( _pImp->_aMutex );
1065 if (nIndex < FOUR) {
1066 ::rtl::OUString name = _pImp->m_UserDefined[nIndex];
1067 uno::Reference<beans::XPropertySet> xPropSet(
1068 _pImp->m_xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
1069 ::rtl::OUString val;
1070 try {
1071 xPropSet->getPropertyValue(name) >>= val;
1072 return val;
1073 } catch (const uno::RuntimeException &) {
1074 throw;
1075 } catch (const uno::Exception &) {
1076 return ::rtl::OUString(); // ignore
1077 }
1078 } else
1079 return ::rtl::OUString();
1080}
1081
1082//-----------------------------------------------------------------------------
1083
1084void SAL_CALL SfxDocumentInfoObject::setUserFieldName(sal_Int16 nIndex, const ::rtl::OUString& aName ) throw( ::com::sun::star::uno::RuntimeException )
1085{
1086 ::osl::ClearableMutexGuard aGuard( _pImp->_aMutex );
1087 if (nIndex < FOUR) // yes, four!
1088 {
1089 // FIXME this is full of race conditions because the PropertyBag
1090 // can be accessed from clients of the DocumentProperties!
1091 ::rtl::OUString name = _pImp->m_UserDefined[nIndex];
1092 if (name != aName) {
1093 uno::Reference<beans::XPropertySet> xPropSet(
1094 _pImp->m_xDocProps->getUserDefinedProperties(),
1095 uno::UNO_QUERY_THROW);
1096 uno::Reference<beans::XPropertyContainer> xPropContainer(
1097 _pImp->m_xDocProps->getUserDefinedProperties(),
1098 uno::UNO_QUERY_THROW);
1099 uno::Any value;
1100 try {
1101 value = xPropSet->getPropertyValue(name);
1102 xPropContainer->removeProperty(name);
1103 xPropContainer->addProperty(aName,
1104 beans::PropertyAttribute::REMOVEABLE, value);
1105 _pImp->m_UserDefined[nIndex] = aName;
1106 } catch (const beans::UnknownPropertyException&) {
1107 try {
1108 xPropContainer->addProperty(aName,
1109 beans::PropertyAttribute::REMOVEABLE,
1110 uno::makeAny(::rtl::OUString("")));
1111 _pImp->m_UserDefined[nIndex] = aName;
1112 } catch (const beans::PropertyExistException&) {
1113 _pImp->m_UserDefined[nIndex] = aName;
1114 // ignore
1115 }
1116 } catch (const beans::PropertyExistException&) {
1117 try {
1118 xPropContainer->addProperty(name,
1119 beans::PropertyAttribute::REMOVEABLE, value);
1120 } catch (const beans::PropertyExistException&) {
1121 // bugger...
1122 }
1123 } catch (const uno::RuntimeException &) {
1124 throw;
1125 } catch (const uno::Exception &) {
1126 // ignore everything else; xPropSet _may_ be corrupted
1127 }
1128 }
1129 }
1130}
1131
1132//-----------------------------------------------------------------------------
1133
1134void SAL_CALL SfxDocumentInfoObject::setUserFieldValue( sal_Int16 nIndex, const ::rtl::OUString& aValue ) throw( ::com::sun::star::uno::RuntimeException )
1135{
1136 ::osl::ClearableMutexGuard aGuard( _pImp->_aMutex );
1137 if (nIndex < FOUR) // yes, four!
1138 {
1139 ::rtl::OUString name = _pImp->m_UserDefined[nIndex];
1140 uno::Reference<beans::XPropertySet> xPropSet(
1141 _pImp->m_xDocProps->getUserDefinedProperties(),
1142 uno::UNO_QUERY_THROW);
1143 uno::Reference<beans::XPropertyContainer> xPropContainer(
1144 _pImp->m_xDocProps->getUserDefinedProperties(),
1145 uno::UNO_QUERY_THROW);
1146 uno::Any aAny;
1147 aAny <<= aValue;
1148 try {
1149 uno::Any value = xPropSet->getPropertyValue(name);
1150 if (value != aAny) {
1151 xPropSet->setPropertyValue(name, aAny);
1152 }
1153 } catch (const beans::UnknownPropertyException&) {
1154 try {
1155 // someone removed it, add it back again
1156 xPropContainer->addProperty(name,
1157 beans::PropertyAttribute::REMOVEABLE, aAny);
1158 } catch (const uno::RuntimeException &) {
1159 throw;
1160 } catch (const uno::Exception &) {
1161 // ignore everything else
1162 }
1163 } catch (const uno::RuntimeException &) {
1164 throw;
1165 } catch (const uno::Exception &) {
1166 // ignore everything else
1167 }
1168 }
1169}
1170
1171//-----------------------------------------------------------------------------
1172SFX_IMPL_XINTERFACE_2( SfxStandaloneDocumentInfoObject, SfxDocumentInfoObject, ::com::sun::star::lang::XServiceInfo, ::com::sun::star::document::XStandaloneDocumentInfo )
1173SFX_IMPL_XTYPEPROVIDER_10( SfxStandaloneDocumentInfoObject, ::com::sun::star::document::XDocumentInfo, ::com::sun::star::lang::XComponent,
1174 ::com::sun::star::beans::XPropertySet, ::com::sun::star::beans::XFastPropertySet, ::com::sun::star::beans::XPropertyAccess,
1175 ::com::sun::star::beans::XPropertyContainer, ::com::sun::star::util::XModifiable, ::com::sun::star::util::XModifyBroadcaster,
1176 ::com::sun::star::document::XStandaloneDocumentInfo, ::com::sun::star::lang::XServiceInfo )
1177
1178SFX_IMPL_XSERVICEINFO( SfxStandaloneDocumentInfoObject, "com.sun.star.document.StandaloneDocumentInfo", "com.sun.star.comp.sfx2.StandaloneDocumentInfo" )
1179SFX_IMPL_SINGLEFACTORY( SfxStandaloneDocumentInfoObject )
1180
1181SfxStandaloneDocumentInfoObject::SfxStandaloneDocumentInfoObject( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory )
1182 : SfxDocumentInfoObject()
1183 , _xFactory( xFactory )
1184{
1185 uno::Reference< lang::XInitialization > xDocProps(
1186 document::DocumentProperties::create(comphelper::getComponentContext(_xFactory)),
1187 uno::UNO_QUERY_THROW);
1188 uno::Any a;
1189 a <<= xDocProps;
1190 uno::Sequence<uno::Any> args(1);
1191 args[0] = a;
1192 initialize(args);
1193}
1194
1195//-----------------------------------------------------------------------------
1196
1197SfxStandaloneDocumentInfoObject::~SfxStandaloneDocumentInfoObject()
1198{
1199}
1200
1201//-----------------------------------------------------------------------------
1202
1203uno::Reference< embed::XStorage > GetStorage_Impl( const ::rtl::OUString& rName, sal_Bool bWrite, uno::Reference < lang::XMultiServiceFactory >& xFactory )
1204{
1205 // catch unexpected exceptions under solaris
1206 // Client code checks the returned reference but is not interested on error details.
1207 try
1208 {
1209 SolarMutexGuard aSolarGuard;
1210 return ::comphelper::OStorageHelper::GetStorageFromURL(
1211 rName,
1212 bWrite ? embed::ElementModes::READWRITE : embed::ElementModes::READ,
1213 xFactory );
1214 }
1215 catch(const uno::Exception&)
1216 {}
1217
1218 return uno::Reference< embed::XStorage >();
1219}
1220
1221//-----------------------------------------------------------------------------
1222
1223sal_Int16 SAL_CALL SfxStandaloneDocumentInfoObject::getUserFieldCount() throw( ::com::sun::star::uno::RuntimeException )
1224{
1225 return SfxDocumentInfoObject::getUserFieldCount();
1226}
1227
1228//-----------------------------------------------------------------------------
1229
1230::rtl::OUString SAL_CALL SfxStandaloneDocumentInfoObject::getUserFieldName(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException )
1231{
1232 return SfxDocumentInfoObject::getUserFieldName(nIndex);
1233}
1234
1235//-----------------------------------------------------------------------------
1236
1237::rtl::OUString SAL_CALL SfxStandaloneDocumentInfoObject::getUserFieldValue(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException )
1238{
1239 return SfxDocumentInfoObject::getUserFieldValue(nIndex);
1240}
1241
1242//-----------------------------------------------------------------------------
1243
1244void SAL_CALL SfxStandaloneDocumentInfoObject::setUserFieldName(sal_Int16 nIndex, const ::rtl::OUString& aName ) throw( ::com::sun::star::uno::RuntimeException )
1245{
1246 SfxDocumentInfoObject::setUserFieldName( nIndex, aName );
1247}
1248
1249//-----------------------------------------------------------------------------
1250
1251void SAL_CALL SfxStandaloneDocumentInfoObject::setUserFieldValue( sal_Int16 nIndex, const ::rtl::OUString& aValue ) throw( ::com::sun::star::uno::RuntimeException )
1252{
1253 SfxDocumentInfoObject::setUserFieldValue( nIndex, aValue );
1254}
1255
1256//-----------------------------------------------------------------------------
1257
1258void SAL_CALL SfxStandaloneDocumentInfoObject::loadFromURL(const ::rtl::OUString& aURL)
1259 throw( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException )
1260{
1261 sal_Bool bOK = sal_False;
1262
1263 ::osl::ClearableMutexGuard aGuard( _pImp->_aMutex );
1264 uno::Reference< document::XDocumentProperties > xDocProps(
1265 document::DocumentProperties::create(comphelper::getComponentContext(_xFactory)) );
1266 _pImp->Reset(xDocProps);
1267 aGuard.clear();
1268
1269 uno::Reference< embed::XStorage > xStorage = GetStorage_Impl( aURL, sal_False, _xFactory );
1270 if ( xStorage.is() )
1271 {
1272 try
1273 {
1274 uno::Sequence<beans::PropertyValue> medium(2);
1275 medium[0].Name = ::rtl::OUString("DocumentBaseURL");
1276 medium[0].Value <<= aURL;
1277 medium[1].Name = ::rtl::OUString("URL");
1278 medium[1].Value <<= aURL;
1279 _pImp->m_xDocProps->loadFromStorage(xStorage, medium);
1280 _pImp->Reset(_pImp->m_xDocProps);
1281 bOK = sal_True;
1282 }
1283 catch( const uno::Exception& )
1284 {
1285 }
1286 }
1287 else
1288 {
1289 uno::Reference < document::XStandaloneDocumentInfo > xBinary( _xFactory->createInstance(
1290 ::rtl::OUString("com.sun.star.document.BinaryStandaloneDocumentInfo" ) ), uno::UNO_QUERY );
1291 if ( xBinary.is() )
1292 {
1293 xBinary->loadFromURL( aURL );
1294 bOK = sal_True;
1295 uno::Reference < document::XStandaloneDocumentInfo > xTarget( static_cast < document::XStandaloneDocumentInfo*> (this), uno::UNO_QUERY );
1296 Copy( xBinary, xTarget );
1297 }
1298 }
1299
1300 if ( !bOK )
1301 throw task::ErrorCodeIOException( ::rtl::OUString(), uno::Reference< uno::XInterface >(), ERRCODE_IO_CANTREAD );
1302}
1303
1304//-----------------------------------------------------------------------------
1305
1306void SAL_CALL SfxStandaloneDocumentInfoObject::storeIntoURL(const ::rtl::OUString& aURL) throw( ::com::sun::star::io::IOException )
1307{
1308 sal_Bool bOK = sal_False;
1309 uno::Reference< embed::XStorage > xStorage = GetStorage_Impl( aURL, sal_True, _xFactory );
1310 if ( xStorage.is() )
1311 {
1312 try
1313 {
1314 uno::Sequence<beans::PropertyValue> medium(2);
1315 medium[0].Name = ::rtl::OUString("DocumentBaseURL");
1316 medium[0].Value <<= aURL;
1317 medium[1].Name = ::rtl::OUString("URL");
1318 medium[1].Value <<= aURL;
1319
1320 _pImp->m_xDocProps->storeToStorage(xStorage, medium);
1321 bOK = sal_True;
1322 }
1323 catch( const io::IOException & )
1324 {
1325 throw;
1326 }
1327 catch( const uno::RuntimeException& )
1328 {
1329 throw;
1330 }
1331 catch( const uno::Exception& )
1332 {
1333 }
1334 }
1335 else
1336 {
1337 uno::Reference < document::XStandaloneDocumentInfo > xBinary( _xFactory->createInstance(
1338 ::rtl::OUString("com.sun.star.document.BinaryStandaloneDocumentInfo" ) ), uno::UNO_QUERY );
1339 if ( xBinary.is() )
1340 {
1341 Copy( this, xBinary );
1342 xBinary->storeIntoURL( aURL );
1343 bOK = sal_True;
1344 }
1345 }
1346
1347 if ( !bOK )
1348 throw task::ErrorCodeIOException( ::rtl::OUString(), uno::Reference< uno::XInterface >(), ERRCODE_IO_CANTWRITE );
1349}
1350
1351/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 276b1b7bbb09..57e8f27d4609 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -46,6 +46,7 @@
46#include <com/sun/star/document/DocumentProperties.hpp> 46#include <com/sun/star/document/DocumentProperties.hpp>
47#include <com/sun/star/frame/XTransientDocumentsDocumentContentFactory.hpp> 47#include <com/sun/star/frame/XTransientDocumentsDocumentContentFactory.hpp>
48#include <com/sun/star/ucb/XCommandEnvironment.hpp> 48#include <com/sun/star/ucb/XCommandEnvironment.hpp>
49#include <com/sun/star/util/XCloneable.hpp>
49#include <comphelper/enumhelper.hxx> // can be removed when this is a "real" service 50#include <comphelper/enumhelper.hxx> // can be removed when this is a "real" service
50 51
51#include <cppuhelper/interfacecontainer.hxx> 52#include <cppuhelper/interfacecontainer.hxx>
@@ -91,7 +92,6 @@
91#include <sfx2/docfile.hxx> 92#include <sfx2/docfile.hxx>
92#include <sfx2/dispatch.hxx> 93#include <sfx2/dispatch.hxx>
93#include <sfx2/request.hxx> 94#include <sfx2/request.hxx>
94#include <sfx2/objuno.hxx>
95#include <sfx2/printer.hxx> 95#include <sfx2/printer.hxx>
96#include <sfx2/basmgr.hxx> 96#include <sfx2/basmgr.hxx>
97#include <sfx2/event.hxx> 97#include <sfx2/event.hxx>
@@ -187,7 +187,6 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument
187 ::cppu::OMultiTypeInterfaceContainerHelper m_aInterfaceContainer ; 187 ::cppu::OMultiTypeInterfaceContainerHelper m_aInterfaceContainer ;
188 uno::Reference< uno::XInterface > m_xParent ; 188 uno::Reference< uno::XInterface > m_xParent ;
189 uno::Reference< frame::XController > m_xCurrent ; 189 uno::Reference< frame::XController > m_xCurrent ;
190 uno::Reference< document::XDocumentInfo > m_xDocumentInfo ;
191 uno::Reference< document::XDocumentProperties > m_xDocumentProperties; 190 uno::Reference< document::XDocumentProperties > m_xDocumentProperties;
192 uno::Reference< script::XStarBasicAccess > m_xStarBasicAccess ; 191 uno::Reference< script::XStarBasicAccess > m_xStarBasicAccess ;
193 uno::Reference< container::XNameReplace > m_xEvents ; 192 uno::Reference< container::XNameReplace > m_xEvents ;
@@ -813,13 +812,6 @@ void SAL_CALL SfxBaseModel::dispose() throw(::com::sun::star::uno::RuntimeExcept
813 lang::EventObject aEvent( (frame::XModel *)this ); 812 lang::EventObject aEvent( (frame::XModel *)this );
814 m_pData->m_aInterfaceContainer.disposeAndClear( aEvent ); 813 m_pData->m_aInterfaceContainer.disposeAndClear( aEvent );
815 814
816 if ( m_pData->m_xDocumentInfo.is() )
817 {
818 // as long as an SfxObjectShell is assigned to an SfxBaseModel it is still existing here
819 // so we can't dispose the shared DocumentInfoObject here
820 m_pData->m_xDocumentInfo = 0;
821 }
822
823 m_pData->m_xDocumentProperties.clear(); 815 m_pData->m_xDocumentProperties.clear();
824 816
825 m_pData->m_xDocumentMetadata.clear(); 817 m_pData->m_xDocumentMetadata.clear();
@@ -859,53 +851,6 @@ void SAL_CALL SfxBaseModel::removeEventListener( const uno::Reference< XEVENTLIS
859 m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const uno::Reference< XEVENTLISTENER >*)0), aListener ); 851 m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const uno::Reference< XEVENTLISTENER >*)0), aListener );
860} 852}
861 853
862//________________________________________________________________________________________________________
863// document::XDocumentInfoSupplier
864//________________________________________________________________________________________________________
865
866uno::Reference< document::XDocumentInfo > SAL_CALL SfxBaseModel::getDocumentInfo() throw(::com::sun::star::uno::RuntimeException)
867{
868 SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING );
869 if ( !m_pData->m_xDocumentInfo.is() )
870 {
871 // WARNING: this will only work if (when loading a document) the
872 // document meta-data has already been read and completely written
873 // into the XDocumentProperties at this point
874 // ==> DO NOT call getDocumentInfo before document info has been read!
875 uno::Reference< document::XDocumentInfo > xDocInfo =
876 new SfxDocumentInfoObject;
877 uno::Reference< document::XDocumentProperties > xDocProps =
878 getDocumentProperties();
879 uno::Sequence< uno::Any > args(1);
880 args[0] <<= xDocProps;
881 uno::Reference< lang::XInitialization > xInit(
882 xDocInfo, uno::UNO_QUERY_THROW);
883 try {
884 xInit->initialize(args);
885 ((SfxBaseModel*)this)->m_pData->m_xDocumentInfo = xDocInfo;
886 } catch (uno::RuntimeException &) {
887 throw;
888 } catch (const uno::Exception & e) {
889 throw lang::WrappedTargetRuntimeException(::rtl::OUString(
890 "SfxBaseModel::getDocumentInfo: cannot initialize"), *this,
891 uno::makeAny(e));
892 }
893 try {
894 rtl::OUString aName("MediaType");
895 uno::Reference < beans::XPropertySet > xSet(
896 getDocumentStorage(), uno::UNO_QUERY_THROW );
897 uno::Any aMediaType = xSet->getPropertyValue( aName );
898 uno::Reference < beans::XPropertySet > xDocSet(
899 m_pData->m_xDocumentInfo, uno::UNO_QUERY_THROW );
900 xDocSet->setPropertyValue( aName, aMediaType );
901 } catch (uno::Exception &) {
902 //ignore
903 }
904 }
905
906 return m_pData->m_xDocumentInfo;
907}
908
909void 854void
910IMPL_SfxBaseModel_DataContainer::impl_setDocumentProperties( 855IMPL_SfxBaseModel_DataContainer::impl_setDocumentProperties(
911 const uno::Reference< document::XDocumentProperties >& rxNewDocProps) 856 const uno::Reference< document::XDocumentProperties >& rxNewDocProps)
@@ -3086,47 +3031,28 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL
3086 uno::Sequence< beans::PropertyValue > aOldModifyPasswordInfo = m_pData->m_pObjectShell->GetModifyPasswordInfo(); 3031 uno::Sequence< beans::PropertyValue > aOldModifyPasswordInfo = m_pData->m_pObjectShell->GetModifyPasswordInfo();
3087 m_pData->m_pObjectShell->SetModifyPasswordInfo( aModifyPasswordInfo ); 3032 m_pData->m_pObjectShell->SetModifyPasswordInfo( aModifyPasswordInfo );
3088 3033
3089 // since saving a document modifies its DocumentInfo, the current 3034 // since saving a document modifies its DocumentProperties, the current
3090 // DocumentInfo must be saved on "SaveTo", so it can be restored 3035 // DocumentProperties must be saved on "SaveTo", so it can be restored
3091 // after saving 3036 // after saving
3092 sal_Bool bCopyTo = bSaveTo || 3037 sal_Bool bCopyTo = bSaveTo ||
3093 m_pData->m_pObjectShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED; 3038 m_pData->m_pObjectShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED;
3094 uno::Reference<document::XDocumentProperties> xOldDocProps; 3039 uno::Reference<document::XDocumentProperties> xOldDocProps;
3095 uno::Reference<document::XDocumentInfo> xOldDocInfo;
3096 if ( bCopyTo ) 3040 if ( bCopyTo )
3097 { 3041 {
3098 xOldDocProps = getDocumentProperties(); 3042 xOldDocProps = getDocumentProperties();
3099 if (m_pData->m_xDocumentInfo.is()) 3043 const Reference<util::XCloneable> xCloneable(xOldDocProps,
3100 { 3044 UNO_QUERY_THROW);
3101 xOldDocInfo = getDocumentInfo(); 3045 const Reference<document::XDocumentProperties> xNewDocProps(
3102 const Reference<util::XCloneable> xCloneable(xOldDocInfo, 3046 xCloneable->createClone(), UNO_QUERY_THROW);
3103 UNO_QUERY_THROW); 3047 m_pData->m_xDocumentProperties = xNewDocProps;
3104 const Reference<document::XDocumentInfo> xNewDocInfo(
3105 xCloneable->createClone(), UNO_QUERY_THROW);
3106 const Reference<document::XDocumentPropertiesSupplier> xDPS(
3107 xNewDocInfo, UNO_QUERY_THROW);
3108 const Reference<document::XDocumentProperties> xNewDocProps(
3109 xDPS->getDocumentProperties());
3110 m_pData->m_xDocumentProperties = xNewDocProps;
3111 m_pData->m_xDocumentInfo = xNewDocInfo;
3112 }
3113 else // try not to create DocumentInfo if it does not exist...
3114 {
3115 const Reference<util::XCloneable> xCloneable(xOldDocProps,
3116 UNO_QUERY_THROW);
3117 const Reference<document::XDocumentProperties> xNewDocProps(
3118 xCloneable->createClone(), UNO_QUERY_THROW);
3119 m_pData->m_xDocumentProperties = xNewDocProps;
3120 }
3121 } 3048 }
3122 3049
3123 sal_Bool bRet = m_pData->m_pObjectShell->APISaveAs_Impl( sURL, aParams ); 3050 sal_Bool bRet = m_pData->m_pObjectShell->APISaveAs_Impl( sURL, aParams );
3124 3051
3125 if ( bCopyTo ) 3052 if ( bCopyTo )
3126 { 3053 {
3127 // restore DocumentInfo if a copy was created 3054 // restore DocumentProperties if a copy was created
3128 m_pData->m_xDocumentProperties = xOldDocProps; 3055 m_pData->m_xDocumentProperties = xOldDocProps;
3129 m_pData->m_xDocumentInfo = xOldDocInfo;
3130 } 3056 }
3131 3057
3132 uno::Reference < task::XInteractionHandler > xHandler; 3058 uno::Reference < task::XInteractionHandler > xHandler;
diff --git a/sfx2/util/sfx.component b/sfx2/util/sfx.component
index b05a67302e0a..567e10a6ed80 100644
--- a/sfx2/util/sfx.component
+++ b/sfx2/util/sfx.component
@@ -63,7 +63,4 @@
63 <implementation name="com.sun.star.comp.sfx2.SfxMacroLoader"> 63 <implementation name="com.sun.star.comp.sfx2.SfxMacroLoader">
64 <service name="com.sun.star.frame.ProtocolHandler"/> 64 <service name="com.sun.star.frame.ProtocolHandler"/>
65 </implementation> 65 </implementation>
66 <implementation name="com.sun.star.comp.sfx2.StandaloneDocumentInfo">
67 <service name="com.sun.star.document.StandaloneDocumentInfo"/>
68 </implementation>
69</component> 66</component>
diff --git a/sfx2/util/sfx.xml b/sfx2/util/sfx.xml
index 660744547876..b188878f05cd 100644
--- a/sfx2/util/sfx.xml
+++ b/sfx2/util/sfx.xml
@@ -70,18 +70,6 @@
70 <supported-service> com.sun.star.frame.ProtocolHandler </supported-service> 70 <supported-service> com.sun.star.frame.ProtocolHandler </supported-service>
71 </component-description> 71 </component-description>
72 72
73 <component-description>
74 <author> Mathias Bauer </author>
75 <name> com.sun.star.comp.sfx2.StandaloneDocumentInfo </name>
76 <description>
77 StandaloneDocumentInfo.
78 </description>
79 <loader-name> com.sun.star.loader.SharedLibrary </loader-name>
80 <language> c++ </language>
81 <status value="final"/>
82 <supported-service> com.sun.star.document.StandaloneDocumentInfo </supported-service>
83 </component-description>
84
85 <project-build-dependency> cppu </project-build-dependency> 73 <project-build-dependency> cppu </project-build-dependency>
86 <project-build-dependency> cppuhelper </project-build-dependency> 74 <project-build-dependency> cppuhelper </project-build-dependency>
87 <project-build-dependency> sal </project-build-dependency> 75 <project-build-dependency> sal </project-build-dependency>