summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'extensions')
-rw-r--r--extensions/Executable_QuickLookPreview.mk38
-rw-r--r--extensions/Executable_QuickLookThumbnail.mk38
-rw-r--r--extensions/Library_OOoSpotlightImporter.mk16
-rw-r--r--extensions/Module_extensions.mk7
-rw-r--r--extensions/Package_QuickLookPreview.mk14
-rw-r--r--extensions/Package_QuickLookThumbnail.mk14
-rw-r--r--extensions/Package_quicklookpreviewappex.mk19
-rw-r--r--extensions/Package_quicklookthumbnailappex.mk19
-rw-r--r--extensions/StaticLibrary_extensions_macosx_common.mk20
-rw-r--r--extensions/source/activex/SOActiveX.cxx10
-rw-r--r--extensions/source/macosx/common/OOoContentDataParser.h (renamed from extensions/source/macosx/spotlight/OOoContentDataParser.h)26
-rw-r--r--extensions/source/macosx/common/OOoContentDataParser.m (renamed from extensions/source/macosx/spotlight/OOoContentDataParser.m)0
-rw-r--r--extensions/source/macosx/common/OOoManifestParser.h49
-rw-r--r--extensions/source/macosx/common/OOoManifestParser.m109
-rw-r--r--extensions/source/macosx/common/OOoMetaDataParser.h (renamed from extensions/source/macosx/spotlight/OOoMetaDataParser.h)25
-rw-r--r--extensions/source/macosx/common/OOoMetaDataParser.m (renamed from extensions/source/macosx/spotlight/OOoMetaDataParser.m)0
-rw-r--r--extensions/source/macosx/common/OOoSpotlightAndQuickLookImporter.h (renamed from extensions/source/macosx/spotlight/OOoSpotlightImporter.h)7
-rw-r--r--extensions/source/macosx/common/OOoSpotlightAndQuickLookImporter.m (renamed from extensions/source/macosx/spotlight/OOoSpotlightImporter.m)74
-rw-r--r--extensions/source/macosx/quicklookpreview/PreviewViewController.h17
-rw-r--r--extensions/source/macosx/quicklookpreview/PreviewViewController.m58
-rw-r--r--extensions/source/macosx/quicklookpreview/appex/Info.plist75
-rw-r--r--extensions/source/macosx/quicklookthumbnail/ThumbnailProvider.h18
-rw-r--r--extensions/source/macosx/quicklookthumbnail/ThumbnailProvider.m65
-rw-r--r--extensions/source/macosx/quicklookthumbnail/appex/Info.plist73
-rw-r--r--extensions/source/macosx/spotlight/GetMetadataForFile.m4
-rw-r--r--extensions/source/ole/servprov.cxx34
-rw-r--r--extensions/source/propctrlr/fontdialog.cxx14
-rw-r--r--extensions/source/scanner/sane.cxx5
-rw-r--r--extensions/source/scanner/scanwin.cxx3
29 files changed, 778 insertions, 73 deletions
diff --git a/extensions/Executable_QuickLookPreview.mk b/extensions/Executable_QuickLookPreview.mk
new file mode 100644
index 000000000000..403c97ad7592
--- /dev/null
+++ b/extensions/Executable_QuickLookPreview.mk
@@ -0,0 +1,38 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#
+
+$(eval $(call gb_Executable_Executable,QuickLookPreview))
+
+$(eval $(call gb_Executable_set_include,QuickLookPreview,\
+ -I$(SRCDIR)/extensions/source/macosx/common \
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_Executable_add_ldflags,QuickLookPreview,\
+ -e _NSExtensionMain -fobjc-link-runtime -fapplication-extension \
+))
+
+$(eval $(call gb_Executable_add_objcobjects,QuickLookPreview,\
+ extensions/source/macosx/quicklookpreview/PreviewViewController \
+))
+
+$(eval $(call gb_Executable_use_system_darwin_frameworks,QuickLookPreview,\
+ AppKit \
+ Quartz \
+))
+
+$(eval $(call gb_Executable_use_static_libraries,QuickLookPreview,\
+ extensions_macosx_common \
+))
+
+$(eval $(call gb_Executable_use_external,QuickLookPreview,zlib))
+
+# vim:set noet sw=4 ts=4:
diff --git a/extensions/Executable_QuickLookThumbnail.mk b/extensions/Executable_QuickLookThumbnail.mk
new file mode 100644
index 000000000000..a8a0bf0a9767
--- /dev/null
+++ b/extensions/Executable_QuickLookThumbnail.mk
@@ -0,0 +1,38 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#
+
+$(eval $(call gb_Executable_Executable,QuickLookThumbnail))
+
+$(eval $(call gb_Executable_set_include,QuickLookThumbnail,\
+ -I$(SRCDIR)/extensions/source/macosx/common \
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_Executable_add_ldflags,QuickLookThumbnail,\
+ -e _NSExtensionMain -fobjc-link-runtime -fapplication-extension \
+))
+
+$(eval $(call gb_Executable_add_objcobjects,QuickLookThumbnail,\
+ extensions/source/macosx/quicklookthumbnail/ThumbnailProvider \
+))
+
+$(eval $(call gb_Executable_use_system_darwin_frameworks,QuickLookThumbnail,\
+ AppKit \
+ QuickLookThumbnailing \
+))
+
+$(eval $(call gb_Executable_use_static_libraries,QuickLookThumbnail,\
+ extensions_macosx_common \
+))
+
+$(eval $(call gb_Executable_use_external,QuickLookThumbnail,zlib))
+
+# vim:set noet sw=4 ts=4:
diff --git a/extensions/Library_OOoSpotlightImporter.mk b/extensions/Library_OOoSpotlightImporter.mk
index ac55f1eac4e2..3f4db95827f0 100644
--- a/extensions/Library_OOoSpotlightImporter.mk
+++ b/extensions/Library_OOoSpotlightImporter.mk
@@ -11,18 +11,22 @@
$(eval $(call gb_Library_Bundle,OOoSpotlightImporter))
+$(eval $(call gb_Library_set_include,OOoSpotlightImporter,\
+ -I$(SRCDIR)/extensions/source/macosx/common \
+ $$(INCLUDE) \
+))
+
$(eval $(call gb_Library_add_objcobjects,OOoSpotlightImporter,\
extensions/source/macosx/spotlight/GetMetadataForFile \
- extensions/source/macosx/spotlight/OOoContentDataParser \
- extensions/source/macosx/spotlight/OOoMetaDataParser \
- extensions/source/macosx/spotlight/OOoSpotlightImporter \
extensions/source/macosx/spotlight/main \
))
+$(eval $(call gb_Library_use_static_libraries,OOoSpotlightImporter,\
+ extensions_macosx_common \
+))
+
$(eval $(call gb_Library_use_system_darwin_frameworks,OOoSpotlightImporter,\
- CoreFoundation \
- Foundation \
- CoreServices \
+ AppKit \
))
$(eval $(call gb_Library_use_external,OOoSpotlightImporter,zlib))
diff --git a/extensions/Module_extensions.mk b/extensions/Module_extensions.mk
index f7bd82978382..9d415ea8c8c4 100644
--- a/extensions/Module_extensions.mk
+++ b/extensions/Module_extensions.mk
@@ -104,9 +104,16 @@ endif # WNT
ifeq ($(OS),MACOSX)
$(eval $(call gb_Module_add_targets,extensions,\
+ StaticLibrary_extensions_macosx_common \
Library_OOoSpotlightImporter \
+ Executable_QuickLookPreview \
+ Executable_QuickLookThumbnail \
Package_mdibundle \
Package_OOoSpotlightImporter \
+ Package_quicklookpreviewappex \
+ Package_QuickLookPreview \
+ Package_quicklookthumbnailappex \
+ Package_QuickLookThumbnail \
))
endif # OS=MACOSX
diff --git a/extensions/Package_QuickLookPreview.mk b/extensions/Package_QuickLookPreview.mk
new file mode 100644
index 000000000000..0af4a1799920
--- /dev/null
+++ b/extensions/Package_QuickLookPreview.mk
@@ -0,0 +1,14 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Package_Package,extensions_QuickLookPreview,$(gb_Executable_BINDIR)))
+
+$(eval $(call gb_Package_add_file,extensions_QuickLookPreview,PlugIns/QuickLookPreview.appex/Contents/MacOS/QuickLookPreview,QuickLookPreview))
+
+# vim: set noet sw=4 ts=4:
diff --git a/extensions/Package_QuickLookThumbnail.mk b/extensions/Package_QuickLookThumbnail.mk
new file mode 100644
index 000000000000..a04aba634893
--- /dev/null
+++ b/extensions/Package_QuickLookThumbnail.mk
@@ -0,0 +1,14 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Package_Package,extensions_QuickLookThumbnail,$(gb_Executable_BINDIR)))
+
+$(eval $(call gb_Package_add_file,extensions_QuickLookThumbnail,PlugIns/QuickLookThumbnail.appex/Contents/MacOS/QuickLookThumbnail,QuickLookThumbnail))
+
+# vim: set noet sw=4 ts=4:
diff --git a/extensions/Package_quicklookpreviewappex.mk b/extensions/Package_quicklookpreviewappex.mk
new file mode 100644
index 000000000000..c90db2546833
--- /dev/null
+++ b/extensions/Package_quicklookpreviewappex.mk
@@ -0,0 +1,19 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Package_Package,extensions_quicklookpreviewappex,$(SRCDIR)/extensions/source/macosx/quicklookpreview/appex))
+
+$(eval $(call gb_Package_add_files,extensions_quicklookpreviewappex,PlugIns/QuickLookPreview.appex/Contents,\
+ Info.plist \
+))
+
+$(eval $(call gb_Package_add_files,extensions_quicklookpreviewappex,PlugIns/QuickLookPreview.appex/Contents/Resources,\
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/extensions/Package_quicklookthumbnailappex.mk b/extensions/Package_quicklookthumbnailappex.mk
new file mode 100644
index 000000000000..32628d50452d
--- /dev/null
+++ b/extensions/Package_quicklookthumbnailappex.mk
@@ -0,0 +1,19 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Package_Package,extensions_quicklookthumbnailappex,$(SRCDIR)/extensions/source/macosx/quicklookthumbnail/appex))
+
+$(eval $(call gb_Package_add_files,extensions_quicklookthumbnailappex,PlugIns/QuickLookThumbnail.appex/Contents,\
+ Info.plist \
+))
+
+$(eval $(call gb_Package_add_files,extensions_quicklookthumbnailappex,PlugIns/QuickLookThumbnail.appex/Contents/Resources,\
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/extensions/StaticLibrary_extensions_macosx_common.mk b/extensions/StaticLibrary_extensions_macosx_common.mk
new file mode 100644
index 000000000000..d6399395996c
--- /dev/null
+++ b/extensions/StaticLibrary_extensions_macosx_common.mk
@@ -0,0 +1,20 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_StaticLibrary_StaticLibrary,extensions_macosx_common))
+
+$(eval $(call gb_StaticLibrary_add_objcobjects,extensions_macosx_common,\
+ extensions/source/macosx/common/OOoContentDataParser \
+ extensions/source/macosx/common/OOoManifestParser \
+ extensions/source/macosx/common/OOoMetaDataParser \
+ extensions/source/macosx/common/OOoSpotlightAndQuickLookImporter \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/extensions/source/activex/SOActiveX.cxx b/extensions/source/activex/SOActiveX.cxx
index b72ab0d66ca0..9bb3b34a4afe 100644
--- a/extensions/source/activex/SOActiveX.cxx
+++ b/extensions/source/activex/SOActiveX.cxx
@@ -146,7 +146,7 @@ CSOActiveX::CSOActiveX()
, mbDrawLocked( false )
{
CLSID const clsFactory = {0x82154420,0x0FBF,0x11d4,{0x83, 0x13,0x00,0x50,0x04,0x52,0x6A,0xB4}};
- HRESULT hr = CoCreateInstance( clsFactory, nullptr, CLSCTX_ALL, __uuidof(IDispatch), reinterpret_cast<void**>(&mpDispFactory));
+ HRESULT hr = CoCreateInstance(clsFactory, nullptr, CLSCTX_ALL, IID_PPV_ARGS(&mpDispFactory));
if( !SUCCEEDED( hr ) )
OutputError_Impl( nullptr, hr );
@@ -303,8 +303,8 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CSOActiveX::Load( LPPROPERTYBAG pPropBag, LPER
{
mnVersion = GetVersionConnected();
- IPropertyBag2* pPropBag2;
- HRESULT hr = pPropBag->QueryInterface( IID_IPropertyBag2, reinterpret_cast<void**>(&pPropBag2) );
+ CComPtr<IPropertyBag2> pPropBag2;
+ HRESULT hr = pPropBag->QueryInterface(&pPropBag2);
//ATLASSERT( hr >= 0 );
if( !SUCCEEDED( hr ) )
@@ -1096,9 +1096,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CSOActiveX::SetClientSite( IOleClientSite* aCl
if( aServiceProvider )
{
- aServiceProvider->QueryService( SID_SInternetExplorer,
- IID_IWebBrowser,
- reinterpret_cast<void**>(&mWebBrowser2) );
+ aServiceProvider->QueryService(SID_SInternetExplorer, IID_PPV_ARGS(&mWebBrowser2));
// ATLASSERT( mWebBrowser2 );
if( mWebBrowser2 )
AtlAdvise( mWebBrowser2, GetUnknown(), DIID_DWebBrowserEvents2, &mCookie );
diff --git a/extensions/source/macosx/spotlight/OOoContentDataParser.h b/extensions/source/macosx/common/OOoContentDataParser.h
index dc07a3166122..b481326ca6a2 100644
--- a/extensions/source/macosx/spotlight/OOoContentDataParser.h
+++ b/extensions/source/macosx/common/OOoContentDataParser.h
@@ -19,32 +19,40 @@
#import <Cocoa/Cocoa.h>
-@interface OOoContentDataParser : NSObject <NSXMLParserDelegate> {
+@interface OOoContentDataParser : NSObject <NSXMLParserDelegate>
+{
// indicates if we are interested in an element's content
BOOL shouldReadCharacters;
// the MD importer's values
- NSMutableDictionary *mdiValues;
+ NSMutableDictionary* mdiValues;
// all of the text inside a document
- NSMutableString *textContent;
+ NSMutableString* textContent;
// the current element's content
- NSMutableString *runningTextContent;
+ NSMutableString* runningTextContent;
}
- (void)parseXML:(NSData*)data intoDictionary:(NSMutableDictionary*)dict;
// delegates
-- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict;
+- (void)parser:(NSXMLParser*)parser
+ didStartElement:(NSString*)elementName
+ namespaceURI:(NSString*)namespaceURI
+ qualifiedName:(NSString*)qualifiedName
+ attributes:(NSDictionary*)attributeDict;
-- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName;
+- (void)parser:(NSXMLParser*)parser
+ didEndElement:(NSString*)elementName
+ namespaceURI:(NSString*)namespaceURI
+ qualifiedName:(NSString*)qName;
-- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string;
+- (void)parser:(NSXMLParser*)parser foundCharacters:(NSString*)string;
-- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError;
+- (void)parser:(NSXMLParser*)parser parseErrorOccurred:(NSError*)parseError;
-- (void)parserDidEndDocument:(NSXMLParser *)parser;
+- (void)parserDidEndDocument:(NSXMLParser*)parser;
@end
diff --git a/extensions/source/macosx/spotlight/OOoContentDataParser.m b/extensions/source/macosx/common/OOoContentDataParser.m
index e1f51e5b90c7..e1f51e5b90c7 100644
--- a/extensions/source/macosx/spotlight/OOoContentDataParser.m
+++ b/extensions/source/macosx/common/OOoContentDataParser.m
diff --git a/extensions/source/macosx/common/OOoManifestParser.h b/extensions/source/macosx/common/OOoManifestParser.h
new file mode 100644
index 000000000000..b032378045b9
--- /dev/null
+++ b/extensions/source/macosx/common/OOoManifestParser.h
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#import <Cocoa/Cocoa.h>
+
+#define MEDIA_TYPE_PDF @"application/pdf"
+#define MEDIA_TYPE_PNG @"image/png"
+
+@interface OOoManifestParser : NSObject <NSXMLParserDelegate>
+{
+ NSMutableDictionary* metaValues;
+}
+
+- (void)parseXML:(NSData*)data intoDictionary:(NSMutableDictionary*)dict;
+
+//delegates
+- (void)parser:(NSXMLParser*)parser
+ didStartElement:(NSString*)elementName
+ namespaceURI:(NSString*)namespaceURI
+ qualifiedName:(NSString*)qualifiedName
+ attributes:(NSDictionary*)attributeDict;
+
+- (void)parser:(NSXMLParser*)parser
+ didEndElement:(NSString*)elementName
+ namespaceURI:(NSString*)namespaceURI
+ qualifiedName:(NSString*)qName;
+
+- (void)parser:(NSXMLParser*)parser foundCharacters:(NSString*)string;
+
+- (void)parser:(NSXMLParser*)parser parseErrorOccurred:(NSError*)parseError;
+@end
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/macosx/common/OOoManifestParser.m b/extensions/source/macosx/common/OOoManifestParser.m
new file mode 100644
index 000000000000..88e01b96d1ee
--- /dev/null
+++ b/extensions/source/macosx/common/OOoManifestParser.m
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#import "OOoManifestParser.h"
+
+@implementation OOoManifestParser
+
+- (id)init
+{
+ if ((self = [super init]) != nil) {
+ metaValues = nil;
+
+ return self;
+ }
+
+ return nil;
+}
+
+- (void)parseXML:(NSData*)data intoDictionary:(NSMutableDictionary*)dict
+{
+ metaValues = dict;
+
+ NSXMLParser *parser = [[NSXMLParser alloc] initWithData:data];
+
+ [parser setDelegate:self];
+
+ [parser setShouldResolveExternalEntities:NO];
+ [parser parse];
+
+ [parser release];
+
+ metaValues = nil;
+}
+
+- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict
+{
+ (void) parser; // unused
+ (void) namespaceURI; // unused
+ (void) qualifiedName; // unused
+
+ if ([@"manifest:file-entry" isEqualToString:elementName]) {
+ NSString *mediaType = [attributeDict objectForKey:@"manifest:media-type"];
+ NSString *path = [attributeDict objectForKey:@"manifest:full-path"];
+ if (mediaType && path && [path length]) {
+ NSString *key = nil;
+ NSArray *mediaComponents = [mediaType componentsSeparatedByString:@"/"];
+ if (mediaComponents && [mediaComponents count] && [[mediaComponents objectAtIndex:0] isEqualToString:@"image"]) {
+ key = mediaType;
+ }
+ else if ([mediaType isEqualToString:MEDIA_TYPE_PDF]) {
+ key = MEDIA_TYPE_PDF;
+ }
+ else if (![mediaType length]) {
+ // NeoOffice sometimes adds PDF thumbnails with an empty mime type
+ if ([path hasSuffix:@".pdf"])
+ key = MEDIA_TYPE_PDF;
+ // Just to be safe, add any PNG thumbnails
+ else if ([path hasSuffix:@".png"])
+ key = MEDIA_TYPE_PNG;
+ }
+
+ // OpenOffice, NeoOffice, and LibreOffice appear to only insert a
+ // single thumbnail per media type so ignore duplicate thumbnails
+ if (key && ![metaValues objectForKey:key])
+ [metaValues setObject:path forKey:key];
+ }
+ }
+}
+
+- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
+{
+ (void) parser; // unused
+ (void) namespaceURI; // unused
+ (void) qName; // unused
+}
+
+- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
+{
+ (void) parser; // unused
+ (void) string; // unused
+}
+
+- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError
+{
+ //NSLog(@"parsing finished with error");
+ NSLog(@"Error %li, Description: %@, Line: %li, Column: %li", (long) [parseError code],
+ [[parser parserError] localizedDescription], (long) [parser lineNumber],
+ (long) [parser columnNumber]);
+}
+
+@end
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/macosx/spotlight/OOoMetaDataParser.h b/extensions/source/macosx/common/OOoMetaDataParser.h
index 85d48b1735d7..401e0759a17d 100644
--- a/extensions/source/macosx/spotlight/OOoMetaDataParser.h
+++ b/extensions/source/macosx/common/OOoMetaDataParser.h
@@ -19,28 +19,35 @@
#import <Cocoa/Cocoa.h>
-
-@interface OOoMetaDataParser : NSObject <NSXMLParserDelegate> {
+@interface OOoMetaDataParser : NSObject <NSXMLParserDelegate>
+{
//indicates if content should be read
BOOL shouldReadCharacters;
//indicates if the current element is a custom metadata tag
BOOL isCustom;
- NSMutableDictionary *metaValues;
- NSMutableString *textCurrentElement;
- NSString *customAttribute;
+ NSMutableDictionary* metaValues;
+ NSMutableString* textCurrentElement;
+ NSString* customAttribute;
}
- (void)parseXML:(NSData*)data intoDictionary:(NSMutableDictionary*)dict;
//delegates
-- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict;
+- (void)parser:(NSXMLParser*)parser
+ didStartElement:(NSString*)elementName
+ namespaceURI:(NSString*)namespaceURI
+ qualifiedName:(NSString*)qualifiedName
+ attributes:(NSDictionary*)attributeDict;
-- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName;
+- (void)parser:(NSXMLParser*)parser
+ didEndElement:(NSString*)elementName
+ namespaceURI:(NSString*)namespaceURI
+ qualifiedName:(NSString*)qName;
-- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string;
+- (void)parser:(NSXMLParser*)parser foundCharacters:(NSString*)string;
-- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError;
+- (void)parser:(NSXMLParser*)parser parseErrorOccurred:(NSError*)parseError;
@end
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/macosx/spotlight/OOoMetaDataParser.m b/extensions/source/macosx/common/OOoMetaDataParser.m
index 1e7cac685b88..1e7cac685b88 100644
--- a/extensions/source/macosx/spotlight/OOoMetaDataParser.m
+++ b/extensions/source/macosx/common/OOoMetaDataParser.m
diff --git a/extensions/source/macosx/spotlight/OOoSpotlightImporter.h b/extensions/source/macosx/common/OOoSpotlightAndQuickLookImporter.h
index 947f8dbf1656..57d0dcc3b0de 100644
--- a/extensions/source/macosx/spotlight/OOoSpotlightImporter.h
+++ b/extensions/source/macosx/common/OOoSpotlightAndQuickLookImporter.h
@@ -19,7 +19,7 @@
#import <Cocoa/Cocoa.h>
-@interface OOoSpotlightImporter : NSObject
+@interface OOoSpotlightAndQuickLookImporter : NSObject
{
}
@@ -27,11 +27,16 @@
contentType:(NSString*)contentTypeUTI
attributes:(NSMutableDictionary*)attributes;
+- (NSImage*)importDocumentThumbnail:(NSString*)pathToFile;
+
- (NSFileHandle*)openZipFileAtPath:(NSString*)pathToFile;
- (NSData*)metaDataFileFromZip:(NSFileHandle*)unzipFile;
- (NSData*)contentDataFileFromZip:(NSFileHandle*)unzipFile;
+
+- (NSData*)manifestFileFromZip:(NSFileHandle*)unzipFile;
+
@end
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/macosx/spotlight/OOoSpotlightImporter.m b/extensions/source/macosx/common/OOoSpotlightAndQuickLookImporter.m
index a144fe259562..8f5cf449546c 100644
--- a/extensions/source/macosx/spotlight/OOoSpotlightImporter.m
+++ b/extensions/source/macosx/common/OOoSpotlightAndQuickLookImporter.m
@@ -19,9 +19,10 @@
#import <zlib.h>
-#import "OOoSpotlightImporter.h"
+#import "OOoSpotlightAndQuickLookImporter.h"
#import "OOoMetaDataParser.h"
#import "OOoContentDataParser.h"
+#import "OOoManifestParser.h"
/* a dictionary to hold the UTIs */
static NSDictionary *uti2kind;
@@ -338,7 +339,7 @@ static NSData *getUncompressedData(NSFileHandle *file, NSString *name)
}
}
-@implementation OOoSpotlightImporter
+@implementation OOoSpotlightAndQuickLookImporter
/* initialize is only called once the first time this class is loaded */
+ (void)initialize
@@ -437,6 +438,69 @@ static NSData *getUncompressedData(NSFileHandle *file, NSString *name)
return YES;
}
+- (NSImage*)importDocumentThumbnail:(NSString*)pathToFile {
+ if (!pathToFile || ![pathToFile length])
+ return nil;
+
+ NSFileHandle *unzipFile = [self openZipFileAtPath:pathToFile];
+ if (!unzipFile)
+ return nil;
+
+ NSData *manifest = [self manifestFileFromZip:unzipFile];
+ if (!manifest) {
+ [unzipFile closeFile];
+ return nil;
+ }
+
+ [manifest retain];
+
+ NSMutableDictionary *attributes = [NSMutableDictionary new];
+
+ OOoManifestParser *parser = [OOoManifestParser new];
+ [parser parseXML:manifest intoDictionary:attributes];
+ [parser release];
+
+ NSMutableArray<NSString *> *pathArray = [NSMutableArray arrayWithCapacity:[attributes count]];
+
+ // NeoOffice files have a low resolution .pdf thumbnail so if there is a .pdf
+ // thumbnail available, use that
+ NSString *path = [attributes objectForKey:MEDIA_TYPE_PDF];
+ if (path && [path length])
+ [pathArray addObject:path];
+
+ // OpenOffice, NeoOffice, and LibreOffice files normally have a .png thumbnail
+ path = [attributes objectForKey:MEDIA_TYPE_PNG];
+ if (path && [path length])
+ [pathArray addObject:path];
+
+ for (NSString *key in [attributes allKeys]) {
+ if (![key length] || [key isEqualToString:MEDIA_TYPE_PDF] || [key isEqualToString:MEDIA_TYPE_PNG])
+ continue;
+ path = [attributes objectForKey:key];
+ if (path && [path length])
+ [pathArray addObject:path];
+ }
+
+ [attributes release];
+ [manifest release];
+
+ NSImage *image = nil;
+ for (path in pathArray) {
+ NSData *imageData = getUncompressedData(unzipFile, path);
+ if (imageData) {
+ image = [[NSImage alloc] initWithData:imageData];
+ if (image) {
+ [image autorelease];
+ break;
+ }
+ }
+ }
+
+ [unzipFile closeFile];
+
+ return image;
+}
+
/* openZipFileAtPath returns the file as a valid data structure or nil otherwise*/
- (NSFileHandle*)openZipFileAtPath:(NSString*)pathToFile
{
@@ -481,6 +545,12 @@ static NSData *getUncompressedData(NSFileHandle *file, NSString *name)
return getUncompressedData(unzipFile, @"content.xml");
}
+- (NSData*) manifestFileFromZip:(NSFileHandle*)unzipFile
+{
+ if (unzipFile == nil)
+ return nil;
+ return getUncompressedData(unzipFile, @"META-INF/manifest.xml");
+}
@end
diff --git a/extensions/source/macosx/quicklookpreview/PreviewViewController.h b/extensions/source/macosx/quicklookpreview/PreviewViewController.h
new file mode 100644
index 000000000000..dae8eac0c92f
--- /dev/null
+++ b/extensions/source/macosx/quicklookpreview/PreviewViewController.h
@@ -0,0 +1,17 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#import <Cocoa/Cocoa.h>
+#import <Quartz/Quartz.h>
+
+@interface PreviewViewController : NSViewController <QLPreviewingController>
+
+@end
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/macosx/quicklookpreview/PreviewViewController.m b/extensions/source/macosx/quicklookpreview/PreviewViewController.m
new file mode 100644
index 000000000000..27ff77993601
--- /dev/null
+++ b/extensions/source/macosx/quicklookpreview/PreviewViewController.m
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#import <Quartz/Quartz.h>
+
+#import "PreviewViewController.h"
+#import "OOoSpotlightAndQuickLookImporter.h"
+
+@implementation PreviewViewController
+
+- (void)preparePreviewOfFileAtURL:(NSURL *)url completionHandler:(void (^)(NSError * _Nullable))handler {
+ if (!url || ![url isFileURL]) {
+ handler([[NSError alloc] initWithDomain:NSURLErrorDomain code:NSURLErrorUnsupportedURL userInfo:nil]);
+ return;
+ }
+
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
+
+ OOoSpotlightAndQuickLookImporter *importer = [OOoSpotlightAndQuickLookImporter new];
+
+ NSImage *image = nil;
+ @try {
+ image = [importer importDocumentThumbnail:[url path]];
+ }
+ @catch (NSException *exception) {
+ NSLog(@"preparePreviewOfFileAtURL: Caught %@: %@", [exception name], [exception reason]);
+ }
+
+ [importer release];
+
+ if (!image) {
+ handler([[NSError alloc] initWithDomain:NSURLErrorDomain code:NSURLErrorUnsupportedURL userInfo:nil]);
+ [pool release];
+ return;
+ }
+
+ // Make image automatic scale to the size of the view while preserving the
+ // image's aspect ratio by using a CALayer to handle image drawing:
+ // https://stackoverflow.com/questions/23002653/nsimageview-image-aspect-fill
+ self.view.layer = [CALayer layer];
+ self.view.layer.contentsGravity = kCAGravityResizeAspect;
+ self.view.layer.contents = image;
+ self.view.wantsLayer = YES;
+
+ handler(nil);
+
+ [pool release];
+}
+
+@end
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/macosx/quicklookpreview/appex/Info.plist b/extensions/source/macosx/quicklookpreview/appex/Info.plist
new file mode 100644
index 000000000000..e17296d9de07
--- /dev/null
+++ b/extensions/source/macosx/quicklookpreview/appex/Info.plist
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+-->
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleDisplayName</key>
+ <string>LibreOffice Quick Look Preview</string>
+ <key>CFBundleExecutable</key>
+ <string>QuickLookPreview</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.libreoffice.quicklookpreview</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>QuickLookPreview</string>
+ <key>CFBundlePackageType</key>
+ <string>XPC!</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSupportedPlatforms</key>
+ <array>
+ <string>MacOSX</string>
+ </array>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>12.0</string>
+ <key>NSExtension</key>
+ <dict>
+ <key>NSExtensionAttributes</key>
+ <dict>
+ <key>QLIsDataBasedPreview</key>
+ <false/>
+ <key>QLSupportedContentTypes</key>
+ <array>
+ <string>org.openoffice.text</string>
+ <string>org.oasis-open.opendocument.text</string>
+ <string>org.openoffice.spreadsheet</string>
+ <string>org.oasis-open.opendocument.spreadsheet</string>
+ <string>org.openoffice.presentation</string>
+ <string>org.oasis-open.opendocument.presentation</string>
+ <string>org.openoffice.graphics</string>
+ <string>org.oasis-open.opendocument.graphics</string>
+ <string>org.openoffice.text-master</string>
+ <string>org.oasis-open.opendocument.text-master</string>
+ <string>org.openoffice.formula</string>
+ <string>org.oasis-open.opendocument.formula</string>
+ <string>org.openoffice.text-template</string>
+ <string>org.oasis-open.opendocument.text-template</string>
+ <string>org.openoffice.spreadsheet-template</string>
+ <string>org.oasis-open.opendocument.spreadsheet-template</string>
+ <string>org.openoffice.presentation-template</string>
+ <string>org.oasis-open.opendocument.presentation-template</string>
+ <string>org.openoffice.graphics-template</string>
+ <string>org.oasis-open.opendocument.graphics-template</string>
+ <string>org.oasis-open.opendocument.database</string>
+ </array>
+ <key>QLSupportsSearchableItems</key>
+ <false/>
+ </dict>
+ <key>NSExtensionPointIdentifier</key>
+ <string>com.apple.quicklook.preview</string>
+ <key>NSExtensionPrincipalClass</key>
+ <string>PreviewViewController</string>
+ </dict>
+</dict>
+</plist>
diff --git a/extensions/source/macosx/quicklookthumbnail/ThumbnailProvider.h b/extensions/source/macosx/quicklookthumbnail/ThumbnailProvider.h
new file mode 100644
index 000000000000..7173d11f4816
--- /dev/null
+++ b/extensions/source/macosx/quicklookthumbnail/ThumbnailProvider.h
@@ -0,0 +1,18 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#import <QuickLookThumbnailing/QuickLookThumbnailing.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface ThumbnailProvider : QLThumbnailProvider
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/extensions/source/macosx/quicklookthumbnail/ThumbnailProvider.m b/extensions/source/macosx/quicklookthumbnail/ThumbnailProvider.m
new file mode 100644
index 000000000000..d22e7878d711
--- /dev/null
+++ b/extensions/source/macosx/quicklookthumbnail/ThumbnailProvider.m
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#import <Quartz/Quartz.h>
+
+#import "ThumbnailProvider.h"
+#import "OOoSpotlightAndQuickLookImporter.h"
+
+@implementation ThumbnailProvider
+
+- (void)provideThumbnailForFileRequest:(QLFileThumbnailRequest *)request completionHandler:(void (^)(QLThumbnailReply * _Nullable, NSError * _Nullable))handler {
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
+
+ NSImage *image = nil;
+ NSRect drawRect = NSMakeRect(0, 0, floorf(request.maximumSize.width), floorf(request.maximumSize.height));
+
+ if (request.fileURL && [request.fileURL isFileURL] && drawRect.size.width > 0 && drawRect.size.height > 0) {
+ OOoSpotlightAndQuickLookImporter *importer = [OOoSpotlightAndQuickLookImporter new];
+
+ @try {
+ image = [importer importDocumentThumbnail:[request.fileURL path]];
+ }
+ @catch (NSException *exception) {
+ NSLog(@"provideThumbnailForFileRequest: Caught %@: %@", [exception name], [exception reason]);
+ }
+
+ [importer release];
+
+ if (image) {
+ // The handler() function appears to run the drawing block asynchronously
+ // so retain the image and release it in the drawing block.
+ [image retain];
+ NSSize imageSize = [image size];
+ CGFloat widthRatio = imageSize.width / request.maximumSize.width;
+ CGFloat heightRatio = imageSize.height / request.maximumSize.height;
+
+ // Eliminate an undrawn white edge in thumbnail by rounding down any
+ // scaling to the nearest integer.
+ if (widthRatio > heightRatio)
+ drawRect.size.height = floorf(imageSize.height / widthRatio);
+ else
+ drawRect.size.width = floorf(imageSize.width / heightRatio);
+ }
+ }
+
+ handler([QLThumbnailReply replyWithContextSize:drawRect.size currentContextDrawingBlock:^BOOL {
+ if (!image)
+ return NO;
+
+ [image drawInRect:drawRect];
+ [image release];
+
+ return YES;
+ }], nil);
+
+ [pool release];
+}
+
+@end
diff --git a/extensions/source/macosx/quicklookthumbnail/appex/Info.plist b/extensions/source/macosx/quicklookthumbnail/appex/Info.plist
new file mode 100644
index 000000000000..d8a1d1338371
--- /dev/null
+++ b/extensions/source/macosx/quicklookthumbnail/appex/Info.plist
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+-->
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleDisplayName</key>
+ <string>LibreOffice Quick Look Thumbnail</string>
+ <key>CFBundleExecutable</key>
+ <string>QuickLookThumbnail</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.libreoffice.quicklookthumbnail</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>QuickLookThumbnail</string>
+ <key>CFBundlePackageType</key>
+ <string>XPC!</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSupportedPlatforms</key>
+ <array>
+ <string>MacOSX</string>
+ </array>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>10.15</string>
+ <key>NSExtension</key>
+ <dict>
+ <key>NSExtensionAttributes</key>
+ <dict>
+ <key>QLSupportedContentTypes</key>
+ <array>
+ <string>org.openoffice.text</string>
+ <string>org.oasis-open.opendocument.text</string>
+ <string>org.openoffice.spreadsheet</string>
+ <string>org.oasis-open.opendocument.spreadsheet</string>
+ <string>org.openoffice.presentation</string>
+ <string>org.oasis-open.opendocument.presentation</string>
+ <string>org.openoffice.graphics</string>
+ <string>org.oasis-open.opendocument.graphics</string>
+ <string>org.openoffice.text-master</string>
+ <string>org.oasis-open.opendocument.text-master</string>
+ <string>org.openoffice.formula</string>
+ <string>org.oasis-open.opendocument.formula</string>
+ <string>org.openoffice.text-template</string>
+ <string>org.oasis-open.opendocument.text-template</string>
+ <string>org.openoffice.spreadsheet-template</string>
+ <string>org.oasis-open.opendocument.spreadsheet-template</string>
+ <string>org.openoffice.presentation-template</string>
+ <string>org.oasis-open.opendocument.presentation-template</string>
+ <string>org.openoffice.graphics-template</string>
+ <string>org.oasis-open.opendocument.graphics-template</string>
+ <string>org.oasis-open.opendocument.database</string>
+ </array>
+ <key>QLThumbnailMinimumDimension</key>
+ <integer>0</integer>
+ </dict>
+ <key>NSExtensionPointIdentifier</key>
+ <string>com.apple.quicklook.thumbnail</string>
+ <key>NSExtensionPrincipalClass</key>
+ <string>ThumbnailProvider</string>
+ </dict>
+</dict>
+</plist>
diff --git a/extensions/source/macosx/spotlight/GetMetadataForFile.m b/extensions/source/macosx/spotlight/GetMetadataForFile.m
index a1dcdbe619ac..61ebb68335bc 100644
--- a/extensions/source/macosx/spotlight/GetMetadataForFile.m
+++ b/extensions/source/macosx/spotlight/GetMetadataForFile.m
@@ -22,7 +22,7 @@
#include <Foundation/Foundation.h>
#include "GetMetadataForFile.h"
-#import "OOoSpotlightImporter.h"
+#import "OOoSpotlightAndQuickLookImporter.h"
/* -----------------------------------------------------------------------------
Get metadata attributes from file
@@ -42,7 +42,7 @@ Boolean GetMetadataForFile(void* thisInterface,
/* Return TRUE if successful, FALSE if there was no data provided */
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- OOoSpotlightImporter *importer = [OOoSpotlightImporter new];
+ OOoSpotlightAndQuickLookImporter *importer = [OOoSpotlightAndQuickLookImporter new];
Boolean importOK = NO;
@try {
diff --git a/extensions/source/ole/servprov.cxx b/extensions/source/ole/servprov.cxx
index 0c3920ccca11..a37703eb012d 100644
--- a/extensions/source/ole/servprov.cxx
+++ b/extensions/source/ole/servprov.cxx
@@ -395,47 +395,21 @@ css::uno::Sequence<OUString> OleClient::getSupportedServiceNames()
Reference<XInterface> SAL_CALL OleClient::createInstance(const OUString& ServiceSpecifier)
{
Reference<XInterface> ret;
- HRESULT result;
- IUnknown* pUnknown = nullptr;
- CLSID classId;
o2u_attachCurrentThread();
- result = CLSIDFromProgID(
- o3tl::toW(ServiceSpecifier.getStr()), //Pointer to the ProgID
- &classId); //Pointer to the CLSID
-
-
- if (result == NOERROR)
- {
- result = CoCreateInstance(
- classId, //Class identifier (CLSID) of the object
- nullptr, //Pointer to whether object is or isn't part of an aggregate
- CLSCTX_SERVER, //Context for running executable code
- IID_IUnknown, //Reference to the identifier of the interface
- reinterpret_cast<void**>(&pUnknown)); //Address of output variable that receives
- // the interface pointer requested in riid
- }
-
- if (pUnknown != nullptr)
+ CComPtr<IUnknown> pUnknown;
+ pUnknown.CoCreateInstance(o3tl::toW(ServiceSpecifier.getStr()), nullptr, CLSCTX_SERVER);
+ if (pUnknown)
{
Any any;
- CComVariant variant;
-
- V_VT(&variant) = VT_UNKNOWN;
- V_UNKNOWN(&variant) = pUnknown;
- // AddRef for Variant
- pUnknown->AddRef();
-
- // When the object is wrapped, then its refcount is increased
+ CComVariant variant(pUnknown);
variantToAny(&variant, any);
if (any.getValueTypeClass() == TypeClass_INTERFACE)
{
any >>= ret;
}
- pUnknown->Release(); // CoCreateInstance
}
-
return ret;
}
diff --git a/extensions/source/propctrlr/fontdialog.cxx b/extensions/source/propctrlr/fontdialog.cxx
index 59ca37b08eda..2adab8f069ba 100644
--- a/extensions/source/propctrlr/fontdialog.cxx
+++ b/extensions/source/propctrlr/fontdialog.cxx
@@ -226,10 +226,16 @@ namespace pcr
// if PROPERTY_STANDARD_THEME is set, use style settings independent of platform (theme)
// KEEP IN SYNC WITH UnoControl::createPeer
- bool bStandardTheme = false;
- css::uno::Any aAnyStandardTheme = _rxModel->getPropertyValue(PROPERTY_STANDARD_THEME);
- if ((aAnyStandardTheme >>= bStandardTheme) && bStandardTheme)
- aStyleSettings.SetStandardStyles();
+ css::uno::Reference<css::beans::XPropertySetInfo> xPropSetInfo
+ = _rxModel->getPropertySetInfo();
+ if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(PROPERTY_STANDARD_THEME))
+ {
+ bool bStandardTheme = false;
+ css::uno::Any aAnyStandardTheme
+ = _rxModel->getPropertyValue(PROPERTY_STANDARD_THEME);
+ if ((aAnyStandardTheme >>= bStandardTheme) && bStandardTheme)
+ aStyleSettings.SetStandardStyles();
+ }
const vcl::Font aDefaultVCLFont = aStyleSettings.GetAppFont();
css::awt::FontDescriptor aDefaultFont = VCLUnoHelper::CreateFontDescriptor(aDefaultVCLFont);
diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx
index e1fde5e5213c..22bada4517c6 100644
--- a/extensions/source/scanner/sane.cxx
+++ b/extensions/source/scanner/sane.cxx
@@ -21,6 +21,7 @@
#include <math.h>
#include <o3tl/safeint.hxx>
+#include <o3tl/unit_conversion.hxx>
#include <osl/file.h>
#include <sal/log.hxx>
#include <tools/stream.hxx>
@@ -747,9 +748,9 @@ bool Sane::Start( BitmapTransporter& rBitmap )
if( ! fResl )
fResl = 300; // if all else fails that's a good guess
if( ! nWidthMM )
- nWidthMM = static_cast<int>((static_cast<double>(nWidth) / fResl) * 25.4);
+ nWidthMM = o3tl::convert(nWidth / fResl, o3tl::Length::in, o3tl::Length::mm);
if( ! nHeightMM )
- nHeightMM = static_cast<int>((static_cast<double>(nHeight) / fResl) * 25.4);
+ nHeightMM = o3tl::convert(nHeight / fResl, o3tl::Length::in, o3tl::Length::mm);
SAL_INFO("extensions.scanner", "set dimensions to(" << nWidth << ", " << nHeight << ") Pixel, (" << nWidthMM << ", " << nHeightMM <<
") mm, resolution is " << fResl);
diff --git a/extensions/source/scanner/scanwin.cxx b/extensions/source/scanner/scanwin.cxx
index 198b092846cd..933531526f7a 100644
--- a/extensions/source/scanner/scanwin.cxx
+++ b/extensions/source/scanner/scanwin.cxx
@@ -264,8 +264,7 @@ void Twain::ShimListenerThread::execute()
// We need a WinAPI HANDLE of the process to be able to wait on it and detect the process
// termination; so use WinAPI to start the process, not osl_executeProcess.
- STARTUPINFOW si{};
- si.cb = sizeof(si);
+ STARTUPINFOW si{ .cb = sizeof(si) };
PROCESS_INFORMATION pi;
if (!CreateProcessW(nullptr, const_cast<LPWSTR>(o3tl::toW(sCmdLine.getStr())), nullptr,