Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Tusooa Zhu
Krita
Commits
0525b371
Commit
0525b371
authored
Apr 02, 2007
by
Thomas Zander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes in the static factory method on KoParagraphStyle
svn path=/trunk/koffice/; revision=649563
parent
6cf45a71
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
15 deletions
+55
-15
libs/kotext/styles/KoListStyle.cpp
libs/kotext/styles/KoListStyle.cpp
+16
-0
libs/kotext/styles/KoListStyle.h
libs/kotext/styles/KoListStyle.h
+2
-0
libs/kotext/styles/KoParagraphStyle.cpp
libs/kotext/styles/KoParagraphStyle.cpp
+28
-7
libs/kotext/styles/KoParagraphStyle.h
libs/kotext/styles/KoParagraphStyle.h
+9
-8
No files found.
libs/kotext/styles/KoListStyle.cpp
View file @
0525b371
...
...
@@ -159,3 +159,19 @@ bool KoListStyle::operator==(const KoListStyle &other) const {
QTextList
*
KoListStyle
::
textList
(
const
QTextDocument
*
doc
)
{
return
m_textLists
[
doc
];
}
// static
KoListStyle
*
KoListStyle
::
fromTextList
(
QTextList
*
list
)
{
KoListStyle
*
answer
=
new
KoListStyle
();
QTextListFormat
format
=
list
->
format
();
int
i
=
0
;
while
(
properties
[
i
]
!=
-
1
)
{
int
key
=
properties
[
i
];
if
(
format
.
hasProperty
(
key
))
answer
->
setProperty
(
key
,
format
.
property
(
key
));
i
++
;
}
return
answer
;
}
libs/kotext/styles/KoListStyle.h
View file @
0525b371
...
...
@@ -158,6 +158,8 @@ public:
QTextList
*
textList
(
const
QTextDocument
*
doc
);
static
KoListStyle
*
fromTextList
(
QTextList
*
list
);
protected:
friend
class
KoParagraphStyle
;
void
addUser
()
{
m_refCount
++
;
}
...
...
libs/kotext/styles/KoParagraphStyle.cpp
View file @
0525b371
...
...
@@ -19,6 +19,8 @@
#include "KoCharacterStyle.h"
#include "KoListStyle.h"
#include "KoTextBlockData.h"
#include "KoTextDocumentLayout.h"
#include "KoStyleManager.h"
#include "Styles_p.h"
...
...
@@ -974,11 +976,32 @@ void KoParagraphStyle::loadOasis(KoStyleStack& styleStack) {
}
// static
KoParagraphStyle
*
KoParagraphStyle
::
fromBlockFormat
(
const
QTextBlockFormat
&
format
)
{
KoParagraphStyle
*
answer
=
new
KoParagraphStyle
();
answer
->
remove
(
PercentLineHeight
);
delete
answer
->
characterStyle
();
// TODO instead replace it with a character style from a QTextCharFormat
answer
->
d
->
charStyle
=
0
;
KoParagraphStyle
*
KoParagraphStyle
::
fromBlock
(
const
QTextBlock
&
block
)
{
QTextBlockFormat
format
=
block
.
blockFormat
();
KoParagraphStyle
*
answer
=
0
;
KoCharacterStyle
*
charStyle
=
0
;
int
styleId
=
format
.
intProperty
(
StyleId
);
if
(
styleId
>
0
)
{
KoTextDocumentLayout
*
layout
=
dynamic_cast
<
KoTextDocumentLayout
*>
(
block
.
document
()
->
documentLayout
());
if
(
layout
)
{
KoStyleManager
*
sm
=
layout
->
styleManager
();
if
(
sm
)
{
KoParagraphStyle
*
style
=
sm
->
paragraphStyle
(
styleId
);
if
(
style
)
answer
=
new
KoParagraphStyle
(
*
style
);
charStyle
=
sm
->
characterStyle
(
format
.
intProperty
(
KoCharacterStyle
::
StyleId
));
}
}
}
if
(
answer
==
0
)
{
answer
=
new
KoParagraphStyle
();
answer
->
remove
(
PercentLineHeight
);
delete
answer
->
characterStyle
();
}
answer
->
d
->
charStyle
=
charStyle
;
if
(
block
.
textList
())
answer
->
d
->
listStyle
=
KoListStyle
::
fromTextList
(
block
.
textList
());
int
i
=
0
;
while
(
properties
[
i
]
!=
-
1
)
{
...
...
@@ -988,8 +1011,6 @@ KoParagraphStyle *KoParagraphStyle::fromBlockFormat(const QTextBlockFormat &form
i
++
;
}
// listStyle ??
return
answer
;
}
...
...
libs/kotext/styles/KoParagraphStyle.h
View file @
0525b371
...
...
@@ -132,30 +132,31 @@ public:
* Note that lineSpacing() is added to this.
* @see setLineSpacingFromFont
*/
void
setLineHeightPercent
(
int
lineHeight
)
;
void
setLineHeightPercent
(
int
lineHeight
)
;
/// @see setLineHeightPercent
int
lineHeightPercent
()
const
;
/**
* Sets the line height to a specific pt-based height, ignoring the font size.
* Note that lineSpacing() is added to this.
*/
void
setLineHeightAbsolute
(
double
height
)
;
void
setLineHeightAbsolute
(
double
height
)
;
/// @see setLineHeightAbsolute
double
lineHeightAbsolute
()
const
;
/**
* Sets the line height to have a minimum height in pt.
*/
void
setMinimumLineHeight
(
double
height
);
/// @see setMinimumLineHeight
double
minimumLineHeight
()
const
;
/**
* Sets the space between two lines to be a specific height. The total linespacing will become
* the line height + this height. Where the line height is dependent on the font.
*/
void
setLineSpacing
(
double
spacing
)
;
void
setLineSpacing
(
double
spacing
)
;
/// @see setLineSpacing
double
lineSpacing
()
const
;
/**
...
...
@@ -320,7 +321,7 @@ public:
QColor
bottomBorderColor
();
// ************ properties from QTextFormat
// ************ properties from QText
Block
Format
/// duplicated property from QTextBlockFormat
void
setTopMargin
(
double
topMargin
);
/// duplicated property from QTextBlockFormat
...
...
@@ -436,7 +437,7 @@ as this is a duplicate of leftMargin, lets make it very clear we are using that
*/
void
loadOasis
(
KoStyleStack
&
styleStack
);
static
KoParagraphStyle
*
fromBlock
Format
(
const
QTextBlock
Format
&
format
);
static
KoParagraphStyle
*
fromBlock
(
const
QTextBlock
&
block
);
private:
void
setProperty
(
int
key
,
const
QVariant
&
value
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment