diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-07-24 15:45:35 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-07-24 15:45:35 +0000 |
commit | 0cc253983c0a3507326cc0f7f81510d754848562 (patch) | |
tree | 1936efb41bc83a60d3a2c97a1e6aa53969b36176 /vcl | |
parent | 4b4c5570a0ebc8d24515fad9350190e542c88be6 (diff) |
CWS-TOOLING: integrate CWS vcl103
2009-07-24 Jens-Heiner Rechtien #i10000#: merge with m53
2009-07-10 Philipp Lohmann merge
2009-07-10 hdu #i103417# ignore non-standard font styles
2009-07-07 Philipp Lohmann #i98789# add: Invalidate on StateChanged( STATE_CHANGE_ENABLE )
2009-07-07 Philipp Lohmann #i102501# ExportFormFields should be persistent
2009-07-07 Philipp Lohmann merge
2009-07-07 Philipp Lohmann #i103319# there is no platform currently where we should beep on disabled controls
2009-07-02 Philipp Lohmann merge
2009-07-01 Philipp Lohmann #i93100# handle ListBox with no border a little more graceful on MacOSX
2009-07-01 Philipp Lohmann #i101307# don't crash due to unfortunate timing
2009-07-03 thb #i103145# Swapped HINT_DOCK for HINT_TOOLBAR for the presentation fullscreen window; anecdotal evidence suggests it works much better then for wide-spread window managers
2009-06-30 Philipp Lohmann #i103102# evaluate Cmd-Option key combinations
2009-06-29 Philipp Lohmann #i103148# catch exception from missing UCB (thanks thb)
2009-06-29 hdu #i102378# fix PDF-export on PPC (thanks cloph!)
2009-06-25 Philipp Lohmann fix another link problem
2009-06-24 Philipp Lohmann use correct method signature
2009-06-24 Philipp Lohmann fix a warning
2009-06-24 Philipp Lohmann fix a warning
2009-06-24 Philipp Lohmann #i100357# add: GDIMetaFile::GetBoundRect
2009-06-24 Philipp Lohmann merge
2009-06-24 hdu #i100357# extend GetTextBoundRect() to measure justified text too
2009-06-23 Philipp Lohmann #i101108# protect writer from itself, no one could ever use paper of size (0,0)
2009-06-22 Philipp Lohmann merge
2009-06-22 Philipp Lohmann #i92356# treat windows running a popup menu as modal
2009-06-22 hdu #i100000# remove sft.h again (CWS dba32b accidentially reintroduced it)
2009-06-17 Philipp Lohmann merge
2009-06-17 Philipp Lohmann remove warnings (thanks ericb)
2009-06-17 Philipp Lohmann merge
2009-06-17 Philipp Lohmann #i102133# free cursors (thanks cmc)
2009-06-17 Philipp Lohmann #i97293# catch exception
2009-06-17 Philipp Lohmann #i91240# fix images in menus, again
2009-06-15 Philipp Lohmann #i100586# fix a pure virtual method (thanks cmc)
2009-06-15 Philipp Lohmann fix an array delete issue
2009-06-15 Philipp Lohmann #i102228# fix a cleanup issue
2009-06-15 Philipp Lohmann #i97218# solve duplicate accelerator
2009-06-12 hdu #i102219# avoid void*->oslGenericFunction cast for MingW (thanks tono!)
Diffstat (limited to 'vcl')
32 files changed, 640 insertions, 778 deletions
diff --git a/vcl/aqua/inc/vclnsapp.h b/vcl/aqua/inc/vclnsapp.h index a5c339c238bd..fc637ff75a31 100755 --- a/vcl/aqua/inc/vclnsapp.h +++ b/vcl/aqua/inc/vclnsapp.h @@ -59,7 +59,6 @@ -(void)scrollbarSettingsChanged: (NSNotification*) pNotification; -(void)addFallbackMenuItem: (NSMenuItem*)pNewItem; -(void)removeFallbackMenuItem: (NSMenuItem*)pOldItem; --(void)getSystemVersionMajor:(unsigned *)major minor:(unsigned *)minor bugFix:(unsigned *)bugFix; -(void)addDockMenuItem: (NSMenuItem*)pNewItem; -(void)applicationWillBecomeActive: (NSNotification *)pNotification; -(void)applicationWillResignActive: (NSNotification *)pNotification; diff --git a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm index 53472e6ae34d..e521e7362323 100644 --- a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm @@ -249,6 +249,8 @@ using namespace ::rtl; // empty } catch ( IndexOutOfBoundsException & e ) { // empty + } catch ( RuntimeException& ) { + // at least don't crash } return string; } diff --git a/vcl/aqua/source/a11y/aqua11yutil.mm b/vcl/aqua/source/a11y/aqua11yutil.mm index 6d12fbee7a91..44f95169ca68 100644 --- a/vcl/aqua/source/a11y/aqua11yutil.mm +++ b/vcl/aqua/source/a11y/aqua11yutil.mm @@ -51,7 +51,7 @@ using namespace ::com::sun::star::awt; +(Point)nsPointToVclPoint:(NSValue *)nsPoint { // VCL coordinates are in upper-left-notation, Cocoa likes it the Cartesian way (lower-left) NSRect screenRect = [ [ NSScreen mainScreen ] frame ]; - return Point ( [ nsPoint pointValue ].x, screenRect.size.height - [ nsPoint pointValue ].y ); + return Point ( static_cast<long>([ nsPoint pointValue ].x), static_cast<long>(screenRect.size.height - [ nsPoint pointValue ].y) ); } @end diff --git a/vcl/aqua/source/a11y/aqua11ywrapper.mm b/vcl/aqua/source/a11y/aqua11ywrapper.mm index d6f99c7020d6..99bcbd20f698 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapper.mm @@ -728,9 +728,15 @@ static MacOSBOOL isPopupMenuOpen = NO; if ( nativeSubrole != nil && ! [ nativeSubrole isEqualToString: @"" ] ) { [ attributeNames addObject: NSAccessibilitySubroleAttribute ]; } + try + { if ( [ self accessibleContext ] -> getAccessibleChildCount() > 0 ) { [ attributeNames addObject: NSAccessibilityChildrenAttribute ]; } + } + catch( DisposedException& ) {} + catch( RuntimeException& ) {} + if ( title != nil && ! [ title isEqualToString: @"" ] ) { [ attributeNames addObject: NSAccessibilityTitleAttribute ]; } @@ -986,7 +992,7 @@ Reference < XAccessibleContext > hitTestRunner ( Point point, Reference < XAcces } Reference < XAccessibleContext > hitChild; NSRect screenRect = [ [ NSScreen mainScreen ] frame ]; - Point hitPoint ( point.x , screenRect.size.height - point.y ); + Point hitPoint ( static_cast<long>(point.x) , static_cast<long>(screenRect.size.height - point.y) ); // check child windows first NSWindow * window = (NSWindow *) [ self accessibilityAttributeValue: NSAccessibilityWindowAttribute ]; NSArray * childWindows = [ window childWindows ]; diff --git a/vcl/aqua/source/app/saldata.cxx b/vcl/aqua/source/app/saldata.cxx index a70854306122..180f6a106459 100644 --- a/vcl/aqua/source/app/saldata.cxx +++ b/vcl/aqua/source/app/saldata.cxx @@ -93,7 +93,7 @@ SalData::~SalData() } osl_destroyThreadKey( s_aAutoReleaseKey ); - s_aAutoReleaseKey = NULL; + s_aAutoReleaseKey = 0; } if ( mpMainController ) [mpMainController release]; diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx index b9d66d1e02d3..71bfb7953187 100644 --- a/vcl/aqua/source/app/salinst.cxx +++ b/vcl/aqua/source/app/salinst.cxx @@ -140,10 +140,6 @@ bool AquaSalInstance::isOnCommandLine( const rtl::OUString& rArg ) // returns an NSAutoreleasePool that must be released when the event loop begins static void initNSApp() { - SInt32 major = NULL; - SInt32 minor = NULL; - SInt32 bugFix = NULL; - // create our cocoa NSApplication [VCL_NSApplication sharedApplication]; @@ -176,7 +172,17 @@ static void initNSApp() object: nil ]; // get System Version and store the value in GetSalData()->mnSystemVersion - [NSApp getSystemVersionMajor: (unsigned int *)major minor:(unsigned int *)minor bugFix:(unsigned int *)bugFix ]; + OSErr err = noErr; + SInt32 systemVersion = VER_TIGER; // Initialize with minimal requirement + if( (err = Gestalt(gestaltSystemVersion, &systemVersion)) == noErr ) + { + GetSalData()->mnSystemVersion = systemVersion; +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "System Version %x\n", (unsigned int)systemVersion); +#endif + } + else + NSLog(@"Unable to obtain system version: %ld", (long)err); // Initialize Apple Remote GetSalData()->mpMainController = [[MainController alloc] init]; diff --git a/vcl/aqua/source/app/salsys.cxx b/vcl/aqua/source/app/salsys.cxx index 28acb47ccade..78b5defe6dd9 100644 --- a/vcl/aqua/source/app/salsys.cxx +++ b/vcl/aqua/source/app/salsys.cxx @@ -75,8 +75,8 @@ Rectangle AquaSalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen ) if( pScreen ) { NSRect aFrame = [pScreen frame]; - aRet = Rectangle( Point( aFrame.origin.x, aFrame.origin.y ), - Size( aFrame.size.width, aFrame.size.height ) ); + aRet = Rectangle( Point( static_cast<long int>(aFrame.origin.x), static_cast<long int>(aFrame.origin.y) ), + Size( static_cast<long int>(aFrame.size.width), static_cast<long int>(aFrame.size.height) ) ); } return aRet; } @@ -94,8 +94,8 @@ Rectangle AquaSalSystem::GetDisplayWorkAreaPosSizePixel( unsigned int nScreen ) if( pScreen ) { NSRect aFrame = [pScreen visibleFrame]; - aRet = Rectangle( Point( aFrame.origin.x, aFrame.origin.y ), - Size( aFrame.size.width, aFrame.size.height ) ); + aRet = Rectangle( Point( static_cast<long int>(aFrame.origin.x), static_cast<long int>(aFrame.origin.y) ), + Size( static_cast<long int>(aFrame.size.width), static_cast<long int>(aFrame.size.height) ) ); } return aRet; } diff --git a/vcl/aqua/source/app/vclnsapp.mm b/vcl/aqua/source/app/vclnsapp.mm index 4ad5e7ff9271..43d44c709c12 100755 --- a/vcl/aqua/source/app/vclnsapp.mm +++ b/vcl/aqua/source/app/vclnsapp.mm @@ -105,44 +105,33 @@ } } - /* #i89611# - Cmd-Option-Space is for some reason not consumed by the menubar, - but also not by the input method (like e.g. Cmd-Space) and stays - without function. - - However MOD1 + MOD2 combinations are not used throughout OOo code - since they tend to clash with system shortcuts on all platforms so - we can skip this case here. - */ // get information whether the event was handled; keyDown returns nothing GetSalData()->maKeyEventAnswer[ pEvent ] = false; bool bHandled = false; - if( nModMask != (NSCommandKeyMask | NSAlternateKeyMask) ) + // dispatch to view directly to avoid the key event being consumed by the menubar + // popup windows do not get the focus, so they don't get these either + // simplest would be dispatch this to the key window always if it is without parent + // however e.g. in document we want the menu shortcut if e.g. the stylist has focus + if( pFrame->mpParent && (pFrame->mnStyle & SAL_FRAME_STYLE_FLOAT) == 0 ) { - // dispatch to view directly to avoid the key event being consumed by the menubar - // popup windows do not get the focus, so they don't get these either - // simplest would be dispatch this to the key window always if it is without parent - // however e.g. in document we want the menu shortcut if e.g. the stylist has focus - if( pFrame->mpParent && (pFrame->mnStyle & SAL_FRAME_STYLE_FLOAT) == 0 ) - { - [[pKeyWin contentView] keyDown: pEvent]; - bHandled = GetSalData()->maKeyEventAnswer[ pEvent ]; - } - - // see whether the main menu consumes this event - // if not, we want to dispatch it ourselves. Unless we do this "trick" - // the main menu just beeps for an unknown or disabled key equivalent - // and swallows the event wholesale - NSMenu* pMainMenu = [NSApp mainMenu]; - if( ! bHandled && (pMainMenu == 0 || ! [pMainMenu performKeyEquivalent: pEvent]) ) - { - [[pKeyWin contentView] keyDown: pEvent]; - bHandled = GetSalData()->maKeyEventAnswer[ pEvent ]; - } - else - bHandled = true; // event handled already or main menu just handled it + [[pKeyWin contentView] keyDown: pEvent]; + bHandled = GetSalData()->maKeyEventAnswer[ pEvent ]; + } + + // see whether the main menu consumes this event + // if not, we want to dispatch it ourselves. Unless we do this "trick" + // the main menu just beeps for an unknown or disabled key equivalent + // and swallows the event wholesale + NSMenu* pMainMenu = [NSApp mainMenu]; + if( ! bHandled && (pMainMenu == 0 || ! [pMainMenu performKeyEquivalent: pEvent]) ) + { + [[pKeyWin contentView] keyDown: pEvent]; + bHandled = GetSalData()->maKeyEventAnswer[ pEvent ]; } + else + bHandled = true; // event handled already or main menu just handled it + GetSalData()->maKeyEventAnswer.erase( pEvent ); if( bHandled ) return; @@ -374,26 +363,6 @@ AquaSalMenu::removeFallbackMenuItem( pItem ); } -- (void)getSystemVersionMajor:(unsigned *)major - minor:(unsigned *)minor - bugFix:(unsigned *)bugFix -{ - OSErr err; - SInt32 systemVersion = VER_TIGER; // Initialize with minimal requirement - if ((err = Gestalt(gestaltSystemVersion, &systemVersion)) == noErr) - { - GetSalData()->mnSystemVersion = systemVersion; -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "System Version %x\n", (unsigned int)systemVersion); - fprintf( stderr, "Stored System Version %x\n", (unsigned int)GetSalData()->mnSystemVersion); -#endif - } - else - NSLog(@"Unable to obtain system version: %ld", (long)err); - - return; -} - -(void)addDockMenuItem: (NSMenuItem*)pNewItem { NSMenu* pDock = AquaSalInstance::GetDynamicDockMenu(); diff --git a/vcl/aqua/source/gdi/aquaprintview.mm b/vcl/aqua/source/gdi/aquaprintview.mm index 6099fbaed741..ba139da5f5a4 100755 --- a/vcl/aqua/source/gdi/aquaprintview.mm +++ b/vcl/aqua/source/gdi/aquaprintview.mm @@ -58,6 +58,9 @@ { NSSize aPaperSize = [mpInfoPrinter->getPrintInfo() paperSize]; int nWidth = (int)aPaperSize.width; + // #i101108# sanity check + if( nWidth < 1 ) + nWidth = 1; NSRect aRect = { { page % nWidth, page / nWidth }, aPaperSize }; return aRect; } @@ -71,7 +74,7 @@ -(void)drawRect: (NSRect)rect { NSPoint aPoint = [self locationOfPrintRect: rect]; - mpInfoPrinter->setStartPageOffset( rect.origin.x, rect.origin.y ); + mpInfoPrinter->setStartPageOffset( static_cast<int>(rect.origin.x), static_cast<int>(rect.origin.y) ); NSSize aPaperSize = [mpInfoPrinter->getPrintInfo() paperSize]; int nPage = (int)(aPaperSize.width * rect.origin.y + rect.origin.x); diff --git a/vcl/aqua/source/gdi/salatslayout.cxx b/vcl/aqua/source/gdi/salatslayout.cxx index 98700feba39d..cec842739de3 100755 --- a/vcl/aqua/source/gdi/salatslayout.cxx +++ b/vcl/aqua/source/gdi/salatslayout.cxx @@ -431,8 +431,8 @@ void ATSLayout::DrawText( SalGraphics& rGraphics ) const if( rAquaGraphics.mnATSUIRotation != 0 ) { const double fRadians = rAquaGraphics.mnATSUIRotation * (M_PI/0xB40000); - nXOfsFixed = +rSubPortion.mnXOffset * cos( fRadians ); - nYOfsFixed = +rSubPortion.mnXOffset * sin( fRadians ); + nXOfsFixed = static_cast<Fixed>(static_cast<double>(+rSubPortion.mnXOffset) * cos( fRadians )); + nYOfsFixed = static_cast<Fixed>(static_cast<double>(+rSubPortion.mnXOffset) * sin( fRadians )); } // draw sub-portions diff --git a/vcl/aqua/source/gdi/salgdiutils.cxx b/vcl/aqua/source/gdi/salgdiutils.cxx index 066268791b11..99a1629006d2 100755 --- a/vcl/aqua/source/gdi/salgdiutils.cxx +++ b/vcl/aqua/source/gdi/salgdiutils.cxx @@ -102,8 +102,8 @@ void AquaSalGraphics::SetVirDevGraphics( CGLayerRef xLayer, CGContextRef xContex else { const CGSize aSize = CGLayerGetSize( mxLayer ); - mnWidth = aSize.width; - mnHeight = aSize.height; + mnWidth = static_cast<int>(aSize.width); + mnHeight = static_cast<int>(aSize.height); } // prepare graphics for drawing @@ -219,7 +219,10 @@ void AquaSalGraphics::RefreshRect(float lX, float lY, float lWidth, float lHeigh { // update a little more around the designated rectangle // this helps with antialiased rendering - const Rectangle aVclRect( Point( lX-1, lY-1 ), Size( lWidth+2, lHeight+2) ); + const Rectangle aVclRect(Point(static_cast<long int>(lX-1), + static_cast<long int>(lY-1) ), + Size( static_cast<long int>(lWidth+2), + static_cast<long int>(lHeight+2) ) ); mpFrame->maInvalidRect.Union( aVclRect ); } } diff --git a/vcl/aqua/source/gdi/salnativewidgets.cxx b/vcl/aqua/source/gdi/salnativewidgets.cxx index 9f2c7c4fa3a7..6cd4e78a2d1a 100644 --- a/vcl/aqua/source/gdi/salnativewidgets.cxx +++ b/vcl/aqua/source/gdi/salnativewidgets.cxx @@ -612,7 +612,7 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType, aPushInfo.animation.time.start = 0; aPushInfo.animation.time.current = 0; PushButtonValue* pPBVal = (PushButtonValue*)aValue.getOptionalVal(); - int nPaintHeight = rc.size.height; + int nPaintHeight = static_cast<int>(rc.size.height); if( pPBVal && pPBVal->mbBevelButton ) { @@ -1162,8 +1162,10 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType, if( mxClipPath ) aRect = CGPathGetBoundingBox( mxClipPath ); if( aRect.size.width != 0 && aRect.size.height != 0 ) - buttonRect.Intersection( Rectangle( Point( aRect.origin.x, aRect.origin.y ), - Size( aRect.size.width, aRect.size.height ) ) ); + buttonRect.Intersection( Rectangle( Point( static_cast<long int>(aRect.origin.x), + static_cast<long int>(aRect.origin.y) ), + Size( static_cast<long int>(aRect.size.width), + static_cast<long int>(aRect.size.height) ) ) ); } RefreshRect( buttonRect.Left(), buttonRect.Top(), buttonRect.GetWidth(), buttonRect.GetHeight() ); diff --git a/vcl/aqua/source/gdi/salprn.cxx b/vcl/aqua/source/gdi/salprn.cxx index 5db6ad30bb8b..b9a1f4ef7748 100644 --- a/vcl/aqua/source/gdi/salprn.cxx +++ b/vcl/aqua/source/gdi/salprn.cxx @@ -310,8 +310,12 @@ BOOL AquaSalInfoPrinter::SetData( ULONG i_nFlags, ImplJobSetup* io_pSetupData ) double width = 0, height = 0; if( io_pSetupData->mePaperFormat == PAPER_USER ) { - width = TenMuToPt( io_pSetupData->mnPaperWidth ); - height = TenMuToPt( io_pSetupData->mnPaperHeight ); + // #i101108# sanity check + if( io_pSetupData->mnPaperWidth && io_pSetupData->mnPaperHeight ) + { + width = TenMuToPt( io_pSetupData->mnPaperWidth ); + height = TenMuToPt( io_pSetupData->mnPaperHeight ); + } } else getPaperSize( width, height, io_pSetupData->mePaperFormat ); diff --git a/vcl/aqua/source/gdi/salvd.cxx b/vcl/aqua/source/gdi/salvd.cxx index d7690e4e38bd..4d25d5d8b63b 100644 --- a/vcl/aqua/source/gdi/salvd.cxx +++ b/vcl/aqua/source/gdi/salvd.cxx @@ -228,8 +228,8 @@ void AquaSalVirtualDevice::GetSize( long& rWidth, long& rHeight ) if( mxLayer ) { const CGSize aSize = CGLayerGetSize( mxLayer ); - rWidth = aSize.width; - rHeight = aSize.height; + rWidth = static_cast<long>(aSize.width); + rHeight = static_cast<long>(aSize.height); } else { diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx index 8c40e1acfe66..9c713ea26a52 100644 --- a/vcl/aqua/source/window/salframe.cxx +++ b/vcl/aqua/source/window/salframe.cxx @@ -1182,7 +1182,7 @@ void AquaSalFrame::UpdateSettings( AllSettings& rSettings ) getAppleScrollBarVariant(); // set scrollbar size - aStyleSettings.SetScrollBarSize( [NSScroller scrollerWidth] ); + aStyleSettings.SetScrollBarSize( static_cast<long int>([NSScroller scrollerWidth]) ); // images in menus false for MacOSX aStyleSettings.SetUseImagesInMenus( false ); @@ -1203,7 +1203,15 @@ const SystemEnvData* AquaSalFrame::GetSystemData() const void AquaSalFrame::Beep( SoundType eSoundType ) { - NSBeep(); + switch( eSoundType ) + { + case SOUND_DISABLE: + // don't beep + break; + default: + NSBeep(); + break; + } } // ----------------------------------------------------------------------- @@ -1240,7 +1248,7 @@ void AquaSalFrame::SetPosSize(long nX, long nY, long nWidth, long nHeight, USHOR if( (nFlags & SAL_FRAME_POSSIZE_WIDTH) != 0 ) nX = mpParent->maGeometry.nWidth - nWidth-1 - nX; else - nX = mpParent->maGeometry.nWidth - aContentRect.size.width-1 - nX; + nX = mpParent->maGeometry.nWidth - static_cast<long int>( aContentRect.size.width-1) - nX; } NSRect aParentFrameRect = [mpParent->mpWindow frame]; aParentContentRect = [NSWindow contentRectForFrameRect: aParentFrameRect styleMask: mpParent->mnStyleMask]; diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm index a6213ca7b64d..c7facd8c6c09 100755 --- a/vcl/aqua/source/window/salframeview.mm +++ b/vcl/aqua/source/window/salframeview.mm @@ -841,6 +841,16 @@ private: if( pUnmodifiedString && [pUnmodifiedString length] == 1 ) { + /* #i103102# key events with command and alternate don't make it through + interpretKeyEvents (why ?). Try to dispatch them here first, + if not successful continue normally + */ + if( (mpFrame->mnLastModifierFlags & (NSAlternateKeyMask | NSCommandKeyMask)) + == (NSAlternateKeyMask | NSCommandKeyMask) ) + { + if( [self sendSingleCharacter: mpLastEvent] ) + return YES; + } unichar keyChar = [pUnmodifiedString characterAtIndex: 0]; USHORT nKeyCode = ImplMapCharCode( keyChar ); diff --git a/vcl/aqua/source/window/salmenu.cxx b/vcl/aqua/source/window/salmenu.cxx index 4fafbbdbb4cf..5c838701933c 100644 --- a/vcl/aqua/source/window/salmenu.cxx +++ b/vcl/aqua/source/window/salmenu.cxx @@ -651,11 +651,9 @@ void AquaSalMenu::SetItemImage( unsigned nPos, SalMenuItem* pSMI, const Image& r NSImage* pImage = CreateNSImage( rImage ); + [pSalMenuItem->mpMenuItem setImage: pImage]; if( pImage ) - { - [pSalMenuItem->mpMenuItem setImage: pImage]; [pImage release]; - } } void AquaSalMenu::SetItemText( unsigned i_nPos, SalMenuItem* i_pSalMenuItem, const XubString& i_rText ) @@ -894,7 +892,13 @@ Rectangle AquaSalMenu::GetMenuBarButtonRectPixel( USHORT i_nItemId, SalFrame* i_ aRect.origin.x -= i_pReferenceFrame->maGeometry.nX; aRect.origin.y -= i_pReferenceFrame->maGeometry.nY + aRect.size.height; - return Rectangle( Point( aRect.origin.x, aRect.origin.y ), Size( aRect.size.width, aRect.size.height ) ); + return Rectangle( Point(static_cast<long int>(aRect.origin.x), + static_cast<long int>(aRect.origin.y) + ), + Size( static_cast<long int>(aRect.size.width), + static_cast<long int>(aRect.size.height) + ) + ); } // ======================================================================= diff --git a/vcl/inc/sft.h b/vcl/inc/sft.h deleted file mode 100644 index efda0903afc5..000000000000 --- a/vcl/inc/sft.h +++ /dev/null @@ -1,641 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: sft.h,v $ - * $Revision: 1.21 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -/* $Id: sft.h,v 1.21 2008-06-25 14:20:49 kz Exp $ */ - -/** - - * - * @file sft.h - * @brief Sun Font Tools - * @author Alexander Gelfenbain - */ - -/* - * If NO_MAPPERS is defined, MapChar() and MapString() and consequently GetTTSimpleCharMetrics() - * don't get compiled in. This is done to avoid including a large chunk of code (TranslateXY() from - * xlat.c in the projects that don't require it. - * - * If NO_TYPE3 is defined CreateT3FromTTGlyphs() does not get compiled in. - * If NO_TYPE42 is defined Type42-related code is excluded - * If NO_TTCR is defined TrueType creation related code is excluded\ - * If NO_LIST is defined list.h and piblic functions that use it don't get compiled - */ - -/* - * Generated fonts contain an XUID entry in the form of: - * - * 103 0 T C1 N C2 C3 - * - * 103 - Sun's Adobe assigned XUID number. Contact person: Alexander Gelfenbain <gelf@eng.sun.com> - * - * T - font type. 0: Type 3, 1: Type 42 - * C1 - CRC-32 of the entire source TrueType font - * N - number of glyphs in the subset - * C2 - CRC-32 of the array of glyph IDs used to generate the subset - * C3 - CRC-32 of the array of encoding numbers used to generate the subset - * - */ - - -#ifndef __SUBFONT_H -#define __SUBFONT_H - -#ifdef UNX -#include <sys/types.h> -#include <unistd.h> -#endif -#include <stdio.h> - -#include <sal/types.h> - -#ifndef NO_LIST -#include "list.h" -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/*@{*/ -#ifndef __cplusplus -#define false 0 /**< standard false value */ -#define true 1 /**< standard true value */ -#endif -/*@}*/ - -/*@{*/ - typedef sal_Int16 F2Dot14; /**< fixed: 2.14 */ - typedef sal_Int32 F16Dot16; /**< fixed: 16.16 */ -/*@}*/ - - typedef struct { - sal_uInt16 s; - sal_uInt16 d; - } sal_uInt16pair; - -/** Return value of OpenTTFont() and CreateT3FromTTGlyphs() */ - enum SFErrCodes { - SF_OK, /**< no error */ - SF_BADFILE, /**< file not found */ - SF_FILEIO, /**< file I/O error */ - SF_MEMORY, /**< memory allocation error */ - SF_GLYPHNUM, /**< incorrect number of glyphs */ - SF_BADARG, /**< incorrect arguments */ - SF_TTFORMAT, /**< incorrect TrueType font format */ - SF_TABLEFORMAT, /**< incorrect format of a TrueType table */ - SF_FONTNO /**< incorrect logical font number of a TTC font */ - }; - -#ifndef FW_THIN /* WIN32 compilation would conflict */ -/** Value of the weight member of the TTGlobalFontInfo struct */ - enum WeightClass { - FW_THIN = 100, /**< Thin */ - FW_EXTRALIGHT = 200, /**< Extra-light (Ultra-light) */ - FW_LIGHT = 300, /**< Light */ - FW_NORMAL = 400, /**< Normal (Regular) */ - FW_MEDIUM = 500, /**< Medium */ - FW_SEMIBOLD = 600, /**< Semi-bold (Demi-bold) */ - FW_BOLD = 700, /**< Bold */ - FW_EXTRABOLD = 800, /**< Extra-bold (Ultra-bold) */ - FW_BLACK = 900 /**< Black (Heavy) */ - }; - -/** Value of the width member of the TTGlobalFontInfo struct */ -#ifndef OS2 - enum WidthClass { - FWIDTH_ULTRA_CONDENSED = 1, /**< 50% of normal */ - FWIDTH_EXTRA_CONDENSED = 2, /**< 62.5% of normal */ - FWIDTH_CONDENSED = 3, /**< 75% of normal */ - FWIDTH_SEMI_CONDENSED = 4, /**< 87.5% of normal */ - FWIDTH_NORMAL = 5, /**< Medium, 100% */ - FWIDTH_SEMI_EXPANDED = 6, /**< 112.5% of normal */ - FWIDTH_EXPANDED = 7, /**< 125% of normal */ - FWIDTH_EXTRA_EXPANDED = 8, /**< 150% of normal */ - FWIDTH_ULTRA_EXPANDED = 9 /**< 200% of normal */ - }; -#endif // OS2 -#endif /* FW_THIN */ - -/** Type of the 'kern' table, stored in _TrueTypeFont::kerntype */ - enum KernType { - KT_NONE = 0, /**< no kern table */ - KT_APPLE_NEW = 1, /**< new Apple kern table */ - KT_MICROSOFT = 2 /**< Microsoft table */ - }; - -/* Composite glyph flags definition */ - enum CompositeFlags { - ARG_1_AND_2_ARE_WORDS = 1, - ARGS_ARE_XY_VALUES = 1<<1, - ROUND_XY_TO_GRID = 1<<2, - WE_HAVE_A_SCALE = 1<<3, - MORE_COMPONENTS = 1<<5, - WE_HAVE_AN_X_AND_Y_SCALE = 1<<6, - WE_HAVE_A_TWO_BY_TWO = 1<<7, - WE_HAVE_INSTRUCTIONS = 1<<8, - USE_MY_METRICS = 1<<9, - OVERLAP_COMPOUND = 1<<10 - }; - -#ifndef NO_TTCR -/** Flags for TrueType generation */ - enum TTCreationFlags { - TTCF_AutoName = 1, /**< Automatically generate a compact 'name' table. - If this flag is not set, name table is generated - either from an array of NameRecord structs passed as - arguments or if the array is NULL, 'name' table - of the generated TrueType file will be a copy - of the name table of the original file. - If this flag is set the array of NameRecord structs - is ignored and a very compact 'name' table is automatically - generated. */ - - TTCF_IncludeOS2 = 2 /** If this flag is set OS/2 table from the original font will be - copied to the subset */ - }; -#endif - - - - -/** Structure used by GetTTSimpleGlyphMetrics() and GetTTSimpleCharMetrics() functions */ - typedef struct { - sal_uInt16 adv; /**< advance width or height */ - sal_Int16 sb; /**< left or top sidebearing */ - } TTSimpleGlyphMetrics; - - - -/** Structure used by the TrueType Creator and GetRawGlyphData() */ - - typedef struct { - sal_uInt32 glyphID; /**< glyph ID */ - sal_uInt16 nbytes; /**< number of bytes in glyph data */ - sal_uInt8 *ptr; /**< pointer to glyph data */ - sal_uInt16 aw; /**< advance width */ - sal_Int16 lsb; /**< left sidebearing */ - sal_uInt16 compflag; /**< 0- if non-composite, 1- otherwise */ - sal_uInt16 npoints; /**< number of points */ - sal_uInt16 ncontours; /**< number of contours */ - /* */ - sal_uInt32 newID; /**< used internally by the TTCR */ - } GlyphData; - -/** Structure used by the TrueType Creator and CreateTTFromTTGlyphs() */ - typedef struct { - sal_uInt16 platformID; /**< Platform ID */ - sal_uInt16 encodingID; /**< Platform-specific encoding ID */ - sal_uInt16 languageID; /**< Language ID */ - sal_uInt16 nameID; /**< Name ID */ - sal_uInt16 slen; /**< String length in bytes */ - sal_uInt8 *sptr; /**< Pointer to string data (not zero-terminated!) */ - } NameRecord; - - - -/** Return value of GetTTGlobalFontInfo() */ - - typedef struct { - char *family; /**< family name */ - sal_uInt16 *ufamily; /**< family name UCS2 */ - char *subfamily; /**< subfamily name */ - sal_uInt16 *usubfamily; /**< subfamily name UCS2 */ - char *psname; /**< PostScript name */ - sal_uInt16 macStyle; /**< macstyle bits from 'HEAD' table */ - int weight; /**< value of WeightClass or 0 if can't be determined */ - int width; /**< value of WidthClass or 0 if can't be determined */ - int pitch; /**< 0: proportianal font, otherwise: monospaced */ - int italicAngle; /**< in counter-clockwise degrees * 65536 */ - int xMin; /**< global bounding box: xMin */ - int yMin; /**< global bounding box: yMin */ - int xMax; /**< global bounding box: xMax */ - int yMax; /**< global bounding box: yMax */ - int ascender; /**< typographic ascent. */ - int descender; /**< typographic descent. */ - int linegap; /**< typographic line gap.\ Negative values are treated as - zero in Win 3.1, System 6 and System 7. */ - int vascent; /**< typographic ascent for vertical writing mode */ - int vdescent; /**< typographic descent for vertical writing mode */ - int typoAscender; /**< OS/2 portable typographic ascender */ - int typoDescender; /**< OS/2 portable typographic descender */ - int typoLineGap; /**< OS/2 portable typographc line gap */ - int winAscent; /**< ascender metric for Windows */ - int winDescent; /**< descender metric for Windows */ - int symbolEncoded; /**< 1: MS symbol encoded 0: not symbol encoded */ - int rangeFlag; /**< if set to 1 Unicode Range flags are applicable */ - sal_uInt32 ur1; /**< bits 0 - 31 of Unicode Range flags */ - sal_uInt32 ur2; /**< bits 32 - 63 of Unicode Range flags */ - sal_uInt32 ur3; /**< bits 64 - 95 of Unicode Range flags */ - sal_uInt32 ur4; /**< bits 96 - 127 of Unicode Range flags */ - sal_uInt8 panose[10]; /**< PANOSE classification number */ - sal_uInt16 typeFlags; /**< type flags (copyright information) */ - } TTGlobalFontInfo; - -/** Structure used by KernGlyphs() */ - typedef struct { - int x; /**< positive: right, negative: left */ - int y; /**< positive: up, negative: down */ - } KernData; - - -/** ControlPoint structure used by GetTTGlyphPoints() */ - typedef struct { - sal_uInt32 flags; /**< 00000000 00000000 e0000000 bbbbbbbb */ - /**< b - byte flags from the glyf array */ - /**< e == 0 - regular point */ - /**< e == 1 - end contour */ - sal_Int16 x; /**< X coordinate in EmSquare units */ - sal_Int16 y; /**< Y coordinate in EmSquare units */ - } ControlPoint; - - typedef struct _TrueTypeFont TrueTypeFont; - -/** - * @defgroup sft Sun Font Tools Exported Functions - */ - - -/** - * Get the number of fonts contained in a TrueType collection - * @param fname - file name - * @return number of fonts or zero, if file is not a TTC file. - * @ingroup sft - */ - int CountTTCFonts(const char* fname); - - -/** - * TrueTypeFont constructor. - * The font file has to be provided as a memory buffer and length - * @param facenum - logical font number within a TTC file. This value is ignored - * for TrueType fonts - * @return value of SFErrCodes enum - * @ingroup sft - */ - int OpenTTFontBuffer(void* pBuffer, sal_uInt32 nLen, sal_uInt32 facenum, TrueTypeFont** ttf); /*FOLD01*/ -#if !defined(WIN32) && !defined(OS2) -/** - * TrueTypeFont constructor. - * Reads the font file and allocates the memory for the structure. - * on WIN32 the font has to be provided as a memory buffer and length - * @param facenum - logical font number within a TTC file. This value is ignored - * for TrueType fonts - * @return value of SFErrCodes enum - * @ingroup sft - */ - int OpenTTFontFile(const char *fname, sal_uInt32 facenum, TrueTypeFont** ttf); -#endif - -/** - * TrueTypeFont destructor. Deallocates the memory. - * @ingroup sft - */ - void CloseTTFont(TrueTypeFont *); - -/** - * Extracts TrueType control points, and stores them in an allocated array pointed to - * by *pointArray. This function returns the number of extracted points. - * - * @param ttf pointer to the TrueTypeFont structure - * @param glyphID Glyph ID - * @param pointArray Return value - address of the pointer to the first element of the array - * of points allocated by the function - * @return Returns the number of points in *pointArray or -1 if glyphID is - * invalid. - * @ingroup sft - * - */ - int GetTTGlyphPoints(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoint **pointArray); - -/** - * Extracts raw glyph data from the 'glyf' table and returns it in an allocated - * GlyphData structure. - * - * @param ttf pointer to the TrueTypeFont structure - * @param glyphID Glyph ID - * - * @return pointer to an allocated GlyphData structure or NULL if - * glyphID is not present in the font - * @ingroup sft - * - */ - GlyphData *GetTTRawGlyphData(TrueTypeFont *ttf, sal_uInt32 glyphID); - -#ifndef NO_LIST -/** - * For a specified glyph adds all component glyphs IDs to the list and - * return their number. If the glyph is a single glyph it has one component - * glyph (which is added to the list) and the function returns 1. - * For a composite glyphs it returns the number of component glyphs - * and adds all of them to the list. - * - * @param ttf pointer to the TrueTypeFont structure - * @param glyphID Glyph ID - * @param glyphlist list of glyphs - * - * @return number of component glyphs - * @ingroup sft - * - */ - int GetTTGlyphComponents(TrueTypeFont *ttf, sal_uInt32 glyphID, list glyphlist); -#endif - -/** - * Extracts all Name Records from the font and stores them in an allocated - * array of NameRecord structs - * - * @param ttf pointer to the TrueTypeFont struct - * @param nr pointer to the array of NameRecord structs - * - * @return number of NameRecord structs - * @ingroup sft - */ - - int GetTTNameRecords(TrueTypeFont *ttf, NameRecord **nr); - -/** - * Deallocates previously allocated array of NameRecords. - * - * @param nr array of NameRecord structs - * @param n number of elements in the array - * - * @ingroup sft - */ - void DisposeNameRecords(NameRecord* nr, int n); - - -#ifndef NO_TYPE3 -/** - * Generates a new PostScript Type 3 font and dumps it to <b>outf</b> file. - * This functions subsititues glyph 0 for all glyphIDs that are not found in the font. - * @param ttf pointer to the TrueTypeFont structure - * @param outf the resulting font is written to this stream - * @param fname font name for the new font. If it is NULL the PostScript name of the - * original font will be used - * @param glyphArray pointer to an array of glyphs that are to be extracted from ttf - * @param encoding array of encoding values. encoding[i] specifies the position of the glyph - * glyphArray[i] in the encoding vector of the resulting Type3 font - * @param nGlyphs number of glyph IDs in glyphArray and encoding values in encoding - * @param wmode writing mode for the output file: 0 - horizontal, 1 - vertical - * @return return the value of SFErrCodes enum - * @see SFErrCodes - * @ingroup sft - * - */ - int CreateT3FromTTGlyphs(TrueTypeFont *ttf, FILE *outf, const char *fname, sal_uInt16 *glyphArray, sal_uInt8 *encoding, int nGlyphs, int wmode); -#endif - -#ifndef NO_TTCR -/** - * Generates a new TrueType font and dumps it to <b>outf</b> file. - * This functions subsititues glyph 0 for all glyphIDs that are not found in the font. - * @param ttf pointer to the TrueTypeFont structure - * @param fname file name for the output TrueType font file - * @param glyphArray pointer to an array of glyphs that are to be extracted from ttf. The first - * element of this array has to be glyph 0 (default glyph) - * @param encoding array of encoding values. encoding[i] specifies character code for - * the glyphID glyphArray[i]. Character code 0 usually points to a default - * glyph (glyphID 0) - * @param nGlyphs number of glyph IDs in glyphArray and encoding values in encoding - * @param nNameRecs number of NameRecords for the font, if 0 the name table from the - * original font will be used - * @param nr array of NameRecords - * @param flags or'ed TTCreationFlags - * @return return the value of SFErrCodes enum - * @see SFErrCodes - * @ingroup sft - * - */ - int CreateTTFromTTGlyphs(TrueTypeFont *ttf, - const char *fname, - sal_uInt16 *glyphArray, - sal_uInt8 *encoding, - int nGlyphs, - int nNameRecs, - NameRecord *nr, - sal_uInt32 flags); -#endif - -#ifndef NO_TYPE42 -/** - * Generates a new PostScript Type42 font and dumps it to <b>outf</b> file. - * This functions subsititues glyph 0 for all glyphIDs that are not found in the font. - * @param ttf pointer to the TrueTypeFont structure - * @param outf output stream for a resulting font - * @param psname PostScript name of the resulting font - * @param glyphArray pointer to an array of glyphs that are to be extracted from ttf. The first - * element of this array has to be glyph 0 (default glyph) - * @param encoding array of encoding values. encoding[i] specifies character code for - * the glyphID glyphArray[i]. Character code 0 usually points to a default - * glyph (glyphID 0) - * @param nGlyphs number of glyph IDs in glyphArray and encoding values in encoding - * @return SF_OK - no errors - * SF_GLYPHNUM - too many glyphs (> 255) - * SF_TTFORMAT - corrupted TrueType fonts - * - * @see SFErrCodes - * @ingroup sft - * - */ - int CreateT42FromTTGlyphs(TrueTypeFont *ttf, - FILE *outf, - const char *psname, - sal_uInt16 *glyphArray, - sal_uInt8 *encoding, - int nGlyphs); -#endif - - -/** - * Queries glyph metrics. Allocates an array of TTSimpleGlyphMetrics structs and returns it. - * - * @param ttf pointer to the TrueTypeFont structure - * @param glyphArray pointer to an array of glyphs that are to be extracted from ttf - * @param nGlyphs number of glyph IDs in glyphArray and encoding values in encoding - * @param mode writing mode: 0 - horizontal, 1 - vertical - * @ingroup sft - * - */ - TTSimpleGlyphMetrics *GetTTSimpleGlyphMetrics(TrueTypeFont *ttf, sal_uInt16 *glyphArray, int nGlyphs, int mode); - -#ifndef NO_MAPPERS -/** - * Queries glyph metrics. Allocates an array of TTSimpleGlyphMetrics structs and returns it. - * This function behaves just like GetTTSimpleGlyphMetrics() but it takes a range of Unicode - * characters instead of an array of glyphs. - * - * @param ttf pointer to the TrueTypeFont structure - * @param firstChar Unicode value of the first character in the range - * @param nChars number of Unicode characters in the range - * @param mode writing mode: 0 - horizontal, 1 - vertical - * - * @see GetTTSimpleGlyphMetrics - * @ingroup sft - * - */ - TTSimpleGlyphMetrics *GetTTSimpleCharMetrics(TrueTypeFont *ttf, sal_uInt16 firstChar, int nChars, int mode); - -/** - * Maps a Unicode (UCS-2) string to a glyph array. Returns the number of glyphs in the array, - * which for TrueType fonts is always the same as the number of input characters. - * - * @param ttf pointer to the TrueTypeFont structure - * @param str pointer to a UCS-2 string - * @param nchars number of characters in <b>str</b> - * @param glyphArray pointer to the glyph array where glyph IDs are to be recorded. - * - * @return MapString() returns -1 if the TrueType font has no usable 'cmap' tables. - * Otherwise it returns the number of characters processed: <b>nChars</b> - * - * glyphIDs of TrueType fonts are 2 byte positive numbers. glyphID of 0 denotes a missing - * glyph and traditionally defaults to an empty square. - * glyphArray should be at least sizeof(sal_uInt16) * nchars bytes long. If glyphArray is NULL - * MapString() replaces the UCS-2 characters in str with glyphIDs. - * @ingroup sft - */ - int MapString(TrueTypeFont *ttf, sal_uInt16 *str, int nchars, sal_uInt16 *glyphArray, int bvertical); - -/** - * Maps a Unicode (UCS-2) character to a glyph ID and returns it. Missing glyph has - * a glyphID of 0 so this function can be used to test if a character is encoded in the font. - * - * @param ttf pointer to the TrueTypeFont structure - * @param ch Unicode (UCS-2) character - * @return glyph ID, if the character is missing in the font, the return value is 0. - * @ingroup sft - */ - sal_uInt16 MapChar(TrueTypeFont *ttf, sal_uInt16 ch, int bvertical); - -/** - * Returns 0 when the font does not substitute vertical glyphs - * - * @param ttf pointer to the TrueTypeFont structure - */ - int DoesVerticalSubstitution( TrueTypeFont *ttf, int bvertical); - -#endif - -/** - * Returns global font information about the TrueType font. - * @see TTGlobalFontInfo - * - * @param ttf pointer to a TrueTypeFont structure - * @param info pointer to a TTGlobalFontInfo structure - * @ingroup sft - * - */ - void GetTTGlobalFontInfo(TrueTypeFont *ttf, TTGlobalFontInfo *info); - -#ifdef TEST5 -/** - * Returns kerning information for an array of glyphs. - * Kerning is not cumulative. - * kern[i] contains kerning information for a pair of glyphs at positions i and i+1 - * - * @param ttf pointer to a TrueTypeFont structure - * @param glyphs array of source glyphs - * @param nglyphs number of glyphs in the array - * @param wmode writing mode: 0 - horizontal, 1 - vertical - * @param kern array of KernData structures. It should contain nglyphs-1 elements - * @see KernData - * @ingroup sft - * - */ - void KernGlyphs(TrueTypeFont *ttf, sal_uInt16 *glyphs, int nglyphs, int wmode, KernData *kern); -#endif - -/** - * Returns nonzero if font is a symbol encoded font - */ - int CheckSymbolEncoding(TrueTypeFont* ttf); - -/** - * returns the number of glyphs in a font - */ - int GetTTGlyphCount( TrueTypeFont* ttf ); - -/*- private definitions */ /*FOLD00*/ - - struct _TrueTypeFont { - sal_uInt32 tag; - - char *fname; - sal_Int32 fsize; - sal_uInt8 *ptr; - - char *psname; - char *family; - sal_uInt16 *ufamily; - char *subfamily; - sal_uInt16 *usubfamily; - - sal_uInt32 ntables; - sal_uInt32 *goffsets; - sal_uInt32 nglyphs; - sal_uInt32 unitsPerEm; - sal_uInt32 numberOfHMetrics; - sal_uInt32 numOfLongVerMetrics; /* if this number is not 0, font has vertical metrics information */ - sal_uInt8 *cmap; - int cmapType; - sal_uInt32 (*mapper)(const sal_uInt8 *, sal_uInt32); /* character to glyphID translation function */ - void **tables; /* array of pointers to tables */ - sal_uInt32 *tlens; /* array of table lengths */ - int kerntype; /* Defined in the KernType enum */ - sal_uInt32 nkern; /* number of kern subtables */ - sal_uInt8 **kerntables; /* array of pointers to kern subtables */ - void *pGSubstitution; /* info provided by GSUB for UseGSUB() */ - }; - -#ifdef __cplusplus -} -#endif - -/* indexes into _TrueTypeFont::tables[] and _TrueTypeFont::tlens[] */ -#define O_maxp 0 /* 'maxp' */ -#define O_glyf 1 /* 'glyf' */ -#define O_head 2 /* 'head' */ -#define O_loca 3 /* 'loca' */ -#define O_name 4 /* 'name' */ -#define O_hhea 5 /* 'hhea' */ -#define O_hmtx 6 /* 'hmtx' */ -#define O_cmap 7 /* 'cmap' */ -#define O_vhea 8 /* 'vhea' */ -#define O_vmtx 9 /* 'vmtx' */ -#define O_OS2 10 /* 'OS/2' */ -#define O_post 11 /* 'post' */ -#define O_kern 12 /* 'kern' */ -#define O_cvt 13 /* 'cvt_' - only used in TT->TT generation */ -#define O_prep 14 /* 'prep' - only used in TT->TT generation */ -#define O_fpgm 15 /* 'fpgm' - only used in TT->TT generation */ -#define O_gsub 16 /* 'GSUB' */ -#define NUM_TAGS 17 - -#endif /* __SUBFONT_H */ diff --git a/vcl/inc/vcl/gdimtf.hxx b/vcl/inc/vcl/gdimtf.hxx index 62439d4d4613..c53460d35584 100644 --- a/vcl/inc/vcl/gdimtf.hxx +++ b/vcl/inc/vcl/gdimtf.hxx @@ -164,6 +164,14 @@ public: void Scale( double fScaleX, double fScaleY ); void Scale( const Fraction& rScaleX, const Fraction& rScaleY ); void Rotate( long nAngle10 ); + /* get the bound rect of the contained actions + * caveats: + * - clip actions will limit the contained actions, + * but the current clipregion of the passed OutputDevice will not + * - coordinates of actions will be transformed to preferred mapmode + * - the returned rectangle is relative to the preferred mapmode of the metafile + */ + Rectangle GetBoundRect( OutputDevice& i_rReference ); void Adjust( short nLuminancePercent = 0, short nContrastPercent = 0, short nChannelRPercent = 0, short nChannelGPercent = 0, diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx index 3f821f995a51..0d071a8a9617 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -655,20 +655,20 @@ public: void GetKerningPairs( ULONG nPairs, KerningPair* pKernPairs ) const; BOOL GetTextBoundRect( Rectangle& rRect, - const String& rStr, xub_StrLen nBase = 0, xub_StrLen nIndex = 0, - xub_StrLen nLen = STRING_LEN ) const; + const String& rStr, xub_StrLen nBase = 0, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, + ULONG nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const; BOOL GetTextOutline( PolyPolygon&, const String& rStr, xub_StrLen nBase = 0, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, BOOL bOptimize = TRUE, - const ULONG nWidth = 0, const sal_Int32* pDXArray = NULL ) const; + ULONG nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const; BOOL GetTextOutlines( PolyPolyVector&, const String& rStr, xub_StrLen nBase = 0, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, BOOL bOptimize = TRUE, - const ULONG nWidth = 0, const sal_Int32* pDXArray = NULL ) const; + ULONG nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const; BOOL GetTextOutlines( ::basegfx::B2DPolyPolygonVector&, const String& rStr, xub_StrLen nBase = 0, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, BOOL bOptimize = TRUE, - const ULONG nWidth = 0, const sal_Int32* pDXArray = NULL ) const; + ULONG nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const; BOOL GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector ); diff --git a/vcl/inc/vcl/sndstyle.hxx b/vcl/inc/vcl/sndstyle.hxx index 2fc568a5e86d..55255171ad9f 100644 --- a/vcl/inc/vcl/sndstyle.hxx +++ b/vcl/inc/vcl/sndstyle.hxx @@ -44,6 +44,6 @@ typedef USHORT SoundType; #define SOUND_ERROR ((SoundType)3) #define SOUND_QUERY ((SoundType)4) -#define SOUND_DISABLE (SOUND_DEFAULT) +#define SOUND_DISABLE ((SoundType)5) #endif // _SV_SNDSTYLE_HXX diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx index c8567264b9b9..36d0991c7640 100644 --- a/vcl/source/app/dbggui.cxx +++ b/vcl/source/app/dbggui.cxx @@ -1782,7 +1782,7 @@ void DbgDialogTest( Window* pWindow ) i++; } - delete pRectAry; + delete [] pRectAry; } // ======================================================================= diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx index 687352716ae8..641665aacf6b 100644 --- a/vcl/source/control/lstbox.cxx +++ b/vcl/source/control/lstbox.cxx @@ -31,21 +31,21 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#ifndef _SV_RC_H -#include <tools/rc.h> -#endif -#include <vcl/svdata.hxx> -#include <vcl/decoview.hxx> -#include <vcl/event.hxx> -#include <vcl/scrbar.hxx> -#include <vcl/button.hxx> -#include <vcl/edit.hxx> -#include <vcl/subedit.hxx> -#include <vcl/ilstbox.hxx> -#include <vcl/lstbox.hxx> -#include <vcl/combobox.hxx> -#include <vcl/controllayout.hxx> -#include <tools/debug.hxx> +#include "tools/rc.h" + +#include "vcl/svdata.hxx" +#include "vcl/decoview.hxx" +#include "vcl/event.hxx" +#include "vcl/scrbar.hxx" +#include "vcl/button.hxx" +#include "vcl/edit.hxx" +#include "vcl/subedit.hxx" +#include "vcl/ilstbox.hxx" +#include "vcl/lstbox.hxx" +#include "vcl/combobox.hxx" +#include "vcl/controllayout.hxx" + +#include "tools/debug.hxx" @@ -650,6 +650,7 @@ void ListBox::Resize() long nTop = 0; long nBottom = aOutSz.Height(); + // note: in case of no border, pBorder will actually be this Window *pBorder = GetWindow( WINDOW_BORDER ); ImplControlValue aControlValue; Point aPoint; @@ -678,6 +679,17 @@ void ListBox::Resize() // use the themes drop down size Rectangle aContentRect = aContent.GetBoundRect(); + if( ! (GetStyle() & WB_BORDER) && ImplGetSVData()->maNWFData.mbNoFocusRects ) + { + // no border but focus ring behavior -> we have a problem; the + // native rect relies on the border to draw the focus + // let's do the best we can and center vertically, so it doesn't look + // completely wrong. + Size aSz( GetOutputSizePixel() ); + long nDiff = aContentRect.Top() - (aSz.Height() - aContentRect.GetHeight())/2; + aContentRect.Top() -= nDiff; + aContentRect.Bottom() -= nDiff; + } mpImplWin->SetPosSizePixel( aContentRect.TopLeft(), aContentRect.GetSize() ); } else @@ -1273,6 +1285,26 @@ Size ListBox::CalcMinimumSize() const else { aSz.Height() = mpImplLB->CalcSize( 1 ).Height(); + if( aSz.Height() < mnDDHeight ) + { + aSz.Height() = mnDDHeight; + // FIXME: this is currently only on mac/aqua + if( ImplGetSVData()->maNWFData.mbNoFocusRects && + IsNativeWidgetEnabled() && + const_cast<ListBox*>(this)->IsNativeControlSupported( CTRL_LISTBOX, PART_ENTIRE_CONTROL ) ) + { + ImplControlValue aControlValue; + Region aCtrlRegion( Rectangle( (const Point&)Point(), Size( 20, mnDDHeight ) ) ); + Region aBoundingRgn( aCtrlRegion ); + Region aContentRgn( aCtrlRegion ); + // adjust the size of the edit field + if( const_cast<ListBox*>(this)->GetNativeControlRegion( CTRL_LISTBOX, PART_ENTIRE_CONTROL, + aCtrlRegion, 0, aControlValue, rtl::OUString(), aBoundingRgn, aContentRgn) ) + { + aSz.Height() = aContentRgn.GetBoundRect().GetHeight(); + } + } + } aSz.Width() = mpImplLB->GetMaxEntryWidth(); aSz.Width() += GetSettings().GetStyleSettings().GetScrollBarSize(); } diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 10d4cf774b04..7744b2f9a59c 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -329,7 +329,7 @@ _inline void PutInt16(sal_Int16 val, sal_uInt8 *ptr, size_t offset, int bigendia } -#if defined(OSL_BIG_ENDIAN) +#if defined(OSL_BIGENDIAN) #define Int16FromMOTA(a) (a) #define Int32FromMOTA(a) (a) #else diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 3a29e6d56095..6483c8292df7 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -1403,6 +1403,436 @@ void GDIMetaFile::Rotate( long nAngle10 ) // ------------------------------------------------------------------------ +static void ImplActionBounds( Rectangle& o_rOutBounds, + const Rectangle& i_rInBounds, + const std::vector<Rectangle>& i_rClipStack ) +{ + Rectangle aBounds( i_rInBounds ); + if( ! i_rInBounds.IsEmpty() && ! i_rClipStack.empty() && ! i_rClipStack.back().IsEmpty() ) + aBounds.Intersection( i_rClipStack.back() ); + if( ! aBounds.IsEmpty() ) + { + if( ! o_rOutBounds.IsEmpty() ) + o_rOutBounds.Union( aBounds ); + else + o_rOutBounds = aBounds; + } +} + +Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference ) +{ + GDIMetaFile aMtf; + VirtualDevice aMapVDev( i_rReference ); + + aMapVDev.EnableOutput( FALSE ); + aMapVDev.SetMapMode( GetPrefMapMode() ); + + std::vector<Rectangle> aClipStack( 1, Rectangle() ); + std::vector<USHORT> aPushFlagStack; + + Rectangle aBound; + + for( MetaAction* pAction = (MetaAction*) First(); pAction; pAction = (MetaAction*) Next() ) + { + const USHORT nActionType = pAction->GetType(); + + switch( nActionType ) + { + case( META_PIXEL_ACTION ): + { + MetaPixelAction* pAct = (MetaPixelAction*) pAction; + ImplActionBounds( aBound, + Rectangle( aMapVDev.LogicToLogic( pAct->GetPoint(), aMapVDev.GetMapMode(), GetPrefMapMode() ), + aMapVDev.PixelToLogic( Size( 1, 1 ), GetPrefMapMode() ) ), + aClipStack ); + } + break; + + case( META_POINT_ACTION ): + { + MetaPointAction* pAct = (MetaPointAction*) pAction; + ImplActionBounds( aBound, + Rectangle( aMapVDev.LogicToLogic( pAct->GetPoint(), aMapVDev.GetMapMode(), GetPrefMapMode() ), + aMapVDev.PixelToLogic( Size( 1, 1 ), GetPrefMapMode() ) ), + aClipStack ); + } + break; + + case( META_LINE_ACTION ): + { + MetaLineAction* pAct = (MetaLineAction*) pAction; + Point aP1( pAct->GetStartPoint() ), aP2( pAct->GetEndPoint() ); + Rectangle aRect( aP1, aP2 ); + aRect.Justify(); + ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_RECT_ACTION ): + { + MetaRectAction* pAct = (MetaRectAction*) pAction; + ImplActionBounds( aBound, aMapVDev.LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_ROUNDRECT_ACTION ): + { + MetaRoundRectAction* pAct = (MetaRoundRectAction*) pAction; + ImplActionBounds( aBound, aMapVDev.LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_ELLIPSE_ACTION ): + { + MetaEllipseAction* pAct = (MetaEllipseAction*) pAction; + ImplActionBounds( aBound, aMapVDev.LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_ARC_ACTION ): + { + MetaArcAction* pAct = (MetaArcAction*) pAction; + // FIXME: this is imprecise + // e.g. for small arcs the whole rectangle is WAY too large + ImplActionBounds( aBound, aMapVDev.LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_PIE_ACTION ): + { + MetaPieAction* pAct = (MetaPieAction*) pAction; + // FIXME: this is imprecise + // e.g. for small arcs the whole rectangle is WAY too large + ImplActionBounds( aBound, aMapVDev.LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_CHORD_ACTION ): + { + MetaChordAction* pAct = (MetaChordAction*) pAction; + // FIXME: this is imprecise + // e.g. for small arcs the whole rectangle is WAY too large + ImplActionBounds( aBound, aMapVDev.LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_POLYLINE_ACTION ): + { + MetaPolyLineAction* pAct = (MetaPolyLineAction*) pAction; + Rectangle aRect( pAct->GetPolygon().GetBoundRect() ); + ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_POLYGON_ACTION ): + { + MetaPolygonAction* pAct = (MetaPolygonAction*) pAction; + Rectangle aRect( pAct->GetPolygon().GetBoundRect() ); + ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_POLYPOLYGON_ACTION ): + { + MetaPolyPolygonAction* pAct = (MetaPolyPolygonAction*) pAction; + Rectangle aRect( pAct->GetPolyPolygon().GetBoundRect() ); + ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_TEXT_ACTION ): + { + MetaTextAction* pAct = (MetaTextAction*) pAction; + Rectangle aRect; + // hdu said base = index + aMapVDev.GetTextBoundRect( aRect, pAct->GetText(), pAct->GetIndex(), pAct->GetIndex(), pAct->GetLen() ); + Point aPt( pAct->GetPoint() ); + aRect.Move( aPt.X(), aPt.Y() ); + ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_TEXTARRAY_ACTION ): + { + MetaTextArrayAction* pAct = (MetaTextArrayAction*) pAction; + Rectangle aRect; + // hdu said base = index + aMapVDev.GetTextBoundRect( aRect, pAct->GetText(), pAct->GetIndex(), pAct->GetIndex(), pAct->GetLen(), + 0, pAct->GetDXArray() ); + Point aPt( pAct->GetPoint() ); + aRect.Move( aPt.X(), aPt.Y() ); + ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_STRETCHTEXT_ACTION ): + { + MetaStretchTextAction* pAct = (MetaStretchTextAction*) pAction; + Rectangle aRect; + // hdu said base = index + aMapVDev.GetTextBoundRect( aRect, pAct->GetText(), pAct->GetIndex(), pAct->GetIndex(), pAct->GetLen(), + pAct->GetWidth(), NULL ); + Point aPt( pAct->GetPoint() ); + aRect.Move( aPt.X(), aPt.Y() ); + ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_TEXTLINE_ACTION ): + { + MetaTextLineAction* pAct = (MetaTextLineAction*) pAction; + // measure a test string to get ascend and descent right + static const sal_Unicode pStr[] = { 0xc4, 0x67, 0 }; + String aStr( pStr ); + + Rectangle aRect; + aMapVDev.GetTextBoundRect( aRect, aStr, 0, 0, aStr.Len(), 0, NULL ); + Point aPt( pAct->GetStartPoint() ); + aRect.Move( aPt.X(), aPt.Y() ); + aRect.Right() = aRect.Left() + pAct->GetWidth(); + ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_BMPSCALE_ACTION ): + { + MetaBmpScaleAction* pAct = (MetaBmpScaleAction*) pAction; + Rectangle aRect( pAct->GetPoint(), pAct->GetSize() ); + ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_BMPSCALEPART_ACTION ): + { + MetaBmpScalePartAction* pAct = (MetaBmpScalePartAction*) pAction; + Rectangle aRect( pAct->GetDestPoint(), pAct->GetDestSize() ); + ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_BMPEXSCALE_ACTION ): + { + MetaBmpExScaleAction* pAct = (MetaBmpExScaleAction*) pAction; + Rectangle aRect( pAct->GetPoint(), pAct->GetSize() ); + ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_BMPEXSCALEPART_ACTION ): + { + MetaBmpExScalePartAction* pAct = (MetaBmpExScalePartAction*) pAction; + Rectangle aRect( pAct->GetDestPoint(), pAct->GetDestSize() ); + ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_GRADIENT_ACTION ): + { + MetaGradientAction* pAct = (MetaGradientAction*) pAction; + Rectangle aRect( pAct->GetRect() ); + ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_GRADIENTEX_ACTION ): + { + MetaGradientExAction* pAct = (MetaGradientExAction*) pAction; + Rectangle aRect( pAct->GetPolyPolygon().GetBoundRect() ); + ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_COMMENT_ACTION ): + { + // nothing to do + }; + break; + + case( META_HATCH_ACTION ): + { + MetaHatchAction* pAct = (MetaHatchAction*) pAction; + Rectangle aRect( pAct->GetPolyPolygon().GetBoundRect() ); + ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_TRANSPARENT_ACTION ): + { + MetaTransparentAction* pAct = (MetaTransparentAction*) pAction; + Rectangle aRect( pAct->GetPolyPolygon().GetBoundRect() ); + ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_FLOATTRANSPARENT_ACTION ): + { + MetaFloatTransparentAction* pAct = (MetaFloatTransparentAction*) pAction; + GDIMetaFile aTransMtf( pAct->GetGDIMetaFile() ); + // get the bound rect of the contained metafile + Rectangle aRect( aTransMtf.GetBoundRect( i_rReference ) ); + // scale the rect now on the assumption that the correct top left of the metafile + // (not its bounds !) is (0,0) + Size aPSize( aTransMtf.GetPrefSize() ); + aPSize = aMapVDev.LogicToLogic( aPSize, aTransMtf.GetPrefMapMode(), aMapVDev.GetMapMode() ); + Size aActSize( pAct->GetSize() ); + double fX = double(aActSize.Width())/double(aPSize.Width()); + double fY = double(aActSize.Height())/double(aPSize.Height()); + aRect.Left() = long(double(aRect.Left())*fX); + aRect.Right() = long(double(aRect.Right())*fX); + aRect.Top() = long(double(aRect.Top())*fY); + aRect.Bottom() = long(double(aRect.Bottom())*fY); + + // transform the rect to current VDev state + aRect = aMapVDev.LogicToLogic( aRect, aTransMtf.GetPrefMapMode(), aMapVDev.GetMapMode() ); + + ImplActionBounds( aBound, aRect, aClipStack ); + } + break; + + case( META_EPS_ACTION ): + { + MetaEPSAction* pAct = (MetaEPSAction*) pAction; + Rectangle aRect( pAct->GetPoint(), pAct->GetSize() ); + ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_CLIPREGION_ACTION ): + { + MetaClipRegionAction* pAct = (MetaClipRegionAction*) pAction; + if( pAct->IsClipping() ) + aClipStack.back() = aMapVDev.LogicToLogic( pAct->GetRegion().GetBoundRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ); + else + aClipStack.back() = Rectangle(); + } + break; + + case( META_ISECTRECTCLIPREGION_ACTION ): + { + MetaISectRectClipRegionAction* pAct = (MetaISectRectClipRegionAction*) pAction; + Rectangle aRect( aMapVDev.LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ) ); + if( aClipStack.back().IsEmpty() ) + aClipStack.back() = aRect; + else + aClipStack.back().Intersection( aRect ); + } + break; + + case( META_ISECTREGIONCLIPREGION_ACTION ): + { + MetaISectRegionClipRegionAction* pAct = (MetaISectRegionClipRegionAction*) pAction; + Rectangle aRect( aMapVDev.LogicToLogic( pAct->GetRegion().GetBoundRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ) ); + if( aClipStack.back().IsEmpty() ) + aClipStack.back() = aRect; + else + aClipStack.back().Intersection( aRect ); + } + break; + + case( META_BMP_ACTION ): + { + MetaBmpAction* pAct = (MetaBmpAction*) pAction; + Rectangle aRect( pAct->GetPoint(), aMapVDev.PixelToLogic( pAct->GetBitmap().GetSizePixel() ) ); + ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_BMPEX_ACTION ): + { + MetaBmpExAction* pAct = (MetaBmpExAction*) pAction; + Rectangle aRect( pAct->GetPoint(), aMapVDev.PixelToLogic( pAct->GetBitmapEx().GetSizePixel() ) ); + ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_MASK_ACTION ): + { + MetaMaskAction* pAct = (MetaMaskAction*) pAction; + Rectangle aRect( pAct->GetPoint(), aMapVDev.PixelToLogic( pAct->GetBitmap().GetSizePixel() ) ); + ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_MASKSCALE_ACTION ): + { + MetaMaskScalePartAction* pAct = (MetaMaskScalePartAction*) pAction; + Rectangle aRect( pAct->GetDestPoint(), pAct->GetDestSize() ); + ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_MASKSCALEPART_ACTION ): + { + MetaMaskScalePartAction* pAct = (MetaMaskScalePartAction*) pAction; + Rectangle aRect( pAct->GetDestPoint(), pAct->GetDestSize() ); + ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_WALLPAPER_ACTION ): + { + MetaWallpaperAction* pAct = (MetaWallpaperAction*) pAction; + Rectangle aRect( pAct->GetRect() ); + ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_TEXTRECT_ACTION ): + { + MetaTextRectAction* pAct = (MetaTextRectAction*) pAction; + Rectangle aRect( pAct->GetRect() ); + ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack ); + } + break; + + case( META_MOVECLIPREGION_ACTION ): + { + MetaMoveClipRegionAction* pAct = (MetaMoveClipRegionAction*) pAction; + if( ! aClipStack.back().IsEmpty() ) + { + Size aDelta( pAct->GetHorzMove(), pAct->GetVertMove() ); + aDelta = aMapVDev.LogicToLogic( aDelta, aMapVDev.GetMapMode(), GetPrefMapMode() ); + aClipStack.back().Move( aDelta.Width(), aDelta.Width() ); + } + } + break; + + default: + { + pAction->Execute( &aMapVDev ); + + if( nActionType == META_PUSH_ACTION ) + { + MetaPushAction* pAct = (MetaPushAction*) pAction; + aPushFlagStack.push_back( pAct->GetFlags() ); + if( (aPushFlagStack.back() & PUSH_CLIPREGION) != 0 ) + { + Rectangle aRect( aClipStack.back() ); + aClipStack.push_back( aRect ); + } + } + else if( nActionType == META_POP_ACTION ) + { + // sanity check + if( ! aPushFlagStack.empty() ) + { + if( (aPushFlagStack.back() & PUSH_CLIPREGION) != 0 ) + { + if( aClipStack.size() > 1 ) + aClipStack.pop_back(); + } + aPushFlagStack.pop_back(); + } + } + } + break; + } + } + return aBound; +} + +// ------------------------------------------------------------------------ + Color GDIMetaFile::ImplColAdjustFnc( const Color& rColor, const void* pColParam ) { return Color( rColor.GetTransparency(), diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk index 977e5386fe97..4d0ded320060 100644 --- a/vcl/source/gdi/makefile.mk +++ b/vcl/source/gdi/makefile.mk @@ -137,6 +137,7 @@ EXCEPTIONSFILES= $(SLO)$/salmisc.obj \ $(SLO)$/pngwrite.obj \ $(SLO)$/virdev.obj \ $(SLO)$/impprn.obj \ + $(SLO)$/gdimtf.obj \ $(SLO)$/graphictools.obj diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 537964582ceb..9d876c7bdcb5 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -7919,8 +7919,8 @@ BOOL OutputDevice::GetGlyphBoundRects( const Point& rOrigin, const String& rStr, // ----------------------------------------------------------------------- BOOL OutputDevice::GetTextBoundRect( Rectangle& rRect, - const String& rStr, xub_StrLen nBase, xub_StrLen nIndex, - xub_StrLen nLen ) const + const String& rStr, xub_StrLen nBase, xub_StrLen nIndex, xub_StrLen nLen, + ULONG nLayoutWidth, const sal_Int32* pDXAry ) const { DBG_TRACE( "OutputDevice::GetTextBoundRect()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -7929,13 +7929,14 @@ BOOL OutputDevice::GetTextBoundRect( Rectangle& rRect, rRect.SetEmpty(); SalLayout* pSalLayout = NULL; + const Point aPoint; // calculate offset when nBase!=nIndex long nXOffset = 0; if( nBase != nIndex ) { xub_StrLen nStart = Min( nBase, nIndex ); xub_StrLen nOfsLen = Max( nBase, nIndex ) - nStart; - pSalLayout = ImplLayout( rStr, nStart, nOfsLen ); + pSalLayout = ImplLayout( rStr, nStart, nOfsLen, aPoint, nLayoutWidth, pDXAry ); if( pSalLayout ) { nXOffset = pSalLayout->GetTextWidth(); @@ -7947,7 +7948,7 @@ BOOL OutputDevice::GetTextBoundRect( Rectangle& rRect, } } - pSalLayout = ImplLayout( rStr, nIndex, nLen ); + pSalLayout = ImplLayout( rStr, nIndex, nLen, aPoint, nLayoutWidth, pDXAry ); Rectangle aPixelRect; if( pSalLayout ) { @@ -7997,7 +7998,7 @@ BOOL OutputDevice::GetTextBoundRect( Rectangle& rRect, aVDev.SetTextAlign( ALIGN_TOP ); // layout the text on the virtual device - pSalLayout = aVDev.ImplLayout( rStr, nIndex, nLen ); + pSalLayout = aVDev.ImplLayout( rStr, nIndex, nLen, aPoint, nLayoutWidth, pDXAry ); if( !pSalLayout ) return false; @@ -8097,7 +8098,7 @@ BOOL OutputDevice::GetTextBoundRect( Rectangle& rRect, BOOL OutputDevice::GetTextOutlines( ::basegfx::B2DPolyPolygonVector& rVector, const String& rStr, xub_StrLen nBase, xub_StrLen nIndex, xub_StrLen nLen, - BOOL bOptimize, const ULONG nTWidth, const sal_Int32* pDXArray ) const + BOOL bOptimize, ULONG nTWidth, const sal_Int32* pDXArray ) const { // the fonts need to be initialized if( mbNewFont ) @@ -8326,7 +8327,7 @@ BOOL OutputDevice::GetTextOutlines( ::basegfx::B2DPolyPolygonVector& rVector, BOOL OutputDevice::GetTextOutlines( PolyPolyVector& rResultVector, const String& rStr, xub_StrLen nBase, xub_StrLen nIndex, - xub_StrLen nLen, BOOL bOptimize, const ULONG nTWidth, const sal_Int32* pDXArray ) const + xub_StrLen nLen, BOOL bOptimize, ULONG nTWidth, const sal_Int32* pDXArray ) const { rResultVector.clear(); @@ -8349,7 +8350,7 @@ BOOL OutputDevice::GetTextOutlines( PolyPolyVector& rResultVector, BOOL OutputDevice::GetTextOutline( PolyPolygon& rPolyPoly, const String& rStr, xub_StrLen nBase, xub_StrLen nIndex, xub_StrLen nLen, - BOOL bOptimize, const ULONG nTWidth, const sal_Int32* pDXArray ) const + BOOL bOptimize, ULONG nTWidth, const sal_Int32* pDXArray ) const { rPolyPoly.Clear(); diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index c827905e94e6..ccf75dbd59b3 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -3480,11 +3480,6 @@ USHORT PopupMenu::Execute( Window* pExecWindow, const Rectangle& rRect, USHORT n USHORT PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, ULONG nPopupModeFlags, Menu* pSFrom, BOOL bPreSelectFirst ) { - - // #59614# Mit TH abgesprochen dass die ASSERTION raus kommt, - // weil es evtl. legitim ist... -// DBG_ASSERT( !PopupMenu::IsInExecute() || pSFrom, "PopupMenu::Execute() called in PopupMenu::Execute()" ); - if ( !pSFrom && ( PopupMenu::IsInExecute() || !GetItemCount() ) ) return 0; @@ -3660,8 +3655,16 @@ USHORT PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, ULONG nPopupM { pWin->ImplAddDel( &aDelData ); + ImplDelData aModalWinDel; + pW->ImplAddDel( &aModalWinDel ); + pW->ImplIncModalCount(); + pWin->Execute(); + DBG_ASSERT( ! aModalWinDel.IsDead(), "window for popup died, modal count incorrect !" ); + if( ! aModalWinDel.IsDead() ) + pW->ImplDecModalCount(); + if ( !aDelData.IsDelete() ) pWin->ImplRemoveDel( &aDelData ); else diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index 9dbb218403d0..fdaa102c614b 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -454,6 +454,10 @@ void GtkData::deInitNWF( void ) gtk_widget_destroy( gWidgetData[i].gMenuWidget ); if( gWidgetData[i].gTooltipPopup ) gtk_widget_destroy( gWidgetData[i].gTooltipPopup ); + delete gWidgetData[i].gCacheTabPages; + gWidgetData[i].gCacheTabPages = NULL; + delete gWidgetData[i].gCacheTabItems; + gWidgetData[i].gCacheTabItems = NULL; delete gWidgetData[i].gNWPixmapCacheList; gWidgetData[i].gNWPixmapCacheList = NULL; } diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index 57f48df66c3c..b6770ca1a77e 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -834,7 +834,7 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) } if( (nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ) ) { - eType = GDK_WINDOW_TYPE_HINT_DOCK; + eType = GDK_WINDOW_TYPE_HINT_TOOLBAR; gtk_window_set_keep_above( GTK_WINDOW(m_pWindow), true ); } diff --git a/vcl/unx/source/window/salframe.cxx b/vcl/unx/source/window/salframe.cxx index 22e43999caa6..04eb9cd32771 100644 --- a/vcl/unx/source/window/salframe.cxx +++ b/vcl/unx/source/window/salframe.cxx @@ -72,6 +72,7 @@ #include "tools/debug.hxx" #include "sal/alloca.h" +#include <com/sun/star/uno/Exception.hpp> #include <algorithm> @@ -425,15 +426,26 @@ void X11SalFrame::Init( ULONG nSalFrameStyle, int nScreen, SystemParentData* pPa if( IsOverrideRedirect() ) Attributes.override_redirect = True; // default icon - if( (nStyle_ & SAL_FRAME_STYLE_INTRO) == 0 && - SelectAppIconPixmap( pDisplay_, m_nScreen, - mnIconID != 1 ? mnIconID : - (mpParent ? mpParent->mnIconID : 1), 32, - Hints.icon_pixmap, Hints.icon_mask )) + if( (nStyle_ & SAL_FRAME_STYLE_INTRO) == 0 ) { - Hints.flags |= IconPixmapHint; - if( Hints.icon_mask ) - Hints.flags |= IconMaskHint; + bool bOk=false; + try + { + bOk=SelectAppIconPixmap( pDisplay_, m_nScreen, + mnIconID != 1 ? mnIconID : + (mpParent ? mpParent->mnIconID : 1), 32, + Hints.icon_pixmap, Hints.icon_mask ); + } + catch( com::sun::star::uno::Exception& ) + { + // can happen - no ucb during early startup + } + if( bOk ) + { + Hints.flags |= IconPixmapHint; + if( Hints.icon_mask ) + Hints.flags |= IconMaskHint; + } } // find the top level frame of the transience hierarchy diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 57ad272bcf51..3ffc358bd76d 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: salframe.cxx,v $ - * $Revision: 1.157.20.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -355,11 +352,9 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, { OUString aLibraryName( RTL_CONSTASCII_USTRINGPARAM( "user32" ) ); oslModule pLib = osl_loadModule( aLibraryName.pData, SAL_LOADMODULE_DEFAULT ); - void *pFunc = NULL; + oslGenericFunction pFunc = NULL; if( pLib ) - { pFunc = osl_getAsciiFunctionSymbol( pLib, "SetLayeredWindowAttributes" ); - } lpfnSetLayeredWindowAttributes = ( SetLayeredWindowAttributes_Proc_T ) pFunc; @@ -3155,7 +3150,8 @@ void WinSalFrame::Beep( SoundType eSoundType ) MB_ICONQUESTION // SOUND_QUERY }; - MessageBeep( aImplSoundTab[eSoundType] ); + if( eSoundType != SOUND_DISABLE ) // don't beep on disable + MessageBeep( aImplSoundTab[eSoundType] ); } // ----------------------------------------------------------------------- |