How to write ORG.OPENOFFICE.EASTERSUNDAY for ODF 1.3 and pure EASTERSUNDAY for ODF 1.4?

Regina Henschel rb.henschel at t-online.de
Mon Oct 28 20:48:16 UTC 2024


Hi all,

a first version is now in
  https://gerrit.libreoffice.org/c/core/+/175736.
Please look whether this is in principle the way to go.
Or do you have a better idea?

Kind regards,
Regina

Mike Kaganski schrieb am 27.10.2024 um 07:51:
> On 27.10.2024 5:27, Regina Henschel wrote:
>> Hi Mike, hi all,
>>
>> Mike Kaganski schrieb am 21.10.2024 um 09:19:
>>> Hi Regina!
>>>
>>> On 20.10.2024 23:20, Regina Henschel wrote:
>>>> it would be necessary to write ORG.OFFICE.EASTERSUNDAY when writing 
>>>> in ODF versions 1.3 and before and write pure EASTERSUNDAY in case 
>>>> of ODF 1.4. But I see no way to distinguish between ODF 1.3 and ODF 
>>>> 1.4 in the export filter. I see only a general mxSymbols->isODFF() 
>>>> in ScCompiler::ParseOpCode().
>>>
>>>
>>> It seems to me, that the export of formula is done in 
>>> ScXMLExport::WriteCell (sc/source/filter/xml/xmlexprt.cxx); and 
>>> there, you have access to getSaneDefaultVersion().
>>>
>>> Hope this helps.
>>>
>>
>> You can indeed get the version to be saved to in xmlexprt.cxx. But 
>> where to evaluate it?
>>
>> Evaluating it directly in sc/source/filter/xml/xmlexprt.cxx would 
>> mean, that you have to tweak the result of
>>   #3218 OUString aFormula = 
>> pFormulaCell->GetFormula(*mpCompileFormulaCxt);
>> so that each occurrence of EASTERSUNDAY is replaced by 
>> ORG.OPENOFFICE.EASTERSUNDAY.
>> Besides the fact that EASTERSUNDAY as text and not as formula name 
>> would be replaced too, I think it is not a good idea to check each 
>> formula in a spreadsheet to catch the EASTERSUNDAY cases.
>>
>> Such approach seems completely wrong to me also because we will get 
>> the same problem again with the new functions XLOOKUP, FILTER, UNIQUE, 
>> etc. when the change from ODF 1.4 to ODF 1.5 is made.
>>
>> I would prefer a solution, that corrects the string, when the string 
>> is created from the opcode ocEasterSunday.
>>
>> When you look where the string is generated, you get the steps:
>> ScFormulaCell::GetFormula() in sc/source/core/data/formulacell.cxx
>> FormulaCompiler::CreateStringFromTokenArray() in 
>> formula/source/core/api/FormulaCompiler.cxx
>> FormulaCompiler::CreateStringFromToken()
>> mxSymbols->getSymbol(eOp), which uses the map in 
>> formula/inc/core_resource.hrc.
>>
>> You could pass on the ODF version and the fact that you are exporting 
>> to ODF to the method GetFormula(). That could be done as new parameter 
>> or by adding members to CompileFormulaContext.
> 
> I believe that this (the version of the ODF, or extending the 
> FormulaGrammar enum) would be the correct approach.
> 
>>
>> But the method CreateStringFromTokenArray() is not only called from 
>> export, but in other, totally unrelated situations, e.g. when the 
>> window with the sheet gets focus.
> 
> It needs that new argument (the ODF version), too.
> 
>>
>> Do we need a totally new method CreateStringFromTokenArrayForODFExport()?
>>
>> I'm still looking for your ideas.
>>
>> Kind regards,
>> Regina
>>
> 
> 



More information about the LibreOffice mailing list