summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerbert Dürr <hdu@apache.org>2014-02-24 09:08:02 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-02-24 13:17:37 +0000
commit42837a066b2347effa75926104f3f3ffc96206b7 (patch)
tree4fac4398665aafa9b2b66c685dfa0c5df6cd1fb7
parent93f3f72d18e551c8edd6a010cb78d9cbe404f8ef (diff)
Resolves: #i123840# prefer NSZero* constants over open coded alternatives
(cherry picked from commit a8c471a7003fdac7d5e1c97e903f669da6bcf0c7) Conflicts: vcl/osx/salframe.cxx vcl/osx/salframeview.mm vcl/osx/salnsmenu.mm vcl/osx/salobj.cxx Change-Id: I379d80355d741dd28aad2e6119a8b82ac10159f5
-rw-r--r--vcl/osx/printaccessoryview.mm8
-rw-r--r--vcl/osx/printview.mm5
-rw-r--r--vcl/osx/salframe.cxx6
-rw-r--r--vcl/osx/salframeview.mm2
-rw-r--r--vcl/osx/salinst.cxx6
-rw-r--r--vcl/osx/salnsmenu.mm10
-rw-r--r--vcl/osx/salobj.cxx8
-rw-r--r--vcl/osx/saltimer.cxx3
8 files changed, 21 insertions, 27 deletions
diff --git a/vcl/osx/printaccessoryview.mm b/vcl/osx/printaccessoryview.mm
index fd77619a593b..40e9036096a9 100644
--- a/vcl/osx/printaccessoryview.mm
+++ b/vcl/osx/printaccessoryview.mm
@@ -640,7 +640,7 @@ static void adjustViewAndChildren( NSView* pNSView, NSSize& rMaxSize,
NSArray* pSubViews = [pNSView subviews];
unsigned int nViews = [pSubViews count];
- NSRect aUnion = { { 0, 0 }, { 0, 0 } };
+ NSRect aUnion = NSZeroRect;
// get the combined frame of all subviews
for( unsigned int n = 0; n < nViews; n++ )
@@ -709,7 +709,7 @@ static void adjustTabViews( NSTabView* pTabView, NSSize aTabSize )
static NSControl* createLabel( const rtl::OUString& i_rText )
{
NSString* pText = CreateNSString( i_rText );
- NSRect aTextRect = { { 0, 0 }, {20, 15} };
+ NSRect aTextRect = { NSZeroPoint, {20, 15} };
NSTextField* pTextView = [[NSTextField alloc] initWithFrame: aTextRect];
[pTextView setFont: [NSFont controlContentFontOfSize: 0]];
[pTextView setEditable: NO];
@@ -1100,9 +1100,9 @@ static void addEdit( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachO
NSView* pCurParent = 0;
long nCurY = 0;
long nCurX = 0;
- NSRect aViewFrame = { { 0, 0 }, {600, 400 } };
+ NSRect aViewFrame = { NSZeroPoint, {600, 400 } };
NSRect aTabViewFrame = { { 190, 0 }, {410, 400 } };
- NSSize aMaxTabSize = { 0, 0 };
+ NSSize aMaxTabSize = NSZeroSize;
NSView* pAccessoryView = [[NSView alloc] initWithFrame: aViewFrame];
NSTabView* pTabView = [[NSTabView alloc] initWithFrame: aTabViewFrame];
[pAccessoryView addSubview: [pTabView autorelease]];
diff --git a/vcl/osx/printview.mm b/vcl/osx/printview.mm
index d2f4ac006d71..8b324b97e992 100644
--- a/vcl/osx/printview.mm
+++ b/vcl/osx/printview.mm
@@ -26,7 +26,7 @@
@implementation AquaPrintView
-(id)initWithController: (vcl::PrinterController*)pController withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter
{
- NSRect aRect = { { 0, 0 }, [pInfoPrinter->getPrintInfo() paperSize] };
+ NSRect aRect = { NSZeroPoint, [pInfoPrinter->getPrintInfo() paperSize] };
if( (self = [super initWithFrame: aRect]) != nil )
{
mpController = pController;
@@ -56,8 +56,7 @@
-(NSPoint)locationOfPrintRect: (NSRect)aRect
{
(void)aRect;
- NSPoint aPoint = { 0, 0 };
- return aPoint;
+ return NSZeroPoint;
}
-(void)drawRect: (NSRect)rect
diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index 71a951c42d68..e49df676fbf0 100644
--- a/vcl/osx/salframe.cxx
+++ b/vcl/osx/salframe.cxx
@@ -207,7 +207,7 @@ void AquaSalFrame::initWindowAndView()
{
objc_msgSend(mpNSWindow, @selector(setRestorable:), NO);
}
- NSRect aRect = { { 0,0 }, { static_cast<CGFloat>(maGeometry.nWidth), static_cast<CGFloat>(maGeometry.nHeight) } };
+ const NSRect aRect = { NSZeroPoint, NSMakeSize( maGeometry.nWidth, maGeometry.nHeight )};
mnTrackingRectTag = [mpNSView addTrackingRect: aRect owner: mpNSView userData: nil assumeInside: NO];
maSysData.mpNSView = mpNSView;
@@ -743,7 +743,7 @@ void AquaSalFrame::ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay )
// which is always on index 0 according to documentation
bool bHideMenu = (nDisplay == 0);
- NSRect aNewContentRect = { { 0, 0 }, { 0, 0 } };
+ NSRect aNewContentRect = NSZeroRect;
// get correct screen
NSScreen* pScreen = nil;
NSArray* pScreens = [NSScreen screens];
@@ -1621,7 +1621,7 @@ void AquaSalFrame::UpdateFrameGeometry()
// release old track rect
[mpNSView removeTrackingRect: mnTrackingRectTag];
// install the new track rect
- NSRect aTrackRect = { { 0, 0 }, aContentRect.size };
+ NSRect aTrackRect = { NSZeroPoint, aContentRect.size };
mnTrackingRectTag = [mpNSView addTrackingRect: aTrackRect owner: mpNSView userData: nil assumeInside: NO];
// convert to vcl convention
diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm
index a84f5aa7a0e1..e52195732cae 100644
--- a/vcl/osx/salframeview.mm
+++ b/vcl/osx/salframeview.mm
@@ -490,7 +490,7 @@ static AquaSalFrame* getMouseContainerFrame()
if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
{
// FIXME: does this leak the returned NSCursor of getCurrentCursor ?
- NSRect aRect = { { 0, 0 }, { static_cast<CGFloat>(mpFrame->maGeometry.nWidth), static_cast<CGFloat>(mpFrame->maGeometry.nHeight) } };
+ const NSRect aRect = { NSZeroPoint, NSMakeSize( mpFrame->maGeometry.nWidth, mpFrame->maGeometry.nHeight) };
[self addCursorRect: aRect cursor: mpFrame->getCurrentCursor()];
}
}
diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index b8172e153cf7..fcec7b6a5c92 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -194,9 +194,8 @@ sal_Bool ImplSVMainHook( int * pnInit )
bNoSVMain = false;
initNSApp();
- NSPoint aPt = { 0, 0 };
NSEvent* pEvent = [NSEvent otherEventWithType: NSApplicationDefined
- location: aPt
+ location: NSZeroPoint
modifierFlags: 0
timestamp: 0
windowNumber: 0
@@ -422,9 +421,8 @@ void AquaSalInstance::wakeupYield()
if( mbWaitingYield )
{
SalData::ensureThreadAutoreleasePool();
- NSPoint aPt = { 0, 0 };
NSEvent* pEvent = [NSEvent otherEventWithType: NSApplicationDefined
- location: aPt
+ location: NSZeroPoint
modifierFlags: 0
timestamp: 0
windowNumber: 0
diff --git a/vcl/osx/salnsmenu.mm b/vcl/osx/salnsmenu.mm
index 796b05ca7ae4..d2aaed9e9e3a 100644
--- a/vcl/osx/salnsmenu.mm
+++ b/vcl/osx/salnsmenu.mm
@@ -131,9 +131,8 @@
NSRect aImgRect = { { 2, 0 }, { 0, 0 } };
for( size_t i = 0; i < rButtons.size(); ++i )
{
- NSRect aFromRect = { { 0, 0 },
- { static_cast<CGFloat>(rButtons[i].maButton.maImage.GetSizePixel().Width()),
- static_cast<CGFloat>(rButtons[i].maButton.maImage.GetSizePixel().Height()) } };
+ const Size aPixSize = rButtons[i].maButton.maImage.GetSizePixel();
+ const NSRect aFromRect = { NSZeroPoint, NSMakeSize( aPixSize.Width(), aPixSize.Height()) };
aImgRect.origin.y = floor((aFrame.size.height - aFromRect.size.height)/2);
aImgRect.size = aFromRect.size;
if( rButtons[i].mpNSImage )
@@ -155,9 +154,8 @@
NSPoint aMousePt = [pEvent locationInWindow];
for( size_t i = 0; i < rButtons.size(); ++i )
{
- NSRect aFromRect = { { 0, 0 },
- { static_cast<CGFloat>(rButtons[i].maButton.maImage.GetSizePixel().Width()),
- static_cast<CGFloat>(rButtons[i].maButton.maImage.GetSizePixel().Height()) } };
+ const Size aPixSize = rButtons[i].maButton.maImage.GetSizePixel();
+ const NSRect aFromRect = { NSZeroPoint, NSMakeSize( aPixSize.Width(), aPixSize.Height()) };
aImgRect.origin.y = (aFrame.size.height - aFromRect.size.height)/2;
aImgRect.size = aFromRect.size;
if( aMousePt.x >= aImgRect.origin.x && aMousePt.x <= (aImgRect.origin.x+aImgRect.size.width) &&
diff --git a/vcl/osx/salobj.cxx b/vcl/osx/salobj.cxx
index 350903fa665e..d749233e58a0 100644
--- a/vcl/osx/salobj.cxx
+++ b/vcl/osx/salobj.cxx
@@ -41,7 +41,7 @@ AquaSalObject::AquaSalObject( AquaSalFrame* pFrame ) :
maSysData.nSize = sizeof( maSysData );
maSysData.mpNSView = NULL;
- NSRect aInitFrame = { { 0, 0 }, { 20, 20 } };
+ NSRect aInitFrame = { NSZeroPoint, { 20, 20 } };
mpClipView = [[NSClipView alloc] initWithFrame: aInitFrame ];
if( mpClipView )
{
@@ -168,15 +168,15 @@ void AquaSalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight )
void AquaSalObject::setClippedPosSize()
{
- NSRect aViewRect = { { 0, 0 }, { static_cast<CGFloat>(mnWidth), static_cast<CGFloat>(mnHeight) } };
+ NSRect aViewRect = { NSZeroPoint, NSMakeSize( mnWidth, mnHeight) };
if( maSysData.mpNSView )
{
NSView* pNSView = maSysData.mpNSView;
[pNSView setFrame: aViewRect];
}
- NSRect aClipViewRect = { { static_cast<CGFloat>(mnX), static_cast<CGFloat>(mnY) }, { static_cast<CGFloat>(mnWidth), static_cast<CGFloat>(mnHeight) } };
- NSPoint aClipPt = { 0, 0 };
+ NSRect aClipViewRect = NSMakeRect( mnX, mnY, mnWidth, mnHeight);
+ NSPoint aClipPt = NSZeroPoint;
if( mbClip )
{
aClipViewRect.origin.x += mnClipX;
diff --git a/vcl/osx/saltimer.cxx b/vcl/osx/saltimer.cxx
index ad0959048964..df8396be2c19 100644
--- a/vcl/osx/saltimer.cxx
+++ b/vcl/osx/saltimer.cxx
@@ -65,9 +65,8 @@ void ImplSalStartTimer( sal_uLong nMS )
{
SalData::ensureThreadAutoreleasePool();
// post an event so we can get into the main thread
- NSPoint aPt = { 0, 0 };
NSEvent* pEvent = [NSEvent otherEventWithType: NSApplicationDefined
- location: aPt
+ location: NSZeroPoint
modifierFlags: 0
timestamp: [NSDate timeIntervalSinceReferenceDate]
windowNumber: 0