Currently only one ScConditionalFormat is allowed per cell because they are stored by index in ScPattrArray. We should move to a concept that allows having multiple conditional formats overlaying so that we no longer remove the old conditional format if we define a new one on the same area. This will help extremely to keep the ScRangeList in ScConditionalFormat/ScColorFormat and the cell storage in sync.
*** Bug 40530 has been marked as a duplicate of this bug. ***
After talking to Eike and thinking for some time about a good solution I will inspect: Storing a structure struct { int nCondFormats; int nCondFormat; // only valid in case of nCondFormats = 1 }; and storing this one instead of the old integer index. This should be fast for all old document but still allow to have overlying cond formats.
Implemented in feature/cond-format-rework and some parts are already in master. Implemented now just a vector storing the conditional formats registered to a cell. Together with a set of adjustments to allow easy adding/removing of single entries calc core now supports this feature. This should be the last major feature necessary for conditional formats in calc core.