Issue 66550

Summary: hyperlinks for shapes not imported
Product: Calc Reporter: noel.power
Component: open-importAssignee: AOO issues mailing list <issues>
Status: ACCEPTED --- QA Contact:
Severity: Trivial    
Priority: P3 CC: freuter, issues, kpalagin, manens, michael.brauer, mmeeks, pagalmes.lists
Version: OOo 2.0.3   
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: PATCH Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
patch file
none
latest patch file with hyperlink context menu
none
screenshot of new context menu ( shape has no hyperlink assigned )
none
screenshot of context menu when the shape alread has associated hlink
none
screenshot showing dialog when ~Hyperlink ctx menu is selected
none
test document ( used for the screenshots )
none
new version of patch
none
patch to enclose shape objects with <draw:a> and associated hyperlink attribute
none
patch file none

Description noel.power 2006-06-19 12:18:50 UTC
Hyperlinks associated with autoshapes in xl are not imported, this is related to
issue 59082. I have a patch that allows the binding to be imported ( and
additionally that binding to be persisted in an ods - calc document )

I will attach a patch here ( the patch is dependant on the patch associated with
issue  59082 being applied previously )

additionally some context menu items will need to be added ( hope to add patch
for that when I figure out how to do that ;-) )
Comment 1 noel.power 2006-06-19 14:16:29 UTC
Created attachment 37231 [details]
patch file
Comment 2 noel.power 2006-06-19 14:48:29 UTC
npower->dr it would be great to get this folded into 2.0.4, I hope to add here a
patch for the context menu bits also
Comment 3 noel.power 2006-06-27 08:45:54 UTC
Created attachment 37347 [details]
latest patch file with hyperlink context menu
Comment 4 noel.power 2006-06-27 08:48:41 UTC
Created attachment 37349 [details]
screenshot of new context menu ( shape has no hyperlink assigned )
Comment 5 noel.power 2006-06-27 08:50:31 UTC
Created attachment 37350 [details]
screenshot of context menu when the shape alread has associated hlink
Comment 6 noel.power 2006-06-27 08:51:46 UTC
Created attachment 37351 [details]
screenshot showing dialog when ~Hyperlink ctx menu is selected
Comment 7 noel.power 2006-06-27 08:52:52 UTC
Created attachment 37352 [details]
test document ( used for the screenshots )
Comment 8 daniel.rentz 2006-07-03 15:55:54 UTC
Same comments as in issue 59082, please take care about the UI things and the 
spec.
Comment 9 noel.power 2006-07-06 09:49:11 UTC
spec is available from here
http://specs.openoffice.org/calc/compatibility/AutoShapeGraphicHyperlinkAndMacroSupport.odt
the patches already contain the ui bits
Comment 10 noel.power 2006-07-17 17:21:59 UTC
Created attachment 37823 [details]
new version of patch
Comment 11 noel.power 2006-07-17 17:23:09 UTC
small change to patch to prevent bad String copy ( I attach the full version of
the patch file with the modification included )
Comment 12 daniel.rentz 2006-10-23 16:15:39 UTC
specification has been updated by the User Experience team.
Comment 13 pagalmes.lists 2007-04-20 11:35:39 UTC
Please, could you check if issue 76543 is a duplicate of this one ?
Comment 14 pagalmes.lists 2007-04-20 11:43:19 UTC
BTW, the status of the above spec is "obsolete". Does this mean there is a new
spec ?
Comment 15 noel.power 2007-04-24 10:41:37 UTC
>please, could you check if issue 76543 is a duplicate of this one ?
it seems similar, that is if on the excel side of things it is a hyperlink that
is associated with the shape.But... this patch wont help because it is a calc
only fix
>BTW, the status of the above spec is "obsolete". Does this mean there is a new
spec ?
No idea, I hope the status was set to obsolete accidentaly, but after nearly a
year of this hanging around I am finding it hard to maintain interest :-(
Comment 16 pagalmes.lists 2007-04-24 10:49:24 UTC
@dr: any news about that?

@npower: Yes, I understand your frustration...
Comment 17 daniel.rentz 2007-06-13 16:22:49 UTC
target
Comment 18 daniel.rentz 2007-06-14 16:15:08 UTC
Ok, so far I have added all pieces of this patch but the xmloff stuff to the sources, 
including some minor changes (e.g. show correct URL in 
ScGridWindow::RequestHelp(), if an object contains an URL and there is a URL 
embedded in its text; removed global OUStrings in shapeuno.cxx because that 
increases library load time).

A question about the xmloff changes, as this is a quite big part of the patch and I 
am not the ODF expert:
Do these changes modify the ODF file format (add elements/attributes, or move 
them, etc)?
Comment 19 mmeeks 2007-06-14 16:26:32 UTC
FYI Noel is on paternity leave, may be a week or so before he can help; sorry.
Comment 20 noel.power 2007-06-20 14:51:30 UTC
It's great something happens with this at last :-)

>A question about the xmloff changes, as this is a quite big part of the patch
and I 
>am not the ODF expert:
me either
>Do these changes modify the ODF file format (add elements/attributes, or move 
them, etc)?
I am looking at the patch but am currently lost, its been a long time, I will
get back to you as soon as I can

Comment 21 daniel.rentz 2007-06-20 15:15:54 UTC
Well, I have had to do a lot of changes to be able to add it into m215. :-)

