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
b391da28
Kaydet (Commit)
b391da28
authored
Eki 24, 2013
tarafından
Miklos Vajna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
DOCX filter: initial table style export based on InteropGrabBag
Change-Id: I7b31322b50c8c924e5df3c32e3c2da8093709938
üst
b7efab3a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
132 additions
and
0 deletions
+132
-0
docxattributeoutput.cxx
sw/source/filter/ww8/docxattributeoutput.cxx
+128
-0
docxattributeoutput.hxx
sw/source/filter/ww8/docxattributeoutput.hxx
+4
-0
No files found.
sw/source/filter/ww8/docxattributeoutput.cxx
Dosyayı görüntüle @
b391da28
...
...
@@ -2660,8 +2660,136 @@ void DocxAttributeOutput::DocDefaults( )
m_pSerializer
->
endElementNS
(
XML_w
,
XML_docDefaults
);
}
void
DocxAttributeOutput
::
TableStyles
()
{
// Do we have table styles from InteropGrabBag available?
uno
::
Reference
<
beans
::
XPropertySet
>
xPropertySet
(
m_rExport
.
pDoc
->
GetDocShell
()
->
GetBaseModel
(),
uno
::
UNO_QUERY_THROW
);
uno
::
Sequence
<
beans
::
PropertyValue
>
aInteropGrabBag
;
xPropertySet
->
getPropertyValue
(
"InteropGrabBag"
)
>>=
aInteropGrabBag
;
uno
::
Sequence
<
beans
::
PropertyValue
>
aTableStyles
;
for
(
sal_Int32
i
=
0
;
i
<
aInteropGrabBag
.
getLength
();
++
i
)
{
if
(
aInteropGrabBag
[
i
].
Name
==
"tableStyles"
)
{
aInteropGrabBag
[
i
].
Value
>>=
aTableStyles
;
break
;
}
}
if
(
!
aTableStyles
.
getLength
())
return
;
for
(
sal_Int32
i
=
0
;
i
<
aTableStyles
.
getLength
();
++
i
)
{
uno
::
Sequence
<
beans
::
PropertyValue
>
aTableStyle
;
aTableStyles
[
i
].
Value
>>=
aTableStyle
;
TableStyle
(
aTableStyle
);
}
}
StringTokenMap
const
aTblCellMarTokens
[]
=
{
{
"left"
,
XML_left
},
{
"right"
,
XML_right
},
{
"start"
,
XML_start
},
{
"end"
,
XML_end
},
{
"top"
,
XML_top
},
{
"bottom"
,
XML_bottom
},
{
0
,
0
}
};
/// Export of w:tblCellMar in a table style.
void
lcl_TableStyleTblCellMar
(
sax_fastparser
::
FSHelperPtr
pSerializer
,
uno
::
Sequence
<
beans
::
PropertyValue
>&
rTblCellMar
)
{
if
(
!
rTblCellMar
.
hasElements
())
return
;
pSerializer
->
startElementNS
(
XML_w
,
XML_tblCellMar
,
FSEND
);
for
(
sal_Int32
i
=
0
;
i
<
rTblCellMar
.
getLength
();
++
i
)
{
if
(
sal_Int32
nToken
=
lcl_getToken
(
aTblCellMarTokens
,
rTblCellMar
[
i
].
Name
))
{
comphelper
::
SequenceAsHashMap
aMap
(
rTblCellMar
[
i
].
Value
.
get
<
uno
::
Sequence
<
beans
::
PropertyValue
>
>
());
pSerializer
->
singleElementNS
(
XML_w
,
nToken
,
FSNS
(
XML_w
,
XML_w
),
OString
::
number
(
aMap
[
"w"
].
get
<
sal_Int32
>
()),
FSNS
(
XML_w
,
XML_type
),
OUStringToOString
(
aMap
[
"type"
].
get
<
OUString
>
(),
RTL_TEXTENCODING_UTF8
).
getStr
(),
FSEND
);
}
}
pSerializer
->
endElementNS
(
XML_w
,
XML_tblCellMar
);
}
/// Export of w:tblInd in a table style.
void
lcl_TableStyleTblInd
(
sax_fastparser
::
FSHelperPtr
pSerializer
,
uno
::
Sequence
<
beans
::
PropertyValue
>&
rTblInd
)
{
if
(
!
rTblInd
.
hasElements
())
return
;
sax_fastparser
::
FastAttributeList
*
pAttributeList
=
pSerializer
->
createAttrList
();
for
(
sal_Int32
i
=
0
;
i
<
rTblInd
.
getLength
();
++
i
)
{
if
(
rTblInd
[
i
].
Name
==
"w"
)
pAttributeList
->
add
(
FSNS
(
XML_w
,
XML_w
),
OString
::
number
(
rTblInd
[
i
].
Value
.
get
<
sal_Int32
>
()));
else
if
(
rTblInd
[
i
].
Name
==
"type"
)
pAttributeList
->
add
(
FSNS
(
XML_w
,
XML_type
),
OUStringToOString
(
rTblInd
[
i
].
Value
.
get
<
OUString
>
(),
RTL_TEXTENCODING_UTF8
).
getStr
());
}
XFastAttributeListRef
xAttributeList
(
pAttributeList
);
pSerializer
->
singleElementNS
(
XML_w
,
XML_tblInd
,
xAttributeList
);
}
/// Export of w:tblPr in a table style.
void
lcl_TableStyleTblPr
(
sax_fastparser
::
FSHelperPtr
pSerializer
,
uno
::
Sequence
<
beans
::
PropertyValue
>&
rTblPr
)
{
if
(
!
rTblPr
.
hasElements
())
return
;
pSerializer
->
startElementNS
(
XML_w
,
XML_tblPr
,
FSEND
);
uno
::
Sequence
<
beans
::
PropertyValue
>
aTblInd
,
aTblCellMar
;
for
(
sal_Int32
i
=
0
;
i
<
rTblPr
.
getLength
();
++
i
)
{
if
(
rTblPr
[
i
].
Name
==
"tblInd"
)
aTblInd
=
rTblPr
[
i
].
Value
.
get
<
uno
::
Sequence
<
beans
::
PropertyValue
>
>
();
else
if
(
rTblPr
[
i
].
Name
==
"tblCellMar"
)
aTblCellMar
=
rTblPr
[
i
].
Value
.
get
<
uno
::
Sequence
<
beans
::
PropertyValue
>
>
();
}
lcl_TableStyleTblInd
(
pSerializer
,
aTblInd
);
lcl_TableStyleTblCellMar
(
pSerializer
,
aTblCellMar
);
pSerializer
->
endElementNS
(
XML_w
,
XML_tblPr
);
}
void
DocxAttributeOutput
::
TableStyle
(
uno
::
Sequence
<
beans
::
PropertyValue
>&
rStyle
)
{
bool
bDefault
=
false
;
OUString
aStyleId
,
aName
;
uno
::
Sequence
<
beans
::
PropertyValue
>
aTblPr
;
for
(
sal_Int32
i
=
0
;
i
<
rStyle
.
getLength
();
++
i
)
{
if
(
rStyle
[
i
].
Name
==
"default"
)
bDefault
=
rStyle
[
i
].
Value
.
get
<
sal_Bool
>
();
else
if
(
rStyle
[
i
].
Name
==
"styleId"
)
aStyleId
=
rStyle
[
i
].
Value
.
get
<
OUString
>
();
else
if
(
rStyle
[
i
].
Name
==
"name"
)
aName
=
rStyle
[
i
].
Value
.
get
<
OUString
>
();
else
if
(
rStyle
[
i
].
Name
==
"tblPr"
)
aTblPr
=
rStyle
[
i
].
Value
.
get
<
uno
::
Sequence
<
beans
::
PropertyValue
>
>
();
}
m_pSerializer
->
startElementNS
(
XML_w
,
XML_style
,
FSNS
(
XML_w
,
XML_type
),
"table"
,
FSNS
(
XML_w
,
XML_default
),
bDefault
?
"true"
:
"false"
,
FSNS
(
XML_w
,
XML_styleId
),
OUStringToOString
(
aStyleId
,
RTL_TEXTENCODING_UTF8
).
getStr
(),
FSEND
);
m_pSerializer
->
singleElementNS
(
XML_w
,
XML_name
,
FSNS
(
XML_w
,
XML_val
),
OUStringToOString
(
aName
,
RTL_TEXTENCODING_UTF8
).
getStr
(),
FSEND
);
lcl_TableStyleTblPr
(
m_pSerializer
,
aTblPr
);
m_pSerializer
->
endElementNS
(
XML_w
,
XML_style
);
}
void
DocxAttributeOutput
::
EndStyles
(
sal_uInt16
/*nNumberOfStyles*/
)
{
TableStyles
();
m_pSerializer
->
endElementNS
(
XML_w
,
XML_styles
);
}
...
...
sw/source/filter/ww8/docxattributeoutput.hxx
Dosyayı görüntüle @
b391da28
...
...
@@ -217,6 +217,10 @@ public:
/// Write latent styles.
void
LatentStyles
();
/// Write table styles from InteropGrabBag.
void
TableStyles
();
void
TableStyle
(
com
::
sun
::
star
::
uno
::
Sequence
<
com
::
sun
::
star
::
beans
::
PropertyValue
>&
rStyle
);
/** Similar to OutputItem(), but write something only if it is not the default.
This is to output the docDefaults, and we should write something out
...
...
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