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
b7604284
Kaydet (Commit)
b7604284
authored
Tem 29, 2014
tarafından
Armin Le Grand
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
i125293 More unified (still simple) CssStyles and solvers
üst
f00d6d2e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
125 additions
and
51 deletions
+125
-51
svgdocument.hxx
svgio/inc/svgio/svgreader/svgdocument.hxx
+2
-2
svgnode.hxx
svgio/inc/svgio/svgreader/svgnode.hxx
+4
-0
svgstylenode.hxx
svgio/inc/svgio/svgreader/svgstylenode.hxx
+5
-1
svgdocument.cxx
svgio/source/svgreader/svgdocument.cxx
+1
-1
svgnode.cxx
svgio/source/svgreader/svgnode.cxx
+0
-0
svgstylenode.cxx
svgio/source/svgreader/svgstylenode.cxx
+113
-47
No files found.
svgio/inc/svgio/svgreader/svgdocument.hxx
Dosyayı görüntüle @
b7604284
...
@@ -71,8 +71,8 @@ namespace svgio
...
@@ -71,8 +71,8 @@ namespace svgio
void
removeSvgStyleAttributesFromMapper
(
const
rtl
::
OUString
&
rStr
);
void
removeSvgStyleAttributesFromMapper
(
const
rtl
::
OUString
&
rStr
);
/// find a style by it's Id
/// find a style by it's Id
bool
has
SvgStyleAttributesById
()
const
{
return
!
maIdStyleTokenMapperList
.
empty
();
}
bool
has
GlobalCssStyleAttributes
()
const
{
return
!
maIdStyleTokenMapperList
.
empty
();
}
const
SvgStyleAttributes
*
find
SvgStyleAttributesById
(
const
rtl
::
OUString
&
rStr
)
const
;
const
SvgStyleAttributes
*
find
GlobalCssStyleAttributes
(
const
rtl
::
OUString
&
rStr
)
const
;
/// data read access
/// data read access
const
SvgNodeVector
&
getSvgNodeVector
()
const
{
return
maNodes
;
}
const
SvgNodeVector
&
getSvgNodeVector
()
const
{
return
maNodes
;
}
...
...
svgio/inc/svgio/svgreader/svgnode.hxx
Dosyayı görüntüle @
b7604284
...
@@ -129,6 +129,10 @@ namespace svgio
...
@@ -129,6 +129,10 @@ namespace svgio
/// helper for filling the CssStyle vector once dependent on mbCssStyleVectorBuilt
/// helper for filling the CssStyle vector once dependent on mbCssStyleVectorBuilt
void
fillCssStyleVector
(
const
rtl
::
OUString
&
rClassStr
);
void
fillCssStyleVector
(
const
rtl
::
OUString
&
rClassStr
);
void
fillCssStyleVectorUsingHierarchyAndSelectors
(
const
rtl
::
OUString
&
rClassStr
,
const
SvgNode
&
rCurrent
,
rtl
::
OUString
aConcatenated
);
public
:
public
:
SvgNode
(
SvgNode
(
...
...
svgio/inc/svgio/svgreader/svgstylenode.hxx
Dosyayı görüntüle @
b7604284
...
@@ -51,7 +51,11 @@ namespace svgio
...
@@ -51,7 +51,11 @@ namespace svgio
virtual
bool
supportsParentStyle
()
const
;
virtual
bool
supportsParentStyle
()
const
;
virtual
void
parseAttribute
(
const
rtl
::
OUString
&
rTokenName
,
SVGToken
aSVGToken
,
const
rtl
::
OUString
&
aContent
);
virtual
void
parseAttribute
(
const
rtl
::
OUString
&
rTokenName
,
SVGToken
aSVGToken
,
const
rtl
::
OUString
&
aContent
);
void
addCssStyleSheet
(
const
rtl
::
OUString
&
aContent
);
/// CssStyleSheet add helpers
void
addCssStyleSheet
(
const
rtl
::
OUString
&
aSelectors
,
const
SvgStyleAttributes
&
rNewStyle
);
void
addCssStyleSheet
(
const
rtl
::
OUString
&
aSelectors
,
const
rtl
::
OUString
&
aContent
);
void
addCssStyleSheet
(
const
rtl
::
OUString
&
aSelectorsAndContent
);
/// textCss access
/// textCss access
bool
isTextCss
()
const
{
return
mbTextCss
;
}
bool
isTextCss
()
const
{
return
mbTextCss
;
}
...
...
svgio/source/svgreader/svgdocument.cxx
Dosyayı görüntüle @
b7604284
...
@@ -100,7 +100,7 @@ namespace svgio
...
@@ -100,7 +100,7 @@ namespace svgio
}
}
}
}
const
SvgStyleAttributes
*
SvgDocument
::
find
SvgStyleAttributesById
(
const
rtl
::
OUString
&
rStr
)
const
const
SvgStyleAttributes
*
SvgDocument
::
find
GlobalCssStyleAttributes
(
const
rtl
::
OUString
&
rStr
)
const
{
{
const
IdStyleTokenMapper
::
const_iterator
aResult
(
maIdStyleTokenMapperList
.
find
(
rStr
));
const
IdStyleTokenMapper
::
const_iterator
aResult
(
maIdStyleTokenMapperList
.
find
(
rStr
));
...
...
svgio/source/svgreader/svgnode.cxx
Dosyayı görüntüle @
b7604284
This diff is collapsed.
Click to expand it.
svgio/source/svgreader/svgstylenode.cxx
Dosyayı görüntüle @
b7604284
...
@@ -90,74 +90,140 @@ namespace svgio
...
@@ -90,74 +90,140 @@ namespace svgio
}
}
}
}
void
SvgStyleNode
::
addCssStyleSheet
(
const
rtl
::
OUString
&
a
Content
)
void
SvgStyleNode
::
addCssStyleSheet
(
const
rtl
::
OUString
&
a
Selectors
,
const
SvgStyleAttributes
&
rNewStyle
)
{
{
const
sal_Int32
nLen
(
aContent
.
getLength
());
// aSelectors: CssStyle selectors, any combination, no comma separations, no spaces at start/end
// rNewStyle: the already preapared style to register on that name
if
(
nLen
)
if
(
aSelectors
.
getLength
()
)
{
{
std
::
vector
<
rtl
::
OUString
>
aSelectorParts
;
const
sal_Int32
nLen
(
aSelectors
.
getLength
());
sal_Int32
nPos
(
0
);
sal_Int32
nPos
(
0
);
rtl
::
OUStringBuffer
aToken
Value
;
rtl
::
OUStringBuffer
aToken
;
// split into single tokens (currently only space separator)
while
(
nPos
<
nLen
)
while
(
nPos
<
nLen
)
{
{
// read the full style node names (may be multiple) and put to aStyleName
const
sal_Int32
nInitPos
(
nPos
);
const
sal_Int32
nInitPos
(
nPos
);
skip_char
(
aContent
,
sal_Unicode
(
' '
),
nPos
,
nLen
);
copyToLimiter
(
aSelectors
,
sal_Unicode
(
' '
),
nPos
,
aToken
,
nLen
);
copyToLimiter
(
aContent
,
sal_Unicode
(
'{'
),
nPos
,
aTokenValue
,
nLen
);
skip_char
(
aSelectors
,
sal_Unicode
(
' '
),
nPos
,
nLen
);
skip_char
(
aContent
,
sal_Unicode
(
' '
),
sal_Unicode
(
'{'
),
nPos
,
nLen
);
const
rtl
::
OUString
aSelectorPart
(
aToken
.
makeStringAndClear
().
trim
()
);
const
rtl
::
OUString
aStyleName
(
aTokenValue
.
makeStringAndClear
().
trim
());
if
(
aSelectorPart
.
getLength
())
const
sal_Int32
nLen2
(
aStyleName
.
getLength
());
{
std
::
vector
<
rtl
::
OUString
>
aStyleNames
;
aSelectorParts
.
push_back
(
aSelectorPart
);
}
if
(
n
Len2
)
if
(
n
InitPos
==
nPos
)
{
{
// extract names
OSL_ENSURE
(
false
,
"Could not interpret on current position (!)"
);
sal_Int32
nPos2
(
0
);
nPos
++
;
rtl
::
OUStringBuffer
aSingleName
;
}
}
while
(
nPos2
<
nLen2
)
if
(
aSelectorParts
.
size
())
{
{
skip_char
(
aStyleName
,
sal_Unicode
(
'#'
),
nPos2
,
nLen2
);
rtl
::
OUString
aConcatenatedSelector
;
copyToLimiter
(
aStyleName
,
sal_Unicode
(
' '
),
nPos2
,
aSingleName
,
nLen2
);
skip_char
(
aStyleName
,
sal_Unicode
(
' '
),
nPos2
,
nLen2
);
// re-combine without spaces, create a unique name (for now)
for
(
sal_uInt32
a
(
0
);
a
<
aSelectorParts
.
size
();
a
++
)
{
aConcatenatedSelector
+=
aSelectorParts
[
a
];
}
const
rtl
::
OUString
aOUSingleName
(
aSingleName
.
makeStringAndClear
().
trim
());
// CssStyles in SVG are currently not completely supported; the current idea for
// supporting the needed minimal set is to register CssStyles associated to a string
// which is just the space-char cleaned, concatenated Selectors. The part to 'match'
// these is in fillCssStyleVectorUsingHierarchyAndSelectors. There, the same string is
// built up using the priorities of local CssStyle, Id, Class and other info combined
// with the existing hierarchy. This creates a specificity- and priority-sorted local
// list for each node which is then chained using get/setCssStyleParent.
// The current solution is capable of solving space-separated selectors which can be
// mixed between Id, Class and type specifiers.
// When CssStyles need more specific solving, the start point is here; remember the
// needed infos not in maIdStyleTokenMapperList at the document, but select evtl.
// more specific infos there in a class capable of handling more complex matchings.
// Additionally fillCssStyleVector (or the mechanism above that when a linked list of
// SvgStyleAttributes will not do it) will have to be adapted to make use of it.
// register new style at document for (evtl. concatenated) stylename
const_cast
<
SvgDocument
&
>
(
getDocument
()).
addSvgStyleAttributesToMapper
(
aConcatenatedSelector
,
rNewStyle
);
}
}
}
if
(
aOUSingleName
.
getLength
())
void
SvgStyleNode
::
addCssStyleSheet
(
const
rtl
::
OUString
&
aSelectors
,
const
rtl
::
OUString
&
aContent
)
{
{
aStyleNames
.
push_back
(
aOUSingleName
);
// aSelectors: possible comma-separated list of CssStyle definitions, no spaces at start/end
}
// aContent: the svg style definitions as string
}
if
(
aSelectors
.
getLength
()
&&
aContent
.
getLength
())
{
// create new style and add to local list (for ownership control)
SvgStyleAttributes
*
pNewStyle
=
new
SvgStyleAttributes
(
*
this
);
maSvgStyleAttributes
.
push_back
(
pNewStyle
);
// fill with content
pNewStyle
->
readStyle
(
aContent
);
// comma-separated split (Css abbreviation for same style for multiple selectors)
const
sal_Int32
nLen
(
aSelectors
.
getLength
());
sal_Int32
nPos
(
0
);
rtl
::
OUStringBuffer
aToken
;
while
(
nPos
<
nLen
)
{
const
sal_Int32
nInitPos
(
nPos
);
copyToLimiter
(
aSelectors
,
sal_Unicode
(
','
),
nPos
,
aToken
,
nLen
);
skip_char
(
aSelectors
,
sal_Unicode
(
' '
),
sal_Unicode
(
','
),
nPos
,
nLen
);
const
rtl
::
OUString
aSingleName
(
aToken
.
makeStringAndClear
().
trim
());
if
(
aSingleName
.
getLength
())
{
addCssStyleSheet
(
aSingleName
,
*
pNewStyle
);
}
}
if
(
aStyleNames
.
size
()
&&
nPos
<
nLen
)
if
(
nInitPos
==
nPos
)
{
{
copyToLimiter
(
aContent
,
sal_Unicode
(
'}'
),
nPos
,
aTokenValue
,
nLen
);
OSL_ENSURE
(
false
,
"Could not interpret on current position (!)"
);
skip_char
(
aContent
,
sal_Unicode
(
' '
),
sal_Unicode
(
'}'
),
nPos
,
nLen
);
nPos
++
;
const
rtl
::
OUString
aStyleContent
(
aTokenValue
.
makeStringAndClear
().
trim
());
}
}
}
}
if
(
aStyleContent
.
getLength
())
void
SvgStyleNode
::
addCssStyleSheet
(
const
rtl
::
OUString
&
aSelectorsAndContent
)
{
{
// create new style
const
sal_Int32
nLen
(
aSelectorsAndContent
.
getLength
());
SvgStyleAttributes
*
pNewStyle
=
new
SvgStyleAttributes
(
*
this
);
maSvgStyleAttributes
.
push_back
(
pNewStyle
);
// fill with content
if
(
nLen
)
pNewStyle
->
readStyle
(
aStyleContent
);
{
sal_Int32
nPos
(
0
);
rtl
::
OUStringBuffer
aToken
;
while
(
nPos
<
nLen
)
{
// read the full selectors (may be multiple, comma-separated)
const
sal_Int32
nInitPos
(
nPos
);
skip_char
(
aSelectorsAndContent
,
sal_Unicode
(
' '
),
nPos
,
nLen
);
copyToLimiter
(
aSelectorsAndContent
,
sal_Unicode
(
'{'
),
nPos
,
aToken
,
nLen
);
skip_char
(
aSelectorsAndContent
,
sal_Unicode
(
' '
),
sal_Unicode
(
'{'
),
nPos
,
nLen
);
// concatenate combined style name
const
rtl
::
OUString
aSelectors
(
aToken
.
makeStringAndClear
().
trim
());
rtl
::
OUString
aConcatenatedStyleName
;
rtl
::
OUString
aContent
;
for
(
sal_uInt32
a
(
0
);
a
<
aStyleNames
.
size
();
a
++
)
if
(
aSelectors
.
getLength
()
&&
nPos
<
nLen
)
{
{
aConcatenatedStyleName
+=
aStyleNames
[
a
];
// isolate content as text, embraced by '{' and '}'
}
copyToLimiter
(
aSelectorsAndContent
,
sal_Unicode
(
'}'
),
nPos
,
aToken
,
nLen
);
skip_char
(
aSelectorsAndContent
,
sal_Unicode
(
' '
),
sal_Unicode
(
'}'
),
nPos
,
nLen
);
// register new style at document for (evtl. concatenated) stylename
aContent
=
aToken
.
makeStringAndClear
().
trim
();
const_cast
<
SvgDocument
&
>
(
getDocument
()).
addSvgStyleAttributesToMapper
(
aConcatenatedStyleName
,
*
pNewStyle
);
}
}
if
(
aSelectors
.
getLength
()
&&
aContent
.
getLength
())
{
addCssStyleSheet
(
aSelectors
,
aContent
);
}
}
if
(
nInitPos
==
nPos
)
if
(
nInitPos
==
nPos
)
...
...
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