20#include <tqstringlist.h>
27bool AbiPropsMap::setProperty( const TQString& newName, const TQString& newValue)
29 replace(newName,AbiProps(newValue));
34void AbiPropsMap::splitAndAddAbiProps( const TQString& strProps)
36 if (strProps.isEmpty())
39 TQStringList list=TQStringList::split( ';',strProps, false);
42 TQStringList::ConstIterator it;
43 TQStringList::ConstIterator end(list.end());
44 for (it=list.begin();it!=end;++it)
46 const int result=(*it).find( ':');
51 kdWarning(30506) << "Property without value: " << name << endl;
55 name=(*it).left(result);
56 value=(*it).mid(result+1);
60 setProperty(name.stripWhiteSpace(),value.stripWhiteSpace());
64double ValueWithLengthUnit( const TQString& _str, bool* atleast )
71 TQRegExp unitExp( "([a-z]+)\\s*(\\+?)");
72 const int pos=unitExp.search(_str);
76 result=_str.toDouble(&flag);
78 kdWarning(30506) << "Unknown value: " << _str << " (ValueWithLengthUnit)" << endl;
82 const double rawValue=_str.left(pos).toDouble();
83 const TQString strUnit ( unitExp.cap(1) );
85 result=CentimetresToPoints(rawValue);
86 else if (strUnit== "in")
87 result=InchesToPoints(rawValue);
88 else if (strUnit== "mm")
89 result=MillimetresToPoints(rawValue);
90 else if (strUnit== "pt")
92 else if(strUnit== "pi")
93 result=PicaToPoints(rawValue);
96 kdWarning(30506) << "Value " << _str << " has non-supported unit: "
97 << strUnit << " (ValueWithLengthUnit)" << endl;
103 *atleast = ( unitExp.cap(2) == "+" );
Helpers for the AbiWord import filter.
|