Issue 76704 - Document variables in Word document get lost on import
Summary: Document variables in Word document get lost on import
Status: CLOSED FIXED
Alias: None
Product: Writer
Classification: Application
Component: code (show other issues)
Version: OOo 2.2
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: michael.ruess
QA Contact: issues@sw
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2007-04-26 08:18 UTC by Mathias_Bauer
Modified: 2013-08-07 14:41 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
proposed patch (1.48 KB, text/plain)
2007-05-03 09:31 UTC, Mathias_Bauer
no flags Details
corrected patch (2.20 KB, text/plain)
2007-05-03 09:45 UTC, Mathias_Bauer
no flags Details
Test deocument with document variables (30.00 KB, application/msword)
2007-05-03 11:56 UTC, Mathias_Bauer
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Mathias_Bauer 2007-04-26 08:18:12 UTC
Writer imports document variables into the DocumentInfo of the ObjectShell. But
after importing this object is copied over by the DocumentInfo of the SwDoc
instance. Until now the variables didn't get lost because the copy method of
SfxDocumentInfo had a bug and didn't copy the custom properties. Obviously
fixing this bug broke the import.

Easy fix: use the DocumentInfo of SwDoc for import.
Comment 1 Mathias_Bauer 2007-04-26 08:52:04 UTC
Added keyword "regression". 
Comment 2 Mathias_Bauer 2007-05-03 09:31:56 UTC
Created attachment 44823 [details]
proposed patch
Comment 3 Mathias_Bauer 2007-05-03 09:34:33 UTC
Patch attached. 

As you can see the changes are in the Writer filter code, additionally sfx2 now
will export a method that until now only was used only internally. The same
method was used by the old code in Writer, but indirectly through the API that
was used here.
Comment 4 Mathias_Bauer 2007-05-03 09:45:06 UTC
Created attachment 44824 [details]
corrected patch
Comment 5 Mathias_Bauer 2007-05-03 11:56:33 UTC
Created attachment 44835 [details]
Test deocument with document variables
Comment 6 Mathias_Bauer 2007-05-03 12:00:56 UTC
Here's a simple basic macro to test if the fix works:

	info = ThisComponent.DocumentInfo
	props = info.PropertySetInfo.Properties
	for i=0 to UBOUND(props)
		
		if props(i).Name = "test1" then print info.test1
		if props(i).Name = "test2" then print info.test2
		if props(i).Name = "test3" then print info.test3
		
	next i

The macro should show "value1", "value2" and "value3". In OOo 2.2 nothing is shown. 
Comment 7 Mathias_Bauer 2007-05-03 12:01:31 UTC
Fixed in cws custompropsfix
Comment 8 Mathias_Bauer 2007-05-03 12:03:27 UTC
Please verify
Comment 9 stefan.baltzer 2007-05-04 11:19:45 UTC
SBA: Verified in CWS custompropsfix.
Comment 10 stefan.baltzer 2007-05-14 11:05:44 UTC
SBA->MRU: PLease take over, thx.
Comment 11 michael.ruess 2007-07-25 15:41:03 UTC
Checked fix in OO 2.2.1 and OO 2.3 dev 680m221.