Kaydet (Commit) cc464d1a authored tarafından Caolán McNamara's avatar Caolán McNamara

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
üst abf265e6
...@@ -398,17 +398,37 @@ void myparser::traverse( xmlNodePtr parentNode ) ...@@ -398,17 +398,37 @@ void myparser::traverse( xmlNodePtr parentNode )
} }
else if (!strcmp(reinterpret_cast<const char*>(test->name), "ahelp")) else if (!strcmp(reinterpret_cast<const char*>(test->name), "ahelp"))
{ {
//tool-tip
std::string text = dump(test); std::string text = dump(test);
std::replace(text.begin(), text.end(), '\n', ' '); std::replace(text.begin(), text.end(), '\n', ' ');
trim(text); trim(text);
std::string name;
//tool-tip target
std::string hidstr("."); //. == previous seen hid bookmarks
xmlChar *hid = xmlGetProp(test, reinterpret_cast<const xmlChar*>("hid"));
if (hid)
{
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(); HashSet::const_iterator aEnd = extendedHelpText.end();
for (HashSet::const_iterator iter = extendedHelpText.begin(); iter != aEnd; ++iter) for (HashSet::const_iterator iter = extendedHelpText.begin(); iter != aEnd; ++iter)
{ {
name = *iter; std::string name = *iter;
(*helptexts)[name] = text; (*helptexts)[name] = text;
} }
}
extendedHelpText.clear(); extendedHelpText.clear();
} }
// traverse children // traverse children
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment