I'm finishing i#35579, and have implemented the user interface so that
we have sensibly-working filter operators of "Begins With," "Ends With,"
"Contains," and "Does Not Contain."  (This builds upon Kohei's previous
work on this and similar bugs, and solves n#201129 [0]).

I'm now trying to implement the file change request, using the filter
keywords suggested by Michael Brauer [1], and have hit a bit of a snag.

In order for the new filter operators to be persisted into a .ods file,
ScFilterDescriptorBase::getFilterFields() needs to map the SC_*
constants to com::sun::star::sheet::FilterOperator constants, which are
then used in ScXMLExportDatabaseRanges::getOperatorXML() to map the
FilterOperator constant to the corresponding string to insert into
the .ods file.  (Similarly, ScXMLConditionContext::getOperatorXML()
needs to map the filter value from the .ods file to a FilterOperator
constant which is later converted to a SC_* constant in
ScFilterDescriptorBase::setFilterFields().)

Unfortunately, the obvious way of doing this mapping would be to add
constants to the FilterOperator enum in
offapi/com/sun/star/sheet/FilterOperator.idl, and changing this file
breaks my build because it breaks the ABI of a published enum. :-)

What is the best way to solve this, so that we can persist the new
FilterOperator values to the .ods file?  I have one working (hackish)
solution [2], but I doubt that this would be ideal.

(As an aside, implementing support for this in the ImportExcel8 type
looks to be significantly less invasive, as the FilterOperator enum
isn't used as an intermediate value between the .xls and the in-memory
spreadsheet representation.)

Any feedback/assistance would be appreciated.

Thanks,

 - Jon

[0] https://bugzilla.novell.com/show_bug.cgi?id=201129
[1] http://lists.oasis-open.org/archives/office/200701/msg00020.html
[2] It involves storing values outside the FilterOperator enum within
FilterOperator enum instances, e.g. in
ScFilterDescriptorBase::getFilterFields():

    case SC_BEGINS_WITH: 
        aField.Operator = (sheet::FilterOperator) (100+SC_BEGINS_WITH); 
        break;
    // ...

and e.g. in ScFilterDescriptorBase::setFilterFields():

    case 100+SC_BEGINS_WITH: rEntry.eOp = SC_BEGINS_WITH; break;

This isn't ideal, because (1) it uses unnamed constants (easily fixed),
and (2) stores values outside of the FilterOperator enum within
FilterOperator instances.  This could potentially break any external
apps that hook into this process.


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

Reply via email to