mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-24 18:35:37 +00:00
Implement support for the left-margin property.
This completes the work on the test sample in http://bugs.kde.org/show_bug.cgi?id=154980 BUG:154980 svn path=/trunk/KDE/kdegraphics/okular/; revision=907544
This commit is contained in:
parent
d77c997f94
commit
9c73f7c314
|
@ -50,6 +50,8 @@ void ParagraphFormatProperty::apply( QTextFormat *format ) const
|
|||
|
||||
format->setProperty( QTextFormat::FrameWidth, 595 );
|
||||
|
||||
static_cast<QTextBlockFormat*>( format )->setLeftMargin( mLeftMargin );
|
||||
|
||||
if ( mBackgroundColor.isValid() )
|
||||
format->setBackground( mBackgroundColor );
|
||||
}
|
||||
|
@ -80,6 +82,11 @@ void ParagraphFormatProperty::setBackgroundColor( const QColor &color )
|
|||
mBackgroundColor = color;
|
||||
}
|
||||
|
||||
void ParagraphFormatProperty::setLeftMargin( const qreal margin )
|
||||
{
|
||||
mLeftMargin = margin;
|
||||
}
|
||||
|
||||
TextFormatProperty::TextFormatProperty()
|
||||
: mStyleInformation( 0 ), mHasFontSize( false ),
|
||||
mFontWeight( -1 ), mTextPosition( 0 )
|
||||
|
|
|
@ -59,6 +59,7 @@ class ParagraphFormatProperty
|
|||
void setWritingMode( WritingMode mode );
|
||||
void setTextAlignment( Qt::Alignment alignment );
|
||||
void setBackgroundColor( const QColor &color );
|
||||
void setLeftMargin( const qreal margin );
|
||||
|
||||
bool writingModeIsRightToLeft() const;
|
||||
|
||||
|
@ -68,6 +69,7 @@ class ParagraphFormatProperty
|
|||
Qt::Alignment mAlignment;
|
||||
bool mHasAlignment;
|
||||
QColor mBackgroundColor;
|
||||
qreal mLeftMargin;
|
||||
};
|
||||
|
||||
class TextFormatProperty
|
||||
|
|
|
@ -305,6 +305,12 @@ ParagraphFormatProperty StyleParser::parseParagraphProperty( QDomElement &parent
|
|||
property.setTextAlignment( alignMap[ parent.attribute( "text-align", "left" ) ] );
|
||||
}
|
||||
|
||||
const QString marginLeft = parent.attribute( "margin-left" );
|
||||
if ( !marginLeft.isEmpty() ) {
|
||||
qreal leftMargin = qRound( convertUnit( marginLeft ) );
|
||||
property.setLeftMargin( leftMargin );
|
||||
}
|
||||
|
||||
const QString colorText = parent.attribute( "background-color" );
|
||||
if ( !colorText.isEmpty() && colorText != QLatin1String( "transparent" ) ) {
|
||||
property.setBackgroundColor( QColor( colorText ) );
|
||||
|
|
Loading…
Reference in a new issue