Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Krita
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tusooa Zhu
Krita
Commits
6a06a9fc
Commit
6a06a9fc
authored
Jul 17, 2007
by
Pierre Ducroquet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify the code
svn path=/trunk/koffice/; revision=689157
parent
6d89a9bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
37 deletions
+22
-37
libs/kotext/opendocument/KoTextLoader.cpp
libs/kotext/opendocument/KoTextLoader.cpp
+22
-37
No files found.
libs/kotext/opendocument/KoTextLoader.cpp
View file @
6a06a9fc
...
@@ -810,7 +810,7 @@ void KoTextLoader::loadSpan(KoTextLoadingContext& context, const KoXmlElement& p
...
@@ -810,7 +810,7 @@ void KoTextLoader::loadSpan(KoTextLoadingContext& context, const KoXmlElement& p
{
{
loadFrame
(
context
,
ts
,
cursor
);
loadFrame
(
context
,
ts
,
cursor
);
}
}
else
if
(
isTextNS
&&
localName
==
"date"
)
else
if
(
isTextNS
&&
(
localName
==
"date"
||
localName
==
"time"
)
)
{
{
KoTextDocumentLayout
*
layout
=
dynamic_cast
<
KoTextDocumentLayout
*>
(
cursor
.
block
().
document
()
->
documentLayout
());
KoTextDocumentLayout
*
layout
=
dynamic_cast
<
KoTextDocumentLayout
*>
(
cursor
.
block
().
document
()
->
documentLayout
());
if
(
layout
)
{
if
(
layout
)
{
...
@@ -830,44 +830,29 @@ void KoTextLoader::loadSpan(KoTextLoadingContext& context, const KoXmlElement& p
...
@@ -830,44 +830,29 @@ void KoTextLoader::loadSpan(KoTextLoadingContext& context, const KoXmlElement& p
}
}
}
}
kDebug
()
<<
"Final date format :"
<<
dateFormat
<<
endl
;
kDebug
()
<<
"Final date format :"
<<
dateFormat
<<
endl
;
QDateTime
dateTime
=
QDateTime
::
fromString
(
ts
.
attributeNS
(
KoXmlNS
::
text
,
"date-value"
),
Qt
::
ISODate
);
KoInlineObject
*
dateObject
=
dateFactory
->
createInlineObject
(
new
KoProperties
());
KoInlineObject
*
dateObject
=
dateFactory
->
createInlineObject
(
new
KoProperties
());
if
(
dateFormat
.
isEmpty
())
QString
result
;
((
KoVariable
*
)
dateObject
)
->
setValue
(
dateTime
.
date
().
toString
(
Qt
::
LocalDate
));
if
(
localName
==
"date"
)
{
else
QDateTime
dateTime
=
QDateTime
::
fromString
(
ts
.
attributeNS
(
KoXmlNS
::
text
,
"date-value"
),
Qt
::
ISODate
);
((
KoVariable
*
)
dateObject
)
->
setValue
(
dateTime
.
date
().
toString
(
dateFormat
));
KoInlineObject
*
dateObject
=
dateFactory
->
createInlineObject
(
new
KoProperties
());
textObjectManager
->
insertInlineObject
(
cursor
,
dateObject
);
if
(
dateFormat
.
isEmpty
())
}
result
=
dateTime
.
date
().
toString
(
Qt
::
LocalDate
);
}
//((KoVariable *)dateObject)->setValue(dateTime.date().toString(Qt::LocalDate));
}
else
}
result
=
dateTime
.
date
().
toString
(
dateFormat
);
}
//((KoVariable *)dateObject)->setValue(dateTime.date().toString(dateFormat));
}
//kDebug() << dateTime.date().toString(dateFormat) << endl;
else
if
(
isTextNS
&&
localName
==
"time"
)
}
else
{
{
QDateTime
dateTime
=
QDateTime
::
fromString
(
ts
.
attributeNS
(
KoXmlNS
::
text
,
"time-value"
),
Qt
::
ISODate
);
KoTextDocumentLayout
*
layout
=
dynamic_cast
<
KoTextDocumentLayout
*>
(
cursor
.
block
().
document
()
->
documentLayout
());
KoInlineObject
*
dateObject
=
dateFactory
->
createInlineObject
(
new
KoProperties
());
if
(
layout
)
{
if
(
dateFormat
.
isEmpty
())
KoInlineTextObjectManager
*
textObjectManager
=
layout
->
inlineObjectTextManager
();
result
=
dateTime
.
time
().
toString
(
Qt
::
LocalDate
);
if
(
textObjectManager
)
{
//((KoVariable *)dateObject)->setValue(dateTime.time().toString(Qt::LocalDate));
KoVariableManager
*
varManager
=
textObjectManager
->
variableManager
();
else
if
(
varManager
)
{
result
=
dateTime
.
time
().
toString
(
dateFormat
);
if
(
KoInlineObjectRegistry
::
instance
()
->
contains
(
"date"
))
{
//((KoVariable *)dateObject)->setValue(dateTime.time().toString(dateFormat));
KoInlineObjectFactory
*
dateFactory
=
KoInlineObjectRegistry
::
instance
()
->
value
(
"date"
);
if
(
dateFactory
)
{
QString
dataStyle
=
ts
.
attributeNS
(
KoXmlNS
::
style
,
"data-style-name"
);
QString
dateFormat
=
""
;
if
(
!
dataStyle
.
isEmpty
())
{
if
(
context
.
oasisStyles
().
dataFormats
().
contains
(
dataStyle
))
{
KoOasisStyles
::
NumericStyleFormat
dataFormat
=
context
.
oasisStyles
().
dataFormats
().
value
(
dataStyle
);
dateFormat
=
dataFormat
.
prefix
+
dataFormat
.
formatStr
+
dataFormat
.
suffix
;
}
}
}
QDateTime
dateTime
=
QDateTime
::
fromString
(
ts
.
attributeNS
(
KoXmlNS
::
text
,
"time-value"
),
Qt
::
ISODate
);
((
KoVariable
*
)
dateObject
)
->
setValue
(
result
);
KoInlineObject
*
dateObject
=
dateFactory
->
createInlineObject
(
new
KoProperties
());
if
(
dateFormat
.
isEmpty
())
((
KoVariable
*
)
dateObject
)
->
setValue
(
dateTime
.
time
().
toString
(
Qt
::
LocalDate
));
else
((
KoVariable
*
)
dateObject
)
->
setValue
(
dateTime
.
time
().
toString
(
dateFormat
));
textObjectManager
->
insertInlineObject
(
cursor
,
dateObject
);
textObjectManager
->
insertInlineObject
(
cursor
,
dateObject
);
}
}
}
}
...
...
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