Currently I have changed the draw:event-listener element (this doesn't exist) 
to a presentation:event-listener element. But I think that's not the final 
solution, what does a presentation element in a Calc document? I am in contact 
with Michael Brauer, and will come back and coment in this issue.
Comment 22 noel.power 2007-06-21 10:03:43 UTC
hi, I looked through your changes as I was concerned about the patch(s) attached
to this issue being out of date. Anyway glad to see everything seems to be fine
( although I ignored the xmloff changes as they were too hard to follow for my
tired excuse for a brain). Just to let you know, it's really easy for the
patches attached to the issues here to get out of sync with whats in ooo-build,
( often even a patch of mine will get changed without my knowledge because we
support a newer milestone ) with so many patches one can quite easily forget to
update the patch in the issue after changing it in ooo-build. Perhaps in future
you could ping before starting to check? it might save some time ;-), I could
answer any questions etc. 

Totally agree with the draw:event-listener element v's
presentation:event-listener in calc, Ihoped adding a element to the draw
namespace would be ok ( e.g. unrecognised elements should be ignored by other
odf aware applications ) The draw:event-listener follows the existing precedent
etc. But I guess Mr Brauer will know what to do.
Comment 23 daniel.rentz 2007-06-28 13:42:19 UTC
cannot be finished in 2.3 -> target
Comment 24 daniel.rentz 2007-06-28 13:52:42 UTC
all code already checked in for this feature is commented out by

#ifdef ISSUE66550_HLINK_FOR_SHAPES
...
#endif

changes are in the modules xmloff and sc.
Comment 25 noel.power 2007-07-04 14:58:59 UTC
Created attachment 46519 [details]
patch to enclose shape objects with <draw:a> and associated hyperlink attribute
Comment 26 noel.power 2007-07-04 15:10:12 UTC
summary of the patch
o I rewound the changes in xmloff sc. So I added back support for hyperlinks in
sc ( except the hyperlink is now transported by a property instead of an event
supplier ) All hyperlink related bits in xmloff have been removed
o I made Hyperlink an optional property of the Shape service
    o the property is only available from a shape in calc at the momement ( but
thats just an  implementation detail ) also I don't want to interfere with the
existing writer ( and others? ) handling of hyperlinks ( I think thats a battle
for another day )
o now all of the xml handling is localised in calc e.g. see. sc/source/filter/xml/* 
   o also I only enclose the shape in <draw:a> if and only if there is an
associated hyperlink


exmaple xml 
============

a) picture in calc with hyperlink

<draw:a xlink:type="simple" xlink:href="#Sheet2"><draw:frame
table:end-cell-address="Sheet1.E16" table:end-x="0.503cm" table:end-y="0.375cm"
draw:z-index="0" draw:name="Graphics 1" draw:style-name="gr1"
draw:text-style-name="P1" svg:width="9.534cm" svg:height="6.805cm" svg:x="0cm"
svg:y="0cm"><draw:image
xlink:href="Pictures/10000000000003A200000387B6D6F7F0.png" xlink:type="simple"
xlink:show="embed"
xlink:actuate="onLoad"><text:p/></draw:image></draw:frame></draw:a>

b) shape in calc ( with hyperlink )

<draw:a xlink:type="simple" xlink:href="#Sheet2"><draw:rect
table:end-cell-address="Sheet1.D19" table:end-x="0.447cm" table:end-y="0.322cm"
draw:z-index="0" draw:style-name="gr1" draw:text-style-name="P1"
svg:width="5.798cm" svg:height="2.036cm" svg:x="1.422cm"
svg:y="0.001cm"><text:p/></draw:rect></draw:a>

Comment 27 daniel.rentz 2007-07-05 09:12:35 UTC
Looks very good, thanks.
What about the ODF changes? They need to be spec'ed.
Comment 28 flr 2007-07-10 12:06:42 UTC
flr->dr:
According to my findings the ODF spec already allows ODF fragments of the above
type. I.e. the current ODF spec explicitly allows a "draw:a" element to appear
inside a "table:table-cell".
So there is not need to modify the ODF spec, since the ODF spec already allows this.
Could you please check this with your ODF experts?
Comment 29 michael.brauer 2007-07-12 14:44:52 UTC
mib->flr: You are right, a <draw:a> may appear within a table cell. But it
currently only allows a <draw:frame> as content, So you may use it for text
boxes, images and embedded objects only. My understanding of the issue is that
you also want to support hyperlinks also for other kind of objects, for instance
rectangles. In that case, the ODF specification has to be extended to also
support <draw:rect>, etc.
Comment 30 flr 2007-07-19 16:15:05 UTC
Proposed enhancement to the ODF TC:
http://lists.oasis-open.org/archives/office/200707/msg00061.html
Comment 31 Martin Hollmichel 2008-01-22 07:49:34 UTC
move target from 2.x to 3.0
Comment 32 clippka 2008-06-25 15:53:17 UTC
fyi, with issue 91056 I fixed that shapes with a surrounding draw:a element are
actually loaded in OOo 3.0 and for impress and draw the hyperlink is actually
used for the shape.

To support the import of the hyperlinks for calc you only have to modify your
derivation of SvXMLShapeContext, if such think exists in calc, and use the new
protected member msHyperlink which is filed for your convenience during import.
If you do not derive from SvXMLShapeContext then you must find another way to
get to that member.
Comment 33 noel.power 2008-06-27 07:46:18 UTC
Created attachment 54776 [details]
patch file
Comment 34 noel.power 2008-06-27 07:57:40 UTC
some details on the above

o the patch file can replace enable-dra-a-hlink.diff above.
o it assumes integration of the cws impress146.
o all xml hackerage in sc/source/filter/xml has been removed [*]
o xmloff has been modified to try and set the hlink at the shape ( if the
optional Hyperlink property exists )

[*] I did leave in the patches to sc/source/filter/xml/xmlexprt.cxx this
provides for export of the draw:a bits for calc ( which are not enabled by cws
impress146 ) imo it is acceptable for a new feature in a new version not to be
readable by and older version of office. But... you can of course just not apply
that part of the patch if you wish
Comment 35 kpalagin 2008-12-02 10:35:22 UTC
Daniel,
please see if this patch can be integrated.
Thanks a lot.
WBR,
KP.
Comment 36 daniel.rentz 2009-07-10 14:37:34 UTC
dr->noel: Please give me an update, what's the status of the ODF proposal?
Comment 37 noel.power 2009-07-14 11:59:48 UTC
Hi Daniel,
from cl's comments above ( from Wed Jun 25 '08 ) regarding issue 91056 it would
seem to be accepted right? and I attached ( some time ago[*] ) a patch in
response to his changes

[*] I don't recall exactly what changes I made, there is some sort of a summary
immediately after the last version of the patch, I don't know if this patch
applies as is anymore, can you try ? if it doesn't apply then I can regenerate
it for the milestone you need if you wish, just let me know if you need me to do
that ( and the milestone required )
Comment 38 daniel.rentz 2009-07-14 12:02:30 UTC
I see, thanks for the feedback. I will try to apply the patch and come back to
you, if I find unsolvable problems.
Comment 39 daniel.rentz 2009-08-14 16:41:22 UTC
dr->npower: have to ask again :-(
which patch should I apply? only the very last in the list? the last patches
seem to be somewhat similar...
Comment 40 noel.power 2009-08-14 17:04:28 UTC
>which patch should I apply? only the very last in the list? the last patches
>seem to be somewhat similar...
http://www.openoffice.org/nonav/issues/showattachment.cgi/54776/vba-sc-autoshapes-hyperlinks.diff
( the last patch ) afaik replaces the others, having a quick look in in I see it
patches xmloff/source/draw/ximpshap.cxx ( and the previous one doesn't ) I guess
this refers to the changes made in response to issue# 91056 
Additionally I see that there is an error in the 
http://www.openoffice.org/nonav/issues/showattachment.cgi/46519/enable-draw-a-hlink.diff
( the previous version ) see Shape.idl which afaics won't even compile

I guess the patches look the same because I am regenerating all the changes
rather than added a little change to the previous version. But I guess you need
to see if it applies, see if it works ( I haven't looked at this in so long I
wouldn't be suprised if it no longer works or applies ) Anyway, if you have
problems just ping me and I will help
Comment 41 daniel.rentz 2009-08-14 17:16:03 UTC
applied successfully. compiling and hoping that it really works :-)
Comment 42 Rob Weir 2013-03-11 15:02:01 UTC
I'm adding this comment to all open issues with Issue Type == PATCH.  We have 220 such issues, many of them quite old.  I apologize for that.  

We need your help in prioritizing which patches should be integrated into our next release, Apache OpenOffice 4.0.

If you have submitted a patch and think it is applicable for AOO 4.0, please respond with a comment to let us know.

On the other hand, if the patch is no longer relevant, please let us know that as well.

If you have any general questions or want to discuss this further, please send a note to our dev mailing list:  dev@openoffice.apache.org

Thanks!

-Rob