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
9b9f2ad9
Kaydet (Commit)
9b9f2ad9
authored
Eyl 24, 2015
tarafından
Miklos Vajna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
lok: add Office::getFilterTypes()
Change-Id: I3b1f4e11f2495e5ccb41f85802f243c0190695ee
üst
14ccaf91
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
0 deletions
+63
-0
init.cxx
desktop/source/lib/init.cxx
+39
-0
LibreOfficeKit.h
include/LibreOfficeKit/LibreOfficeKit.h
+3
-0
LibreOfficeKit.hxx
include/LibreOfficeKit/LibreOfficeKit.hxx
+21
-0
No files found.
desktop/source/lib/init.cxx
Dosyayı görüntüle @
9b9f2ad9
...
...
@@ -317,6 +317,8 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions (LibreOfficeKit* pThi
static
void
lo_registerCallback
(
LibreOfficeKit
*
pThis
,
LibreOfficeKitCallback
pCallback
,
void
*
pData
);
static
char
*
lo_getFilterTypes
(
LibreOfficeKit
*
pThis
);
struct
LibLibreOffice_Impl
:
public
_LibreOfficeKit
{
OUString
maLastExceptionMsg
;
...
...
@@ -339,6 +341,7 @@ struct LibLibreOffice_Impl : public _LibreOfficeKit
m_pOfficeClass
->
getError
=
lo_getError
;
m_pOfficeClass
->
documentLoadWithOptions
=
lo_documentLoadWithOptions
;
m_pOfficeClass
->
registerCallback
=
lo_registerCallback
;
m_pOfficeClass
->
getFilterTypes
=
lo_getFilterTypes
;
gOfficeClass
=
m_pOfficeClass
;
}
...
...
@@ -1095,6 +1098,42 @@ static char* lo_getError (LibreOfficeKit *pThis)
return
pMemory
;
}
static
char
*
lo_getFilterTypes
(
LibreOfficeKit
*
pThis
)
{
LibLibreOffice_Impl
*
pImpl
=
static_cast
<
LibLibreOffice_Impl
*>
(
pThis
);
if
(
!
xSFactory
.
is
())
xSFactory
=
comphelper
::
getProcessServiceFactory
();
if
(
!
xSFactory
.
is
())
{
pImpl
->
maLastExceptionMsg
=
"Service factory is not available"
;
return
0
;
}
uno
::
Reference
<
container
::
XNameAccess
>
xTypeDetection
(
xSFactory
->
createInstance
(
"com.sun.star.document.TypeDetection"
),
uno
::
UNO_QUERY
);
uno
::
Sequence
<
OUString
>
aTypes
=
xTypeDetection
->
getElementNames
();
boost
::
property_tree
::
ptree
aTree
;
for
(
const
OUString
&
rType
:
aTypes
)
{
uno
::
Sequence
<
beans
::
PropertyValue
>
aValues
;
if
(
xTypeDetection
->
getByName
(
rType
)
>>=
aValues
)
{
auto
it
=
std
::
find_if
(
aValues
.
begin
(),
aValues
.
end
(),
[](
const
beans
::
PropertyValue
&
rValue
)
{
return
rValue
.
Name
==
"MediaType"
;
});
OUString
aValue
;
if
(
it
!=
aValues
.
end
()
&&
(
it
->
Value
>>=
aValue
)
&&
!
aValue
.
isEmpty
())
{
boost
::
property_tree
::
ptree
aChild
;
aChild
.
put
(
"MediaType"
,
aValue
.
toUtf8
());
aTree
.
add_child
(
rType
.
toUtf8
().
getStr
(),
aChild
);
}
}
}
std
::
stringstream
aStream
;
boost
::
property_tree
::
write_json
(
aStream
,
aTree
);
return
strdup
(
aStream
.
str
().
c_str
());
}
static
void
force_c_locale
()
{
// force locale (and resource files loaded) to en-US
...
...
include/LibreOfficeKit/LibreOfficeKit.h
Dosyayı görüntüle @
9b9f2ad9
...
...
@@ -54,6 +54,9 @@ struct _LibreOfficeKitClass
void
(
*
registerCallback
)
(
LibreOfficeKit
*
pThis
,
LibreOfficeKitCallback
pCallback
,
void
*
pData
);
/// @see lok::Office::getFilterTypes().
char
*
(
*
getFilterTypes
)
(
LibreOfficeKit
*
pThis
);
#endif
};
...
...
include/LibreOfficeKit/LibreOfficeKit.hxx
Dosyayı görüntüle @
9b9f2ad9
...
...
@@ -353,6 +353,27 @@ public:
{
return
mpThis
->
pClass
->
getError
(
mpThis
);
}
#ifdef LOK_USE_UNSTABLE_API
/**
* Returns details of filter types.
*
* Example returned string:
*
* {
* "writer8": {
* "MediaType": "application/vnd.oasis.opendocument.text"
* },
* "calc8": {
* "MediaType": "application/vnd.oasis.opendocument.spreadsheet"
* }
* }
*/
inline
char
*
getFilterTypes
()
{
return
mpThis
->
pClass
->
getFilterTypes
(
mpThis
);
}
#endif // LOK_USE_UNSTABLE_API
};
/// Factory method to create a lok::Office instance.
...
...
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