[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KOFFICE_1_3_BRANCH: koffice/filters/kword/rtf/import
From: Nicolas Goutte <nicolasg () snafu ! de>
Date: 2004-04-11 12:54:23
Message-ID: 20040411125423.C1ABA9A31 () office ! kde ! org
[Download RAW message or body]
CVS commit by goutte:
- fix line spacing (add support of RTF keyword \slmult )
- declare using KWord syntax 3
(Backport)
M +54 -18 rtfimport.cpp 1.90.2.6
M +3 -1 rtfimport.h 1.36.2.2
--- koffice/filters/kword/rtf/import/rtfimport.cpp #1.90.2.5:1.90.2.6
@@ -219,4 +219,5 @@ static RTFProperty propertyTable[] =
PROP( 0L, "sectd", setSectionDefaults, 0L, 0 ),
MEMBER( 0L, "sl", setNumericProperty, \
state.layout.spaceBetween, 0 ), + MEMBER( 0L, "slmult", \
setToggleProperty, state.layout.spaceBetweenMultiple, 0 ),
MEMBER( "@stylesheet", "snext", setNumericProperty, style.next, \
0 ),
MEMBER( 0L, "strike", setToggleProperty, \
state.format.strike, 0 ), @@ -512,5 +513,5 @@ KoFilter::ConversionStatus \
RTFImport::co DomNode mainDoc( "DOC" );
mainDoc.setAttribute( "mime", "application/x-kword" );
- mainDoc.setAttribute( "syntaxVersion", "2" );
+ mainDoc.setAttribute( "syntaxVersion", "3" );
mainDoc.setAttribute( "editor", "KWord's RTF Import Filter" );
mainDoc.addNode( "PAPER" );
@@ -2252,24 +2253,59 @@ void RTFImport::addLayout( DomNode &node
// Linespacing
- if (layout.spaceBetween > 0)
+
+ QString lineSpacingType;
+ QString lineSpacingValue;
+ if ( layout.spaceBetweenMultiple )
{
- node.addNode( "LINESPACING" );
- if( layout.spaceBetween == 360 )
- node.setAttribute( "type", "oneandhalf" );
- else if( layout.spaceBetween == 480 )
- node.setAttribute( "type", "double" );
- else
+ // Note: 240 is a sort of magic value for one line (Once upon a time, it \
meant 12pt for a single line) + switch (layout.spaceBetween )
{
- node.setAttribute( "type", "custom" );
- node.setAttribute( "spacevalue", 0.05*layout.spaceBetween );
+ case 240:
+ {
+ //lineSpacingType = "single"; // ### TODO: does KWord really \
supports this? + break;
}
- node.closeNode( "LINESPACING" );
+ case 360:
+ {
+ lineSpacingType = "oneandhalf";
+ break;
+ }
+ case 480 :
+ {
+ lineSpacingType = "double";
+ break;
+ }
+ default:
+ {
+ if ( layout.spaceBetween > 0 )
+ {
+ lineSpacingType = "multiple";
+ lineSpacingValue.setNum( layout.spaceBetween / 240.0 );
+ }
+ break;
+ }
+ }
+ }
+ else
+ {
+ if (layout.spaceBetween > 0)
+ {
+ lineSpacingType = "atleast";
+ lineSpacingValue.setNum( 0.05*layout.spaceBetween );
}
if (layout.spaceBetween < 0)
{
// negative linespace means "exact"
+ lineSpacingType = "fixed" ;
+ lineSpacingValue.setNum( -0.05*layout.spaceBetween );
+ }
+ }
+
+ if ( ! lineSpacingType.isEmpty() )
+ {
node.addNode( "LINESPACING" );
- node.setAttribute( "type", "exactly" );
- node.setAttribute( "spacevalue", -0.05*layout.spaceBetween );
+ node.setAttribute( "type", lineSpacingType );
+ if ( ! lineSpacingValue.isEmpty() )
+ node.setAttribute( "spacingvalue", lineSpacingValue );
node.closeNode( "LINESPACING" );
}
--- koffice/filters/kword/rtf/import/rtfimport.h #1.36.2.1:1.36.2.2
@@ -120,5 +120,7 @@ struct RTFLayout
int style;
int firstIndent, leftIndent, rightIndent;
- int spaceBefore, spaceAfter, spaceBetween;
+ int spaceBefore, spaceAfter;
+ int spaceBetween; ///< Line spacing
+ bool spaceBetweenMultiple; ///< Is the linespacing defined as multiple of line \
height (true) or by a height in 1/20 pt (false)? bool inTable;
bool keep, keepNext;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic