summaryrefslogtreecommitdiff
path: root/helpcompiler
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-02-02 14:49:15 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-02-02 15:01:43 +0000
commitcc464d1a94172ca28e9d962fa6e1ffadabc1dc79 (patch)
treeb8d0e7901c6085aac8ad19789d86709206ebd7d2 /helpcompiler
parentabf265e61794aedd60497778d31c82ca6fdf3583 (diff)
Resolves: fdo#88970 fix Incorrect Extended-tips with dodgy ahelp tags
ahelp puts the tip on the previous bookmarks with hid branches but has a scattergun effect if those previous bookmarks have nothing to do with the current element being described. So take the hid attribute of the ahelp and if its hid="." use the current set of bookmarks as the context otherwise believe it and apply the tip just to the stated hid Change-Id: I00648daadf5673e1abc96f222a4526959f1f7d7a
Diffstat (limited to 'helpcompiler')
-rw-r--r--helpcompiler/source/HelpCompiler.cxx30
1 files changed, 25 insertions, 5 deletions
diff --git a/helpcompiler/source/HelpCompiler.cxx b/helpcompiler/source/HelpCompiler.cxx
index 80c1bc6504dd..ccc324f949a1 100644
--- a/helpcompiler/source/HelpCompiler.cxx
+++ b/helpcompiler/source/HelpCompiler.cxx
@@ -398,16 +398,36 @@ void myparser::traverse( xmlNodePtr parentNode )
}
else if (!strcmp(reinterpret_cast<const char*>(test->name), "ahelp"))
{
+ //tool-tip
std::string text = dump(test);
std::replace(text.begin(), text.end(), '\n', ' ');
trim(text);
- std::string name;
- HashSet::const_iterator aEnd = extendedHelpText.end();
- for (HashSet::const_iterator iter = extendedHelpText.begin(); iter != aEnd; ++iter)
+ //tool-tip target
+ std::string hidstr("."); //. == previous seen hid bookmarks
+ xmlChar *hid = xmlGetProp(test, reinterpret_cast<const xmlChar*>("hid"));
+ if (hid)
{
- name = *iter;
- (*helptexts)[name] = text;
+ hidstr = std::string(reinterpret_cast<char*>(hid));
+ xmlFree (hid);
+ }
+
+ if (hidstr != "." && !hidstr.empty()) //simple case of explicitly named target
+ {
+ assert(!hidstr.empty());
+ (*helptexts)[hidstr] = text;
+ }
+ else //apply to list of "current" hids determined by recent bookmarks that have hid in their branch
+ {
+ //TODO: make these asserts and flush out all our broken help ids
+ SAL_WARN_IF(hidstr.empty(), "helpcompiler", "hid='' for text:" << text);
+ SAL_WARN_IF(!hidstr.empty() && extendedHelpText.empty(), "helpcompiler", "hid='.' with no hid bookmark branches for text:" << text);
+ HashSet::const_iterator aEnd = extendedHelpText.end();
+ for (HashSet::const_iterator iter = extendedHelpText.begin(); iter != aEnd; ++iter)
+ {
+ std::string name = *iter;
+ (*helptexts)[name] = text;
+ }
}
extendedHelpText.clear();
}