CSSToLengthConversionData StyleResolverState::fontSizeConversionData() const { float em = parentStyle()->specifiedFontSize(); float rem = rootElementStyle() ? rootElementStyle()->specifiedFontSize() : 1; CSSToLengthConversionData::FontSizes fontSizes(em, rem, &parentStyle()->font()); CSSToLengthConversionData::ViewportSize viewportSize(document().layoutViewItem()); return CSSToLengthConversionData(style(), fontSizes, viewportSize, 1); }
bool Style::doubleLine() const { if (propertySet(s_doubleLine)) { return d->doubleLine; } if (parentStyle().isValid()) { return parentStyle().entity<Style>()->doubleLine(); } return false; }
QColor Style::innerLineColor() const { if (propertySet(s_innerLineColor)) { return d->innerLineColor; } if (parentStyle().isValid()) { return parentStyle().entity<Style>()->innerLineColor(); } return Qt::white; }
qreal Style::fillOpacity() const { if (propertySet(s_fillOpacity)) { return d->fillOpacity; } if (parentStyle().isValid()) { return parentStyle().entity<Style>()->fillOpacity(); } return 1.0; }
QColor Style::penColor() const { if (propertySet(s_penColor)) { return d->penColor; } if (parentStyle().isValid()) { return parentStyle().entity<Style>()->penColor(); } return Qt::black; }
PenStyle Style::penStyle() const { if (propertySet(s_penStyle)) { return d->penStyle; } if (parentStyle().isValid()) { return parentStyle().entity<Style>()->penStyle(); } return tikz::PenStyle::SolidLine; }
tikz::Value Style::lineWidth() const { if (propertySet(s_lineWidth)) { return d->lineWidth; } if (parentStyle().isValid()) { return parentStyle().entity<Style>()->lineWidth(); } return tikz::Value::semiThick(); }
QColor Style::fillColor() const { if (propertySet(s_fillColor)) { return d->fillColor; } if (parentStyle().isValid()) { return parentStyle().entity<Style>()->fillColor(); } return Qt::transparent; }
qreal Style::rotation() const { if (propertySet(s_rotation)) { return d->rotation; } if (parentStyle().isValid()) { return parentStyle().entity<Style>()->rotation(); } return 0.0; }
tikz::Value Style::innerLineWidth() const { if (doubleLine()) { if (propertySet(s_innerLineWidth)) { return d->innerLineWidth; } if (parentStyle().isValid() && parentStyle().entity<Style>()->doubleLine()) { return parentStyle().entity<Style>()->innerLineWidth(); } return tikz::Value::semiThick(); } return 0.0_pt; }
tikz::Value Style::innerSep() const { auto style = parentStyle().entity<Style>(); if (!propertySet(s_innerSep) && style) { return style->innerSep(); } return d->innerSep; }
tikz::Value Style::shortenEnd() const { if (propertySet(s_shortenEnd)) { return d->shortenEnd; } auto style = parentStyle().entity<Style>(); if (style) { return style->shortenEnd(); } return 0.0_cm; }
qreal Style::inAngle() const { if (propertySet(s_inAngle)) { return d->inAngle; } auto style = parentStyle().entity<Style>(); if (style) { return style->inAngle(); } return 135; }
tikz::Value Style::minimumWidth() const { if (propertySet(s_minimumWidth)) { return d->minimumWidth; } auto style = parentStyle().entity<Style>(); if (style) { return style->minimumWidth(); } return 0.0_cm; }
Shape Style::shape() const { if (propertySet(s_shape)) { return d->shape; } auto style = parentStyle().entity<Style>(); if (style) { return style->shape(); } return Shape::ShapeRectangle; }
TextAlignment Style::textAlign() const { if (propertySet(s_align)) { return d->textAlign; } auto style = parentStyle().entity<Style>(); if (style) { return style->textAlign(); } return TextAlignment::NoAlign; }
qreal Style::outAngle() const { if (propertySet(s_outAngle)) { return d->outAngle; } auto style = parentStyle().entity<Style>(); if (style) { return style->outAngle(); } return 45; }
Arrow Style::arrowHead() const { if (propertySet(s_arrowHead)) { return d->arrowHead; } auto style = parentStyle().entity<Style>(); if (style) { return style->arrowHead(); } return tikz::Arrow::NoArrow; }
qreal Style::looseness() const { if (propertySet(s_looseness)) { return d->looseness; } auto style = parentStyle().entity<Style>(); if (style) { return style->looseness(); } return 1.0; }
tikz::Value Style::radiusY() const { if (propertySet(s_radiusY)) { return d->radiusY; } auto style = parentStyle().entity<Style>(); if (style) { return style->radiusY(); } return 0.0_cm; }
qreal Style::bendAngle() const { if (propertySet(s_bendAngle)) { return d->bendAngle; } auto style = parentStyle().entity<Style>(); if (style) { return style->bendAngle(); } return 0.0; }
QJsonObject Style::saveData() const { QJsonObject json = Entity::saveData(); json["parentStyle"] = parentStyle().isValid() ? parentStyle().entity<Style>()->uid().toString() : Uid().toString(); if (penColorSet()) { json["penColor"] = penColor().name(); } if (fillColorSet()) { json["fillColor"] = fillColor().name(); } if (penOpacitySet()) { json["penOpacity"] = penOpacity(); } if (fillOpacitySet()) { json["fillOpacity"] = fillOpacity(); } if (penStyleSet()) { json["penStyle"] = toString(penStyle()); } if (lineWidthSet()) { json["lineWidth"] = lineWidth().toString(); } // FIXME line type if (doubleLineSet()) { json["doubleLine"] = doubleLine(); } if (innerLineWidthSet()) { json["innerLineWidth"] = innerLineWidth().toString(); } if (innerLineColorSet()) { json["innerLineColor"] = innerLineColor().name(); } if (rotationSet()) { json["rotation"] = rotation(); } if (radiusXSet()) { json["radiusX"] = radiusX().toString(); } if (radiusYSet()) { json["radiusY"] = radiusY().toString(); } if (bendAngleSet()) { json["bendAngle"] = bendAngle(); } if (loosenessSet()) { json["looseness"] = looseness(); } if (outAngleSet()) { json["outAngle"] = outAngle(); } if (inAngleSet()) { json["inAngle"] = inAngle(); } if (arrowTailSet()) { json["arrowTail"] = toString(arrowTail()); } if (arrowHeadSet()) { json["arrowHead"] = toString(arrowHead()); } if (shortenStartSet()) { json["shortenStart"] = shortenStart().toString(); } if (shortenEndSet()) { json["shortenEnd"] = shortenEnd().toString(); } if (textAlignSet()) { json["textAlign"] = toString(textAlign()); } if (shapeSet()) { json["shape"] = toString(shape()); } if (minimumWidthSet()) { json["minimumWidth"] = minimumWidth().toString(); } if (minimumHeightSet()) { json["minimumHeight"] = minimumHeight().toString(); } if (innerSepSet()) { json["innerSep"] = innerSep().toString(); } if (outerSepSet()) { json["outerSep"] = outerSep().toString(); } return json; }