summaryrefslogtreecommitdiffstats
path: root/lib/kformula/fractionelement.cc
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /lib/kformula/fractionelement.cc
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz
koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/kformula/fractionelement.cc')
-rw-r--r--lib/kformula/fractionelement.cc96
1 files changed, 48 insertions, 48 deletions
diff --git a/lib/kformula/fractionelement.cc b/lib/kformula/fractionelement.cc
index 8652bf66..a8c1db9c 100644
--- a/lib/kformula/fractionelement.cc
+++ b/lib/kformula/fractionelement.cc
@@ -18,7 +18,7 @@
* Boston, MA 02110-1301, USA.
*/
-#include <qpainter.h>
+#include <tqpainter.h>
#include <kdebug.h>
#include <klocale.h>
@@ -32,7 +32,7 @@
KFORMULA_NAMESPACE_BEGIN
using namespace std;
-FractionElement::FractionElement(BasicElement* parent) : BasicElement(parent),
+FractionElement::FractionElement(BasicElement* tqparent) : BasicElement(tqparent),
m_lineThicknessType( NoSize ),
m_numAlign( NoHorizontalAlign ),
m_denomAlign( NoHorizontalAlign ),
@@ -81,12 +81,12 @@ void FractionElement::entered( SequenceElement* child )
BasicElement* FractionElement::goToPos( FormulaCursor* cursor, bool& handled,
- const LuPixelPoint& point, const LuPixelPoint& parentOrigin )
+ const LuPixelPoint& point, const LuPixelPoint& tqparentOrigin )
{
- BasicElement* e = BasicElement::goToPos(cursor, handled, point, parentOrigin);
+ BasicElement* e = BasicElement::goToPos(cursor, handled, point, tqparentOrigin);
if (e != 0) {
- LuPixelPoint myPos(parentOrigin.x() + getX(),
- parentOrigin.y() + getY());
+ LuPixelPoint myPos(tqparentOrigin.x() + getX(),
+ tqparentOrigin.y() + getY());
e = numerator->goToPos(cursor, handled, point, myPos);
if (e != 0) {
return e;
@@ -121,7 +121,7 @@ BasicElement* FractionElement::goToPos( FormulaCursor* cursor, bool& handled,
/**
* Calculates our width and height and
- * our children's parentPosition.
+ * our tqchildren's tqparentPosition.
*/
void FractionElement::calcSizes( const ContextStyle& context,
ContextStyle::TextStyle tstyle,
@@ -140,10 +140,10 @@ void FractionElement::calcSizes( const ContextStyle& context,
double linethickness = lineThickness( context, factor );
- setWidth( QMAX( numerator->getWidth(), denominator->getWidth() ) );
+ setWidth( TQMAX( numerator->getWidth(), denominator->getWidth() ) );
setHeight( numerator->getHeight() + denominator->getHeight() +
2*distY + linethickness );
- setBaseline( qRound( numerator->getHeight() + distY + .5*linethickness
+ setBaseline( tqRound( numerator->getHeight() + distY + .5*linethickness
+ context.axisHeight( tstyle, factor ) ) );
numerator->setX( ( getWidth() - numerator->getWidth() ) / 2 );
@@ -155,18 +155,18 @@ void FractionElement::calcSizes( const ContextStyle& context,
/**
- * Draws the whole element including its children.
- * The `parentOrigin' is the point this element's parent starts.
- * We can use our parentPosition to get our own origin then.
+ * Draws the whole element including its tqchildren.
+ * The `tqparentOrigin' is the point this element's tqparent starts.
+ * We can use our tqparentPosition to get our own origin then.
*/
-void FractionElement::draw( QPainter& painter, const LuPixelRect& r,
+void FractionElement::draw( TQPainter& painter, const LuPixelRect& r,
const ContextStyle& context,
ContextStyle::TextStyle tstyle,
ContextStyle::IndexStyle istyle,
StyleAttributes& style,
- const LuPixelPoint& parentOrigin )
+ const LuPixelPoint& tqparentOrigin )
{
- LuPixelPoint myPos( parentOrigin.x()+getX(), parentOrigin.y()+getY() );
+ LuPixelPoint myPos( tqparentOrigin.x()+getX(), tqparentOrigin.y()+getY() );
//if ( !LuPixelRect( myPos.x(), myPos.y(), getWidth(), getHeight() ).intersects( r ) )
// return;
@@ -184,12 +184,12 @@ void FractionElement::draw( QPainter& painter, const LuPixelRect& r,
// TODO: thickness
double factor = style.sizeFactor();
double linethickness = lineThickness( context, factor );
- painter.setPen( QPen( style.color(),
- context.layoutUnitToPixelY( linethickness ) ) );
- painter.drawLine( context.layoutUnitToPixelX( myPos.x() ),
- context.layoutUnitToPixelY( myPos.y() + axis( context, tstyle, factor ) ),
- context.layoutUnitToPixelX( myPos.x() + getWidth() ),
- context.layoutUnitToPixelY( myPos.y() + axis( context, tstyle, factor ) ) );
+ painter.setPen( TQPen( style.color(),
+ context.tqlayoutUnitToPixelY( linethickness ) ) );
+ painter.drawLine( context.tqlayoutUnitToPixelX( myPos.x() ),
+ context.tqlayoutUnitToPixelY( myPos.y() + axis( context, tstyle, factor ) ),
+ context.tqlayoutUnitToPixelX( myPos.x() + getWidth() ),
+ context.tqlayoutUnitToPixelY( myPos.y() + axis( context, tstyle, factor ) ) );
}
}
@@ -312,7 +312,7 @@ void FractionElement::moveDown(FormulaCursor* cursor, BasicElement* from)
* Reinserts the denominator if it has been removed.
*/
void FractionElement::insert(FormulaCursor* cursor,
- QPtrList<BasicElement>& newChildren,
+ TQPtrList<BasicElement>& newChildren,
Direction direction)
{
if (cursor->getPos() == denominatorPos) {
@@ -332,8 +332,8 @@ void FractionElement::insert(FormulaCursor* cursor,
/**
- * Removes all selected children and returns them. Places the
- * cursor to where the children have been.
+ * Removes all selected tqchildren and returns them. Places the
+ * cursor to where the tqchildren have been.
*
* We remove ourselve if we are requested to remove our numerator.
*
@@ -341,7 +341,7 @@ void FractionElement::insert(FormulaCursor* cursor,
* are senseless and the caller is required to replace us.
*/
void FractionElement::remove(FormulaCursor* cursor,
- QPtrList<BasicElement>& removedChildren,
+ TQPtrList<BasicElement>& removedChildren,
Direction direction)
{
switch (cursor->getPos()) {
@@ -362,7 +362,7 @@ void FractionElement::remove(FormulaCursor* cursor,
/**
* Returns wether the element has no more useful
- * children (except its main child) and should therefore
+ * tqchildren (except its main child) and should therefore
* be replaced by its main child's content.
*/
bool FractionElement::isSenseless()
@@ -373,7 +373,7 @@ bool FractionElement::isSenseless()
// main child
//
-// If an element has children one has to become the main one.
+// If an element has tqchildren one has to become the main one.
SequenceElement* FractionElement::getMainChild()
{
@@ -407,18 +407,18 @@ void FractionElement::selectChild(FormulaCursor* cursor, BasicElement* child)
/**
* Appends our attributes to the dom element.
*/
-void FractionElement::writeDom(QDomElement element)
+void FractionElement::writeDom(TQDomElement element)
{
BasicElement::writeDom(element);
- QDomDocument doc = element.ownerDocument();
+ TQDomDocument doc = element.ownerDocument();
if (!withLine()) element.setAttribute("NOLINE", 1);
- QDomElement num = doc.createElement("NUMERATOR");
+ TQDomElement num = doc.createElement("NUMERATOR");
num.appendChild(numerator->getElementDom(doc));
element.appendChild(num);
- QDomElement den = doc.createElement("DENOMINATOR");
+ TQDomElement den = doc.createElement("DENOMINATOR");
den.appendChild(denominator->getElementDom(doc));
element.appendChild(den);
}
@@ -427,12 +427,12 @@ void FractionElement::writeDom(QDomElement element)
* Reads our attributes from the element.
* Returns false if it failed.
*/
-bool FractionElement::readAttributesFromDom(QDomElement element)
+bool FractionElement::readAttributesFromDom(TQDomElement element)
{
if (!BasicElement::readAttributesFromDom(element)) {
return false;
}
- QString lineStr = element.attribute("NOLINE");
+ TQString lineStr = element.attribute("NOLINE");
if(!lineStr.isNull()) {
m_lineThicknessType = RelativeSize;
m_lineThickness = lineStr.toInt();
@@ -444,12 +444,12 @@ bool FractionElement::readAttributesFromDom(QDomElement element)
* Reads our attributes from the MathML element.
* Returns false if it failed.
*/
-bool FractionElement::readAttributesFromMathMLDom(const QDomElement& element)
+bool FractionElement::readAttributesFromMathMLDom(const TQDomElement& element)
{
if ( ! BasicElement::readAttributesFromMathMLDom( element ) ) {
return false;
}
- QString linethicknessStr = element.attribute( "linethickness" ).lower();
+ TQString linethicknessStr = element.attribute( "linethickness" ).lower();
if ( ! linethicknessStr.isNull() ) {
if ( linethicknessStr == "thin" ) {
m_lineThicknessType = RelativeSize;
@@ -467,7 +467,7 @@ bool FractionElement::readAttributesFromMathMLDom(const QDomElement& element)
m_lineThickness = getSize( linethicknessStr, &m_lineThicknessType );
}
}
- QString numalignStr = element.attribute( "numalign" ).lower();
+ TQString numalignStr = element.attribute( "numalign" ).lower();
if ( ! numalignStr.isNull() ) {
if ( numalignStr == "left" ) {
m_numAlign = LeftHorizontalAlign;
@@ -479,7 +479,7 @@ bool FractionElement::readAttributesFromMathMLDom(const QDomElement& element)
m_numAlign = RightHorizontalAlign;
}
}
- QString denomalignStr = element.attribute( "denomalign" ).lower();
+ TQString denomalignStr = element.attribute( "denomalign" ).lower();
if ( ! denomalignStr.isNull() ) {
if ( denomalignStr == "left" ) {
m_denomAlign = LeftHorizontalAlign;
@@ -491,7 +491,7 @@ bool FractionElement::readAttributesFromMathMLDom(const QDomElement& element)
m_denomAlign = RightHorizontalAlign;
}
}
- QString bevelledStr = element.attribute( "bevelled" ).lower();
+ TQString bevelledStr = element.attribute( "bevelled" ).lower();
if ( ! bevelledStr.isNull() ) {
m_customBevelled = true;
if ( bevelledStr == "true" ) {
@@ -510,7 +510,7 @@ bool FractionElement::readAttributesFromMathMLDom(const QDomElement& element)
* that needs to be read.
* Returns false if it failed.
*/
-bool FractionElement::readContentFromDom(QDomNode& node)
+bool FractionElement::readContentFromDom(TQDomNode& node)
{
if (!BasicElement::readContentFromDom(node)) {
return false;
@@ -536,7 +536,7 @@ bool FractionElement::readContentFromDom(QDomNode& node)
* that needs to be read.
* Returns false if it failed.
*/
-int FractionElement::readContentFromMathMLDom(QDomNode& node)
+int FractionElement::readContentFromMathMLDom(TQDomNode& node)
{
if ( BasicElement::readContentFromMathMLDom( node ) == -1 ) {
return -1;
@@ -562,7 +562,7 @@ int FractionElement::readContentFromMathMLDom(QDomNode& node)
return 1;
}
-QString FractionElement::toLatex()
+TQString FractionElement::toLatex()
{
if ( withLine() ) {
return "\\frac{" + numerator->toLatex() +"}{" + denominator->toLatex() + "}";
@@ -572,22 +572,22 @@ QString FractionElement::toLatex()
}
}
-QString FractionElement::formulaString()
+TQString FractionElement::formulaString()
{
return "(" + numerator->formulaString() + ")/(" + denominator->formulaString() + ")";
}
-void FractionElement::writeMathMLAttributes( QDomElement& element ) const
+void FractionElement::writeMathMLAttributes( TQDomElement& element ) const
{
switch ( m_lineThicknessType ) {
case AbsoluteSize:
- element.setAttribute( "linethickness", QString( "%1pt" ).arg( m_lineThickness ) );
+ element.setAttribute( "linethickness", TQString( "%1pt" ).tqarg( m_lineThickness ) );
break;
case RelativeSize:
- element.setAttribute( "linethickness", QString( "%1%" ).arg( m_lineThickness * 100.0 ) );
+ element.setAttribute( "linethickness", TQString( "%1%" ).tqarg( m_lineThickness * 100.0 ) );
break;
case PixelSize:
- element.setAttribute( "linethickness", QString( "%1px" ).arg( m_lineThickness ) );
+ element.setAttribute( "linethickness", TQString( "%1px" ).tqarg( m_lineThickness ) );
break;
default:
break;
@@ -626,8 +626,8 @@ void FractionElement::writeMathMLAttributes( QDomElement& element ) const
}
}
-void FractionElement::writeMathMLContent( QDomDocument& doc,
- QDomElement& element,
+void FractionElement::writeMathMLContent( TQDomDocument& doc,
+ TQDomElement& element,
bool oasisFormat ) const
{
numerator->writeMathML( doc, element, oasisFormat );