1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:07:34 +00:00

Spreadsheet: Add conditional formatting

Currently only supports setting the foregound and the background colours.
This patch also unifies `foreground_color' and `background_color' used
throughout to a `Format' struct, in hopes of getting more formatting
options one day :P
This commit is contained in:
AnotherTest 2020-09-25 22:31:39 +03:30 committed by Andreas Kling
parent 6902a09e47
commit 395df7b27d
13 changed files with 401 additions and 28 deletions

View file

@ -27,6 +27,7 @@
#pragma once
#include "CellType/Type.h"
#include "ConditionalFormatting.h"
#include "Forward.h"
#include "JSIntegration.h"
#include <AK/String.h>
@ -62,6 +63,14 @@ struct Cell : public Weakable<Cell> {
void set_type(const CellType*);
void set_type_metadata(CellTypeMetadata&&);
const Format& evaluated_formats() const { return m_evaluated_formats; }
const Vector<ConditionalFormat>& conditional_formats() const { return m_conditional_formats; }
void set_conditional_formats(Vector<ConditionalFormat>&& fmts)
{
dirty = true;
m_conditional_formats = move(fmts);
}
String typed_display() const;
JS::Value typed_js_data() const;
@ -91,6 +100,9 @@ struct Cell : public Weakable<Cell> {
const CellType* m_type { nullptr };
CellTypeMetadata m_type_metadata;
Vector<ConditionalFormat> m_conditional_formats;
Format m_evaluated_formats;
private:
void update_data();
};