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
f86a1dbf
Kaydet (Commit)
f86a1dbf
authored
Ock 06, 2015
tarafından
David Tardon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fdo#78921 save embedded fonts in Flat ODF
Change-Id: I9d8614a5c20bab8e3b3d7c40e2504348c4386b64
üst
ca1fb20a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
3 deletions
+43
-3
XMLFontAutoStylePool.cxx
xmloff/source/style/XMLFontAutoStylePool.cxx
+43
-3
No files found.
xmloff/source/style/XMLFontAutoStylePool.cxx
Dosyayı görüntüle @
f86a1dbf
...
...
@@ -31,7 +31,9 @@
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include "XMLBase64Export.hxx"
using
namespace
::
com
::
sun
::
star
;
using
namespace
::
com
::
sun
::
star
::
uno
;
...
...
@@ -217,6 +219,25 @@ OUString XMLFontAutoStylePool::Find(
return
sName
;
}
namespace
{
OUString
lcl_checkFontFile
(
const
OUString
&
fileUrl
)
{
osl
::
DirectoryItem
aDirItem
;
if
(
osl
::
DirectoryItem
::
get
(
fileUrl
,
aDirItem
)
==
osl
::
File
::
E_None
)
{
osl
::
FileStatus
aStatus
(
osl_FileStatus_Mask_Type
);
if
(
aDirItem
.
getFileStatus
(
aStatus
)
==
osl
::
File
::
E_None
)
{
if
(
!
aStatus
.
isDirectory
()
)
return
fileUrl
;
}
}
return
OUString
();
}
}
void
XMLFontAutoStylePool
::
exportXML
()
{
...
...
@@ -272,6 +293,7 @@ void XMLFontAutoStylePool::exportXML()
if
(
tryToEmbedFonts
)
{
const
bool
bExportFlat
(
GetExport
().
getExportFlags
()
&
SvXMLExportFlags
::
EMBEDDED
);
std
::
vector
<
OUString
>
fileUrls
;
static
const
FontWeight
weight
[]
=
{
WEIGHT_NORMAL
,
WEIGHT_BOLD
,
WEIGHT_NORMAL
,
WEIGHT_BOLD
};
static
const
FontItalic
italic
[]
=
{
ITALIC_NONE
,
ITALIC_NONE
,
ITALIC_NORMAL
,
ITALIC_NORMAL
};
...
...
@@ -289,7 +311,7 @@ void XMLFontAutoStylePool::exportXML()
continue
;
if
(
!
fontFilesMap
.
count
(
fileUrl
))
{
OUString
docUrl
=
embedFontFile
(
fileUrl
);
const
OUString
docUrl
=
bExportFlat
?
lcl_checkFontFile
(
fileUrl
)
:
embedFontFile
(
fileUrl
);
if
(
!
docUrl
.
isEmpty
())
fontFilesMap
[
fileUrl
]
=
docUrl
;
else
...
...
@@ -307,11 +329,29 @@ void XMLFontAutoStylePool::exportXML()
{
if
(
fontFilesMap
.
count
(
*
it
))
{
GetExport
().
AddAttribute
(
XML_NAMESPACE_XLINK
,
XML_HREF
,
fontFilesMap
[
*
it
]
);
GetExport
().
AddAttribute
(
XML_NAMESPACE_XLINK
,
XML_TYPE
,
"simple"
);
if
(
!
bExportFlat
)
{
GetExport
().
AddAttribute
(
XML_NAMESPACE_XLINK
,
XML_HREF
,
fontFilesMap
[
*
it
]
);
GetExport
().
AddAttribute
(
XML_NAMESPACE_XLINK
,
XML_TYPE
,
"simple"
);
}
SvXMLElementExport
fontFaceUri
(
GetExport
(),
XML_NAMESPACE_SVG
,
XML_FONT_FACE_URI
,
true
,
true
);
if
(
bExportFlat
)
{
const
uno
::
Reference
<
ucb
::
XSimpleFileAccess
>
xFileAccess
(
ucb
::
SimpleFileAccess
::
create
(
GetExport
().
getComponentContext
()
)
);
try
{
const
uno
::
Reference
<
io
::
XInputStream
>
xInput
(
xFileAccess
->
openFileRead
(
fontFilesMap
[
*
it
]
)
);
XMLBase64Export
aBase64Exp
(
GetExport
()
);
aBase64Exp
.
exportOfficeBinaryDataElement
(
xInput
);
}
catch
(
const
uno
::
Exception
&
)
{
// opening the file failed, ignore
}
}
GetExport
().
AddAttribute
(
XML_NAMESPACE_SVG
,
XML_STRING
,
"truetype"
);
SvXMLElementExport
fontFaceFormat
(
GetExport
(),
XML_NAMESPACE_SVG
,
XML_FONT_FACE_FORMAT
,
true
,
true
);
...
...
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