[Libreoffice-commits] core.git: vcl/osx
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jun 28 15:10:06 UTC 2021
vcl/osx/DataFlavorMapping.cxx | 102 +++++++++++++++++++++---------------------
vcl/osx/DragSource.cxx | 28 +++++------
vcl/osx/HtmlFmtFlt.cxx | 4 -
vcl/osx/OSXTransferable.cxx | 32 ++++++-------
vcl/osx/a11ywrapper.mm | 58 +++++++++++------------
vcl/osx/clipboard.cxx | 4 -
vcl/osx/salnativewidgets.cxx | 2
7 files changed, 115 insertions(+), 115 deletions(-)
New commits:
commit efab07a370c52e57c4a4adaed1ab90e232caaf0b
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Jun 28 16:09:24 2021 +0200
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon Jun 28 17:09:32 2021 +0200
loplugin:indentation (macOS)
Change-Id: Ia7b33ee93dbb4d27a2387af6e2dd247b5f0b0788
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118026
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/vcl/osx/DataFlavorMapping.cxx b/vcl/osx/DataFlavorMapping.cxx
index 82065b2c88be..feecca3f663e 100644
--- a/vcl/osx/DataFlavorMapping.cxx
+++ b/vcl/osx/DataFlavorMapping.cxx
@@ -186,9 +186,9 @@ DataProviderBaseImpl::DataProviderBaseImpl(id data) :
DataProviderBaseImpl::~DataProviderBaseImpl()
{
if (mSystemData)
- {
+ {
[mSystemData release];
- }
+ }
}
namespace {
@@ -233,15 +233,15 @@ Any UniDataProvider::getOOoData()
Any oOOData;
if (mSystemData)
- {
+ {
oOOData <<= OUString(static_cast<const char*>([mSystemData bytes]),
[mSystemData length],
RTL_TEXTENCODING_UTF8);
- }
+ }
else
- {
+ {
oOOData = mData;
- }
+ }
return oOOData;
}
@@ -285,17 +285,17 @@ Any ByteSequenceDataProvider::getOOoData()
Any oOOData;
if (mSystemData)
- {
+ {
unsigned int flavorDataLength = [mSystemData length];
Sequence<sal_Int8> byteSequence;
byteSequence.realloc(flavorDataLength);
memcpy(byteSequence.getArray(), [mSystemData bytes], flavorDataLength);
oOOData <<= byteSequence;
- }
+ }
else
- {
+ {
oOOData = mData;
- }
+ }
return oOOData;
}
@@ -334,7 +334,7 @@ Any HTMLFormatDataProvider::getOOoData()
Any oOOData;
if (mSystemData)
- {
+ {
unsigned int flavorDataLength = [mSystemData length];
Sequence<sal_Int8> unkHtmlData;
@@ -345,17 +345,17 @@ Any HTMLFormatDataProvider::getOOoData()
Sequence<sal_Int8> plainHtml;
if (isHTMLFormat(unkHtmlData))
- {
+ {
plainHtml = HTMLFormatToTextHtml(unkHtmlData);
pPlainHtml = &plainHtml;
- }
+ }
oOOData <<= *pPlainHtml;
- }
+ }
else
- {
+ {
oOOData = mData;
- }
+ }
return oOOData;
}
@@ -463,34 +463,34 @@ Any FileListDataProvider::getOOoData()
Any oOOData;
if (mSystemData)
- {
+ {
size_t length = [mSystemData count];
size_t lenSeqRequired = 0;
for (size_t i = 0; i < length; i++)
- {
+ {
NSString* fname = [mSystemData objectAtIndex: i];
lenSeqRequired += [fname maximumLengthOfBytesUsingEncoding: NSUnicodeStringEncoding] + sizeof(unichar);
- }
+ }
Sequence<sal_Int8> oOOFileList(lenSeqRequired);
unichar* pBuffer = reinterpret_cast<unichar*>(oOOFileList.getArray());
memset(pBuffer, 0, lenSeqRequired);
for (size_t i = 0; i < length; i++)
- {
+ {
NSString* fname = [mSystemData objectAtIndex: i];
[fname getCharacters: pBuffer];
size_t l = [fname length];
pBuffer += l + 1;
- }
+ }
oOOData <<= oOOFileList;
- }
+ }
else
- {
+ {
oOOData = mData;
- }
+ }
return oOOData;
}
@@ -553,7 +553,7 @@ const NSString* DataFlavorMapper::openOfficeToSystemFlavor( const DataFlavor& oO
for( size_t i = 0; i < SIZE_FLAVOR_MAP; ++i )
{
- if (oOOFlavor.MimeType.startsWith(OUString::createFromAscii(flavorMap[i].OOoFlavor)))
+ if (oOOFlavor.MimeType.startsWith(OUString::createFromAscii(flavorMap[i].OOoFlavor)))
{
if (flavorMap[i].SystemFlavor != nil)
sysFlavor = flavorMap[i].SystemFlavor;
@@ -594,7 +594,7 @@ DataProviderPtr_t DataFlavorMapper::getDataProvider( const NSString* systemFlavo
Any data = rTransferable->getTransferData(oOOFlavor);
if (isByteSequenceType(data.getValueType()))
- {
+ {
/*
the HTMLFormatDataProvider prepends segment information to HTML
this is useful for exchange with MS Word (which brings this stuff from Windows)
@@ -608,29 +608,29 @@ DataProviderPtr_t DataFlavorMapper::getDataProvider( const NSString* systemFlavo
else
*/
if ([systemFlavor caseInsensitiveCompare: NSPasteboardTypeTIFF] == NSOrderedSame)
- {
+ {
dp = DataProviderPtr_t( new PNGDataProvider( data, NSBitmapImageFileTypeTIFF));
- }
+ }
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// "'NSFilenamesPboardType' is deprecated: first deprecated in macOS 10.14 - Create
// multiple pasteboard items with NSPasteboardTypeFileURL or kUTTypeFileURL instead"
else if ([systemFlavor caseInsensitiveCompare: NSFilenamesPboardType] == NSOrderedSame)
SAL_WNODEPRECATED_DECLARATIONS_POP
- {
+ {
dp = DataProviderPtr_t(new FileListDataProvider(data));
- }
+ }
else
- {
+ {
dp = DataProviderPtr_t(new ByteSequenceDataProvider(data));
- }
- }
+ }
+ }
else // Must be OUString type
- {
+ {
SAL_WARN_IF(
!isOUStringType(data.getValueType()), "vcl",
"must be OUString type");
dp = DataProviderPtr_t(new UniDataProvider(data));
- }
+ }
}
catch( const UnsupportedFlavorException& e )
{
@@ -652,29 +652,29 @@ DataProviderPtr_t DataFlavorMapper::getDataProvider( const NSString* systemFlavo
DataProviderPtr_t dp;
if ([systemFlavor caseInsensitiveCompare: NSPasteboardTypeString] == NSOrderedSame)
- {
+ {
dp = DataProviderPtr_t(new UniDataProvider(systemData));
- }
+ }
else if ([systemFlavor caseInsensitiveCompare: NSPasteboardTypeHTML] == NSOrderedSame)
- {
+ {
dp = DataProviderPtr_t(new HTMLFormatDataProvider(systemData));
- }
+ }
else if ([systemFlavor caseInsensitiveCompare: NSPasteboardTypeTIFF] == NSOrderedSame)
- {
+ {
dp = DataProviderPtr_t( new PNGDataProvider(systemData, NSBitmapImageFileTypeTIFF));
- }
+ }
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// "'NSFilenamesPboardType' is deprecated: first deprecated in macOS 10.14 - Create multiple
// pasteboard items with NSPasteboardTypeFileURL or kUTTypeFileURL instead"
else if ([systemFlavor caseInsensitiveCompare: NSFilenamesPboardType] == NSOrderedSame)
SAL_WNODEPRECATED_DECLARATIONS_POP
- {
+ {
//dp = DataProviderPtr_t(new FileListDataProvider(systemData));
- }
+ }
else
- {
+ {
dp = DataProviderPtr_t(new ByteSequenceDataProvider(systemData));
- }
+ }
return dp;
}
@@ -738,16 +738,16 @@ css::uno::Sequence<css::datatransfer::DataFlavor> DataFlavorMapper::typesArrayTo
Sequence<DataFlavor> flavors;
for (int i = 0; i < nFormats; i++)
- {
+ {
NSString* sysFormat = [types objectAtIndex: i];
DataFlavor oOOFlavor = systemToOpenOfficeFlavor(sysFormat);
if (isValidFlavor(oOOFlavor))
- {
+ {
flavors.realloc(flavors.getLength() + 1);
flavors[flavors.getLength() - 1] = oOOFlavor;
- }
- }
+ }
+ }
return flavors;
}
@@ -757,12 +757,12 @@ NSArray* DataFlavorMapper::getAllSupportedPboardTypes()
NSMutableArray* array = [[NSMutableArray alloc] initWithCapacity: SIZE_FLAVOR_MAP];
for (sal_uInt32 i = 0; i < SIZE_FLAVOR_MAP; i++)
- {
+ {
if (flavorMap[i].SystemFlavor != nil)
[array addObject: flavorMap[i].SystemFlavor];
else
[array addObject: [NSString stringWithUTF8String: flavorMap[i].OOoFlavor]];
- }
+ }
return [array autorelease];
}
diff --git a/vcl/osx/DragSource.cxx b/vcl/osx/DragSource.cxx
index bcb4cb43543a..bf2c0c25a310 100644
--- a/vcl/osx/DragSource.cxx
+++ b/vcl/osx/DragSource.cxx
@@ -71,9 +71,9 @@ static Sequence<OUString> dragSource_getSupportedServiceNames()
self = [super init];
if (self)
- {
+ {
mDragSource = pds;
- }
+ }
return self;
}
@@ -161,10 +161,10 @@ DragSource::~DragSource()
void SAL_CALL DragSource::initialize(const Sequence< Any >& aArguments)
{
if (aArguments.getLength() < 2)
- {
+ {
throw Exception("DragSource::initialize: Not enough parameter.",
static_cast<OWeakObject*>(this));
- }
+ }
Any pNSView = aArguments[1];
sal_uInt64 tmp = 0;
@@ -179,10 +179,10 @@ void SAL_CALL DragSource::initialize(const Sequence< Any >& aArguments)
*/
if (![mView respondsToSelector: @selector(registerMouseEventListener:)] ||
![mView respondsToSelector: @selector(unregisterMouseEventListener:)])
- {
+ {
throw Exception("DragSource::initialize: Provided view doesn't support mouse listener",
static_cast<OWeakObject*>(this));
- }
+ }
NSWindow* pWin = [mView window];
if( ! pWin || ![pWin respondsToSelector: @selector(getSalFrame)] )
{
@@ -194,10 +194,10 @@ void SAL_CALL DragSource::initialize(const Sequence< Any >& aArguments)
mDragSourceHelper = [[DragSourceHelper alloc] initWithDragSource: this];
if (mDragSourceHelper == nil)
- {
+ {
throw Exception("DragSource::initialize: Cannot initialize DragSource",
static_cast<OWeakObject*>(this));
- }
+ }
[static_cast<id <MouseEventListener>>(mView) registerMouseEventListener: mDragSourceHelper];
}
@@ -288,9 +288,9 @@ void SAL_CALL DragSource::startDrag(const DragGestureEvent& trigger,
void DragSource::saveMouseEvent(NSEvent* theEvent)
{
if (mLastMouseEventBeforeStartDrag != nil)
- {
+ {
[mLastMouseEventBeforeStartDrag release];
- }
+ }
mLastMouseEventBeforeStartDrag = theEvent;
}
@@ -303,19 +303,19 @@ unsigned int DragSource::getSupportedDragOperations(bool isLocal) const
unsigned int srcActions = OfficeToSystemDragActions(mDragSourceActions);
if (isLocal)
- {
+ {
// Support NSDragOperation generic which means we can
// decide which D&D operation to choose. We map
// NSDragOperationGeneric to DNDConstants::ACTION_DEFAULT
// in SystemToOfficeDragActions to signal this and
// use it in DropTarget::determineDropAction
srcActions |= NSDragOperationGeneric;
- }
+ }
else
- {
+ {
// Mask out link and move operations on external DnD
srcActions &= ~(NSDragOperationMove | NSDragOperationLink);
- }
+ }
return srcActions;
}
diff --git a/vcl/osx/HtmlFmtFlt.cxx b/vcl/osx/HtmlFmtFlt.cxx
index 940bf90cbb87..3549ecd2104b 100644
--- a/vcl/osx/HtmlFmtFlt.cxx
+++ b/vcl/osx/HtmlFmtFlt.cxx
@@ -131,9 +131,9 @@ Sequence<sal_Int8> HTMLFormatToTextHtml(const Sequence<sal_Int8>& aHTMLFormat)
// It doesn't seem to be HTML? Well then simply return what has been
// provided in non-debug builds
if (htmlStartTag == nullptr)
- {
+ {
return aHTMLFormat;
- }
+ }
sal_Int32 len = dataEnd - htmlStartTag;
Sequence<sal_Int8> plainHtmlData(len);
diff --git a/vcl/osx/OSXTransferable.cxx b/vcl/osx/OSXTransferable.cxx
index 6f8613799111..4857843c34f3 100644
--- a/vcl/osx/OSXTransferable.cxx
+++ b/vcl/osx/OSXTransferable.cxx
@@ -62,15 +62,15 @@ bool cmpAllContentTypeParameter(const Reference<XMimeContentType> & xLhs,
OUString pRhs;
for (sal_Int32 i = 0; i < xLhsFlavors.getLength(); i++)
- {
+ {
pLhs = xLhs->getParameterValue(xLhsFlavors[i]);
pRhs = xRhs->getParameterValue(xLhsFlavors[i]);
if (!pLhs.equalsIgnoreAsciiCase(pRhs))
- {
+ {
return false;
- }
- }
+ }
+ }
}
catch(IllegalArgumentException&)
{
@@ -102,10 +102,10 @@ OSXTransferable::~OSXTransferable()
Any SAL_CALL OSXTransferable::getTransferData( const DataFlavor& aFlavor )
{
if (!isValidFlavor(aFlavor) || !isDataFlavorSupported(aFlavor))
- {
+ {
throw UnsupportedFlavorException("AquaClipboard: Unsupported data flavor",
static_cast<XTransferable*>(this));
- }
+ }
bool bInternal(false);
NSString const * sysFormat =
@@ -119,21 +119,21 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH
// pasteboard items with NSPasteboardTypeFileURL or kUTTypeFileURL instead"
if ([sysFormat caseInsensitiveCompare: NSFilenamesPboardType] == NSOrderedSame)
SAL_WNODEPRECATED_DECLARATIONS_POP
- {
+ {
NSArray* sysData = [mPasteboard propertyListForType: const_cast<NSString *>(sysFormat)];
dp = DataFlavorMapper::getDataProvider(sysFormat, sysData);
- }
+ }
else
- {
+ {
NSData* sysData = [mPasteboard dataForType: const_cast<NSString *>(sysFormat)];
dp = DataFlavorMapper::getDataProvider(sysFormat, sysData);
- }
+ }
if (!dp)
- {
+ {
throw UnsupportedFlavorException("AquaClipboard: Unsupported data flavor",
static_cast<XTransferable*>(this));
- }
+ }
return dp->getOOoData();
}
@@ -157,10 +157,10 @@ void OSXTransferable::initClipboardItemList()
NSArray* pboardFormats = [mPasteboard types];
if (pboardFormats == nullptr)
- {
+ {
throw RuntimeException("AquaClipboard: Cannot get clipboard data",
static_cast<XTransferable*>(this));
- }
+ }
mFlavorList = mDataFlavorMapper->typesArrayToFlavorSequence(pboardFormats);
}
@@ -178,9 +178,9 @@ bool OSXTransferable::compareDataFlavors(const DataFlavor& lhs, const DataFlavor
if (!xLhs->getFullMediaType().equalsIgnoreAsciiCase(xRhs->getFullMediaType()) ||
!cmpAllContentTypeParameter(xLhs, xRhs))
- {
+ {
return false;
- }
+ }
}
catch( IllegalArgumentException& )
{
diff --git a/vcl/osx/a11ywrapper.mm b/vcl/osx/a11ywrapper.mm
index acb254f59426..32200acd0292 100644
--- a/vcl/osx/a11ywrapper.mm
+++ b/vcl/osx/a11ywrapper.mm
@@ -423,34 +423,34 @@ static std::ostream &operator<<(std::ostream &s, NSObject *obj) {
-(id)roleDescriptionAttribute {
if ( mActsAsRadioGroup ) {
return [ AquaA11yRoleHelper getRoleDescriptionFrom: NSAccessibilityRadioGroupRole with: @"" ];
- } else if( [ self accessibleContext ] -> getAccessibleRole() == AccessibleRole::RADIO_BUTTON ) {
- // FIXME: VO should read this because of hierarchy, this is just a workaround
- // get parent and its children
- AquaA11yWrapper * parent = [ self parentAttribute ];
- NSArray * children = [ parent childrenAttribute ];
- // find index of self
- int index = 1;
- NSEnumerator * enumerator = [ children objectEnumerator ];
- AquaA11yWrapper * child = nil;
- while ( ( child = [ enumerator nextObject ] ) ) {
- if ( self == child ) {
- break;
- }
- index++;
- }
- // build string
- NSNumber * nIndex = [ NSNumber numberWithInt: index ];
- NSNumber * nGroupsize = [ NSNumber numberWithInt: [ children count ] ];
- NSMutableString * value = [ [ NSMutableString alloc ] init ];
- [ value appendString: @"radio button " ];
- [ value appendString: [ nIndex stringValue ] ];
- [ value appendString: @" of " ];
- [ value appendString: [ nGroupsize stringValue ] ];
- // clean up and return string
- [ nIndex release ];
- [ nGroupsize release ];
- [ children release ];
- return value;
+ } else if( [ self accessibleContext ] -> getAccessibleRole() == AccessibleRole::RADIO_BUTTON ) {
+ // FIXME: VO should read this because of hierarchy, this is just a workaround
+ // get parent and its children
+ AquaA11yWrapper * parent = [ self parentAttribute ];
+ NSArray * children = [ parent childrenAttribute ];
+ // find index of self
+ int index = 1;
+ NSEnumerator * enumerator = [ children objectEnumerator ];
+ AquaA11yWrapper * child = nil;
+ while ( ( child = [ enumerator nextObject ] ) ) {
+ if ( self == child ) {
+ break;
+ }
+ index++;
+ }
+ // build string
+ NSNumber * nIndex = [ NSNumber numberWithInt: index ];
+ NSNumber * nGroupsize = [ NSNumber numberWithInt: [ children count ] ];
+ NSMutableString * value = [ [ NSMutableString alloc ] init ];
+ [ value appendString: @"radio button " ];
+ [ value appendString: [ nIndex stringValue ] ];
+ [ value appendString: @" of " ];
+ [ value appendString: [ nGroupsize stringValue ] ];
+ // clean up and return string
+ [ nIndex release ];
+ [ nGroupsize release ];
+ [ children release ];
+ return value;
} else {
return [ AquaA11yRoleHelper getRoleDescriptionFrom:
[ AquaA11yRoleHelper getNativeRoleFrom: [ self accessibleContext ] ]
@@ -761,7 +761,7 @@ static std::ostream &operator<<(std::ostream &s, NSObject *obj) {
nAccessibleChildren = [ self accessibleContext ] -> getAccessibleChildCount();
if ( nAccessibleChildren > 0 ) {
[ attributeNames addObject: NSAccessibilityChildrenAttribute ];
- }
+ }
}
catch( DisposedException& ) {}
catch( RuntimeException& ) {}
diff --git a/vcl/osx/clipboard.cxx b/vcl/osx/clipboard.cxx
index 48c2a94e7bfd..cc99c3c985d9 100644
--- a/vcl/osx/clipboard.cxx
+++ b/vcl/osx/clipboard.cxx
@@ -92,10 +92,10 @@ AquaClipboard::AquaClipboard(NSPasteboard* pasteboard, bool bUseSystemPasteboard
SAL_WNODEPRECATED_DECLARATIONS_POP
if (mPasteboard == nil)
- {
+ {
throw uno::RuntimeException("AquaClipboard: Cannot create Cocoa pasteboard",
static_cast<XClipboardEx*>(this));
- }
+ }
}
[mPasteboard retain];
diff --git a/vcl/osx/salnativewidgets.cxx b/vcl/osx/salnativewidgets.cxx
index 589feec62208..b1d2893aba6c 100644
--- a/vcl/osx/salnativewidgets.cxx
+++ b/vcl/osx/salnativewidgets.cxx
@@ -982,7 +982,7 @@ bool AquaSalGraphics::getNativeControlRegion(ControlType nType,
}
break;
case ControlType::Combobox:
- if (nPart == ControlPart::Entire)
+ if (nPart == ControlPart::Entire)
{
w = aCtrlBoundRect.GetWidth();
h = COMBOBOX_HEIGHT + 2 * FOCUS_RING_WIDTH;
More information about the Libreoffice-commits
mailing list