[PATCH] [PUSHED] Moving misplaced Formula options from ScDocOptions to ScAppOptions

Albert Thuswaldner albert.thuswaldner at gmail.com
Mon Feb 27 11:31:57 PST 2012


Hi Kohei,

On Mon, Feb 27, 2012 at 18:34, Kohei Yoshida <kohei.yoshida at suse.com> wrote:
> On Mon, 2012-02-27 at 12:15 -0500, Kohei Yoshida wrote:
>> Hi Albert,
>>
>> Pushed both of your patches to master without modifications.
>
> Actually, now I have an issue with changing the formula syntax in the
> UI.  The new value won't stick for some reason.
>
> I'm debugging this at the moment.
>
Oh, sorry for that. It is probably due to one of the conversions being
incorrect. Around line 1046 in scmod.cxx you have this:

 if (rOptSet.HasItem(SID_SC_OPT_FORMULA_GRAMMAR, &pItem))
    {
        sal_uInt16 nVal = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
        ::formula::FormulaGrammar::Grammar eOld = pAppCfg->GetFormulaSyntax();
        ::formula::FormulaGrammar::Grammar eNew;

        switch (nVal)
        {
        case 0:
            eNew = ::formula::FormulaGrammar::GRAM_NATIVE;
            break;
        case 1:
            eNew = ::formula::FormulaGrammar::GRAM_NATIVE_XL_A1;
            break;
        case 2:
            eNew = ::formula::FormulaGrammar::GRAM_NATIVE_XL_R1C1;
            break;
        }

Here nVal should somehow be converted to from sal_uInt16 to
::formula::FormulaGrammar::Grammar (eNew). I fiddled around quite abit
with this and think I never got it right. The above is of course
completely wrong, it was a short-cut I was thinking about at the time,
I storing the position of the drop down list as an integer, which I
know is NOT the way to do it.

Some kind of static_cast should be used I guess but how?

/Albert


More information about the LibreOffice mailing list