/* -*- 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/. * * 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 .
*/
// The SystemFlavor member is nil for the cases where there is no predefined pasteboard type UTI and // we use the internal MIME type (media type) also on the pasteboard. That is OK, there dos not seem // to be a requirement that the types are well-formed UTIs even on iOS. For an introduction to UTIs, // see for instance // https://alastairs-place.net/blog/2012/06/06/utis-are-better-than-you-think-and-heres-why/ // // In those cases the MIME type might actually have parameters appended, separated by semicolons. // At least the FLAVOR_SODX one must have at least a typename="%PRODUCTNAME %PRODUCTVERSION // Spreadsheet" parameter (with macros expanded and translated) for LO to recognise it. See // lcl_TestFormat() in sc/source/ui/view/cellsh.cxx.
/* A base class for other data provider.
*/ class DataProviderBaseImpl : public DataProvider
{ public:
DataProviderBaseImpl(const Any& data);
DataProviderBaseImpl(id data); virtual ~DataProviderBaseImpl() override;
protected:
Any mData; //NSData* mSystemData;
id mSystemData;
};
for (size_t i = 0; i < SIZE_FLAVOR_MAP; i++)
{ if ((flavorMap[i].SystemFlavor == nil
&& ([systemDataFlavor
isEqualToString:[NSString stringWithUTF8String:flavorMap[i].OOoFlavor]]
||
[systemDataFlavor hasPrefix:[[NSString stringWithUTF8String:flavorMap[i].OOoFlavor]
stringByAppendingString:@";"]]))
|| (flavorMap[i].SystemFlavor != nil &&
[systemDataFlavor
isEqualToString:const_cast<NSString*>(flavorMap[i].SystemFlavor)]))
{ if (flavorMap[i].SystemFlavor == nil)
oOOFlavor.MimeType = NSStringToOUString(systemDataFlavor); else
oOOFlavor.MimeType = OUString::createFromAscii(flavorMap[i].OOoFlavor);
oOOFlavor.HumanPresentableName
= OUString::createFromAscii(flavorMap[i].HumanPresentableName);
oOOFlavor.DataType = flavorMap[i].DataTypeOUString
? cppu::UnoType<OUString>::get()
: cppu::UnoType<Sequence<sal_Int8>>::get(); return oOOFlavor;
}
} // for
// look if this might be an internal type; if it comes in here it must have // been through openOfficeToSystemFlavor before, so it should then be in the map
OUString aTryFlavor(NSStringToOUString(systemDataFlavor)); if (maOfficeOnlyTypes.find(aTryFlavor) != maOfficeOnlyTypes.end())
{
oOOFlavor.MimeType = aTryFlavor;
oOOFlavor.HumanPresentableName.clear();
oOOFlavor.DataType = cppu::UnoType<Sequence<sal_Int8>>::get();
}
for (size_t i = 0; i < SIZE_FLAVOR_MAP; ++i)
{ if (oOOFlavor.MimeType.startsWith(OUString::createFromAscii(flavorMap[i].OOoFlavor)))
{ if (flavorMap[i].SystemFlavor != nil)
sysFlavor = flavorMap[i].SystemFlavor; else
sysFlavor = OUStringToNSString(oOOFlavor.MimeType);
// Flavor set, then break if (sysFlavor != nullptr) break;
}
}
if (!sysFlavor)
{ // For some reason, if we allow text/html, we get an OSL_ENSURE failure in xmloff that // apparently is a symptom of something being seriously wrong: // xmloff/source/transform/OOo2Oasis.cxx:1925: duplicate doc handler // Because is then followed a bit later by an assertion failure: // Assertion failed: (!m_pFirst && !m_pLast && "There are still indices registered"), function ~SwContentIndexReg, file [...]/sw/source/core/bastyp/index.cxx, line 226
if (oOOFlavor.MimeType == "text/html") return nil;
rbInternal = true;
OfficeOnlyTypes::const_iterator it = maOfficeOnlyTypes.find(oOOFlavor.MimeType);
if (it == maOfficeOnlyTypes.end())
{ // tdf#161461 stop crashing by retaining NSString // OUStringToNSString() returns an autoreleased NSString so it // needs to be retained for the life of maOfficeOnlyTypes.
sysFlavor = maOfficeOnlyTypes[oOOFlavor.MimeType] =
[OUStringToNSString(oOOFlavor.MimeType) retain];
} else
{
sysFlavor = it->second;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.