Commit 07fde752 authored by David Faure's avatar David Faure

Improve KoStyleStack API: attributeNS -> property, childNodeNS -> childNode, etc.

svn path=/trunk/koffice/; revision=663297
parent 65b16c82
......@@ -533,8 +533,8 @@ void KoParagLayout::loadOasisParagLayout( KoParagLayout& layout, KoOasisContext&
// Tabulators
KoTabulatorList tabList;
if ( context.styleStack().hasChildNodeNS( KoXmlNS::style, "tab-stops" ) ) { // 3.11.10
KoXmlElement tabStops = context.styleStack().childNodeNS( KoXmlNS::style, "tab-stops" );
if ( context.styleStack().hasChildNode( KoXmlNS::style, "tab-stops" ) ) { // 3.11.10
KoXmlElement tabStops = context.styleStack().childNode( KoXmlNS::style, "tab-stops" );
//kDebug(30519) << k_funcinfo << tabStops.childNodes().count() << " tab stops in layout." << endl;
KoXmlElement tabStop;
forEachElement( tabStop, tabStops )
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -1469,11 +1469,11 @@ QBrush KoOasisStyles::loadOasisFillStyle( const KoStyleStack &styleStack, const
if ( fill == "solid" )
{
tmpBrush.setStyle(static_cast<Qt::BrushStyle>( 1 ) );
if ( styleStack.hasAttributeNS( KoXmlNS::draw, "fill-color" ) )
tmpBrush.setColor(styleStack.attributeNS( KoXmlNS::draw, "fill-color" ) );
if ( styleStack.hasAttributeNS( KoXmlNS::draw, "transparency" ) )
if ( styleStack.hasProperty( KoXmlNS::draw, "fill-color" ) )
tmpBrush.setColor(styleStack.property( KoXmlNS::draw, "fill-color" ) );
if ( styleStack.hasProperty( KoXmlNS::draw, "transparency" ) )
{
QString transparency = styleStack.attributeNS( KoXmlNS::draw, "transparency" );
QString transparency = styleStack.property( KoXmlNS::draw, "transparency" );
if ( transparency == "94%" )
{
tmpBrush.setStyle(Qt::Dense1Pattern);
......@@ -1513,7 +1513,7 @@ QBrush KoOasisStyles::loadOasisFillStyle( const KoStyleStack &styleStack, const
}
else if ( fill == "hatch" )
{
QString style = styleStack.attributeNS( KoXmlNS::draw, "fill-hatch-name" );
QString style = styleStack.property( KoXmlNS::draw, "fill-hatch-name" );
kDebug(30003)<<" hatch style is : "<<style<<endl;
//type not defined by default
......
......@@ -96,7 +96,7 @@ void KoStyleStack::push( const KoXmlElement& style )
#endif
}
QString KoStyleStack::attributeNS( const char* nsURI, const char* name, const char* detail ) const
QString KoStyleStack::property( const char* nsURI, const char* name, const char* detail ) const
{
QString fullName( name );
if ( detail )
......@@ -117,7 +117,7 @@ QString KoStyleStack::attributeNS( const char* nsURI, const char* name, const ch
return QString();
}
bool KoStyleStack::hasAttributeNS( const char* nsURI, const char* name, const char* detail ) const
bool KoStyleStack::hasProperty( const char* nsURI, const char* name, const char* detail ) const
{
QString fullName( name );
if ( detail )
......@@ -138,7 +138,7 @@ bool KoStyleStack::hasAttributeNS( const char* nsURI, const char* name, const ch
}
// Font size is a bit special. "115%" applies to "the fontsize of the parent style".
// This can be generalized though (hasAttributeThatCanBePercentOfParent() ? :)
// This can be generalized though (hasPropertyThatCanBePercentOfParent() ? :)
// Although, if we also add support for fo:font-size-rel here then it's not general anymore.
double KoStyleStack::fontSize() const
{
......@@ -161,7 +161,7 @@ double KoStyleStack::fontSize() const
return 0;
}
bool KoStyleStack::hasChildNodeNS( const char* nsURI, const char* localName ) const
bool KoStyleStack::hasChildNode( const char* nsURI, const char* localName ) const
{
Q3ValueList<KoXmlElement>::ConstIterator it = m_stack.end();
while ( it != m_stack.begin() )
......@@ -175,7 +175,7 @@ bool KoStyleStack::hasChildNodeNS( const char* nsURI, const char* localName ) co
return false;
}
KoXmlElement KoStyleStack::childNodeNS( const char* nsURI, const char* localName) const
KoXmlElement KoStyleStack::childNode( const char* nsURI, const char* localName) const
{
Q3ValueList<KoXmlElement>::ConstIterator it = m_stack.end();
......
......@@ -101,25 +101,25 @@ public:
* where detail is e.g. left, right, top or bottom.
* This allows to also find 'name' alone (e.g. padding implies padding-left, padding-right etc.)
*/
bool hasAttributeNS( const char* nsURI, const char* localName, const char* detail = 0 ) const;
bool hasProperty( const char* nsURI, const char* localName, const char* detail = 0 ) const;
/**
* Search for the attribute called 'name', starting on top of the stack,
* and return it.
*/
QString attributeNS( const char* nsURI, const char* localName, const char* detail = 0 ) const;
QString property( const char* nsURI, const char* localName, const char* detail = 0 ) const;
/**
* Check if any of the styles on the stack has a child element called 'localName' in the namespace 'nsURI'.
*/
bool hasChildNodeNS( const char* nsURI, const char* localName ) const;
bool hasChildNode( const char* nsURI, const char* localName ) const;
/**
* Search for a child element which has a child element called 'localName'
* in the namespace 'nsURI' starting on top of the stack,
* and return it.
*/
KoXmlElement childNodeNS( const char* nsURI, const char* localName ) const;
KoXmlElement childNode( const char* nsURI, const char* localName ) const;
/**
* Special case for the current font size, due to special handling of fo:font-size="115%".
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment