Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
2a1a6ebf
Commit
2a1a6ebf
authored
Apr 26, 2012
by
Aleksei Kanash
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved html parser.
Transformations adjusted to iwb specification.
parent
82c155ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
24 deletions
+32
-24
UBCFFAdaptor.cpp
plugins/cffadaptor/src/UBCFFAdaptor.cpp
+32
-24
No files found.
plugins/cffadaptor/src/UBCFFAdaptor.cpp
View file @
2a1a6ebf
...
...
@@ -443,7 +443,6 @@ bool UBCFFAdaptor::UBToCFFConverter::parseMetadata()
QSize
tmpSize
=
getSVGDimentions
(
nextInElement
.
text
());
if
(
!
tmpSize
.
isNull
())
{
mSVGSize
=
tmpSize
;
mViewbox
.
setRect
(
0
,
0
,
tmpSize
.
width
(),
tmpSize
.
height
());
}
else
{
qDebug
()
<<
"can't interpret svg section size"
;
errorStr
=
"InterpretSvgSizeError"
;
...
...
@@ -487,6 +486,11 @@ bool UBCFFAdaptor::UBToCFFConverter::parseContent() {
}
if
(
QRect
()
==
mViewbox
)
{
mViewbox
.
setRect
(
0
,
0
,
mSVGSize
.
width
(),
mSVGSize
.
height
());
}
svgDocumentSection
.
setAttribute
(
aIWBViewBox
,
rectToIWBAttr
(
mViewbox
));
svgDocumentSection
.
setAttribute
(
aWidth
,
QString
(
"%1"
).
arg
(
mViewbox
.
width
()));
svgDocumentSection
.
setAttribute
(
aHeight
,
QString
(
"%1"
).
arg
(
mViewbox
.
height
()));
...
...
@@ -639,30 +643,29 @@ QDomElement UBCFFAdaptor::UBToCFFConverter::parseSvgPageSection(const QDomElemen
void
UBCFFAdaptor
::
UBToCFFConverter
::
writeQDomElementToXML
(
const
QDomNode
&
node
)
{
if
(
!
node
.
isNull
()){
if
(
node
.
isText
())
if
(
!
node
.
isNull
())
if
(
node
.
isText
())
{
mIWBContentWriter
->
writeCharacters
(
node
.
nodeValue
());
}
else
{
mIWBContentWriter
->
writeStartElement
(
node
.
namespaceURI
(),
node
.
toElement
().
tagName
());
for
(
int
i
=
0
;
i
<
node
.
toElement
().
attributes
().
count
();
i
++
)
{
mIWBContentWriter
->
writeCharacters
(
node
.
nodeValue
());
QDomAttr
attr
=
node
.
toElement
().
attributes
().
item
(
i
).
toAttr
();
mIWBContentWriter
->
writeAttribute
(
attr
.
name
(),
attr
.
value
());
}
else
QDomNode
child
=
node
.
firstChild
();
while
(
!
child
.
isNull
())
{
mIWBContentWriter
->
writeStartElement
(
node
.
namespaceURI
(),
node
.
toElement
().
tagName
());
for
(
int
i
=
0
;
i
<
node
.
toElement
().
attributes
().
count
();
i
++
)
{
QDomAttr
attr
=
node
.
toElement
().
attributes
().
item
(
i
).
toAttr
();
mIWBContentWriter
->
writeAttribute
(
attr
.
name
(),
attr
.
value
());
}
QDomNode
child
=
node
.
firstChild
();
while
(
!
child
.
isNull
())
{
writeQDomElementToXML
(
child
);
child
=
child
.
nextSibling
();
}
mIWBContentWriter
->
writeEndElement
();
writeQDomElementToXML
(
child
);
child
=
child
.
nextSibling
();
}
}
mIWBContentWriter
->
writeEndElement
();
}
}
bool
UBCFFAdaptor
::
UBToCFFConverter
::
writeExtendedIwbSection
()
...
...
@@ -1025,8 +1028,6 @@ void UBCFFAdaptor::UBToCFFConverter::setCoordinatesFromUBZ(const QDomElement &ub
item
.
setRect
(
0
,
0
,
width
,
height
);
item
.
setTransform
(
tr
);
item
.
setTransformOriginPoint
(
item
.
boundingRect
().
center
());
item
.
setRotation
(
-
alpha
);
QMatrix
sceneMatrix
=
item
.
sceneMatrix
();
...
...
@@ -1107,6 +1108,9 @@ bool UBCFFAdaptor::UBToCFFConverter::setContentFromUBZ(const QDomElement &ubzEle
svgElement
.
setAttribute
(
aSVGRequiredExtension
,
svgRequiredExtensionPrefix
+
fePng
);
}
}
}
else
{
bRet
=
false
;
}
if
(
!
bRet
)
...
...
@@ -1142,7 +1146,6 @@ void UBCFFAdaptor::UBToCFFConverter::setCFFTextFromHTMLTextNode(const QDomElemen
QDomNode
spanNode
=
htmlPNode
.
firstChild
();
while
(
!
spanNode
.
isNull
())
{
if
(
spanNode
.
isText
())
...
...
@@ -1153,7 +1156,10 @@ void UBCFFAdaptor::UBToCFFConverter::setCFFTextFromHTMLTextNode(const QDomElemen
else
if
(
spanNode
.
isElement
())
{
QDomElement
pElementIwb
;
QDomElement
spanElement
=
textDoc
.
createElementNS
(
svgIWBNS
,
svgIWBNSPrefix
+
":"
+
tIWBTspan
);
setCommonAttributesFromUBZ
(
htmlPNode
.
toElement
(),
pElementIwb
,
spanElement
);
if
(
spanNode
.
hasAttributes
())
{
int
attrCount
=
spanNode
.
attributes
().
count
();
...
...
@@ -1196,6 +1202,8 @@ QString UBCFFAdaptor::UBToCFFConverter::ubzAttrNameToCFFAttrName(QString cffAttr
QString
sRet
=
cffAttrName
;
if
(
QString
(
"color"
)
==
cffAttrName
)
sRet
=
QString
(
"fill"
);
if
(
QString
(
"align"
)
==
cffAttrName
)
sRet
=
QString
(
"text-align"
);
return
sRet
;
}
...
...
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