Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
e29639ac
Kaydet (Commit)
e29639ac
authored
Agu 02, 2012
tarafından
Armin Le Grand
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#120435# Corrected CSS style detection to be executed only once per node
üst
2a91a539
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
43 deletions
+50
-43
svgnode.cxx
svgio/source/svgreader/svgnode.cxx
+50
-43
No files found.
svgio/source/svgreader/svgnode.cxx
Dosyayı görüntüle @
e29639ac
...
...
@@ -43,68 +43,71 @@ namespace svgio
const
SvgStyleAttributes
*
SvgNode
::
checkForCssStyle
(
const
rtl
::
OUString
&
rClassStr
,
const
SvgStyleAttributes
&
rOriginal
)
const
{
const
SvgDocument
&
rDocument
=
getDocument
();
if
(
rDocument
.
hasSvgStyleAttributesById
())
if
(
maCssStyleVector
.
empty
())
// #120435# Evaluate for CSS styles only once, this cannot change
{
if
(
getClass
())
{
// find all referenced CSS styles, a list of entries is allowed
const
rtl
::
OUString
*
pClassList
=
getClass
();
const
sal_Int32
nLen
(
pClassList
->
getLength
());
sal_Int32
nPos
(
0
);
const
SvgStyleAttributes
*
pNew
=
0
;
const
SvgDocument
&
rDocument
=
getDocument
();
skip_char
(
*
pClassList
,
sal_Unicode
(
' '
),
nPos
,
nLen
);
while
(
nPos
<
nLen
)
if
(
rDocument
.
hasSvgStyleAttributesById
())
{
if
(
getClass
()
)
{
rtl
::
OUStringBuffer
aTokenValue
;
// find all referenced CSS styles, a list of entries is allowed
const
rtl
::
OUString
*
pClassList
=
getClass
();
const
sal_Int32
nLen
(
pClassList
->
getLength
());
sal_Int32
nPos
(
0
);
const
SvgStyleAttributes
*
pNew
=
0
;
copyToLimiter
(
*
pClassList
,
sal_Unicode
(
' '
),
nPos
,
aTokenValue
,
nLen
);
skip_char
(
*
pClassList
,
sal_Unicode
(
' '
),
nPos
,
nLen
);
rtl
::
OUString
aId
(
rtl
::
OUString
::
createFromAscii
(
"."
));
const
rtl
::
OUString
aOUTokenValue
(
aTokenValue
.
makeStringAndClear
());
while
(
nPos
<
nLen
)
{
rtl
::
OUStringBuffer
aTokenValue
;
// look for CSS style common to token
aId
=
aId
+
aOUTokenValue
;
pNew
=
rDocument
.
findSvgStyleAttributesById
(
aId
);
copyToLimiter
(
*
pClassList
,
sal_Unicode
(
' '
),
nPos
,
aTokenValue
,
nLen
);
skip_char
(
*
pClassList
,
sal_Unicode
(
' '
),
nPos
,
nLen
);
if
(
!
pNew
&&
rClassStr
.
getLength
())
{
// look for CSS style common to class.token
aId
=
rClassStr
+
aId
;
rtl
::
OUString
aId
(
rtl
::
OUString
::
createFromAscii
(
"."
));
const
rtl
::
OUString
aOUTokenValue
(
aTokenValue
.
makeStringAndClear
());
// look for CSS style common to token
aId
=
aId
+
aOUTokenValue
;
pNew
=
rDocument
.
findSvgStyleAttributesById
(
aId
);
if
(
!
pNew
&&
rClassStr
.
getLength
())
{
// look for CSS style common to class.token
aId
=
rClassStr
+
aId
;
pNew
=
rDocument
.
findSvgStyleAttributesById
(
aId
);
}
if
(
pNew
)
{
const_cast
<
SvgNode
*
>
(
this
)
->
maCssStyleVector
.
push_back
(
pNew
);
}
}
}
if
(
maCssStyleVector
.
empty
()
&&
getId
())
{
// if none found, search for CSS style equal to Id
const
SvgStyleAttributes
*
pNew
=
rDocument
.
findSvgStyleAttributesById
(
*
getId
());
if
(
pNew
)
{
const_cast
<
SvgNode
*
>
(
this
)
->
maCssStyleVector
.
push_back
(
pNew
);
}
}
}
if
(
maCssStyleVector
.
empty
()
&&
getId
())
{
// if none found, search for CSS style equal to Id
const
SvgStyleAttributes
*
pNew
=
rDocument
.
findSvgStyleAttributesById
(
*
getId
());
if
(
pNew
)
if
(
maCssStyleVector
.
empty
()
&&
rClassStr
.
getLength
())
{
const_cast
<
SvgNode
*
>
(
this
)
->
maCssStyleVector
.
push_back
(
pNew
);
}
}
// if none found, search for CSS style equal to class type
const
SvgStyleAttributes
*
pNew
=
rDocument
.
findSvgStyleAttributesById
(
rClassStr
);
if
(
maCssStyleVector
.
empty
()
&&
rClassStr
.
getLength
())
{
// if none found, search for CSS style equal to class type
const
SvgStyleAttributes
*
pNew
=
rDocument
.
findSvgStyleAttributesById
(
rClassStr
);
if
(
pNew
)
{
const_cast
<
SvgNode
*
>
(
this
)
->
maCssStyleVector
.
push_back
(
pNew
);
if
(
pNew
)
{
const_cast
<
SvgNode
*
>
(
this
)
->
maCssStyleVector
.
push_back
(
pNew
);
}
}
}
}
...
...
@@ -116,8 +119,12 @@ namespace svgio
else
{
// set CssStyleParent at maCssStyleVector members to hang them in front of
// the existing style
// the existing style. Build a style chain, reset parent of original for security.
// Repeated style requests should only be issued from sub-Text nodes and I'm not
// sure if in-between text nodes may build other chains (should not happen). But
// it's only a re-chaining with pointers (cheap), so allow to do it every time.
SvgStyleAttributes
*
pCurrent
=
const_cast
<
SvgStyleAttributes
*
>
(
&
rOriginal
);
pCurrent
->
setCssStyleParent
(
0
);
for
(
sal_uInt32
a
(
0
);
a
<
maCssStyleVector
.
size
();
a
++
)
{
...
...
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