summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-12-16 14:31:16 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-12-16 14:58:44 +0100
commit0946e2da2a310d9cfb5feeed94a6b2ad9f829751 (patch)
treeb3738d3d7e22dcad1b7367f5216f5ff9ab71ea8d /desktop
parent270fdd6b788974fa5d8e1ce01cc5358a0824fb99 (diff)
LOK: let doc_getDocumentType() use supportsService()
css::frame::XModel::getArgs() may or may not return a Sequence that contains a DocumentService key, while css::lang::XServiceInfo::supportsService() can always determine the document type. This fixes the problem that doc_getDocumentType() returned LOK_DOCTYPE_OTHER for Writer documents on Android. Change-Id: I380d59a963553fb30a3eb20fbe84dcfc6a1bbd61
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/init.cxx24
1 files changed, 6 insertions, 18 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 9910fd151f65..40cc46784175 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -28,7 +28,6 @@
#include <comphelper/processfactory.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/lang/Locale.hpp>
@@ -423,38 +422,27 @@ static LibreOfficeKitDocumentType doc_getDocumentType (LibreOfficeKitDocument* p
try
{
- uno::Reference<frame::XModel> xDocument(pDocument->mxComponent, uno::UNO_QUERY_THROW);
- uno::Sequence<beans::PropertyValue> aSequence = xDocument->getArgs();
+ uno::Reference<lang::XServiceInfo> xDocument(pDocument->mxComponent, uno::UNO_QUERY_THROW);
- MediaDescriptor aMediaDescriptor(aSequence);
- OUString sPropertyName = MediaDescriptor::PROP_DOCUMENTSERVICE();
- OUString aDocumentService = aMediaDescriptor.getUnpackedValueOrDefault(sPropertyName, OUString());
-
- if (aDocumentService.isEmpty())
- {
- gImpl->maLastExceptionMsg = "unknown document type";
- return LOK_DOCTYPE_OTHER;
- }
-
- if (aDocumentService == "com.sun.star.sheet.SpreadsheetDocument")
+ if (xDocument->supportsService("com.sun.star.sheet.SpreadsheetDocument"))
{
return LOK_DOCTYPE_SPREADSHEET;
}
- else if (aDocumentService == "com.sun.star.presentation.PresentationDocument")
+ else if (xDocument->supportsService("com.sun.star.presentation.PresentationDocument"))
{
return LOK_DOCTYPE_PRESENTATION;
}
- else if (aDocumentService == "com.sun.star.drawing.DrawingDocument")
+ else if (xDocument->supportsService("com.sun.star.drawing.DrawingDocument"))
{
return LOK_DOCTYPE_DRAWING;
}
- else if (aDocumentService == "com.sun.star.text.TextDocument")
+ else if (xDocument->supportsService("com.sun.star.text.TextDocument"))
{
return LOK_DOCTYPE_TEXT;
}
else
{
- gImpl->maLastExceptionMsg = "unknown document mapping";
+ gImpl->maLastExceptionMsg = "unknown document type";
}
}
catch (const uno::Exception& exception)