// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- /* * 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/. */ // List the contents of the macOS pasteboard // Build with: clang++ -g -Wall -o pasteboard pasteboard.mm -framework AppKit -framework UniformTypeIdentifiers #import #import #import #import static void usage() { std::cout << "Usage: pasteboard\n" " List the types on the pasteboard and in each pasteboard item.\n" " pasteboard -a\n" " Output the data for all types to stdout. Note: output will\n" " in many cases be binary. The different types are separated by a textual header.\n" " pasteboard -t type\n" " Output the data for the type in question to stdout. Note: output will\n" " in many cases be binary.\n"; } int main(int argc, char** argv) { NSString* requestedType = @""; int ch; while ((ch = getopt(argc, argv, "at:")) != -1) { switch (ch) { case 'a': requestedType = @"*"; break; case 't': requestedType = [NSString stringWithUTF8String:optarg]; break; case '?': usage(); return 0; } } argc -= optind; argv += optind; if (argc > 0) { usage(); return 1; } NSPasteboard* pb = [NSPasteboard generalPasteboard]; if ([requestedType isEqualToString:@"*"]) { NSArray* types = [pb types]; for (unsigned i = 0; i < [types count]; i++) { NSData* data = [pb dataForType:types[i]]; std::cout << i << ": " << [types[i] UTF8String] << ": " << std::to_string([data length]) << " bytes:\n"; if (data != nil) { std::cout.write((const char*)[data bytes], [data length]); std::cout << "\n"; } } return 0; } if ([requestedType length] > 0) { NSData* data = [pb dataForType:requestedType]; if (data == nil) std::cerr << "No data for " << [requestedType UTF8String] << std::endl; else std::cout.write((const char*)[data bytes], [data length]); return 0; } { NSArray* types = [pb types]; std::cout << "Types directly on pasteboard:\n"; for (unsigned i = 0; i < [types count]; i++) { std::cout << " " << i << ": " << [types[i] UTF8String] << "\n"; } } NSArray* items = [pb pasteboardItems]; std::cout << "New-style items on pasteboard:\n"; for (unsigned i = 0; i < [items count]; i++) { std::cout << " Item " << i << ", types:\n"; NSArray* types = [items[i] types]; for (unsigned j = 0; j < [types count]; j++) { std::cout << " " << j << ": " << [types[j] UTF8String] << std::flush; if ([types[j] isEqualToString:[UTTypePlainText identifier]] || [types[j] isEqualToString:[UTTypeUTF8PlainText identifier]] || [types[j] isEqualToString:[UTTypeText identifier]] || [types[j] isEqualToString:[UTTypeHTML identifier]] || [types[j] isEqualToString:[UTTypeRTF identifier]] || [types[j] isEqualToString:[UTTypeUTF16ExternalPlainText identifier]]) { NSString* string = [items[i] stringForType:NSPasteboardTypeString]; if ([string length] > 500) string = [[string substringToIndex:501] stringByAppendingString:@"..."]; std::cout << ": '" << [string UTF8String] << "'"; } std::cout << "\n"; } } return 0; } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ -6.2'>distro/collabora/dcm-6.2 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
0ff55faeaea70a5910b612be6446ebf'>inc/InternalDataProvider.hxx
AgeCommit message (Expand)Author
AgeCommit message (Expand)Author
2018-09-10tdf#42949 Fix IWYU warnings in include/cppuhelper/*Gabor Kelemen
2018-08-08tdf#42949 Fix IWYU warnings in chart2/source/inc/[d-l]*hxxGabor Kelemen
2017-12-19remove unused typedefsNoel Grandin
2017-07-28loplugin:checkunusedparams more part3Noel Grandin
2017-02-15Drop :: prefix from std in c*/Tor Lillqvist
2017-01-26Remove dynamic exception specificationsStephan Bergmann
2016-11-11loplugin:expandablemethods in chart2Noel Grandin
2016-09-13loplugin:override: No more need for the "MSVC dtor override" workaroundStephan Bergmann
2016-03-14com::sun::star->css in chart2Noel Grandin
2015-10-12Replace "SAL_OVERRIDE" with "override" in LIBO_INTERNAL_ONLY codeStephan Bergmann
2015-07-20loplugin:unusedmethods chart2Noel Grandin
2015-07-17tdf#88206 replace cppu::WeakImplHelper* etc.Takeshi Abe
2015-06-08loplugin:cstylecast: deal with remaining pointer castsStephan Bergmann
2014-12-09inline UNO helper macrosNoel Grandin
2014-12-09inline UNO helper macro APPHELPER_SERVICE_FACTORY_HELPERNoel Grandin
2014-07-02bnc#812796: Correctly handle static value array for OOXML charts.Kohei Yoshida
2014-06-24Let's remove these lcl_ fetish.Kohei Yoshida
2014-04-03remove unnecessary scope qualifier from sal_Bool usesNoel Grandin
2014-03-27Second batch of adding SAL_OVERRIDE to overriding function declarationsStephan Bergmann
2014-02-26cppuhelper: retrofit std::exception into overriding exception specsStephan Bergmann
2014-01-29no auto_ptr in this classMarkus Mohrhard
2013-10-23fixincludeguards.sh: chart2Thomas Arnhold
2013-07-01Resolves: #i120559# Corrected load for charts without RangeString...Armin Le Grand
2013-04-07mass removal of rtl:: prefixes for O(U)String*Luboš Luňák