[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/kexi/plugins/reportspgz/koreport (silent)
From: Adam Pigg <adam () piggz ! co ! uk>
Date: 2010-01-08 21:51:06
Message-ID: 1262987466.357794.3860.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1071838 by piggz:
Better handling of the section height.
+Set the property when the section is manually resized.
+Set the height when the property is changed
+Save as svg:height
+Save/load in user units
SVN_SILENT
M +5 -3 common/krsectiondata.cpp
M +17 -4 wrtembed/reportsection.cpp
--- trunk/koffice/kexi/plugins/reportspgz/koreport/common/krsectiondata.cpp \
#1071837:1071838 @@ -57,7 +57,8 @@
m_valid = false;
return;
}
- m_height->setValue(elemSource.attribute("report:height").toDouble());
+ m_height->setValue(KoUnit::parseValue(elemSource.attribute("svg:height", \
"2.0cm"))); +
m_backgroundColor->setValue(QColor(elemSource.attribute("fo:background-color")));
QDomNodeList section = elemSource.childNodes();
@@ -114,9 +115,10 @@
{
m_set = new KoProperty::Set(0, "Section");
- m_height = new KoProperty::Property("height", 1.0, "Height", "Height");
+ m_height = new KoProperty::Property("height", \
KoUnit::unit("cm").fromUserValue(2.0), "Height", "Height");
m_backgroundColor = new KoProperty::Property("background-color", Qt::white, \
"Background Color", "Background Color");
-
+ m_height->setOption("unit", "cm");
+
m_set->addProperty(m_height);
m_set->addProperty(m_backgroundColor);
}
--- trunk/koffice/kexi/plugins/reportspgz/koreport/wrtembed/reportsection.cpp \
#1071837:1071838 @@ -144,7 +144,7 @@
if (h < 1) h = 1;
h = m_scene->gridPoint(QPointF(0, h)).y();
-
+ m_sectionData->m_height->setValue(INCH_TO_POINT(h/KoDpi::dpiY()));
m_sectionRuler->setRulerLength(h);
m_scene->setSceneRect(0, 0, m_scene->width(), h);
@@ -156,8 +156,9 @@
void ReportSection::buildXML(QDomDocument &doc, QDomElement §ion)
{
qreal f = INCH_TO_POINT(m_scene->height() / KoDpi::dpiY());
+ QString un = m_sectionData->m_height->option("unit", "cm").toString();
- section.setAttribute("report:height", QString::number(f));
+ section.setAttribute("svg:height", \
KoUnit::unit(un).toUserStringValue(m_sectionData->m_height->value().toDouble()) + \
un);
section.setAttribute("fo:background-color", \
m_sectionData->backgroundColor().name());
// now get a list of all the QGraphicsItems on this scene and output them.
@@ -174,7 +175,9 @@
QDomNode node;
QString n;
- qreal h = section.toElement().attribute("report:height", \
QString::number(72)).toDouble(); + qreal h = \
KoUnit::parseValue(section.toElement().attribute("svg:height", "2.0cm")); + \
m_sectionData->m_height->setValue(h); +
h = POINT_TO_INCH(h) * KoDpi::dpiY();
kDebug() << "Section Height: " << h;
m_scene->setSceneRect(0, 0, m_scene->width(), h);
@@ -221,6 +224,8 @@
Q_UNUSED(set)
KoUnit unit = m_reportDesigner->pageUnit();
+
+ m_sectionData->m_height->setOption("unit", KoUnit::unitName(unit));
//update items position with unit
QList<QGraphicsItem*> itms = m_scene->items();
@@ -239,6 +244,8 @@
m_reportDesigner->adjustSize();
m_reportDesigner->repaint();
+
+ slotResizeBarDragged(0);
}
void ReportSection::slotSceneClicked()
@@ -252,13 +259,19 @@
Q_UNUSED(s)
//Handle Background Color
- if (p.name() == "BackgroundColor") {
+ if (p.name() == "background-color") {
m_scene->setBackgroundBrush(p.value().value<QColor>());
}
+
+ if (p.name() == "height") {
+ m_scene->setSceneRect(0, 0, m_scene->width(), POINT_TO_INCH(p.value().toDouble()) * \
KoDpi::dpiY()); + slotResizeBarDragged(0);
+ }
if (m_reportDesigner)
m_reportDesigner->setModified(true);
+ m_sceneView->resetCachedContent();
m_scene->update();
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic