Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Tusooa Zhu
Krita
Commits
9b35a8bf
Commit
9b35a8bf
authored
Jul 16, 2007
by
Jan Hambrecht
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start implementing loading of stroke
svn path=/trunk/koffice/; revision=688816
parent
df5634b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
0 deletions
+70
-0
libs/flake/KoShape.cpp
libs/flake/KoShape.cpp
+67
-0
libs/flake/KoShape.h
libs/flake/KoShape.h
+3
-0
No files found.
libs/flake/KoShape.cpp
View file @
9b35a8bf
...
...
@@ -34,6 +34,7 @@
#include "KoShapeSavingContext.h"
#include "KoShapeLoadingContext.h"
#include "KoViewConverter.h"
#include "KoLineBorder.h"
#include <KoXmlReader.h>
#include <KoXmlWriter.h>
...
...
@@ -596,6 +597,7 @@ void KoShape::setName( const QString & name ) {
// loading & saving methods
void
KoShape
::
saveOdfConnections
(
KoShapeSavingContext
&
context
)
const
{
// TODO save "draw-glue-point" elements (9.2.19)
Q_UNUSED
(
context
);
}
QString
KoShape
::
style
(
KoShapeSavingContext
&
context
)
const
...
...
@@ -657,6 +659,7 @@ bool KoShape::loadOdfAttributes( const KoXmlElement & element, KoShapeLoadingCon
}
setBackground
(
loadOdfFill
(
element
,
context
)
);
setBorder
(
loadOdfStroke
(
element
,
context
)
);
}
if
(
attributes
&
OdfSize
)
{
...
...
@@ -708,6 +711,70 @@ QBrush KoShape::loadOdfFill( const KoXmlElement & element, KoShapeLoadingContext
return
QBrush
();
}
KoShapeBorderModel
*
KoShape
::
loadOdfStroke
(
const
KoXmlElement
&
element
,
KoShapeLoadingContext
&
context
)
{
KoStyleStack
&
styleStack
=
context
.
koLoadingContext
().
styleStack
();
QString
stroke
;
if
(
element
.
hasAttributeNS
(
KoXmlNS
::
draw
,
"style-name"
)
)
{
// fill the style stack with the shapes style
context
.
koLoadingContext
().
fillStyleStack
(
element
,
KoXmlNS
::
draw
,
"style-name"
,
"graphic"
);
styleStack
.
setTypeProperties
(
"graphic"
);
if
(
styleStack
.
hasProperty
(
KoXmlNS
::
draw
,
"stroke"
)
)
stroke
=
styleStack
.
property
(
KoXmlNS
::
draw
,
"stroke"
);
}
else
if
(
element
.
hasAttributeNS
(
KoXmlNS
::
draw
,
"style-name"
)
)
{
// fill the style stack with the shapes style
context
.
koLoadingContext
().
fillStyleStack
(
element
,
KoXmlNS
::
presentation
,
"style-name"
,
"presentation"
);
styleStack
.
setTypeProperties
(
"presentation"
);
if
(
styleStack
.
hasProperty
(
KoXmlNS
::
presentation
,
"stroke"
)
)
stroke
=
styleStack
.
property
(
KoXmlNS
::
presentation
,
"stroke"
);
}
KoLineBorder
*
border
=
0
;
if
(
stroke
==
"solid"
)
{
border
=
new
KoLineBorder
();
}
else
if
(
stroke
==
"dash"
)
{
border
=
new
KoLineBorder
();
if
(
styleStack
.
hasProperty
(
KoXmlNS
::
draw
,
"stroke-dash"
)
)
{
QString
dashStyleName
=
styleStack
.
property
(
KoXmlNS
::
draw
,
"stroke-dash"
);
// TODO load dashes
}
}
else
return
0
;
if
(
styleStack
.
hasProperty
(
KoXmlNS
::
svg
,
"stroke-color"
)
)
border
->
setColor
(
styleStack
.
property
(
KoXmlNS
::
svg
,
"stroke-color"
)
);
if
(
styleStack
.
hasProperty
(
KoXmlNS
::
svg
,
"stroke-opacity"
)
)
{
QColor
color
=
border
->
color
();
QString
opacity
=
styleStack
.
property
(
KoXmlNS
::
svg
,
"stroke-opacity"
);
color
.
setAlphaF
(
opacity
.
toDouble
()
);
border
->
setColor
(
color
);
}
if
(
styleStack
.
hasProperty
(
KoXmlNS
::
svg
,
"stroke-width"
)
)
border
->
setLineWidth
(
KoUnit
::
parseValue
(
styleStack
.
property
(
KoXmlNS
::
svg
,
"stroke-width"
)
)
);
if
(
styleStack
.
hasProperty
(
KoXmlNS
::
draw
,
"stroke-linejoin"
)
)
{
QString
join
=
styleStack
.
property
(
KoXmlNS
::
draw
,
"stroke-linejoin"
);
if
(
join
==
"bevel"
)
border
->
setJoinStyle
(
Qt
::
BevelJoin
);
else
if
(
join
==
"round"
)
border
->
setJoinStyle
(
Qt
::
RoundJoin
);
else
border
->
setJoinStyle
(
Qt
::
MiterJoin
);
}
return
border
;
}
QMatrix
KoShape
::
parseOdfTransform
(
const
QString
&
transform
)
{
QMatrix
matrix
;
...
...
libs/flake/KoShape.h
View file @
9b35a8bf
...
...
@@ -647,6 +647,9 @@ protected:
/// Loads the fill style
QBrush
loadOdfFill
(
const
KoXmlElement
&
element
,
KoShapeLoadingContext
&
context
);
/// Loads the stroke style
KoShapeBorderModel
*
loadOdfStroke
(
const
KoXmlElement
&
element
,
KoShapeLoadingContext
&
context
);
/* ** end loading saving */
...
...
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