shizhoubo[OOoFrm] schrieb:
> Hi Carsten,
> after I have investigated the FontMenuController::fillPopupMenu()
> source, I think the pFontNameArray[] array was sorted, so before every
> new FontName insert into the m_xPopuMenu, the new FontName is compared
> with every FontName inserted of the xPopupMenu. so that inserting
> MenuItem efficiency is very low.
> So I think before the new FontName is inserted, the pFontNameArray[]
> array should be sorted, than insert it into Menu.
> Other, I have investigated C's qsort() and STL's sort() via reading some
> document and found the STL's sort() is very quick then C's qsort(). So I
> used the STL's sort().
> 
> As stated above is what I understand. If you have good suggestions,
> please tell me.
> 
> The attachment is source changing, Please, review it. I have tested the
> changing source and the changing work right, but it trigger other
> question which is the Chinese FontName was placed in the last place. but
> before the source was not changed, the Chinese FontName was plased in
> the first place. why ? Could you give me some advices ?
> 
Hi Shizhoubo,

I checked your changes and I have to backup Fridrich that we need a
functor for sort() to have better sorting. The built-in operator<
provided by ustring.hxx/::rtl::OUString is not I18N aware and doesn't
work correctly for many languages. That's why you see the differences
between your implementation and the old one. Please have a look into the
stl documentation for sort (http://www.sgi.com/tech/stl/sort.html) and
you can find this declaration.

template <class RandomAccessIterator, class StrictWeakOrdering>
void sort(RandomAccessIterator first, RandomAccessIterator last,
          StrictWeakOrdering comp);

StrictWeakOrdering can be used to provide a functor (function object)
for the comparison. We need to make sure that we use the I18nHelper
class to make the comparison. See this following snippet from the old code:

const vcl::I18nHelper& rI18nHelper =
Application::GetSettings().GetUILocaleI18nHelper();
...
    if ( rI18nHelper.CompareString( rName, aString ) > 0 )
        break;
...

If you need further help don't hesitate to contact me.

Regards,
Carsten

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to