diff options
author | Jan Holesovsky <kendy@suse.cz> | 2011-03-18 15:55:08 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2011-03-18 15:55:08 +0100 |
commit | 4fdd55226d2972e3a256426db3122ac23b0615c6 (patch) | |
tree | 23f5b3a68382d6d3b8db0cb5e2537ed74a228d7c /vcl/aqua/source | |
parent | c3d5444d84e18fa82235bb9d419861ac5e54f544 (diff) | |
parent | e1028d9225bc47922c387aa462887c7643bc6c40 (diff) |
Merge remote-tracking branch 'origin/integration/dev300_m101'
Conflicts:
comphelper/source/misc/servicedecl.cxx
i18npool/source/breakiterator/breakiteratorImpl.cxx
l10ntools/scripts/localize.pl
svl/source/items/itemset.cxx
svl/source/memtools/svarray.cxx
svl/source/numbers/zformat.cxx
svtools/source/brwbox/brwbox1.cxx
tools/source/stream/strmwnt.cxx
vcl/inc/vcl/graphite_adaptors.hxx
vcl/inc/vcl/graphite_layout.hxx
vcl/inc/vcl/graphite_serverfont.hxx
vcl/source/control/imgctrl.cxx
vcl/source/gdi/outdev.cxx
vcl/source/gdi/outdev3.cxx
vcl/source/glyphs/gcach_ftyp.cxx
vcl/source/glyphs/graphite_adaptors.cxx
vcl/source/glyphs/graphite_layout.cxx
vcl/source/window/winproc.cxx
vcl/unx/source/fontmanager/fontconfig.cxx
Diffstat (limited to 'vcl/aqua/source')
41 files changed, 1183 insertions, 747 deletions
diff --git a/vcl/aqua/source/a11y/aqua11ycomponentwrapper.h b/vcl/aqua/source/a11y/aqua11ycomponentwrapper.h index 3968e71f4992..f7ec6e513fa7 100644 --- a/vcl/aqua/source/a11y/aqua11ycomponentwrapper.h +++ b/vcl/aqua/source/a11y/aqua11ycomponentwrapper.h @@ -39,7 +39,7 @@ +(id)positionAttributeForElement:(AquaA11yWrapper *)wrapper; +(id)descriptionAttributeForElement:(AquaA11yWrapper *)wrapper; +(void)addAttributeNamesTo:(NSMutableArray *)attributeNames; -+(MacOSBOOL)isAttributeSettable:(NSString *)attribute forElement:(AquaA11yWrapper *)wrapper; ++(BOOL)isAttributeSettable:(NSString *)attribute forElement:(AquaA11yWrapper *)wrapper; +(void)setFocusedAttributeForElement:(AquaA11yWrapper *)wrapper to:(id)value; @end diff --git a/vcl/aqua/source/a11y/aqua11ycomponentwrapper.mm b/vcl/aqua/source/a11y/aqua11ycomponentwrapper.mm index a700b0b89ae9..c66e7c3d8515 100644 --- a/vcl/aqua/source/a11y/aqua11ycomponentwrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ycomponentwrapper.mm @@ -75,8 +75,8 @@ using namespace ::com::sun::star::uno; [ pool release ]; } -+(MacOSBOOL)isAttributeSettable:(NSString *)attribute forElement:(AquaA11yWrapper *)wrapper { - MacOSBOOL isSettable = NO; ++(BOOL)isAttributeSettable:(NSString *)attribute forElement:(AquaA11yWrapper *)wrapper { + BOOL isSettable = NO; NSAutoreleasePool * pool = [ [ NSAutoreleasePool alloc ] init ]; if ( [ attribute isEqualToString: NSAccessibilityFocusedAttribute ] && ! [ [ AquaA11yRoleHelper getNativeRoleFrom: [ wrapper accessibleContext ] ] isEqualToString: NSAccessibilityScrollBarRole ] diff --git a/vcl/aqua/source/a11y/aqua11yfactory.mm b/vcl/aqua/source/a11y/aqua11yfactory.mm index 7732ce202cd2..5dcdf4bb9f61 100644 --- a/vcl/aqua/source/a11y/aqua11yfactory.mm +++ b/vcl/aqua/source/a11y/aqua11yfactory.mm @@ -95,11 +95,11 @@ static bool enabled = false; return [ AquaA11yFactory wrapperForAccessibleContext: rxAccessibleContext createIfNotExists: YES asRadioGroup: NO ]; } -+(AquaA11yWrapper *)wrapperForAccessibleContext: (Reference < XAccessibleContext >) rxAccessibleContext createIfNotExists:(MacOSBOOL) bCreate { ++(AquaA11yWrapper *)wrapperForAccessibleContext: (Reference < XAccessibleContext >) rxAccessibleContext createIfNotExists:(BOOL) bCreate { return [ AquaA11yFactory wrapperForAccessibleContext: rxAccessibleContext createIfNotExists: bCreate asRadioGroup: NO ]; } -+(AquaA11yWrapper *)wrapperForAccessibleContext: (Reference < XAccessibleContext >) rxAccessibleContext createIfNotExists:(MacOSBOOL) bCreate asRadioGroup:(MacOSBOOL) asRadioGroup{ ++(AquaA11yWrapper *)wrapperForAccessibleContext: (Reference < XAccessibleContext >) rxAccessibleContext createIfNotExists:(BOOL) bCreate asRadioGroup:(BOOL) asRadioGroup{ NSMutableDictionary * dAllWrapper = [ AquaA11yFactory allWrapper ]; NSValue * nKey = nil; if ( asRadioGroup ) { diff --git a/vcl/aqua/source/a11y/aqua11yselectionwrapper.h b/vcl/aqua/source/a11y/aqua11yselectionwrapper.h index 56a77ae9b728..0585f01c9360 100644 --- a/vcl/aqua/source/a11y/aqua11yselectionwrapper.h +++ b/vcl/aqua/source/a11y/aqua11yselectionwrapper.h @@ -37,7 +37,7 @@ } +(id)selectedChildrenAttributeForElement:(AquaA11yWrapper *)wrapper; +(void)addAttributeNamesTo:(NSMutableArray *)attributeNames; -+(MacOSBOOL)isAttributeSettable:(NSString *)attribute forElement:(AquaA11yWrapper *)wrapper; ++(BOOL)isAttributeSettable:(NSString *)attribute forElement:(AquaA11yWrapper *)wrapper; +(void)setSelectedChildrenAttributeForElement:(AquaA11yWrapper *)wrapper to:(id)value; @end diff --git a/vcl/aqua/source/a11y/aqua11yselectionwrapper.mm b/vcl/aqua/source/a11y/aqua11yselectionwrapper.mm index 81f203da5d68..66f19b80a9f9 100644 --- a/vcl/aqua/source/a11y/aqua11yselectionwrapper.mm +++ b/vcl/aqua/source/a11y/aqua11yselectionwrapper.mm @@ -65,7 +65,7 @@ using namespace ::com::sun::star::uno; [ attributeNames addObject: NSAccessibilitySelectedChildrenAttribute ]; } -+(MacOSBOOL)isAttributeSettable:(NSString *)attribute forElement:(AquaA11yWrapper *)wrapper ++(BOOL)isAttributeSettable:(NSString *)attribute forElement:(AquaA11yWrapper *)wrapper { if ( [ attribute isEqualToString: NSAccessibilitySelectedChildrenAttribute ] ) { diff --git a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm index 7bee05d49ce6..f0d0e46a517e 100644 --- a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm @@ -77,8 +77,8 @@ using namespace ::rtl; return italicStyle; } -+(MacOSBOOL)isStrikethrough:(PropertyValue)property { - MacOSBOOL strikethrough = NO; ++(BOOL)isStrikethrough:(PropertyValue)property { + BOOL strikethrough = NO; sal_Int16 value = 0; property.Value >>= value; if ( value != FontStrikeout::NONE @@ -88,8 +88,8 @@ using namespace ::rtl; return strikethrough; } -+(MacOSBOOL)convertBoolean:(PropertyValue)property { - MacOSBOOL myBoolean = NO; ++(BOOL)convertBoolean:(PropertyValue)property { + BOOL myBoolean = NO; bool value = sal_False; property.Value >>= value; if ( value ) { @@ -149,7 +149,7 @@ using namespace ::rtl; int fonttraits = 0; float fontsize = 0.0; sal_Int32 underlineColor = 0; - MacOSBOOL underlineHasColor = NO; + BOOL underlineHasColor = NO; // add attributes to string for ( int attrIndex = 0; attrIndex < attributes.getLength(); attrIndex++ ) { PropertyValue property = attributes [ attrIndex ]; diff --git a/vcl/aqua/source/a11y/aqua11ytextwrapper.h b/vcl/aqua/source/a11y/aqua11ytextwrapper.h index c793ae01a69e..ceb9bcbe393d 100644 --- a/vcl/aqua/source/a11y/aqua11ytextwrapper.h +++ b/vcl/aqua/source/a11y/aqua11ytextwrapper.h @@ -55,7 +55,7 @@ +(void)addParameterizedAttributeNamesTo:(NSMutableArray *)attributeNames; +(NSArray *)specialAttributeNames; +(NSArray *)specialParameterizedAttributeNames; -+(MacOSBOOL)isAttributeSettable:(NSString *)attribute forElement:(AquaA11yWrapper *)wrapper; ++(BOOL)isAttributeSettable:(NSString *)attribute forElement:(AquaA11yWrapper *)wrapper; +(void)setVisibleCharacterRangeAttributeForElement:(AquaA11yWrapper *)wrapper to:(id)value; +(void)setSelectedTextRangeAttributeForElement:(AquaA11yWrapper *)wrapper to:(id)value; +(void)setSelectedTextAttributeForElement:(AquaA11yWrapper *)wrapper to:(id)value; diff --git a/vcl/aqua/source/a11y/aqua11ytextwrapper.mm b/vcl/aqua/source/a11y/aqua11ytextwrapper.mm index 2033135564d8..89c164e5e0b9 100644 --- a/vcl/aqua/source/a11y/aqua11ytextwrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ytextwrapper.mm @@ -273,8 +273,8 @@ using namespace ::rtl; return rtfData; } -+(MacOSBOOL)isAttributeSettable:(NSString *)attribute forElement:(AquaA11yWrapper *)wrapper { - MacOSBOOL isSettable = NO; ++(BOOL)isAttributeSettable:(NSString *)attribute forElement:(AquaA11yWrapper *)wrapper { + BOOL isSettable = NO; if ( [ attribute isEqualToString: NSAccessibilityValueAttribute ] || [ attribute isEqualToString: NSAccessibilitySelectedTextAttribute ] || [ attribute isEqualToString: NSAccessibilitySelectedTextRangeAttribute ] diff --git a/vcl/aqua/source/a11y/aqua11yvaluewrapper.h b/vcl/aqua/source/a11y/aqua11yvaluewrapper.h index 6b92718cc808..1292ef5ab77b 100644 --- a/vcl/aqua/source/a11y/aqua11yvaluewrapper.h +++ b/vcl/aqua/source/a11y/aqua11yvaluewrapper.h @@ -40,7 +40,7 @@ +(id)minValueAttributeForElement:(AquaA11yWrapper *)wrapper; +(id)maxValueAttributeForElement:(AquaA11yWrapper *)wrapper; +(void)addAttributeNamesTo:(NSMutableArray *)attributeNames; -+(MacOSBOOL)isAttributeSettable:(NSString *)attribute forElement:(AquaA11yWrapper *)wrapper; ++(BOOL)isAttributeSettable:(NSString *)attribute forElement:(AquaA11yWrapper *)wrapper; +(void)setValueAttributeForElement:(AquaA11yWrapper *)wrapper to:(id)value; @end diff --git a/vcl/aqua/source/a11y/aqua11yvaluewrapper.mm b/vcl/aqua/source/a11y/aqua11yvaluewrapper.mm index 85ef0041da95..fb257921b13e 100644 --- a/vcl/aqua/source/a11y/aqua11yvaluewrapper.mm +++ b/vcl/aqua/source/a11y/aqua11yvaluewrapper.mm @@ -82,8 +82,8 @@ using namespace ::com::sun::star::uno; [ attributeNames addObject: NSAccessibilityValueAttribute ]; } -+(MacOSBOOL)isAttributeSettable:(NSString *)attribute forElement:(AquaA11yWrapper *)wrapper { - MacOSBOOL isSettable = NO; ++(BOOL)isAttributeSettable:(NSString *)attribute forElement:(AquaA11yWrapper *)wrapper { + BOOL isSettable = NO; if ( [ wrapper accessibleValue ] != nil && [ attribute isEqualToString: NSAccessibilityValueAttribute ] && ! [ wrapper isKindOfClass: [ AquaA11yWrapperStaticText class ] ] ) { diff --git a/vcl/aqua/source/a11y/aqua11ywrapper.mm b/vcl/aqua/source/a11y/aqua11ywrapper.mm index e86676e725f2..c2724a372f9f 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapper.mm @@ -63,7 +63,7 @@ using namespace ::com::sun::star::uno; -(Reference<XAccessibleContext>)accessibleContext; @end -static MacOSBOOL isPopupMenuOpen = NO; +static BOOL isPopupMenuOpen = NO; @implementation AquaA11yWrapper : NSView @@ -154,7 +154,7 @@ static MacOSBOOL isPopupMenuOpen = NO; // (getter without parameter) attributeNameHereAttribute // (getter with parameter) attributeNameHereAttributeForParameter: // (setter) setAttributeNameHereAttributeForElement:to: --(SEL)selectorForAttribute:(NSString *)attribute asGetter:(MacOSBOOL)asGetter withGetterParameter:(MacOSBOOL)withGetterParameter { +-(SEL)selectorForAttribute:(NSString *)attribute asGetter:(BOOL)asGetter withGetterParameter:(BOOL)withGetterParameter { SEL selector = nil; NSAutoreleasePool * pool = [ [ NSAutoreleasePool alloc ] init ]; @try { @@ -197,7 +197,7 @@ static MacOSBOOL isPopupMenuOpen = NO; return Reference < XAccessible > (); } --(MacOSBOOL)isFirstRadioButtonInGroup { +-(BOOL)isFirstRadioButtonInGroup { Reference < XAccessible > rFirstMateAccessible = [ self getFirstRadioButtonInGroup ]; if ( rFirstMateAccessible.is() && rFirstMateAccessible -> getAccessibleContext().get() == [ self accessibleContext ] ) { return YES; @@ -693,12 +693,12 @@ static MacOSBOOL isPopupMenuOpen = NO; return value; } --(MacOSBOOL)accessibilityIsIgnored { +-(BOOL)accessibilityIsIgnored { // #i90575# guard NSAccessibility protocol against unwanted access if ( isPopupMenuOpen ) { return nil; } - MacOSBOOL ignored = NO; + BOOL ignored = NO; sal_Int16 nRole = [ self accessibleContext ] -> getAccessibleRole(); switch ( nRole ) { case AccessibleRole::PANEL: @@ -796,8 +796,8 @@ static MacOSBOOL isPopupMenuOpen = NO; } } --(MacOSBOOL)accessibilityIsAttributeSettable:(NSString *)attribute { - MacOSBOOL isSettable = NO; +-(BOOL)accessibilityIsAttributeSettable:(NSString *)attribute { + BOOL isSettable = NO; if ( [ self accessibleText ] != nil ) { isSettable = [ AquaA11yTextWrapper isAttributeSettable: attribute forElement: self ]; } @@ -830,7 +830,7 @@ static MacOSBOOL isPopupMenuOpen = NO; return nil; // TODO: to be completed } --(MacOSBOOL)accessibilitySetOverrideValue:(id)value forAttribute:(NSString *)attribute { +-(BOOL)accessibilitySetOverrideValue:(id)value forAttribute:(NSString *)attribute { return NO; // TODO } @@ -904,7 +904,7 @@ static MacOSBOOL isPopupMenuOpen = NO; // get some information NSString * role = (NSString *) [ self accessibilityAttributeValue: NSAccessibilityRoleAttribute ]; id enabledAttr = [ self enabledAttribute ]; - MacOSBOOL enabled = [ enabledAttr boolValue ]; + BOOL enabled = [ enabledAttr boolValue ]; NSView * parent = (NSView *) [ self accessibilityAttributeValue: NSAccessibilityParentAttribute ]; AquaA11yWrapper * parentAsWrapper = nil; if ( [ parent isKindOfClass: [ AquaA11yWrapper class ] ] ) { @@ -947,8 +947,8 @@ static MacOSBOOL isPopupMenuOpen = NO; #pragma mark - #pragma mark Hit Test --(MacOSBOOL)isViewElement:(NSObject *)viewElement hitByPoint:(NSPoint)point { - MacOSBOOL hit = NO; +-(BOOL)isViewElement:(NSObject *)viewElement hitByPoint:(NSPoint)point { + BOOL hit = NO; NSAutoreleasePool * pool = [ [ NSAutoreleasePool alloc ] init ]; NSValue * position = [ viewElement accessibilityAttributeValue: NSAccessibilityPositionAttribute ]; NSValue * size = [ viewElement accessibilityAttributeValue: NSAccessibilitySizeAttribute ]; @@ -1127,15 +1127,15 @@ Reference < XAccessibleContext > hitTestRunner ( com::sun::star::awt::Point poin return mDefaultFontsize; } --(void)setActsAsRadioGroup:(MacOSBOOL)actsAsRadioGroup { +-(void)setActsAsRadioGroup:(BOOL)actsAsRadioGroup { mActsAsRadioGroup = actsAsRadioGroup; } --(MacOSBOOL)actsAsRadioGroup { +-(BOOL)actsAsRadioGroup { return mActsAsRadioGroup; } -+(void)setPopupMenuOpen:(MacOSBOOL)popupMenuOpen { ++(void)setPopupMenuOpen:(BOOL)popupMenuOpen { isPopupMenuOpen = popupMenuOpen; } diff --git a/vcl/aqua/source/a11y/aqua11ywrappercheckbox.h b/vcl/aqua/source/a11y/aqua11ywrappercheckbox.h index e689e829a6e2..192e528e930d 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappercheckbox.h +++ b/vcl/aqua/source/a11y/aqua11ywrappercheckbox.h @@ -35,7 +35,7 @@ { } -(id)valueAttribute; --(MacOSBOOL)accessibilityIsAttributeSettable:(NSString *)attribute; +-(BOOL)accessibilityIsAttributeSettable:(NSString *)attribute; -(NSArray *)accessibilityAttributeNames; @end diff --git a/vcl/aqua/source/a11y/aqua11ywrappercheckbox.mm b/vcl/aqua/source/a11y/aqua11ywrappercheckbox.mm index c4ac34dc5bce..25f012e1163f 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappercheckbox.mm +++ b/vcl/aqua/source/a11y/aqua11ywrappercheckbox.mm @@ -44,7 +44,7 @@ return [ NSNumber numberWithInt: 0 ]; } --(MacOSBOOL)accessibilityIsAttributeSettable:(NSString *)attribute { +-(BOOL)accessibilityIsAttributeSettable:(NSString *)attribute { if ( [ attribute isEqualToString: NSAccessibilityValueAttribute ] ) { return NO; } diff --git a/vcl/aqua/source/a11y/aqua11ywrappercombobox.h b/vcl/aqua/source/a11y/aqua11ywrappercombobox.h index ea58a227ed95..5ca5c967234f 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappercombobox.h +++ b/vcl/aqua/source/a11y/aqua11ywrappercombobox.h @@ -43,7 +43,7 @@ -(id)selectedTextRangeAttribute; -(id)visibleCharacterRangeAttribute; // Accessibility Protocol --(MacOSBOOL)accessibilityIsAttributeSettable:(NSString *)attribute; +-(BOOL)accessibilityIsAttributeSettable:(NSString *)attribute; -(void)accessibilitySetValue:(id)value forAttribute:(NSString *)attribute; -(NSArray *)accessibilityAttributeNames; @end diff --git a/vcl/aqua/source/a11y/aqua11ywrappercombobox.mm b/vcl/aqua/source/a11y/aqua11ywrappercombobox.mm index 85aed320e470..16fa1372fe4e 100644 --- a/vcl/aqua/source/a11y/aqua11ywrappercombobox.mm +++ b/vcl/aqua/source/a11y/aqua11ywrappercombobox.mm @@ -117,7 +117,7 @@ using namespace ::com::sun::star::uno; #pragma mark - #pragma mark Accessibility Protocol --(MacOSBOOL)accessibilityIsAttributeSettable:(NSString *)attribute { +-(BOOL)accessibilityIsAttributeSettable:(NSString *)attribute { if ( [ self textArea ] != nil && ( [ attribute isEqualToString: NSAccessibilitySelectedTextAttribute ] || [ attribute isEqualToString: NSAccessibilitySelectedTextRangeAttribute ] diff --git a/vcl/aqua/source/a11y/aqua11ywrapperradiobutton.h b/vcl/aqua/source/a11y/aqua11ywrapperradiobutton.h index 6edc9b139b70..ac9e0e7022ff 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperradiobutton.h +++ b/vcl/aqua/source/a11y/aqua11ywrapperradiobutton.h @@ -35,7 +35,7 @@ { } -(id)valueAttribute; --(MacOSBOOL)accessibilityIsAttributeSettable:(NSString *)attribute; +-(BOOL)accessibilityIsAttributeSettable:(NSString *)attribute; -(NSArray *)accessibilityAttributeNames; @end diff --git a/vcl/aqua/source/a11y/aqua11ywrapperradiobutton.mm b/vcl/aqua/source/a11y/aqua11ywrapperradiobutton.mm index 54d6edac619a..930f940c4971 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapperradiobutton.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapperradiobutton.mm @@ -44,7 +44,7 @@ return [ NSNumber numberWithInt: 0 ]; } --(MacOSBOOL)accessibilityIsAttributeSettable:(NSString *)attribute { +-(BOOL)accessibilityIsAttributeSettable:(NSString *)attribute { if ( [ attribute isEqualToString: NSAccessibilityValueAttribute ] ) { return NO; } diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx index da5b92b7ff7f..20ac4e2251d6 100644 --- a/vcl/aqua/source/app/salinst.cxx +++ b/vcl/aqua/source/app/salinst.cxx @@ -73,7 +73,7 @@ using namespace std; using namespace ::com::sun::star; -extern BOOL ImplSVMain(); +extern sal_Bool ImplSVMain(); static int* gpnInit = 0; static NSMenu* pDockMenu = nil; @@ -209,7 +209,7 @@ static void initNSApp() [NSApp activateIgnoringOtherApps: YES]; } -BOOL ImplSVMainHook( int * pnInit ) +sal_Bool ImplSVMainHook( int * pnInit ) { gpnInit = pnInit; @@ -404,7 +404,7 @@ sal_Bool SalYieldMutex::tryToAcquire() // some convenience functions regarding the yield mutex, aka solar mutex -BOOL ImplSalYieldMutexTryToAcquire() +sal_Bool ImplSalYieldMutexTryToAcquire() { AquaSalInstance* pInst = (AquaSalInstance*) GetSalData()->mpFirstInstance; if ( pInst ) @@ -451,7 +451,7 @@ SalInstance* CreateSalInstance() ImplGetSVData()->maNWFData.mbCenteredTabs = true; ImplGetSVData()->maNWFData.mbProgressNeedsErase = true; ImplGetSVData()->maNWFData.mbCheckBoxNeedsErase = true; - ImplGetSVData()->maGDIData.mbPrinterPullModel = true; + ImplGetSVData()->maNWFData.mnStatusBarLowerRightOffset = 10; ImplGetSVData()->maGDIData.mbNoXORClipping = true; ImplGetSVData()->maWinData.mbNoSaveBackground = true; @@ -515,7 +515,7 @@ void AquaSalInstance::wakeupYield() // ----------------------------------------------------------------------- -void AquaSalInstance::PostUserEvent( AquaSalFrame* pFrame, USHORT nType, void* pData ) +void AquaSalInstance::PostUserEvent( AquaSalFrame* pFrame, sal_uInt16 nType, void* pData ) { osl_acquireMutex( maUserEventListMutex ); maUserEvents.push_back( SalUserEvent( pFrame, pData, nType ) ); @@ -534,14 +534,14 @@ osl::SolarMutex* AquaSalInstance::GetYieldMutex() // ----------------------------------------------------------------------- -ULONG AquaSalInstance::ReleaseYieldMutex() +sal_uLong AquaSalInstance::ReleaseYieldMutex() { SalYieldMutex* pYieldMutex = mpSalYieldMutex; if ( pYieldMutex->GetThreadId() == osl::Thread::getCurrentIdentifier() ) { - ULONG nCount = pYieldMutex->GetAcquireCount(); - ULONG n = nCount; + sal_uLong nCount = pYieldMutex->GetAcquireCount(); + sal_uLong n = nCount; while ( n ) { pYieldMutex->release(); @@ -556,7 +556,7 @@ ULONG AquaSalInstance::ReleaseYieldMutex() // ----------------------------------------------------------------------- -void AquaSalInstance::AcquireYieldMutex( ULONG nCount ) +void AquaSalInstance::AcquireYieldMutex( sal_uLong nCount ) { SalYieldMutex* pYieldMutex = mpSalYieldMutex; while ( nCount ) @@ -568,6 +568,21 @@ void AquaSalInstance::AcquireYieldMutex( ULONG nCount ) // ----------------------------------------------------------------------- +bool AquaSalInstance::CheckYieldMutex() +{ + bool bRet = true; + + SalYieldMutex* pYieldMutex = mpSalYieldMutex; + if ( pYieldMutex->GetThreadId() != osl::Thread::getCurrentIdentifier()) + { + bRet = false; + } + + return bRet; +} + +// ----------------------------------------------------------------------- + bool AquaSalInstance::isNSAppThread() const { return osl::Thread::getCurrentIdentifier() == maMainThread; @@ -697,7 +712,7 @@ void AquaSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) bool bDispatchUser = true; while( bDispatchUser ) { - ULONG nCount = ReleaseYieldMutex(); + sal_uLong nCount = ReleaseYieldMutex(); // get one user event osl_acquireMutex( maUserEventListMutex ); @@ -738,7 +753,7 @@ void AquaSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) bool bHadEvent = false; do { - ULONG nCount = ReleaseYieldMutex(); + sal_uLong nCount = ReleaseYieldMutex(); pEvent = [NSApp nextEventMatchingMask: NSAnyEventMask untilDate: nil inMode: NSDefaultRunLoopMode dequeue: YES]; @@ -755,7 +770,7 @@ void AquaSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) // if we had no event yet, wait for one if requested if( bWait && ! bHadEvent ) { - ULONG nCount = ReleaseYieldMutex(); + sal_uLong nCount = ReleaseYieldMutex(); NSDate* pDt = AquaSalTimer::pRunningTimer ? [AquaSalTimer::pRunningTimer fireDate] : [NSDate distantFuture]; pEvent = [NSApp nextEventMatchingMask: NSAnyEventMask untilDate: pDt @@ -799,7 +814,7 @@ void AquaSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) // has dispatched an event, cop out at 200 ms osl_resetCondition( maWaitingYieldCond ); TimeValue aVal = { 0, 200000000 }; - ULONG nCount = ReleaseYieldMutex(); + sal_uLong nCount = ReleaseYieldMutex(); osl_waitCondition( maWaitingYieldCond, &aVal ); AcquireYieldMutex( nCount ); } @@ -830,7 +845,7 @@ void AquaSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) // ----------------------------------------------------------------------- -bool AquaSalInstance::AnyInput( USHORT nType ) +bool AquaSalInstance::AnyInput( sal_uInt16 nType ) { if( nType & INPUT_APPEVENT ) { @@ -876,14 +891,14 @@ bool AquaSalInstance::AnyInput( USHORT nType ) // ----------------------------------------------------------------------- -SalFrame* AquaSalInstance::CreateChildFrame( SystemParentData* pSystemParentData, ULONG nSalFrameStyle ) +SalFrame* AquaSalInstance::CreateChildFrame( SystemParentData* pSystemParentData, sal_uLong nSalFrameStyle ) { return NULL; } // ----------------------------------------------------------------------- -SalFrame* AquaSalInstance::CreateFrame( SalFrame* pParent, ULONG nSalFrameStyle ) +SalFrame* AquaSalInstance::CreateFrame( SalFrame* pParent, sal_uLong nSalFrameStyle ) { SalData::ensureThreadAutoreleasePool(); @@ -900,7 +915,7 @@ void AquaSalInstance::DestroyFrame( SalFrame* pFrame ) // ----------------------------------------------------------------------- -SalObject* AquaSalInstance::CreateObject( SalFrame* pParent, SystemWindowData* /* pWindowData */, BOOL /* bShow */ ) +SalObject* AquaSalInstance::CreateObject( SalFrame* pParent, SystemWindowData* /* pWindowData */, sal_Bool /* bShow */ ) { // SystemWindowData is meaningless on Mac OS X AquaSalObject *pObject = NULL; @@ -977,6 +992,9 @@ void AquaSalInstance::DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) XubString AquaSalInstance::GetDefaultPrinter() { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + if( ! maDefaultPrinter.getLength() ) { NSPrintInfo* pPI = [NSPrintInfo sharedPrintInfo]; @@ -1001,6 +1019,9 @@ XubString AquaSalInstance::GetDefaultPrinter() SalInfoPrinter* AquaSalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, ImplJobSetup* pSetupData ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + SalInfoPrinter* pNewInfoPrinter = NULL; if( pQueueInfo ) { @@ -1016,6 +1037,9 @@ SalInfoPrinter* AquaSalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueI void AquaSalInstance::DestroyInfoPrinter( SalInfoPrinter* pPrinter ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + delete pPrinter; } diff --git a/vcl/aqua/source/app/salsys.cxx b/vcl/aqua/source/app/salsys.cxx index 91f5e4df0180..ea588c9de132 100644 --- a/vcl/aqua/source/app/salsys.cxx +++ b/vcl/aqua/source/app/salsys.cxx @@ -31,9 +31,11 @@ #include "tools/rc.hxx" #include "vcl/svids.hrc" +#include "vcl/button.hxx" #include "salsys.h" #include "saldata.hxx" +#include "salinst.h" #include "rtl/ustrbuf.hxx" using ::rtl::OUString; @@ -115,12 +117,22 @@ rtl::OUString AquaSalSystem::GetScreenName( unsigned int nScreen ) return aRet; } -int AquaSalSystem::ShowNativeDialog( const String& rTitle, - const String& rMessage, - const std::list< String >& rButtons, - int nDefButton ) +static NSString* getStandardString( int nButtonId ) { - return 0; + rtl::OUString aText( Button::GetStandardText( nButtonId ) ); + if( ! aText.getLength() ) // this is for bad cases, we might be missing the vcl resource + { + switch( nButtonId ) + { + case BUTTON_OK: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OK" ) );break; + case BUTTON_ABORT: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Abort" ) );break; + case BUTTON_CANCEL: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cancel" ) );break; + case BUTTON_RETRY: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Retry" ) );break; + case BUTTON_YES: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Yes" ) );break; + case BUTTON_NO : aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No" ) );break; + } + } + return aText.getLength() ? CreateNSString( aText) : nil; } int AquaSalSystem::ShowNativeMessageBox( const String& rTitle, @@ -128,7 +140,84 @@ int AquaSalSystem::ShowNativeMessageBox( const String& rTitle, int nButtonCombination, int nDefaultButton) { - return 0; + NSString* pTitle = CreateNSString( rTitle ); + NSString* pMessage = CreateNSString( rMessage ); + + struct id_entry + { + int nCombination; + int nDefaultButton; + int nTextIds[3]; + } aButtonIds[] = + { + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK, { BUTTON_OK, -1, -1 } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK, { BUTTON_OK, BUTTON_CANCEL, -1 } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, { BUTTON_CANCEL, BUTTON_OK, -1 } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_ABORT, { BUTTON_ABORT, BUTTON_IGNORE, BUTTON_RETRY } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY, { BUTTON_RETRY, BUTTON_IGNORE, BUTTON_ABORT } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_IGNORE, { BUTTON_IGNORE, BUTTON_IGNORE, BUTTON_ABORT } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES, { BUTTON_YES, BUTTON_NO, BUTTON_CANCEL } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO, { BUTTON_NO, BUTTON_YES, BUTTON_CANCEL } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, { BUTTON_CANCEL, BUTTON_YES, BUTTON_NO } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES, { BUTTON_YES, BUTTON_NO, -1 } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO, { BUTTON_NO, BUTTON_YES, -1 } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY, { BUTTON_RETRY, BUTTON_CANCEL, -1 } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, { BUTTON_CANCEL, BUTTON_RETRY, -1 } } + }; + + NSString* pDefText = nil; + NSString* pAltText = nil; + NSString* pOthText = nil; + + unsigned int nC; + for( nC = 0; nC < sizeof(aButtonIds)/sizeof(aButtonIds[0]); nC++ ) + { + if( aButtonIds[nC].nCombination == nButtonCombination ) + { + if( aButtonIds[nC].nDefaultButton == nDefaultButton ) + { + if( aButtonIds[nC].nTextIds[0] != -1 ) + pDefText = getStandardString( aButtonIds[nC].nTextIds[0] ); + if( aButtonIds[nC].nTextIds[1] != -1 ) + pAltText = getStandardString( aButtonIds[nC].nTextIds[1] ); + if( aButtonIds[nC].nTextIds[2] != -1 ) + pOthText = getStandardString( aButtonIds[nC].nTextIds[2] ); + break; + } + } + } + + + int nResult = NSRunAlertPanel( pTitle, pMessage, pDefText, pAltText, pOthText ); + + if( pTitle ) + [pTitle release]; + if( pMessage ) + [pMessage release]; + if( pDefText ) + [pDefText release]; + if( pAltText ) + [pAltText release]; + if( pOthText ) + [pOthText release]; + + int nRet = 0; + if( nC < sizeof(aButtonIds)/sizeof(aButtonIds[0]) && nResult >= 1 && nResult <= 3 ) + { + int nPressed = aButtonIds[nC].nTextIds[nResult-1]; + switch( nPressed ) + { + case BUTTON_NO: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO; break; + case BUTTON_YES: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES; break; + case BUTTON_OK: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK; break; + case BUTTON_CANCEL: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL; break; + case BUTTON_ABORT: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_ABORT; break; + case BUTTON_RETRY: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY; break; + case BUTTON_IGNORE: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_IGNORE; break; + } + } + + return nRet; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/app/saltimer.cxx b/vcl/aqua/source/app/saltimer.cxx index 75c5f92f820b..e0c406a6a589 100644 --- a/vcl/aqua/source/app/saltimer.cxx +++ b/vcl/aqua/source/app/saltimer.cxx @@ -41,7 +41,7 @@ NSTimer* AquaSalTimer::pRunningTimer = nil; bool AquaSalTimer::bDispatchTimer = false; -void ImplSalStartTimer( ULONG nMS ) +void ImplSalStartTimer( sal_uLong nMS ) { SalData* pSalData = GetSalData(); if( pSalData->mpFirstInstance->isNSAppThread() ) @@ -109,7 +109,7 @@ void AquaSalTimer::handleStartTimerEvent( NSEvent* pEvent ) // timer already elapsed since event posted pSVData->mpSalTimer->CallCallback(); } - ImplSalStartTimer( ULONG( [pEvent data1] ) ); + ImplSalStartTimer( sal_uLong( [pEvent data1] ) ); } } @@ -123,7 +123,7 @@ AquaSalTimer::~AquaSalTimer() ImplSalStopTimer(); } -void AquaSalTimer::Start( ULONG nMS ) +void AquaSalTimer::Start( sal_uLong nMS ) { ImplSalStartTimer( nMS ); } diff --git a/vcl/aqua/source/app/vclnsapp.mm b/vcl/aqua/source/app/vclnsapp.mm index 4264f8802126..455e7c64c6a4 100755 --- a/vcl/aqua/source/app/vclnsapp.mm +++ b/vcl/aqua/source/app/vclnsapp.mm @@ -287,7 +287,7 @@ return AquaSalInstance::GetDynamicDockMenu(); } --(MacOSBOOL)application: (NSApplication*)app openFile: (NSString*)pFile +-(BOOL)application: (NSApplication*)app openFile: (NSString*)pFile { const rtl::OUString aFile( GetOUString( pFile ) ); if( ! AquaSalInstance::isOnCommandLine( aFile ) ) @@ -328,7 +328,7 @@ } } --(MacOSBOOL)application: (NSApplication*)app printFile: (NSString*)pFile +-(BOOL)application: (NSApplication*)app printFile: (NSString*)pFile { const rtl::OUString aFile( GetOUString( pFile ) ); const ApplicationEvent* pAppEvent = new ApplicationEvent( String(), ApplicationAddress(), @@ -336,7 +336,7 @@ AquaSalInstance::aAppEventList.push_back( pAppEvent ); return YES; } --(NSApplicationPrintReply)application: (NSApplication *) app printFiles:(NSArray *)files withSettings: (NSDictionary *)printSettings showPrintPanels:(MacOSBOOL)bShowPrintPanels +-(NSApplicationPrintReply)application: (NSApplication *) app printFiles:(NSArray *)files withSettings: (NSDictionary *)printSettings showPrintPanels:(BOOL)bShowPrintPanels { // currently ignores print settings an bShowPrintPanels rtl::OUStringBuffer aFileList( 256 ); @@ -360,70 +360,35 @@ -(NSApplicationTerminateReply)applicationShouldTerminate: (NSApplication *) app { - SalData* pSalData = GetSalData(); - #if 1 // currently do some really bad hack - if( ! pSalData->maFrames.empty() ) + NSApplicationTerminateReply aReply = NSTerminateNow; { - /* #i92766# something really weird is going on with the retain count of - our windows; sometimes we get a duplicate free before exit on one of our - NSWindows. The reason is unclear; to avoid this currently we retain them once more - - FIXME: this is a really bad hack, relying on the system to catch the leaked - resources. Find out what really goes on here and fix it ! - */ - std::vector< NSWindow* > aHackRetainedWindows; - for( std::list< AquaSalFrame* >::iterator it = pSalData->maFrames.begin(); - it != pSalData->maFrames.end(); ++it ) - { - #if OSL_DEBUG_LEVEL > 1 - Window* pWin = (*it)->GetWindow(); - String aTitle = pWin->GetText(); - Window* pClient = pWin->ImplGetClientWindow(); - fprintf( stderr, "retaining %p (old count %d) windowtype=%s clienttyp=%s title=%s\n", - (*it)->mpWindow, [(*it)->mpWindow retainCount], - typeid(*pWin).name(), pClient ? typeid(*pClient).name() : "<nil>", - rtl::OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 ).getStr() - ); - #endif - [(*it)->mpWindow retain]; - aHackRetainedWindows.push_back( (*it)->mpWindow ); - } - if( pSalData->maFrames.front()->CallCallback( SALEVENT_SHUTDOWN, NULL ) ) + YIELD_GUARD; + + SalData* pSalData = GetSalData(); + if( ! pSalData->maFrames.empty() ) { - for( std::vector< NSWindow* >::iterator it = aHackRetainedWindows.begin(); - it != aHackRetainedWindows.end(); ++it ) - { - // clean up the retaing count again from the shutdown workaround - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "releasing %p\n", (*it) ); - #endif - [(*it) release]; - } - return NSTerminateCancel; + // the following QueryExit will likely present a message box, activate application + [NSApp activateIgnoringOtherApps: YES]; + aReply = pSalData->maFrames.front()->CallCallback( SALEVENT_SHUTDOWN, NULL ) ? NSTerminateCancel : NSTerminateNow; } - #if OSL_DEBUG_LEVEL > 1 - for( std::list< AquaSalFrame* >::iterator it = pSalData->maFrames.begin(); - it != pSalData->maFrames.end(); ++it ) + + if( aReply == NSTerminateNow ) { - Window* pWin = (*it)->GetWindow(); - String aTitle = pWin->GetText(); - Window* pClient = pWin->ImplGetClientWindow(); - fprintf( stderr, "frame still alive: NSWindow %p windowtype=%s clienttyp=%s title=%s\n", - (*it)->mpWindow, typeid(*pWin).name(), pClient ? typeid(*pClient).name() : "<nil>", - rtl::OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 ).getStr() - ); + ApplicationEvent aEv( String(), ApplicationAddress(), ByteString( "PRIVATE:DOSHUTDOWN" ), String() ); + GetpApp()->AppEvent( aEv ); + ImplImageTreeSingletonRef()->shutDown(); + // DeInitVCL should be called in ImplSVMain - unless someon _exits first which + // can occur in Desktop::doShutdown for example } - #endif } - #else // the clean version follows - return pSalData->maFrames.front()->CallCallback( SALEVENT_SHUTDOWN, NULL ) ? NSTerminateCancel : NSTerminateNow; - #endif - ImplImageTreeSingletonRef()->shutDown(); - return NSTerminateNow; + + return aReply; } -(void)systemColorsChanged: (NSNotification*) pNotification { + YIELD_GUARD; + const SalData* pSalData = GetSalData(); if( !pSalData->maFrames.empty() ) pSalData->maFrames.front()->CallCallback( SALEVENT_SETTINGSCHANGED, NULL ); @@ -431,6 +396,8 @@ -(void)screenParametersChanged: (NSNotification*) pNotification { + YIELD_GUARD; + SalData* pSalData = GetSalData(); std::list< AquaSalFrame* >::iterator it; for( it = pSalData->maFrames.begin(); it != pSalData->maFrames.end(); ++it ) @@ -501,7 +468,7 @@ } } -- (MacOSBOOL)applicationShouldHandleReopen: (NSApplication*)pApp hasVisibleWindows: (MacOSBOOL) bWinVisible +- (BOOL)applicationShouldHandleReopen: (NSApplication*)pApp hasVisibleWindows: (BOOL) bWinVisible { NSObject* pHdl = GetSalData()->mpDockIconClickHandler; if( pHdl && [pHdl respondsToSelector: @selector(dockIconClicked:)] ) diff --git a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx index 0c388e4643d9..c660dbc0616d 100644 --- a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx +++ b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx @@ -579,11 +579,19 @@ DataProviderPtr_t DataFlavorMapper::getDataProvider(NSString* systemFlavor, Refe 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) + but annoying for other applications. Since this extension is not a standard datatype + on the Mac, let us not provide but provide normal HTML + if ([systemFlavor caseInsensitiveCompare: NSHTMLPboardType] == NSOrderedSame) { dp = DataProviderPtr_t(new HTMLFormatDataProvider(data)); } - else if ([systemFlavor caseInsensitiveCompare: NSPICTPboardType] == NSOrderedSame) + else + */ + if ([systemFlavor caseInsensitiveCompare: NSPICTPboardType] == NSOrderedSame) { dp = DataProviderPtr_t(new BMPDataProvider(data, PICTImageFileType)); } diff --git a/vcl/aqua/source/dtrans/DragSource.cxx b/vcl/aqua/source/dtrans/DragSource.cxx index 93871add6ffa..bef1e639caf9 100644 --- a/vcl/aqua/source/dtrans/DragSource.cxx +++ b/vcl/aqua/source/dtrans/DragSource.cxx @@ -39,6 +39,7 @@ #include "DragSourceContext.hxx" #include "aqua_clipboard.hxx" #include "DragActionConversion.hxx" +#include "salframe.h" #include <rtl/ustring.h> #include <memory> @@ -46,6 +47,7 @@ using namespace cppu; using namespace osl; +using namespace com::sun::star; using namespace com::sun::star::datatransfer; using namespace com::sun::star::datatransfer::clipboard; using namespace com::sun::star::datatransfer::dnd; @@ -61,7 +63,7 @@ using ::rtl::OUString; // For OOo internal D&D we provide the Transferable without NSDragPboard // interference as a shortcut -Reference<XTransferable> DragSource::g_XTransferable = Reference<XTransferable>(); +uno::Reference<XTransferable> DragSource::g_XTransferable; NSView* DragSource::g_DragSourceView = nil; bool DragSource::g_DropSuccessSet = false; bool DragSource::g_DropSuccess = false; @@ -105,7 +107,7 @@ Sequence<OUString> dragSource_getSupportedServiceNames() } --(unsigned int)draggingSourceOperationMaskForLocal: (MacOSBOOL)isLocal +-(unsigned int)draggingSourceOperationMaskForLocal: (BOOL)isLocal { return mDragSource->getSupportedDragOperations(isLocal); } @@ -138,7 +140,7 @@ Sequence<OUString> dragSource_getSupportedServiceNames() bDropSuccess ); mDragSource->mXDragSrcListener->dragDropEnd(dsde); - mDragSource->mXDragSrcListener = Reference<XDragSourceListener>(); + mDragSource->mXDragSrcListener = uno::Reference<XDragSourceListener>(); } @@ -159,6 +161,7 @@ Sequence<OUString> dragSource_getSupportedServiceNames() DragSource::DragSource(): WeakComponentImplHelper3<XDragSource, XInitialization, XServiceInfo>(m_aMutex), mView(NULL), + mpFrame(NULL), mLastMouseEventBeforeStartDrag(nil), m_MouseButton(0) { @@ -167,8 +170,9 @@ DragSource::DragSource(): DragSource::~DragSource() { - [(id <MouseEventListener>)mView unregisterMouseEventListener: mDragSourceHelper]; - [mDragSourceHelper release]; + if( mpFrame && AquaSalFrame::isAlive( mpFrame ) ) + [(id <MouseEventListener>)mView unregisterMouseEventListener: mDragSourceHelper]; + [mDragSourceHelper release]; } @@ -198,6 +202,13 @@ void SAL_CALL DragSource::initialize(const Sequence< Any >& aArguments) throw Exception(OUString(RTL_CONSTASCII_USTRINGPARAM("DragSource::initialize: Provided view doesn't support mouse listener")), static_cast<OWeakObject*>(this)); } + NSWindow* pWin = [mView window]; + if( ! pWin || ![pWin respondsToSelector: @selector(getSalFrame)] ) + { + throw Exception(OUString(RTL_CONSTASCII_USTRINGPARAM("DragSource::initialize: Provided view is not attached to a vcl frame")), + static_cast<OWeakObject*>(this)); + } + mpFrame = (AquaSalFrame*)[pWin performSelector: @selector(getSalFrame)]; mDragSourceHelper = [[DragSourceHelper alloc] initWithDragSource: this]; @@ -233,8 +244,8 @@ void SAL_CALL DragSource::startDrag(const DragGestureEvent& trigger, sal_Int8 sourceActions, sal_Int32 cursor, sal_Int32 image, - const Reference<XTransferable >& transferable, - const Reference<XDragSourceListener >& listener ) + const uno::Reference<XTransferable >& transferable, + const uno::Reference<XDragSourceListener >& listener ) throw( RuntimeException) { MutexGuard guard(m_aMutex); @@ -248,7 +259,7 @@ void SAL_CALL DragSource::startDrag(const DragGestureEvent& trigger, mXCurrentContext = static_cast<XDragSourceContext*>(new DragSourceContext(this)); auto_ptr<AquaClipboard> clipb(new AquaClipboard(NULL, false)); g_XTransferable = transferable; - clipb->setContents(g_XTransferable, Reference<XClipboardOwner>()); + clipb->setContents(g_XTransferable, uno::Reference<XClipboardOwner>()); mDragSourceActions = sourceActions; g_DragSourceView = mView; @@ -288,7 +299,7 @@ void SAL_CALL DragSource::startDrag(const DragGestureEvent& trigger, [dragImage release]; - g_XTransferable = Reference<XTransferable>(); + g_XTransferable = uno::Reference<XTransferable>(); g_DragSourceView = nil; // reset drop success flags diff --git a/vcl/aqua/source/dtrans/DragSource.hxx b/vcl/aqua/source/dtrans/DragSource.hxx index 498feaf819bb..943c84c5036e 100644 --- a/vcl/aqua/source/dtrans/DragSource.hxx +++ b/vcl/aqua/source/dtrans/DragSource.hxx @@ -47,6 +47,7 @@ class DragSource; +class AquaSalFrame; /* The functions declared in this protocol are actually declared in vcl/aqua/inc/salframe.h. Because we want @@ -72,7 +73,7 @@ class DragSource; -(void)mouseDown: (NSEvent*)theEvent; -(void)mouseDragged: (NSEvent*)theEvent; --(unsigned int)draggingSourceOperationMaskForLocal:(MacOSBOOL)isLocal; +-(unsigned int)draggingSourceOperationMaskForLocal:(BOOL)isLocal; -(void)draggedImage:(NSImage*)anImage beganAt:(NSPoint)aPoint; -(void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation; -(void)draggedImage:(NSImage *)draggedImage movedTo:(NSPoint)screenPoint; @@ -121,6 +122,7 @@ public: com::sun::star::uno::Reference< com::sun::star::datatransfer::dnd::XDragSourceContext > mXCurrentContext; id mView; + AquaSalFrame* mpFrame; NSEvent* mLastMouseEventBeforeStartDrag; DragSourceHelper* mDragSourceHelper; com::sun::star::awt::MouseEvent mMouseEvent; diff --git a/vcl/aqua/source/dtrans/DropTarget.cxx b/vcl/aqua/source/dtrans/DropTarget.cxx index 6d5335dba6af..1fb6b9bb2d53 100644 --- a/vcl/aqua/source/dtrans/DropTarget.cxx +++ b/vcl/aqua/source/dtrans/DropTarget.cxx @@ -126,13 +126,13 @@ namespace /* private */ } --(MacOSBOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender +-(BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender { return mDropTarget->prepareForDragOperation(sender); } --(MacOSBOOL)performDragOperation:(id <NSDraggingInfo>)sender +-(BOOL)performDragOperation:(id <NSDraggingInfo>)sender { return mDropTarget->performDragOperation(sender); } @@ -321,13 +321,13 @@ NSDragOperation DropTarget::draggingUpdated(id sender) } - MacOSBOOL DropTarget::prepareForDragOperation(id sender) + BOOL DropTarget::prepareForDragOperation(id sender) { return 1; } -MacOSBOOL DropTarget::performDragOperation(id sender) +BOOL DropTarget::performDragOperation(id sender) { bool bSuccess = false; diff --git a/vcl/aqua/source/dtrans/DropTarget.hxx b/vcl/aqua/source/dtrans/DropTarget.hxx index bb25497244a6..293db4d4eb39 100644 --- a/vcl/aqua/source/dtrans/DropTarget.hxx +++ b/vcl/aqua/source/dtrans/DropTarget.hxx @@ -75,8 +75,8 @@ class DropTarget; -(NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender; -(NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender; -(void)draggingExited:(id <NSDraggingInfo>)sender; --(MacOSBOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender; --(MacOSBOOL)performDragOperation:(id <NSDraggingInfo>)sender; +-(BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender; +-(BOOL)performDragOperation:(id <NSDraggingInfo>)sender; -(void)concludeDragOperation:(id <NSDraggingInfo>)sender; @end @@ -134,8 +134,8 @@ public: virtual NSDragOperation draggingEntered(id sender); virtual NSDragOperation draggingUpdated(id sender); virtual void draggingExited(id sender); - virtual MacOSBOOL prepareForDragOperation(id sender); - virtual MacOSBOOL performDragOperation(id sender); + virtual BOOL prepareForDragOperation(id sender); + virtual BOOL performDragOperation(id sender); virtual void concludeDragOperation(id sender); /* If multiple actions are supported by the drag source and diff --git a/vcl/aqua/source/dtrans/aqua_service.cxx b/vcl/aqua/source/dtrans/aqua_service.cxx index d27548354022..aa46713bce1f 100644 --- a/vcl/aqua/source/dtrans/aqua_service.cxx +++ b/vcl/aqua/source/dtrans/aqua_service.cxx @@ -60,28 +60,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pRegistryKey ) -{ - sal_Bool bRetVal = sal_False; - - if ( pRegistryKey ) - { - try - { - Reference< XRegistryKey > pXNewKey( static_cast< XRegistryKey* >( pRegistryKey ) ); - pXNewKey->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM( AQUA_CLIPBOARD_REGKEY_NAME ) ) ); - bRetVal = sal_True; - } - catch( InvalidRegistryException& ) - { - OSL_ENSURE(sal_False, "InvalidRegistryException caught"); - bRetVal = sal_False; - } - } - - return bRetVal; -} - void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* pRegistryKey ) { void* pRet = 0; diff --git a/vcl/aqua/source/dtrans/service_entry.cxx b/vcl/aqua/source/dtrans/service_entry.cxx index 73476525b6b4..661d87576fa8 100644 --- a/vcl/aqua/source/dtrans/service_entry.cxx +++ b/vcl/aqua/source/dtrans/service_entry.cxx @@ -35,32 +35,42 @@ #include "DropTarget.hxx" #include "aqua_clipboard.hxx" #include "osl/diagnose.h" +#include "vcl/svapp.hxx" using namespace ::osl; using namespace ::rtl; +using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::cppu; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::datatransfer::clipboard; -Reference< XInterface > AquaSalInstance::CreateClipboard( const Sequence< Any >& i_rArguments ) +uno::Reference< XInterface > AquaSalInstance::CreateClipboard( const Sequence< Any >& i_rArguments ) { + if ( Application::IsHeadlessModeEnabled() ) + return SalInstance::CreateClipboard( i_rArguments ); + SalData* pSalData = GetSalData(); if( ! pSalData->mxClipboard.is() ) - pSalData->mxClipboard = Reference<XInterface>(static_cast< XClipboard* >(new AquaClipboard()), UNO_QUERY); + pSalData->mxClipboard = uno::Reference<XInterface>(static_cast< XClipboard* >(new AquaClipboard()), UNO_QUERY); return pSalData->mxClipboard; } - -Reference<XInterface> AquaSalInstance::CreateDragSource() +uno::Reference<XInterface> AquaSalInstance::CreateDragSource() { - return Reference<XInterface>(static_cast< XInitialization* >(new DragSource()), UNO_QUERY); + if ( Application::IsHeadlessModeEnabled() ) + return SalInstance::CreateDragSource(); + + return uno::Reference<XInterface>(static_cast< XInitialization* >(new DragSource()), UNO_QUERY); } -Reference<XInterface> AquaSalInstance::CreateDropTarget() +uno::Reference<XInterface> AquaSalInstance::CreateDropTarget() { - return Reference<XInterface>(static_cast< XInitialization* >(new DropTarget()), UNO_QUERY); + if ( Application::IsHeadlessModeEnabled() ) + return SalInstance::CreateDropTarget(); + + return uno::Reference<XInterface>(static_cast< XInitialization* >(new DropTarget()), UNO_QUERY); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm index 8f0e080e5fb2..e62a950129e4 100644 --- a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm +++ b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm @@ -112,7 +112,7 @@ class ControllerProperties maLocalizedStrings( VclResId( SV_PRINT_NATIVE_STRINGS ) ) { mpState->bNeedRestart = false; - DBG_ASSERT( maLocalizedStrings.Count() >= 4, "resources not found !" ); + DBG_ASSERT( maLocalizedStrings.Count() >= 5, "resources not found !" ); } rtl::OUString getMoreString() @@ -122,6 +122,13 @@ class ControllerProperties : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "More" ) ); } + rtl::OUString getPrintSelectionString() + { + return maLocalizedStrings.Count() >= 5 + ? rtl::OUString( maLocalizedStrings.GetString( 4 ) ) + : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Print selection only" ) ); + } + void updatePrintJob() { // TODO: refresh page count etc from mpController @@ -246,7 +253,11 @@ class ControllerProperties PropertyValue* pVal = mpController->getValue( name_it->second ); if( pVal ) { - pVal->Value <<= i_bValue; + // ugly + if( name_it->second.equalsAscii( "PrintContent" ) ) + pVal->Value <<= i_bValue ? sal_Int32(2) : sal_Int32(0); + else + pVal->Value <<= i_bValue; updatePrintJob(); } } @@ -283,9 +294,9 @@ class ControllerProperties -1; std::map< int, rtl::OUString >::const_iterator name_it = maTagToPropertyName.find( nTag ); - if( name_it != maTagToPropertyName.end() ) + if( name_it != maTagToPropertyName.end() && ! name_it->second.equalsAscii( "PrintContent" ) ) { - MacOSBOOL bEnabled = mpController->isUIOptionEnabled( name_it->second ) ? YES : NO; + BOOL bEnabled = mpController->isUIOptionEnabled( name_it->second ) ? YES : NO; if( pCtrl ) { [pCtrl setEnabled: bEnabled]; @@ -311,6 +322,9 @@ class ControllerProperties GDIMetaFile aMtf; PrinterController::PageSize aPageSize( mpController->getFilteredPageFile( i_nPage, aMtf, false ) ); VirtualDevice aDev; + if( mpController->getPrinter()->GetPrinterOptions().IsConvertToGreyscales() ) + aDev.SetDrawMode( aDev.GetDrawMode() | ( DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_GRAYTEXT | + DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT ) ); // see salprn.cxx, currently we pretend to be a 720dpi device on printers aDev.SetReferenceDevice( 720, 720 ); aDev.EnableOutput( TRUE ); @@ -768,6 +782,325 @@ static void linebreakCell( NSCell* pBtn, const rtl::OUString& i_rText ) } } +static void addSubgroup( NSView* pCurParent, long& rCurY, const rtl::OUString& rText ) +{ + NSControl* pTextView = createLabel( rText ); + [pCurParent addSubview: [pTextView autorelease]]; + NSRect aTextRect = [pTextView frame]; + // move to nCurY + aTextRect.origin.y = rCurY - aTextRect.size.height; + [pTextView setFrame: aTextRect]; + + NSRect aSepRect = { { aTextRect.size.width + 1, aTextRect.origin.y }, { 100, 6 } }; + NSBox* pBox = [[NSBox alloc] initWithFrame: aSepRect]; + [pBox setBoxType: NSBoxSeparator]; + [pCurParent addSubview: [pBox autorelease]]; + + // update nCurY + rCurY = aTextRect.origin.y - 5; +} + +static void addBool( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachOffset, + const rtl::OUString& rText, sal_Bool bEnabled, + const rtl::OUString& rProperty, sal_Bool bValue, + std::vector<ColumnItem >& rRightColumn, + ControllerProperties* pControllerProperties, + ControlTarget* pCtrlTarget + ) +{ + NSRect aCheckRect = { { rCurX + nAttachOffset, 0 }, { 0, 15 } }; + NSButton* pBtn = [[NSButton alloc] initWithFrame: aCheckRect]; + [pBtn setButtonType: NSSwitchButton]; + [pBtn setState: bValue ? NSOnState : NSOffState]; + if( ! bEnabled ) + [pBtn setEnabled: NO]; + linebreakCell( [pBtn cell], rText ); + [pBtn sizeToFit]; + + rRightColumn.push_back( ColumnItem( pBtn ) ); + + // connect target + [pBtn setTarget: pCtrlTarget]; + [pBtn setAction: @selector(triggered:)]; + int nTag = pControllerProperties->addNameTag( rProperty ); + pControllerProperties->addObservedControl( pBtn ); + [pBtn setTag: nTag]; + + aCheckRect = [pBtn frame]; + // #i115837# add a murphy factor; it can apparently occasionally happen + // that sizeToFit does not a perfect job and that the button linebreaks again + // if - and only if - there is already a '\n' contained in the text and the width + // is minimally of + aCheckRect.size.width += 1; + + // move to rCurY + aCheckRect.origin.y = rCurY - aCheckRect.size.height; + [pBtn setFrame: aCheckRect]; + + [pCurParent addSubview: [pBtn autorelease]]; + + // update rCurY + rCurY = aCheckRect.origin.y - 5; +} + +static void addRadio( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachOffset, + const rtl::OUString& rText, + const rtl::OUString& rProperty, Sequence< rtl::OUString > rChoices, sal_Int32 nSelectValue, + std::vector<ColumnItem >& rLeftColumn, + std::vector<ColumnItem >& rRightColumn, + ControllerProperties* pControllerProperties, + ControlTarget* pCtrlTarget + ) +{ + sal_Int32 nOff = 0; + if( rText.getLength() ) + { + // add a label + NSControl* pTextView = createLabel( rText ); + NSRect aTextRect = [pTextView frame]; + aTextRect.origin.x = rCurX + nAttachOffset; + [pCurParent addSubview: [pTextView autorelease]]; + + rLeftColumn.push_back( ColumnItem( pTextView ) ); + + // move to nCurY + aTextRect.origin.y = rCurY - aTextRect.size.height; + [pTextView setFrame: aTextRect]; + + // update nCurY + rCurY = aTextRect.origin.y - 5; + + // indent the radio group relative to the text + // nOff = 20; + } + + // setup radio matrix + NSButtonCell* pProto = [[NSButtonCell alloc] init]; + + NSRect aRadioRect = { { rCurX + nOff, 0 }, { 280 - rCurX, 5*rChoices.getLength() } }; + [pProto setTitle: @"RadioButtonGroup"]; + [pProto setButtonType: NSRadioButton]; + NSMatrix* pMatrix = [[NSMatrix alloc] initWithFrame: aRadioRect + mode: NSRadioModeMatrix + prototype: (NSCell*)pProto + numberOfRows: rChoices.getLength() + numberOfColumns: 1]; + // set individual titles + NSArray* pCells = [pMatrix cells]; + for( sal_Int32 m = 0; m < rChoices.getLength(); m++ ) + { + NSCell* pCell = [pCells objectAtIndex: m]; + filterAccelerator( rChoices[m] ); + linebreakCell( pCell, rChoices[m] ); + // connect target and action + [pCell setTarget: pCtrlTarget]; + [pCell setAction: @selector(triggered:)]; + int nTag = pControllerProperties->addNameAndValueTag( rProperty, m ); + pControllerProperties->addObservedControl( pCell ); + [pCell setTag: nTag]; + // set current selection + if( nSelectValue == m ) + [pMatrix selectCellAtRow: m column: 0]; + } + [pMatrix sizeToFit]; + aRadioRect = [pMatrix frame]; + + // move it down, so it comes to the correct position + aRadioRect.origin.y = rCurY - aRadioRect.size.height; + [pMatrix setFrame: aRadioRect]; + [pCurParent addSubview: [pMatrix autorelease]]; + + rRightColumn.push_back( ColumnItem( pMatrix ) ); + + // update nCurY + rCurY = aRadioRect.origin.y - 5; + + [pProto release]; +} + +static void addList( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachOffset, + const rtl::OUString& rText, + const rtl::OUString& rProperty, const Sequence< rtl::OUString > rChoices, sal_Int32 nSelectValue, + std::vector<ColumnItem >& rLeftColumn, + std::vector<ColumnItem >& rRightColumn, + ControllerProperties* pControllerProperties, + ControlTarget* pCtrlTarget + ) +{ + // don't indent attached lists, looks bad in the existing cases + NSControl* pTextView = createLabel( rText ); + [pCurParent addSubview: [pTextView autorelease]]; + rLeftColumn.push_back( ColumnItem( pTextView ) ); + NSRect aTextRect = [pTextView frame]; + aTextRect.origin.x = rCurX /* + nAttachOffset*/; + + // don't indent attached lists, looks bad in the existing cases + NSRect aBtnRect = { { rCurX /*+ nAttachOffset*/ + aTextRect.size.width, 0 }, { 0, 15 } }; + NSPopUpButton* pBtn = [[NSPopUpButton alloc] initWithFrame: aBtnRect pullsDown: NO]; + + // iterate options + for( sal_Int32 m = 0; m < rChoices.getLength(); m++ ) + { + NSString* pItemText = CreateNSString( rChoices[m] ); + [pBtn addItemWithTitle: pItemText]; + NSMenuItem* pItem = [pBtn itemWithTitle: pItemText]; + int nTag = pControllerProperties->addNameAndValueTag( rProperty, m ); + [pItem setTag: nTag]; + [pItemText release]; + } + + [pBtn selectItemAtIndex: nSelectValue]; + + // add the button to observed controls for enabled state changes + // also add a tag just for this purpose + pControllerProperties->addObservedControl( pBtn ); + [pBtn setTag: pControllerProperties->addNameTag( rProperty )]; + + [pBtn sizeToFit]; + [pCurParent addSubview: [pBtn autorelease]]; + + rRightColumn.push_back( ColumnItem( pBtn ) ); + + // connect target and action + [pBtn setTarget: pCtrlTarget]; + [pBtn setAction: @selector(triggered:)]; + + // move to nCurY + aBtnRect = [pBtn frame]; + aBtnRect.origin.y = rCurY - aBtnRect.size.height; + [pBtn setFrame: aBtnRect]; + + // align label + aTextRect.origin.y = aBtnRect.origin.y + (aBtnRect.size.height - aTextRect.size.height)/2; + [pTextView setFrame: aTextRect]; + + // update rCurY + rCurY = aBtnRect.origin.y - 5; +} + +static void addEdit( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachOffset, + const rtl::OUString rCtrlType, + const rtl::OUString& rText, + const rtl::OUString& rProperty, const PropertyValue* pValue, + sal_Int64 nMinValue, sal_Int64 nMaxValue, + std::vector<ColumnItem >& rLeftColumn, + std::vector<ColumnItem >& rRightColumn, + ControllerProperties* pControllerProperties, + ControlTarget* pCtrlTarget + ) +{ + sal_Int32 nOff = 0; + if( rText.getLength() ) + { + // add a label + NSControl* pTextView = createLabel( rText ); + [pCurParent addSubview: [pTextView autorelease]]; + + rLeftColumn.push_back( ColumnItem( pTextView ) ); + + // move to nCurY + NSRect aTextRect = [pTextView frame]; + aTextRect.origin.x = rCurX + nAttachOffset; + aTextRect.origin.y = rCurY - aTextRect.size.height; + [pTextView setFrame: aTextRect]; + + // update nCurY + rCurY = aTextRect.origin.y - 5; + + // and set the offset for the real edit field + nOff = aTextRect.size.width + 5; + } + + NSRect aFieldRect = { { rCurX + nOff + nAttachOffset, 0 }, { 100, 25 } }; + NSTextField* pFieldView = [[NSTextField alloc] initWithFrame: aFieldRect]; + [pFieldView setEditable: YES]; + [pFieldView setSelectable: YES]; + [pFieldView setDrawsBackground: YES]; + [pFieldView sizeToFit]; // FIXME: this does nothing + [pCurParent addSubview: [pFieldView autorelease]]; + + rRightColumn.push_back( ColumnItem( pFieldView ) ); + + // add the field to observed controls for enabled state changes + // also add a tag just for this purpose + pControllerProperties->addObservedControl( pFieldView ); + int nTag = pControllerProperties->addNameTag( rProperty ); + [pFieldView setTag: nTag]; + // pControllerProperties->addNamedView( pFieldView, aPropertyName ); + + // move to nCurY + aFieldRect.origin.y = rCurY - aFieldRect.size.height; + [pFieldView setFrame: aFieldRect]; + + if( rCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Range" ) ) ) + { + // add a stepper control + NSRect aStepFrame = { { aFieldRect.origin.x + aFieldRect.size.width + 5, + aFieldRect.origin.y }, + { 15, aFieldRect.size.height } }; + NSStepper* pStep = [[NSStepper alloc] initWithFrame: aStepFrame]; + [pStep setIncrement: 1]; + [pStep setValueWraps: NO]; + [pStep setTag: nTag]; + [pCurParent addSubview: [pStep autorelease]]; + + rRightColumn.back().pSubControl = pStep; + + pControllerProperties->addObservedControl( pStep ); + [pStep setTarget: pCtrlTarget]; + [pStep setAction: @selector(triggered:)]; + + // constrain the text field to decimal numbers + NSNumberFormatter* pFormatter = [[NSNumberFormatter alloc] init]; + [pFormatter setFormatterBehavior: NSNumberFormatterBehavior10_4]; + [pFormatter setNumberStyle: NSNumberFormatterDecimalStyle]; + [pFormatter setAllowsFloats: NO]; + [pFormatter setMaximumFractionDigits: 0]; + if( nMinValue != nMaxValue ) + { + [pFormatter setMinimum: [[NSNumber numberWithInt: nMinValue] autorelease]]; + [pStep setMinValue: nMinValue]; + [pFormatter setMaximum: [[NSNumber numberWithInt: nMaxValue] autorelease]]; + [pStep setMaxValue: nMaxValue]; + } + [pFieldView setFormatter: pFormatter]; + + sal_Int64 nSelectVal = 0; + if( pValue && pValue->Value.hasValue() ) + pValue->Value >>= nSelectVal; + + [pFieldView setIntValue: nSelectVal]; + [pStep setIntValue: nSelectVal]; + + pControllerProperties->addViewPair( pFieldView, pStep ); + // connect target and action + [pFieldView setTarget: pCtrlTarget]; + [pFieldView setAction: @selector(triggeredNumeric:)]; + [pStep setTarget: pCtrlTarget]; + [pStep setAction: @selector(triggeredNumeric:)]; + } + else + { + // connect target and action + [pFieldView setTarget: pCtrlTarget]; + [pFieldView setAction: @selector(triggered:)]; + + if( pValue && pValue->Value.hasValue() ) + { + rtl::OUString aValue; + pValue->Value >>= aValue; + if( aValue.getLength() ) + { + NSString* pText = CreateNSString( aValue ); + [pFieldView setStringValue: pText]; + [pText release]; + } + } + } + + // update nCurY + rCurY = aFieldRect.origin.y - 5; +} @implementation AquaPrintAccessoryView +(NSObject*)setupPrinterPanel: (NSPrintOperation*)pOp withController: (vcl::PrinterController*)pController withState: (PrintAccessoryViewState*)pState; @@ -792,6 +1125,54 @@ static void linebreakCell( NSCell* pBtn, const rtl::OUString& i_rText ) ControlTarget* pCtrlTarget = [[ControlTarget alloc] initWithControllerMap: pControllerProperties]; std::vector< ColumnItem > aLeftColumn, aRightColumn; + + // ugly: + // prepend a "selection" checkbox if the properties have such a selection in PrintContent + bool bAddSelectionCheckBox = false, bSelectionBoxEnabled = false, bSelectionBoxChecked = false; + for( int i = 0; i < rOptions.getLength(); i++ ) + { + Sequence< beans::PropertyValue > aOptProp; + rOptions[i].Value >>= aOptProp; + + rtl::OUString aCtrlType; + rtl::OUString aPropertyName; + Sequence< rtl::OUString > aChoices; + Sequence< sal_Bool > aChoicesDisabled; + sal_Int32 aSelectionChecked = 0; + for( int n = 0; n < aOptProp.getLength(); n++ ) + { + const beans::PropertyValue& rEntry( aOptProp[ n ] ); + if( rEntry.Name.equalsAscii( "ControlType" ) ) + { + rEntry.Value >>= aCtrlType; + } + else if( rEntry.Name.equalsAscii( "Choices" ) ) + { + rEntry.Value >>= aChoices; + } + else if( rEntry.Name.equalsAscii( "ChoicesDisabled" ) ) + { + rEntry.Value >>= aChoicesDisabled; + } + else if( rEntry.Name.equalsAscii( "Property" ) ) + { + PropertyValue aVal; + rEntry.Value >>= aVal; + aPropertyName = aVal.Name; + if( aPropertyName.equalsAscii( "PrintContent" ) ) + aVal.Value >>= aSelectionChecked; + } + } + if( aCtrlType.equalsAscii( "Radio" ) && + aPropertyName.equalsAscii( "PrintContent" ) && + aChoices.getLength() > 2 ) + { + bAddSelectionCheckBox = true; + bSelectionBoxEnabled = aChoicesDisabled.getLength() < 2 || ! aChoicesDisabled[2]; + bSelectionBoxChecked = (aSelectionChecked==2); + break; + } + } for( int i = 0; i < rOptions.getLength(); i++ ) { @@ -803,6 +1184,7 @@ static void linebreakCell( NSCell* pBtn, const rtl::OUString& i_rText ) rtl::OUString aCtrlType; rtl::OUString aText; rtl::OUString aPropertyName; + rtl::OUString aGroupHint; Sequence< rtl::OUString > aChoices; sal_Int64 nMinValue = 0, nMaxValue = 0; long nAttachOffset = 0; @@ -811,66 +1193,70 @@ static void linebreakCell( NSCell* pBtn, const rtl::OUString& i_rText ) for( int n = 0; n < aOptProp.getLength(); n++ ) { const beans::PropertyValue& rEntry( aOptProp[ n ] ); - if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Text" ) ) ) + if( rEntry.Name.equalsAscii( "Text" ) ) { rEntry.Value >>= aText; filterAccelerator( aText ); } - else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ControlType" ) ) ) + else if( rEntry.Name.equalsAscii( "ControlType" ) ) { rEntry.Value >>= aCtrlType; } - else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Choices" ) ) ) + else if( rEntry.Name.equalsAscii( "Choices" ) ) { rEntry.Value >>= aChoices; } - else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Property" ) ) ) + else if( rEntry.Name.equalsAscii( "Property" ) ) { PropertyValue aVal; rEntry.Value >>= aVal; aPropertyName = aVal.Name; } - else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Enabled" ) ) ) + else if( rEntry.Name.equalsAscii( "Enabled" ) ) { sal_Bool bValue = sal_True; rEntry.Value >>= bValue; bEnabled = bValue; } - else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MinValue" ) ) ) + else if( rEntry.Name.equalsAscii( "MinValue" ) ) { rEntry.Value >>= nMinValue; } - else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MaxValue" ) ) ) + else if( rEntry.Name.equalsAscii( "MaxValue" ) ) { rEntry.Value >>= nMaxValue; } - else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "AttachToDependency" ) ) ) + else if( rEntry.Name.equalsAscii( "AttachToDependency" ) ) { nAttachOffset = 20; } - else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "InternalUIOnly" ) ) ) + else if( rEntry.Name.equalsAscii( "InternalUIOnly" ) ) { rEntry.Value >>= bIgnore; } + else if( rEntry.Name.equalsAscii( "GroupingHint" ) ) + { + rEntry.Value >>= aGroupHint; + } } - if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Group" ) ) || - aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Subgroup" ) ) || - aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Radio" ) ) || - aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "List" ) ) || - aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Edit" ) ) || - aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Range" ) ) || - aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Bool" ) ) ) + if( aCtrlType.equalsAscii( "Group" ) || + aCtrlType.equalsAscii( "Subgroup" ) || + aCtrlType.equalsAscii( "Radio" ) || + aCtrlType.equalsAscii( "List" ) || + aCtrlType.equalsAscii( "Edit" ) || + aCtrlType.equalsAscii( "Range" ) || + aCtrlType.equalsAscii( "Bool" ) ) { // since our build target is MacOSX 10.4 we can have only one accessory view // so we have a single accessory view that is tabbed for grouping - if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Group" ) ) + if( aCtrlType.equalsAscii( "Group" ) || ! pCurParent - || ( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Subgroup" ) ) && nCurY < -250 && ! bIgnore ) + || ( aCtrlType.equalsAscii( "Subgroup" ) && nCurY < -250 && ! bIgnore ) ) { rtl::OUString aGroupTitle( aText ); - if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Subgroup" ) ) ) + if( aCtrlType.equalsAscii( "Subgroup" ) ) aGroupTitle = pControllerProperties->getMoreString(); // set size of current parent if( pCurParent ) @@ -894,310 +1280,73 @@ static void linebreakCell( NSCell* pBtn, const rtl::OUString& i_rText ) // clear columns aLeftColumn.clear(); aRightColumn.clear(); + + if( bAddSelectionCheckBox ) + { + addBool( pCurParent, nCurX, nCurY, 0, + pControllerProperties->getPrintSelectionString(), bSelectionBoxEnabled, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ), bSelectionBoxChecked, + aRightColumn, pControllerProperties, pCtrlTarget ); + bAddSelectionCheckBox = false; + } } - if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Subgroup" ) ) && pCurParent ) + if( aCtrlType.equalsAscii( "Subgroup" ) && pCurParent ) { bIgnoreSubgroup = bIgnore; if( bIgnore ) continue; - NSControl* pTextView = createLabel( aText ); - [pCurParent addSubview: [pTextView autorelease]]; - NSRect aTextRect = [pTextView frame]; - // move to nCurY - aTextRect.origin.y = nCurY - aTextRect.size.height; - [pTextView setFrame: aTextRect]; - - NSRect aSepRect = { { aTextRect.size.width + 1, aTextRect.origin.y }, { 100, 6 } }; - NSBox* pBox = [[NSBox alloc] initWithFrame: aSepRect]; - [pBox setBoxType: NSBoxSeparator]; - [pCurParent addSubview: [pBox autorelease]]; - - // update nCurY - nCurY = aTextRect.origin.y - 5; + addSubgroup( pCurParent, nCurY, aText ); } else if( bIgnoreSubgroup || bIgnore ) + { continue; - else if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Bool" ) ) && pCurParent ) + } + else if( aCtrlType.equalsAscii( "Bool" ) && pCurParent ) { - NSRect aCheckRect = { { nCurX + nAttachOffset, 0 }, { 0, 15 } }; - NSButton* pBtn = [[NSButton alloc] initWithFrame: aCheckRect]; - [pBtn setButtonType: NSSwitchButton]; sal_Bool bVal = sal_False; PropertyValue* pVal = pController->getValue( aPropertyName ); if( pVal ) pVal->Value >>= bVal; - [pBtn setState: bVal ? NSOnState : NSOffState]; - linebreakCell( [pBtn cell], aText ); - [pBtn sizeToFit]; - [pCurParent addSubview: [pBtn autorelease]]; - - aRightColumn.push_back( ColumnItem( pBtn ) ); - - // connect target - [pBtn setTarget: pCtrlTarget]; - [pBtn setAction: @selector(triggered:)]; - int nTag = pControllerProperties->addNameTag( aPropertyName ); - pControllerProperties->addObservedControl( pBtn ); - [pBtn setTag: nTag]; - - aCheckRect = [pBtn frame]; - - // move to nCurY - aCheckRect.origin.y = nCurY - aCheckRect.size.height; - [pBtn setFrame: aCheckRect]; - - // update nCurY - nCurY = aCheckRect.origin.y - 5; + addBool( pCurParent, nCurX, nCurY, nAttachOffset, + aText, true, aPropertyName, bVal, + aRightColumn, pControllerProperties, pCtrlTarget ); } - else if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Radio" ) ) && pCurParent ) + else if( aCtrlType.equalsAscii( "Radio" ) && pCurParent ) { - sal_Int32 nOff = 0; - if( aText.getLength() ) - { - // add a label - NSControl* pTextView = createLabel( aText ); - NSRect aTextRect = [pTextView frame]; - aTextRect.origin.x = nCurX + nAttachOffset; - [pCurParent addSubview: [pTextView autorelease]]; - - aLeftColumn.push_back( ColumnItem( pTextView ) ); - - // move to nCurY - aTextRect.origin.y = nCurY - aTextRect.size.height; - [pTextView setFrame: aTextRect]; - - // update nCurY - nCurY = aTextRect.origin.y - 5; - - // indent the radio group relative to the text - // nOff = 20; - } - - // setup radio matrix - NSButtonCell* pProto = [[NSButtonCell alloc] init]; - - NSRect aRadioRect = { { nCurX + nOff, 0 }, { 280 - nCurX, 5*aChoices.getLength() } }; - [pProto setTitle: @"RadioButtonGroup"]; - [pProto setButtonType: NSRadioButton]; - NSMatrix* pMatrix = [[NSMatrix alloc] initWithFrame: aRadioRect - mode: NSRadioModeMatrix - prototype: (NSCell*)pProto - numberOfRows: aChoices.getLength() - numberOfColumns: 1]; // get currently selected value sal_Int32 nSelectVal = 0; PropertyValue* pVal = pController->getValue( aPropertyName ); if( pVal && pVal->Value.hasValue() ) pVal->Value >>= nSelectVal; - // set individual titles - NSArray* pCells = [pMatrix cells]; - for( sal_Int32 m = 0; m < aChoices.getLength(); m++ ) - { - NSCell* pCell = [pCells objectAtIndex: m]; - filterAccelerator( aChoices[m] ); - linebreakCell( pCell, aChoices[m] ); - //NSString* pTitle = CreateNSString( aChoices[m] ); - //[pCell setTitle: pTitle]; - // connect target and action - [pCell setTarget: pCtrlTarget]; - [pCell setAction: @selector(triggered:)]; - int nTag = pControllerProperties->addNameAndValueTag( aPropertyName, m ); - pControllerProperties->addObservedControl( pCell ); - [pCell setTag: nTag]; - //[pTitle release]; - // set current selection - if( nSelectVal == m ) - [pMatrix selectCellAtRow: m column: 0]; - } - [pMatrix sizeToFit]; - aRadioRect = [pMatrix frame]; - - // move it down, so it comes to the correct position - aRadioRect.origin.y = nCurY - aRadioRect.size.height; - [pMatrix setFrame: aRadioRect]; - [pCurParent addSubview: [pMatrix autorelease]]; - aRightColumn.push_back( ColumnItem( pMatrix ) ); - - // update nCurY - nCurY = aRadioRect.origin.y - 5; - - [pProto release]; + addRadio( pCurParent, nCurX, nCurY, nAttachOffset, + aText, aPropertyName, aChoices, nSelectVal, + aLeftColumn, aRightColumn, + pControllerProperties, pCtrlTarget ); } - else if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "List" ) ) && pCurParent ) + else if( aCtrlType.equalsAscii( "List" ) && pCurParent ) { - // don't indent attached lists, looks bad in the existing cases - NSControl* pTextView = createLabel( aText ); - [pCurParent addSubview: [pTextView autorelease]]; - aLeftColumn.push_back( ColumnItem( pTextView ) ); - NSRect aTextRect = [pTextView frame]; - aTextRect.origin.x = nCurX /* + nAttachOffset*/; - - // don't indent attached lists, looks bad in the existing cases - NSRect aBtnRect = { { nCurX /*+ nAttachOffset*/ + aTextRect.size.width, 0 }, { 0, 15 } }; - NSPopUpButton* pBtn = [[NSPopUpButton alloc] initWithFrame: aBtnRect pullsDown: NO]; - - // iterate options - for( sal_Int32 m = 0; m < aChoices.getLength(); m++ ) - { - NSString* pItemText = CreateNSString( aChoices[m] ); - [pBtn addItemWithTitle: pItemText]; - NSMenuItem* pItem = [pBtn itemWithTitle: pItemText]; - int nTag = pControllerProperties->addNameAndValueTag( aPropertyName, m ); - [pItem setTag: nTag]; - [pItemText release]; - } - PropertyValue* pVal = pController->getValue( aPropertyName ); sal_Int32 aSelectVal = 0; if( pVal && pVal->Value.hasValue() ) pVal->Value >>= aSelectVal; - [pBtn selectItemAtIndex: aSelectVal]; - - // add the button to observed controls for enabled state changes - // also add a tag just for this purpose - pControllerProperties->addObservedControl( pBtn ); - [pBtn setTag: pControllerProperties->addNameTag( aPropertyName )]; - - [pBtn sizeToFit]; - [pCurParent addSubview: [pBtn autorelease]]; - - aRightColumn.push_back( ColumnItem( pBtn ) ); - - // connect target and action - [pBtn setTarget: pCtrlTarget]; - [pBtn setAction: @selector(triggered:)]; - - // move to nCurY - aBtnRect = [pBtn frame]; - aBtnRect.origin.y = nCurY - aBtnRect.size.height; - [pBtn setFrame: aBtnRect]; - - // align label - aTextRect.origin.y = aBtnRect.origin.y + (aBtnRect.size.height - aTextRect.size.height)/2; - [pTextView setFrame: aTextRect]; - // update nCurY - nCurY = aBtnRect.origin.y - 5; + addList( pCurParent, nCurX, nCurY, nAttachOffset, + aText, aPropertyName, aChoices, aSelectVal, + aLeftColumn, aRightColumn, + pControllerProperties, pCtrlTarget ); } - else if( (aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Edit" ) ) || aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Range" ) )) && pCurParent ) + else if( (aCtrlType.equalsAscii( "Edit" ) || aCtrlType.equalsAscii( "Range" )) && pCurParent ) { - sal_Int32 nOff = 0; - if( aText.getLength() ) - { - // add a label - NSControl* pTextView = createLabel( aText ); - [pCurParent addSubview: [pTextView autorelease]]; - - aLeftColumn.push_back( ColumnItem( pTextView ) ); - - // move to nCurY - NSRect aTextRect = [pTextView frame]; - aTextRect.origin.x = nCurX + nAttachOffset; - aTextRect.origin.y = nCurY - aTextRect.size.height; - [pTextView setFrame: aTextRect]; - - // update nCurY - nCurY = aTextRect.origin.y - 5; - - // and set the offset for the real edit field - nOff = aTextRect.size.width + 5; - } - - NSRect aFieldRect = { { nCurX + nOff + nAttachOffset, 0 }, { 100, 25 } }; - NSTextField* pFieldView = [[NSTextField alloc] initWithFrame: aFieldRect]; - [pFieldView setEditable: YES]; - [pFieldView setSelectable: YES]; - [pFieldView setDrawsBackground: YES]; - [pFieldView sizeToFit]; // FIXME: this does nothing - [pCurParent addSubview: [pFieldView autorelease]]; - - aRightColumn.push_back( ColumnItem( pFieldView ) ); - - // add the field to observed controls for enabled state changes - // also add a tag just for this purpose - pControllerProperties->addObservedControl( pFieldView ); - int nTag = pControllerProperties->addNameTag( aPropertyName ); - [pFieldView setTag: nTag]; - // pControllerProperties->addNamedView( pFieldView, aPropertyName ); - - // move to nCurY - aFieldRect.origin.y = nCurY - aFieldRect.size.height; - [pFieldView setFrame: aFieldRect]; - // current value PropertyValue* pVal = pController->getValue( aPropertyName ); - if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Range" ) ) ) - { - // add a stepper control - NSRect aStepFrame = { { aFieldRect.origin.x + aFieldRect.size.width + 5, - aFieldRect.origin.y }, - { 15, aFieldRect.size.height } }; - NSStepper* pStep = [[NSStepper alloc] initWithFrame: aStepFrame]; - [pStep setIncrement: 1]; - [pStep setValueWraps: NO]; - [pStep setTag: nTag]; - [pCurParent addSubview: [pStep autorelease]]; - - aRightColumn.back().pSubControl = pStep; - - pControllerProperties->addObservedControl( pStep ); - [pStep setTarget: pCtrlTarget]; - [pStep setAction: @selector(triggered:)]; - - // constrain the text field to decimal numbers - NSNumberFormatter* pFormatter = [[NSNumberFormatter alloc] init]; - [pFormatter setFormatterBehavior: NSNumberFormatterBehavior10_4]; - [pFormatter setNumberStyle: NSNumberFormatterDecimalStyle]; - [pFormatter setAllowsFloats: NO]; - [pFormatter setMaximumFractionDigits: 0]; - if( nMinValue != nMaxValue ) - { - [pFormatter setMinimum: [[NSNumber numberWithInt: nMinValue] autorelease]]; - [pStep setMinValue: nMinValue]; - [pFormatter setMaximum: [[NSNumber numberWithInt: nMaxValue] autorelease]]; - [pStep setMaxValue: nMaxValue]; - } - [pFieldView setFormatter: pFormatter]; - - sal_Int64 nSelectVal = 0; - if( pVal && pVal->Value.hasValue() ) - pVal->Value >>= nSelectVal; - - [pFieldView setIntValue: nSelectVal]; - [pStep setIntValue: nSelectVal]; - - pControllerProperties->addViewPair( pFieldView, pStep ); - // connect target and action - [pFieldView setTarget: pCtrlTarget]; - [pFieldView setAction: @selector(triggeredNumeric:)]; - [pStep setTarget: pCtrlTarget]; - [pStep setAction: @selector(triggeredNumeric:)]; - } - else - { - // connect target and action - [pFieldView setTarget: pCtrlTarget]; - [pFieldView setAction: @selector(triggered:)]; - - if( pVal && pVal->Value.hasValue() ) - { - rtl::OUString aValue; - pVal->Value >>= aValue; - if( aValue.getLength() ) - { - NSString* pText = CreateNSString( aValue ); - [pFieldView setStringValue: pText]; - [pText release]; - } - } - } - - // update nCurY - nCurY = aFieldRect.origin.y - 5; - + addEdit( pCurParent, nCurX, nCurY, nAttachOffset, + aCtrlType, aText, aPropertyName, pVal, + nMinValue, nMaxValue, + aLeftColumn, aRightColumn, + pControllerProperties, pCtrlTarget ); } } else @@ -1205,7 +1354,7 @@ static void linebreakCell( NSCell* pBtn, const rtl::OUString& i_rText ) OSL_FAIL( "Unsupported UI option" ); } } - + pControllerProperties->updateEnableState(); adjustViewAndChildren( pCurParent, aMaxTabSize, aLeftColumn, aRightColumn ); diff --git a/vcl/aqua/source/gdi/aquaprintview.mm b/vcl/aqua/source/gdi/aquaprintview.mm index ae42c5c09e8d..11b4b9088591 100755 --- a/vcl/aqua/source/gdi/aquaprintview.mm +++ b/vcl/aqua/source/gdi/aquaprintview.mm @@ -44,7 +44,7 @@ return self; } --(MacOSBOOL)knowsPageRange: (NSRangePointer)range +-(BOOL)knowsPageRange: (NSRangePointer)range { range->location = 1; range->length = mpInfoPrinter->getCurPageRangeCount(); diff --git a/vcl/aqua/source/gdi/salatslayout.cxx b/vcl/aqua/source/gdi/salatslayout.cxx index f79da3559b35..3a88422a2160 100644 --- a/vcl/aqua/source/gdi/salatslayout.cxx +++ b/vcl/aqua/source/gdi/salatslayout.cxx @@ -267,7 +267,7 @@ bool ATSLayout::LayoutText( ImplLayoutArgs& rArgs ) if( (rArgs.mnFlags & SAL_LAYOUT_BIDI_STRONG) != 0 ) { // control BiDi defaults - MacOSBOOL nLineDirTag = kATSULeftToRightBaseDirection; + BOOL nLineDirTag = kATSULeftToRightBaseDirection; if( (rArgs.mnFlags & SAL_LAYOUT_BIDI_RTL) != 0 ) nLineDirTag = kATSURightToLeftBaseDirection; aTagAttrs[0] = kATSULineDirectionTag; diff --git a/vcl/aqua/source/gdi/salbmp.cxx b/vcl/aqua/source/gdi/salbmp.cxx index 2a531f243de2..7fc5ff74ed2e 100644 --- a/vcl/aqua/source/gdi/salbmp.cxx +++ b/vcl/aqua/source/gdi/salbmp.cxx @@ -105,7 +105,7 @@ bool AquaSalBitmap::Create( CGLayerRef xLayer, int nBitmapBits, // ------------------------------------------------------------------ -bool AquaSalBitmap::Create( const Size& rSize, USHORT nBits, const BitmapPalette& rBitmapPalette ) +bool AquaSalBitmap::Create( const Size& rSize, sal_uInt16 nBits, const BitmapPalette& rBitmapPalette ) { if( !isValidBitCount( nBits ) ) return false; @@ -132,7 +132,7 @@ bool AquaSalBitmap::Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics ) // ------------------------------------------------------------------ -bool AquaSalBitmap::Create( const SalBitmap& rSalBmp, USHORT nNewBitCount ) +bool AquaSalBitmap::Create( const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount ) { const AquaSalBitmap& rSourceBitmap = static_cast<const AquaSalBitmap&>(rSalBmp); @@ -568,7 +568,7 @@ Size AquaSalBitmap::GetSize() const // ------------------------------------------------------------------ -USHORT AquaSalBitmap::GetBitCount() const +sal_uInt16 AquaSalBitmap::GetBitCount() const { return mnBits; } @@ -577,9 +577,9 @@ USHORT AquaSalBitmap::GetBitCount() const static struct pal_entry { - BYTE mnRed; - BYTE mnGreen; - BYTE mnBlue; + sal_uInt8 mnRed; + sal_uInt8 mnGreen; + sal_uInt8 mnBlue; } const aImplSalSysPalEntryAry[ 16 ] = { @@ -634,9 +634,9 @@ const BitmapPalette& GetDefaultPalette( int mnBits, bool bMonochrome ) // own palette (6/6/6) const int DITHER_PAL_STEPS = 6; - const BYTE DITHER_PAL_DELTA = 51; + const sal_uInt8 DITHER_PAL_DELTA = 51; int nB, nG, nR; - BYTE nRed, nGreen, nBlue; + sal_uInt8 nRed, nGreen, nBlue; for( nB=0, nBlue=0; nB < DITHER_PAL_STEPS; nB++, nBlue += DITHER_PAL_DELTA ) { for( nG=0, nGreen=0; nG < DITHER_PAL_STEPS; nG++, nGreen += DITHER_PAL_DELTA ) diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index cd32820f258c..4eadc86ff15d 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -42,6 +42,7 @@ #include "vcl/sysdata.hxx" #include "vcl/sallayout.hxx" #include "vcl/svapp.hxx" +#include "vcl/region.h" #include "osl/file.hxx" #include "osl/process.h" @@ -59,7 +60,7 @@ using namespace vcl; -typedef unsigned char Boolean; // copied from MacTypes.h, should be properly included +//typedef unsigned char Boolean; // copied from MacTypes.h, should be properly included typedef std::vector<unsigned char> ByteVector; @@ -118,17 +119,15 @@ inline FourCharCode GetTag(const char aTagName[5]) static unsigned GetUShort( const unsigned char* p ){return((p[0]<<8)+p[1]);} static unsigned GetUInt( const unsigned char* p ) { return((p[0]<<24)+(p[1]<<16)+(p[2]<<8)+p[3]);} -ImplFontCharMap* ImplMacFontData::GetImplFontCharMap() const +const ImplFontCharMap* ImplMacFontData::GetImplFontCharMap() const { + // return the cached charmap if( mpCharMap ) - { - // return the cached charmap - mpCharMap->AddReference(); return mpCharMap; - } // set the default charmap mpCharMap = ImplFontCharMap::GetDefaultMap(); + mpCharMap->AddReference(); // get the CMAP byte size ATSFontRef rFont = FMGetATSFontRefFromFont( mnFontId ); @@ -502,9 +501,9 @@ void AquaSalGraphics::copyResolution( AquaSalGraphics& rGraphics ) // ----------------------------------------------------------------------- -USHORT AquaSalGraphics::GetBitCount() const +sal_uInt16 AquaSalGraphics::GetBitCount() const { - USHORT nBits = mnBitmapDepth ? mnBitmapDepth : 32;//24; + sal_uInt16 nBits = mnBitmapDepth ? mnBitmapDepth : 32;//24; return nBits; } @@ -611,7 +610,7 @@ void AquaSalGraphics::ResetClipRegion() // ----------------------------------------------------------------------- -void AquaSalGraphics::BeginSetClipRegion( ULONG nRectCount ) +bool AquaSalGraphics::setClipRegion( const Region& i_rClip ) { // release old clip path if( mxClipPath ) @@ -619,41 +618,33 @@ void AquaSalGraphics::BeginSetClipRegion( ULONG nRectCount ) CGPathRelease( mxClipPath ); mxClipPath = NULL; } -} - -// ----------------------------------------------------------------------- - -BOOL AquaSalGraphics::unionClipRegion( long nX, long nY, long nWidth, long nHeight ) -{ - if( (nWidth <= 0) || (nHeight <= 0) ) - return TRUE; - - if( !mxClipPath ) - mxClipPath = CGPathCreateMutable(); - const CGRect aClipRect = {{nX,nY},{nWidth,nHeight}}; - CGPathAddRect( mxClipPath, NULL, aClipRect ); - return TRUE; -} - -// ----------------------------------------------------------------------- - -bool AquaSalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& rPolyPolygon ) -{ - if( rPolyPolygon.count() <= 0 ) - return true; - - if( !mxClipPath ) - mxClipPath = CGPathCreateMutable(); - AddPolyPolygonToPath( mxClipPath, rPolyPolygon, !getAntiAliasB2DDraw(), false ); - return true; -} + mxClipPath = CGPathCreateMutable(); -// ----------------------------------------------------------------------- - -void AquaSalGraphics::EndSetClipRegion() -{ + // set current path, either as polypolgon or sequence of rectangles + if( i_rClip.HasPolyPolygon() ) + { + basegfx::B2DPolyPolygon aClip( const_cast<Region&>(i_rClip).ConvertToB2DPolyPolygon() ); + AddPolyPolygonToPath( mxClipPath, aClip, !getAntiAliasB2DDraw(), false ); + } + else + { + long nX, nY, nW, nH; + ImplRegionInfo aInfo; + bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH ); + while( bRegionRect ) + { + if( nW && nH ) + { + CGRect aRect = {{nX,nY}, {nW,nH}}; + CGPathAddRect( mxClipPath, NULL, aRect ); + } + bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH ); + } + } + // set the current path as clip region if( CheckContext() ) SetState(); + return true; } // ----------------------------------------------------------------------- @@ -796,13 +787,13 @@ void AquaSalGraphics::drawRect( long nX, long nY, long nWidth, long nHeight ) // ----------------------------------------------------------------------- -static void getBoundRect( ULONG nPoints, const SalPoint *pPtAry, long &rX, long& rY, long& rWidth, long& rHeight ) +static void getBoundRect( sal_uLong nPoints, const SalPoint *pPtAry, long &rX, long& rY, long& rWidth, long& rHeight ) { long nX1 = pPtAry->mnX; long nX2 = nX1; long nY1 = pPtAry->mnY; long nY2 = nY1; - for( ULONG n = 1; n < nPoints; n++ ) + for( sal_uLong n = 1; n < nPoints; n++ ) { if( pPtAry[n].mnX < nX1 ) nX1 = pPtAry[n].mnX; @@ -826,7 +817,7 @@ static inline void alignLinePoint( const SalPoint* i_pIn, float& o_fX, float& o_ o_fY = static_cast<float>(i_pIn->mnY ) + 0.5; } -void AquaSalGraphics::drawPolyLine( ULONG nPoints, const SalPoint *pPtAry ) +void AquaSalGraphics::drawPolyLine( sal_uLong nPoints, const SalPoint *pPtAry ) { if( nPoints < 1 ) return; @@ -842,7 +833,7 @@ void AquaSalGraphics::drawPolyLine( ULONG nPoints, const SalPoint *pPtAry ) alignLinePoint( pPtAry, fX, fY ); CGContextMoveToPoint( mrContext, fX, fY ); pPtAry++; - for( ULONG nPoint = 1; nPoint < nPoints; nPoint++, pPtAry++ ) + for( sal_uLong nPoint = 1; nPoint < nPoints; nPoint++, pPtAry++ ) { alignLinePoint( pPtAry, fX, fY ); CGContextAddLineToPoint( mrContext, fX, fY ); @@ -854,7 +845,7 @@ void AquaSalGraphics::drawPolyLine( ULONG nPoints, const SalPoint *pPtAry ) // ----------------------------------------------------------------------- -void AquaSalGraphics::drawPolygon( ULONG nPoints, const SalPoint *pPtAry ) +void AquaSalGraphics::drawPolygon( sal_uLong nPoints, const SalPoint *pPtAry ) { if( nPoints <= 1 ) return; @@ -882,7 +873,7 @@ void AquaSalGraphics::drawPolygon( ULONG nPoints, const SalPoint *pPtAry ) alignLinePoint( pPtAry, fX, fY ); CGContextMoveToPoint( mrContext, fX, fY ); pPtAry++; - for( ULONG nPoint = 1; nPoint < nPoints; nPoint++, pPtAry++ ) + for( sal_uLong nPoint = 1; nPoint < nPoints; nPoint++, pPtAry++ ) { alignLinePoint( pPtAry, fX, fY ); CGContextAddLineToPoint( mrContext, fX, fY ); @@ -892,7 +883,7 @@ void AquaSalGraphics::drawPolygon( ULONG nPoints, const SalPoint *pPtAry ) { CGContextMoveToPoint( mrContext, pPtAry->mnX, pPtAry->mnY ); pPtAry++; - for( ULONG nPoint = 1; nPoint < nPoints; nPoint++, pPtAry++ ) + for( sal_uLong nPoint = 1; nPoint < nPoints; nPoint++, pPtAry++ ) CGContextAddLineToPoint( mrContext, pPtAry->mnX, pPtAry->mnY ); } @@ -902,7 +893,7 @@ void AquaSalGraphics::drawPolygon( ULONG nPoints, const SalPoint *pPtAry ) // ----------------------------------------------------------------------- -void AquaSalGraphics::drawPolyPolygon( ULONG nPolyCount, const ULONG *pPoints, PCONSTSALPOINT *ppPtAry ) +void AquaSalGraphics::drawPolyPolygon( sal_uLong nPolyCount, const sal_uLong *pPoints, PCONSTSALPOINT *ppPtAry ) { if( nPolyCount <= 0 ) return; @@ -912,7 +903,7 @@ void AquaSalGraphics::drawPolyPolygon( ULONG nPolyCount, const ULONG *pPoints, P // find bound rect long leftX = 0, topY = 0, maxWidth = 0, maxHeight = 0; getBoundRect( pPoints[0], ppPtAry[0], leftX, topY, maxWidth, maxHeight ); - for( ULONG n = 1; n < nPolyCount; n++ ) + for( sal_uLong n = 1; n < nPolyCount; n++ ) { long nX = leftX, nY = topY, nW = maxWidth, nH = maxHeight; getBoundRect( pPoints[n], ppPtAry[n], nX, nY, nW, nH ); @@ -947,9 +938,9 @@ void AquaSalGraphics::drawPolyPolygon( ULONG nPolyCount, const ULONG *pPoints, P CGContextBeginPath( mrContext ); if( IsPenVisible() ) { - for( ULONG nPoly = 0; nPoly < nPolyCount; nPoly++ ) + for( sal_uLong nPoly = 0; nPoly < nPolyCount; nPoly++ ) { - const ULONG nPoints = pPoints[nPoly]; + const sal_uLong nPoints = pPoints[nPoly]; if( nPoints > 1 ) { const SalPoint *pPtAry = ppPtAry[nPoly]; @@ -957,7 +948,7 @@ void AquaSalGraphics::drawPolyPolygon( ULONG nPolyCount, const ULONG *pPoints, P alignLinePoint( pPtAry, fX, fY ); CGContextMoveToPoint( mrContext, fX, fY ); pPtAry++; - for( ULONG nPoint = 1; nPoint < nPoints; nPoint++, pPtAry++ ) + for( sal_uLong nPoint = 1; nPoint < nPoints; nPoint++, pPtAry++ ) { alignLinePoint( pPtAry, fX, fY ); CGContextAddLineToPoint( mrContext, fX, fY ); @@ -968,15 +959,15 @@ void AquaSalGraphics::drawPolyPolygon( ULONG nPolyCount, const ULONG *pPoints, P } else { - for( ULONG nPoly = 0; nPoly < nPolyCount; nPoly++ ) + for( sal_uLong nPoly = 0; nPoly < nPolyCount; nPoly++ ) { - const ULONG nPoints = pPoints[nPoly]; + const sal_uLong nPoints = pPoints[nPoly]; if( nPoints > 1 ) { const SalPoint *pPtAry = ppPtAry[nPoly]; CGContextMoveToPoint( mrContext, pPtAry->mnX, pPtAry->mnY ); pPtAry++; - for( ULONG nPoint = 1; nPoint < nPoints; nPoint++, pPtAry++ ) + for( sal_uLong nPoint = 1; nPoint < nPoints; nPoint++, pPtAry++ ) CGContextAddLineToPoint( mrContext, pPtAry->mnX, pPtAry->mnY ); CGContextClosePath(mrContext); } @@ -1101,22 +1092,22 @@ bool AquaSalGraphics::drawPolyLine( const ::basegfx::B2DPolygon& rPolyLine, // ----------------------------------------------------------------------- -sal_Bool AquaSalGraphics::drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) +sal_Bool AquaSalGraphics::drawPolyLineBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ) { return sal_False; } // ----------------------------------------------------------------------- -sal_Bool AquaSalGraphics::drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) +sal_Bool AquaSalGraphics::drawPolygonBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ) { return sal_False; } // ----------------------------------------------------------------------- -sal_Bool AquaSalGraphics::drawPolyPolygonBezier( ULONG nPoly, const ULONG* pPoints, - const SalPoint* const* pPtAry, const BYTE* const* pFlgAry ) +sal_Bool AquaSalGraphics::drawPolyPolygonBezier( sal_uLong nPoly, const sal_uLong* pPoints, + const SalPoint* const* pPtAry, const sal_uInt8* const* pFlgAry ) { return sal_False; } @@ -1202,7 +1193,7 @@ void AquaSalGraphics::copyBits( const SalTwoRect *pPosAry, SalGraphics *pSrcGrap // ----------------------------------------------------------------------- -void AquaSalGraphics::copyArea( long nDstX, long nDstY,long nSrcX, long nSrcY, long nSrcWidth, long nSrcHeight, USHORT nFlags ) +void AquaSalGraphics::copyArea( long nDstX, long nDstY,long nSrcX, long nSrcY, long nSrcWidth, long nSrcHeight, sal_uInt16 nFlags ) { ApplyXorContext(); @@ -1429,7 +1420,7 @@ void AquaSalGraphics::invert( long nX, long nY, long nWidth, long nHeight, SalIn // ----------------------------------------------------------------------- -void AquaSalGraphics::invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nSalFlags ) +void AquaSalGraphics::invert( sal_uLong nPoints, const SalPoint* pPtAry, SalInvert nSalFlags ) { CGPoint* CGpoints ; if ( CheckContext() ) @@ -1466,8 +1457,8 @@ void AquaSalGraphics::invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert // ----------------------------------------------------------------------- -BOOL AquaSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, - void* pEpsData, ULONG nByteCount ) +sal_Bool AquaSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, + void* pEpsData, sal_uLong nByteCount ) { // convert the raw data to an NSImageRef NSData* xNSData = [NSData dataWithBytes:(void*)pEpsData length:(int)nByteCount]; @@ -1636,7 +1627,7 @@ void AquaSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackL // ----------------------------------------------------------------------- -ULONG AquaSalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ) +sal_uLong AquaSalGraphics::GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs ) { return 0; } @@ -1817,7 +1808,7 @@ static OSStatus GgoMoveToProc( const Float32Point* pPoint, void* pData ) return eStatus; } -BOOL AquaSalGraphics::GetGlyphOutline( long nGlyphId, basegfx::B2DPolyPolygon& rPolyPoly ) +sal_Bool AquaSalGraphics::GetGlyphOutline( long nGlyphId, basegfx::B2DPolyPolygon& rPolyPoly ) { GgoData aGgoData; aGgoData.mpPolyPoly = &rPolyPoly; @@ -1859,7 +1850,7 @@ long AquaSalGraphics::GetGraphicsWidth() const // ----------------------------------------------------------------------- -BOOL AquaSalGraphics::GetGlyphBoundRect( long nGlyphId, Rectangle& rRect ) +sal_Bool AquaSalGraphics::GetGlyphBoundRect( long nGlyphId, Rectangle& rRect ) { ATSUStyle rATSUStyle = maATSUStyle; // TODO: handle glyph fallback GlyphID aGlyphId = nGlyphId; @@ -1892,7 +1883,7 @@ void AquaSalGraphics::DrawServerFontLayout( const ServerFontLayout& ) // ----------------------------------------------------------------------- -USHORT AquaSalGraphics::SetFont( ImplFontSelectData* pReqFont, int nFallbackLevel ) +sal_uInt16 AquaSalGraphics::SetFont( ImplFontSelectData* pReqFont, int nFallbackLevel ) { if( !pReqFont ) { @@ -2026,7 +2017,7 @@ USHORT AquaSalGraphics::SetFont( ImplFontSelectData* pReqFont, int nFallbackLeve // ----------------------------------------------------------------------- -ImplFontCharMap* AquaSalGraphics::GetImplFontCharMap() const +const ImplFontCharMap* AquaSalGraphics::GetImplFontCharMap() const { if( !mpMacFontData ) return ImplFontCharMap::GetDefaultMap(); @@ -2217,10 +2208,10 @@ static bool GetRawFontData( const ImplFontData* pFontData, DBG_ASSERT( (nOfs==nTotalLen), "AquaSalGraphics::CreateFontSubset (nOfs!=nTotalLen)"); - return true; + return sal_True; } -BOOL AquaSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, +sal_Bool AquaSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, const ImplFontData* pFontData, long* pGlyphIDs, sal_uInt8* pEncoding, sal_Int32* pGlyphWidths, int nGlyphCount, FontSubsetInfo& rInfo ) { @@ -2229,7 +2220,7 @@ BOOL AquaSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, // prepare the requested file name for writing the font-subset file rtl::OUString aSysPath; if( osl_File_E_None != osl_getSystemPathFromFileURL( rToFile.pData, &aSysPath.pData ) ) - return FALSE; + return sal_False; const rtl_TextEncoding aThreadEncoding = osl_getThreadTextEncoding(); const ByteString aToFile( rtl::OUStringToOString( aSysPath, aThreadEncoding ) ); @@ -2290,7 +2281,7 @@ BOOL AquaSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, // subset glyphs and get their properties // take care that subset fonts require the NotDef glyph in pos 0 int nOrigCount = nGlyphCount; - USHORT aShortIDs[ 256 ]; + sal_uInt16 aShortIDs[ 256 ]; sal_uInt8 aTempEncs[ 256 ]; int nNotDef = -1; @@ -2310,7 +2301,7 @@ BOOL AquaSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, nGlyphIdx = ::MapChar( pSftFont, static_cast<sal_uInt16>(nGlyphIdx), bVertical ); } } - aShortIDs[i] = static_cast<USHORT>( nGlyphIdx ); + aShortIDs[i] = static_cast<sal_uInt16>( nGlyphIdx ); if( !nGlyphIdx ) if( nNotDef < 0 ) nNotDef = i; // first NotDef glyph found @@ -2338,7 +2329,7 @@ BOOL AquaSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, TTSimpleGlyphMetrics* pGlyphMetrics = ::GetTTSimpleGlyphMetrics( pSftFont, aShortIDs, nGlyphCount, bVertical ); if( !pGlyphMetrics ) - return FALSE; + return sal_False; sal_uInt16 nNotDefAdv = pGlyphMetrics[0].adv; pGlyphMetrics[0].adv = pGlyphMetrics[nNotDef].adv; pGlyphMetrics[nNotDef].adv = nNotDefAdv; @@ -2396,8 +2387,10 @@ void AquaSalGraphics::GetGlyphWidths( const ImplFontData* pFontData, bool bVerti const ImplFontCharMap* pMap = mpMacFontData->GetImplFontCharMap(); DBG_ASSERT( pMap && pMap->GetCharCount(), "no charmap" ); + pMap->AddReference(); // TODO: add and use RAII object instead // get unicode<->glyph encoding + // TODO? avoid sft mapping by using the pMap itself int nCharCount = pMap->GetCharCount(); sal_uInt32 nChar = pMap->GetFirstChar(); for(; --nCharCount >= 0; nChar = pMap->GetNextChar( nChar ) ) @@ -2409,6 +2402,8 @@ void AquaSalGraphics::GetGlyphWidths( const ImplFontData* pFontData, bool bVerti if( nGlyph > 0 ) rUnicodeEnc[ nUcsChar ] = nGlyph; } + + pMap->DeReference(); // TODO: add and use RAII object instead } ::CloseTTFont( pSftFont ); @@ -2625,24 +2620,24 @@ void XorEmulation::SetTarget( int nWidth, int nHeight, int nTargetDepth, nBytesPerRow = 1; } nBytesPerRow *= nWidth; - mnBufferLongs = (nHeight * nBytesPerRow + sizeof(ULONG)-1) / sizeof(ULONG); + mnBufferLongs = (nHeight * nBytesPerRow + sizeof(sal_uLong)-1) / sizeof(sal_uLong); // create a XorMask context - mpMaskBuffer = new ULONG[ mnBufferLongs ]; + mpMaskBuffer = new sal_uLong[ mnBufferLongs ]; mxMaskContext = ::CGBitmapContextCreate( mpMaskBuffer, nWidth, nHeight, nBitsPerComponent, nBytesPerRow, aCGColorSpace, aCGBmpInfo ); // reset the XOR mask to black - memset( mpMaskBuffer, 0, mnBufferLongs * sizeof(ULONG) ); + memset( mpMaskBuffer, 0, mnBufferLongs * sizeof(sal_uLong) ); // a bitmap context will be needed for manual XORing // create one unless the target context is a bitmap context if( nTargetDepth ) - mpTempBuffer = (ULONG*)CGBitmapContextGetData( mxTargetContext ); + mpTempBuffer = (sal_uLong*)CGBitmapContextGetData( mxTargetContext ); if( !mpTempBuffer ) { // create a bitmap context matching to the target context - mpTempBuffer = new ULONG[ mnBufferLongs ]; + mpTempBuffer = new sal_uLong[ mnBufferLongs ]; mxTempContext = ::CGBitmapContextCreate( mpTempBuffer, nWidth, nHeight, nBitsPerComponent, nBytesPerRow, aCGColorSpace, aCGBmpInfo ); @@ -2682,8 +2677,8 @@ bool XorEmulation::UpdateTarget() // do a manual XOR with the XorMask // this approach suffices for simple color manipulations // and also the complex-clipping-XOR-trick used in metafiles - const ULONG* pSrc = mpMaskBuffer; - ULONG* pDst = mpTempBuffer; + const sal_uLong* pSrc = mpMaskBuffer; + sal_uLong* pDst = mpTempBuffer; for( int i = mnBufferLongs; --i >= 0;) *(pDst++) ^= *(pSrc++); @@ -2701,7 +2696,7 @@ bool XorEmulation::UpdateTarget() // reset the XorMask to black again // TODO: not needed for last update - memset( mpMaskBuffer, 0, mnBufferLongs * sizeof(ULONG) ); + memset( mpMaskBuffer, 0, mnBufferLongs * sizeof(sal_uLong) ); // TODO: return FALSE if target was not changed return true; diff --git a/vcl/aqua/source/gdi/salgdiutils.cxx b/vcl/aqua/source/gdi/salgdiutils.cxx index 56d40d3c7e72..22316a50da8d 100644 --- a/vcl/aqua/source/gdi/salgdiutils.cxx +++ b/vcl/aqua/source/gdi/salgdiutils.cxx @@ -254,12 +254,12 @@ void AquaSalGraphics::RefreshRect(float lX, float lY, float lWidth, float lHeigh } } -CGPoint* AquaSalGraphics::makeCGptArray(ULONG nPoints, const SalPoint* pPtAry) +CGPoint* AquaSalGraphics::makeCGptArray(sal_uLong nPoints, const SalPoint* pPtAry) { CGPoint *CGpoints = new (CGPoint[nPoints]); if ( CGpoints ) { - for(ULONG i=0;i<nPoints;i++) + for(sal_uLong i=0;i<nPoints;i++) { CGpoints[i].x = (float)(pPtAry[i].mnX); CGpoints[i].y = (float)(pPtAry[i].mnY); diff --git a/vcl/aqua/source/gdi/salnativewidgets.cxx b/vcl/aqua/source/gdi/salnativewidgets.cxx index 4e40bfa7077d..1ad5f5d3919c 100644 --- a/vcl/aqua/source/gdi/salnativewidgets.cxx +++ b/vcl/aqua/source/gdi/salnativewidgets.cxx @@ -237,13 +237,13 @@ static bool AquaGetScrollRect( /* TODO: int nScreen, */ ControlPart nPart, /* * IsNativeControlSupported() * -------------------------- - * Returns TRUE if the platform supports native + * Returns sal_True if the platform supports native * drawing of the control defined by nPart. * */ -BOOL AquaSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart ) +sal_Bool AquaSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart ) { - bool bOk = FALSE; + bool bOk = sal_False; // Native controls are now defaults // If you want to disable experimental native controls code, @@ -372,18 +372,18 @@ BOOL AquaSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart n /* * HitTestNativeControl() * - * If the return value is TRUE, bIsInside contains information whether + * If the return value is sal_True, bIsInside contains information whether * aPos was or was not inside the native widget specified by the * nType/nPart combination. */ -BOOL AquaSalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, - const Point& rPos, BOOL& rIsInside ) +sal_Bool AquaSalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, + const Point& rPos, sal_Bool& rIsInside ) { if ( nType == CTRL_SCROLLBAR ) { Rectangle aRect; bool bValid = AquaGetScrollRect( /* TODO: m_nScreen */ nPart, rControlRegion, aRect ); - rIsInside = bValid ? aRect.IsInside( rPos ) : FALSE; + rIsInside = bValid ? aRect.IsInside( rPos ) : sal_False; if( GetSalData()->mbIsScrollbarDoubleMax ) { // in double max mode the actual trough is a little smaller than the track @@ -394,20 +394,20 @@ BOOL AquaSalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart { // the left 4 pixels are not hit sensitive if( rPos.X() - aRect.Left() < 4 ) - rIsInside = FALSE; + rIsInside = sal_False; } else if( nPart == PART_TRACK_VERT_AREA ) { // the top 4 pixels are not hit sensitive if( rPos.Y() - aRect.Top() < 4 ) - rIsInside = FALSE; + rIsInside = sal_False; } } } return bValid; } // CTRL_SCROLLBAR - return FALSE; + return sal_False; } /* @@ -467,14 +467,14 @@ UInt32 AquaSalGraphics::getTrackState( ControlState nState ) * aValue: An optional value (tristate/numerical/string) * aCaption: A caption or title string (like button text etc) */ -BOOL AquaSalGraphics::drawNativeControl(ControlType nType, +sal_Bool AquaSalGraphics::drawNativeControl(ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption ) { - BOOL bOK = FALSE; + sal_Bool bOK = sal_False; if( ! CheckContext() ) return false; @@ -1148,7 +1148,7 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType, case CTRL_FRAME: { - USHORT nStyle = aValue.getNumericVal(); + sal_uInt16 nStyle = aValue.getNumericVal(); if( nPart == PART_BORDER ) { if(!( nStyle & FRAME_DRAW_MENU ) && !(nStyle & FRAME_DRAW_WINDOWBORDER) ) { @@ -1225,18 +1225,18 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType, * aValue: An optional value (tristate/numerical/string) * aCaption: A caption or title string (like button text etc) */ -BOOL AquaSalGraphics::drawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, +sal_Bool AquaSalGraphics::drawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption ) { - return( FALSE ); + return( sal_False ); } /* * GetNativeControlRegion() * - * If the return value is TRUE, rNativeBoundingRegion + * If the return value is sal_True, rNativeBoundingRegion * contains the true bounding region covered by the control * including any adornment, while rNativeContentRegion contains the area * within the control that can be safely drawn into without drawing over @@ -1246,12 +1246,12 @@ BOOL AquaSalGraphics::drawNativeControlText( ControlType nType, ControlPart nPar * aValue: An optional value (tristate/numerical/string) * aCaption: A caption or title string (like button text etc) */ -BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, +sal_Bool AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption, Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ) { - BOOL toReturn = FALSE; + sal_Bool toReturn = sal_False; Rectangle aCtrlBoundRect( rControlRegion ); short x = aCtrlBoundRect.Left(); @@ -1286,7 +1286,7 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa Rectangle aRect; if( AquaGetScrollRect( /* m_nScreen */ nPart, aCtrlBoundRect, aRect ) ) { - toReturn = TRUE; + toReturn = sal_True; rNativeBoundingRegion = aRect; rNativeContentRegion = aRect; } @@ -1316,7 +1316,7 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa rNativeContentRegion = Rectangle( Point( x, y ), Size( w, h + nBorderCleanup) ); rNativeBoundingRegion = Rectangle( Point( x, y ), Size( w, h ) ); - toReturn = TRUE; + toReturn = sal_True; } break; case CTRL_PROGRESS: @@ -1328,7 +1328,7 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa aRect.Bottom() = aRect.Top() + 15; // values taken from HIG for large progress rNativeBoundingRegion = aRect; rNativeContentRegion = aRect; - toReturn = TRUE; + toReturn = sal_True; } break; @@ -1338,7 +1338,7 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa aRect.Bottom() = aRect.Top() + INTRO_PROGRESS_HEIGHT; // values taken from HIG for medium progress rNativeBoundingRegion = aRect; rNativeContentRegion = aRect; - toReturn = TRUE; + toReturn = sal_True; } break; @@ -1354,7 +1354,7 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa rNativeContentRegion = Rectangle( Point( x, y ), Size( w, h ) ); rNativeBoundingRegion = Rectangle( Point( x, y ), Size( w, h ) ); - toReturn = TRUE; + toReturn = sal_True; break; @@ -1370,7 +1370,7 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa rNativeContentRegion = Rectangle( Point( x+FOCUS_RING_WIDTH, y+FOCUS_RING_WIDTH ), Size( w-2*(FOCUS_RING_WIDTH+1), h-2*(FOCUS_RING_WIDTH+1) ) ); rNativeBoundingRegion = Rectangle( Point( x, y ), Size( w, h ) ); - toReturn = TRUE; + toReturn = sal_True; } break; case CTRL_LISTBOX: @@ -1384,7 +1384,7 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa rNativeContentRegion = Rectangle( Point( x+FOCUS_RING_WIDTH, y+FOCUS_RING_WIDTH ), Size( w-2*FOCUS_RING_WIDTH, h ) ); rNativeBoundingRegion = Rectangle( Point( x, y ), Size( w, h+2*FOCUS_RING_WIDTH ) ); - toReturn = TRUE; + toReturn = sal_True; } else if( nPart == PART_BUTTON_DOWN ) { @@ -1433,7 +1433,7 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa rNativeContentRegion = Rectangle( Point( x+FOCUS_RING_WIDTH, y ), Size( w-2*FOCUS_RING_WIDTH, h ) ); rNativeBoundingRegion = Rectangle( Point( x, y ), Size( w, h+2*FOCUS_RING_WIDTH ) ); - toReturn = TRUE; + toReturn = sal_True; } else if( nPart == PART_SUB_EDIT ) { w = aCtrlBoundRect.GetWidth() - SPIN_BUTTON_SPACE - SPIN_BUTTON_WIDTH; @@ -1446,7 +1446,7 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa rNativeContentRegion = Rectangle( Point( x + FOCUS_RING_WIDTH, y + FOCUS_RING_WIDTH ), Size( w - 2* FOCUS_RING_WIDTH, h ) ); rNativeBoundingRegion = Rectangle( Point( x, y ), Size( w, h+2*FOCUS_RING_WIDTH ) ); - toReturn = TRUE; + toReturn = sal_True; } else if( nPart == PART_BUTTON_UP ) { //aCtrlBoundRect.GetWidth() contains the width of the full control @@ -1460,7 +1460,7 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa rNativeContentRegion = Rectangle( Point( x, y ), Size( w, h ) ); rNativeBoundingRegion = Rectangle( Point( x, y ), Size( w, h ) ); - toReturn = TRUE; + toReturn = sal_True; } else if( nPart == PART_BUTTON_DOWN ) { x += aCtrlBoundRect.GetWidth() - SPIN_BUTTON_WIDTH - SPIN_BUTTON_SPACE - CLIP_FUZZ; @@ -1471,12 +1471,12 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa rNativeContentRegion = Rectangle( Point( x, y ), Size( w, h ) ); rNativeBoundingRegion = Rectangle( Point( x, y ), Size( w, h ) ); - toReturn = TRUE; + toReturn = sal_True; } break; case CTRL_FRAME: { - USHORT nStyle = aValue.getNumericVal(); + sal_uInt16 nStyle = aValue.getNumericVal(); if( ( nPart == PART_BORDER ) && !( nStyle & (FRAME_DRAW_MENU | FRAME_DRAW_WINDOWBORDER | FRAME_DRAW_BORDERWINDOWBORDER) ) ) { @@ -1499,7 +1499,7 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa rNativeContentRegion = aRect; rNativeBoundingRegion = aRect; - toReturn = TRUE; + toReturn = sal_True; } } break; @@ -1515,7 +1515,7 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa rNativeContentRegion = Rectangle( Point( x, y ), Size( w, h ) ); rNativeBoundingRegion = Rectangle( Point( x, y ), Size( w, h ) ); - toReturn = TRUE; + toReturn = sal_True; } } break; diff --git a/vcl/aqua/source/gdi/salprn.cxx b/vcl/aqua/source/gdi/salprn.cxx index 3d6eba93a59b..3e25d9eb111d 100644 --- a/vcl/aqua/source/gdi/salprn.cxx +++ b/vcl/aqua/source/gdi/salprn.cxx @@ -174,9 +174,9 @@ void AquaSalInfoPrinter::ReleaseGraphics( SalGraphics* ) // ----------------------------------------------------------------------- -BOOL AquaSalInfoPrinter::Setup( SalFrame* i_pFrame, ImplJobSetup* i_pSetupData ) +sal_Bool AquaSalInfoPrinter::Setup( SalFrame* i_pFrame, ImplJobSetup* i_pSetupData ) { - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -249,14 +249,14 @@ static Paper recognizePaper( double i_fWidth, double i_fHeight ) return aPaper; } -BOOL AquaSalInfoPrinter::SetPrinterData( ImplJobSetup* io_pSetupData ) +sal_Bool AquaSalInfoPrinter::SetPrinterData( ImplJobSetup* io_pSetupData ) { // FIXME: implement driver data if( io_pSetupData && io_pSetupData->mpDriverData ) return SetData( ~0, io_pSetupData ); - BOOL bSuccess = TRUE; + sal_Bool bSuccess = sal_True; // set system type io_pSetupData->mnSystem = JOBSETUP_SYSTEM_MAC; @@ -283,11 +283,11 @@ BOOL AquaSalInfoPrinter::SetPrinterData( ImplJobSetup* io_pSetupData ) io_pSetupData->meOrientation = mePageOrientation; io_pSetupData->mnPaperBin = 0; - io_pSetupData->mpDriverData = reinterpret_cast<BYTE*>(rtl_allocateMemory( 4 )); + io_pSetupData->mpDriverData = reinterpret_cast<sal_uInt8*>(rtl_allocateMemory( 4 )); io_pSetupData->mnDriverDataLen = 4; } else - bSuccess = FALSE; + bSuccess = sal_False; return bSuccess; @@ -317,10 +317,10 @@ void AquaSalInfoPrinter::setPaperSize( long i_nWidth, long i_nHeight, Orientatio // ----------------------------------------------------------------------- -BOOL AquaSalInfoPrinter::SetData( ULONG i_nFlags, ImplJobSetup* io_pSetupData ) +sal_Bool AquaSalInfoPrinter::SetData( sal_uLong i_nFlags, ImplJobSetup* io_pSetupData ) { if( ! io_pSetupData || io_pSetupData->mnSystem != JOBSETUP_SYSTEM_MAC ) - return FALSE; + return sal_False; if( mpPrintInfo ) @@ -358,14 +358,14 @@ BOOL AquaSalInfoPrinter::SetData( ULONG i_nFlags, ImplJobSetup* io_pSetupData ) // ----------------------------------------------------------------------- -ULONG AquaSalInfoPrinter::GetPaperBinCount( const ImplJobSetup* i_pSetupData ) +sal_uLong AquaSalInfoPrinter::GetPaperBinCount( const ImplJobSetup* i_pSetupData ) { return 0; } // ----------------------------------------------------------------------- -XubString AquaSalInfoPrinter::GetPaperBinName( const ImplJobSetup* i_pSetupData, ULONG i_nPaperBin ) +XubString AquaSalInfoPrinter::GetPaperBinName( const ImplJobSetup* i_pSetupData, sal_uLong i_nPaperBin ) { return XubString(); } @@ -378,14 +378,14 @@ static bool getUseNativeDialog() try { // get service provider - Reference< XMultiServiceFactory > xSMgr( unohelper::GetMultiServiceFactory() ); + uno::Reference< XMultiServiceFactory > xSMgr( unohelper::GetMultiServiceFactory() ); // create configuration hierachical access name if( xSMgr.is() ) { try { - Reference< XMultiServiceFactory > xConfigProvider( - Reference< XMultiServiceFactory >( + uno::Reference< XMultiServiceFactory > xConfigProvider( + uno::Reference< XMultiServiceFactory >( xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ))), UNO_QUERY ) @@ -397,8 +397,8 @@ static bool getUseNativeDialog() aVal.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ); aVal.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common/Misc" ) ); aArgs.getArray()[0] <<= aVal; - Reference< XNameAccess > xConfigAccess( - Reference< XNameAccess >( + uno::Reference< XNameAccess > xConfigAccess( + uno::Reference< XNameAccess >( xConfigProvider->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationAccess" )), aArgs ), @@ -434,7 +434,7 @@ static bool getUseNativeDialog() return bNative; } -ULONG AquaSalInfoPrinter::GetCapabilities( const ImplJobSetup* i_pSetupData, USHORT i_nType ) +sal_uLong AquaSalInfoPrinter::GetCapabilities( const ImplJobSetup* i_pSetupData, sal_uInt16 i_nType ) { switch( i_nType ) { @@ -458,6 +458,8 @@ ULONG AquaSalInfoPrinter::GetCapabilities( const ImplJobSetup* i_pSetupData, USH return getUseNativeDialog() ? 1 : 0; case PRINTER_CAPABILITIES_PDF: return 1; + case PRINTER_CAPABILITIES_USEPULLMODEL: + return 1; default: break; }; return 0; @@ -514,7 +516,7 @@ static Size getPageSize( vcl::PrinterController& i_rController, sal_Int32 i_nPag return aPageSize; } -BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName, +sal_Bool AquaSalInfoPrinter::StartJob( const String* i_pFileName, const String& i_rJobName, const String& i_rAppName, ImplJobSetup* i_pSetupData, @@ -522,9 +524,9 @@ BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName, ) { if( mbJob ) - return FALSE; + return sal_False; - BOOL bSuccess = FALSE; + sal_Bool bSuccess = sal_False; bool bWasAborted = false; AquaSalInstance* pInst = GetSalData()->mpFirstInstance; PrintAccessoryViewState aAccViewState; @@ -659,7 +661,7 @@ BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName, if( bShowPanel && mnCurPageRangeStart == 0 && nCurJob == 0) // only the first range of pages (in the first job) gets the accesory view pReleaseAfterUse = [AquaPrintAccessoryView setupPrinterPanel: pPrintOperation withController: &i_rController withState: &aAccViewState]; - bSuccess = TRUE; + bSuccess = sal_True; mbJob = true; pInst->startedPrintJob(); [pPrintOperation runOperation]; @@ -677,7 +679,7 @@ BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName, // inform application that it can release its data // this is awkward, but the XRenderable interface has no method for this, - // so we need to call XRenderadble::render one last time with IsLastPage = TRUE + // so we need to call XRenderadble::render one last time with IsLastPage = sal_True i_rController.setLastPage( sal_True ); GDIMetaFile aPageFile; if( mrContext ) @@ -695,26 +697,26 @@ BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName, // ----------------------------------------------------------------------- -BOOL AquaSalInfoPrinter::EndJob() +sal_Bool AquaSalInfoPrinter::EndJob() { mnStartPageOffsetX = mnStartPageOffsetY = 0; mbJob = false; - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -BOOL AquaSalInfoPrinter::AbortJob() +sal_Bool AquaSalInfoPrinter::AbortJob() { mbJob = false; // FIXME: implementation - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -SalGraphics* AquaSalInfoPrinter::StartPage( ImplJobSetup* i_pSetupData, BOOL i_bNewJobData ) +SalGraphics* AquaSalInfoPrinter::StartPage( ImplJobSetup* i_pSetupData, sal_Bool i_bNewJobData ) { if( i_bNewJobData && i_pSetupData ) SetPrinterData( i_pSetupData ); @@ -728,15 +730,15 @@ SalGraphics* AquaSalInfoPrinter::StartPage( ImplJobSetup* i_pSetupData, BOOL i_b // ----------------------------------------------------------------------- -BOOL AquaSalInfoPrinter::EndPage() +sal_Bool AquaSalInfoPrinter::EndPage() { mpGraphics->InvalidateContext(); - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- -ULONG AquaSalInfoPrinter::GetErrorCode() const +sal_uLong AquaSalInfoPrinter::GetErrorCode() const { return 0; } @@ -756,7 +758,7 @@ AquaSalPrinter::~AquaSalPrinter() // ----------------------------------------------------------------------- -BOOL AquaSalPrinter::StartJob( const String* i_pFileName, +sal_Bool AquaSalPrinter::StartJob( const String* i_pFileName, const String& i_rJobName, const String& i_rAppName, ImplJobSetup* i_pSetupData, @@ -767,49 +769,49 @@ BOOL AquaSalPrinter::StartJob( const String* i_pFileName, // ----------------------------------------------------------------------- -BOOL AquaSalPrinter::StartJob( const XubString* i_pFileName, +sal_Bool AquaSalPrinter::StartJob( const XubString* i_pFileName, const XubString& i_rJobName, const XubString& i_rAppName, - ULONG i_nCopies, + sal_uLong i_nCopies, bool i_bCollate, bool i_bDirect, ImplJobSetup* i_pSetupData ) { OSL_FAIL( "should never be called" ); - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- -BOOL AquaSalPrinter::EndJob() +sal_Bool AquaSalPrinter::EndJob() { return mpInfoPrinter->EndJob(); } // ----------------------------------------------------------------------- -BOOL AquaSalPrinter::AbortJob() +sal_Bool AquaSalPrinter::AbortJob() { return mpInfoPrinter->AbortJob(); } // ----------------------------------------------------------------------- -SalGraphics* AquaSalPrinter::StartPage( ImplJobSetup* i_pSetupData, BOOL i_bNewJobData ) +SalGraphics* AquaSalPrinter::StartPage( ImplJobSetup* i_pSetupData, sal_Bool i_bNewJobData ) { return mpInfoPrinter->StartPage( i_pSetupData, i_bNewJobData ); } // ----------------------------------------------------------------------- -BOOL AquaSalPrinter::EndPage() +sal_Bool AquaSalPrinter::EndPage() { return mpInfoPrinter->EndPage(); } // ----------------------------------------------------------------------- -ULONG AquaSalPrinter::GetErrorCode() +sal_uLong AquaSalPrinter::GetErrorCode() { return mpInfoPrinter->GetErrorCode(); } diff --git a/vcl/aqua/source/gdi/salvd.cxx b/vcl/aqua/source/gdi/salvd.cxx index de09867e4071..2aa8357b28f6 100644 --- a/vcl/aqua/source/gdi/salvd.cxx +++ b/vcl/aqua/source/gdi/salvd.cxx @@ -34,13 +34,14 @@ #include "salgdi.h" #include "saldata.hxx" #include "salframe.h" +#include <vcl/svapp.hxx> #include "vcl/sysdata.hxx" // ----------------------------------------------------------------------- SalVirtualDevice* AquaSalInstance::CreateVirtualDevice( SalGraphics* pGraphics, - long nDX, long nDY, USHORT nBitCount, const SystemGraphicsData *pData ) + long nDX, long nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData ) { // #i92075# can be called first in a thread SalData::ensureThreadAutoreleasePool(); @@ -57,7 +58,7 @@ void AquaSalInstance::DestroyVirtualDevice( SalVirtualDevice* pDevice ) // ======================================================================= -AquaSalVirtualDevice::AquaSalVirtualDevice( AquaSalGraphics* pGraphic, long nDX, long nDY, USHORT nBitCount, const SystemGraphicsData *pData ) +AquaSalVirtualDevice::AquaSalVirtualDevice( AquaSalGraphics* pGraphic, long nDX, long nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData ) : mbGraphicsUsed( false ) , mxBitmapContext( NULL ) , mnBitmapDepth( 0 ) @@ -156,7 +157,7 @@ void AquaSalVirtualDevice::ReleaseGraphics( SalGraphics *pGraphics ) // ----------------------------------------------------------------------- -BOOL AquaSalVirtualDevice::SetSize( long nDX, long nDY ) +sal_Bool AquaSalVirtualDevice::SetSize( long nDX, long nDY ) { if( mbForeignContext ) { @@ -198,9 +199,27 @@ BOOL AquaSalVirtualDevice::SetSize( long nDX, long nDY ) pSalFrame = *GetSalData()->maFrames.begin(); if( pSalFrame ) { - NSGraphicsContext* pNSContext = [NSGraphicsContext graphicsContextWithWindow: pSalFrame->getWindow()]; - if( pNSContext ) - xCGContext = reinterpret_cast<CGContextRef>([pNSContext graphicsPort]); + // #i91990# + NSWindow* pWindow = pSalFrame->getWindow(); + if ( pWindow ) + { + NSGraphicsContext* pNSContext = [NSGraphicsContext graphicsContextWithWindow: pWindow]; + if( pNSContext ) + xCGContext = reinterpret_cast<CGContextRef>([pNSContext graphicsPort]); + } + else + { + // fall back to a bitmap context + mnBitmapDepth = 32; + const CGColorSpaceRef aCGColorSpace = GetSalData()->mxRGBSpace; + const CGBitmapInfo aCGBmpInfo = kCGImageAlphaNoneSkipFirst; + const int nBytesPerRow = (mnBitmapDepth * nDX) / 8; + + void* pRawData = rtl_allocateMemory( nBytesPerRow * nDY ); + mxBitmapContext = ::CGBitmapContextCreate( pRawData, nDX, nDY, + 8, nBytesPerRow, aCGColorSpace, aCGBmpInfo ); + xCGContext = mxBitmapContext; + } } } diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx index ca99a2ca6a2d..9c136fba262e 100644 --- a/vcl/aqua/source/window/salframe.cxx +++ b/vcl/aqua/source/window/salframe.cxx @@ -62,7 +62,7 @@ AquaSalFrame* AquaSalFrame::s_pCaptureFrame = NULL; // ======================================================================= -AquaSalFrame::AquaSalFrame( SalFrame* pParent, ULONG salFrameStyle ) : +AquaSalFrame::AquaSalFrame( SalFrame* pParent, sal_uLong salFrameStyle ) : mpWindow(nil), mpView(nil), mpDockMenuEntry(nil), @@ -192,8 +192,17 @@ void AquaSalFrame::initWindowAndView() mnStyleMask |= NSTitledWindowMask; } + // #i91990# support GUI-less (daemon) execution + @try + { mpWindow = [[SalFrameWindow alloc] initWithSalFrame: this]; mpView = [[SalFrameView alloc] initWithSalFrame: this]; + } + @catch ( id exception ) + { + return; + } + if( (mnStyle & SAL_FRAME_STYLE_TOOLTIP) ) [mpWindow setIgnoresMouseEvents: YES]; else @@ -208,8 +217,6 @@ void AquaSalFrame::initWindowAndView() UpdateFrameGeometry(); - // setContentView causes a display; in multithreaded use this can deadlock - //YieldMutexReleaser aRel; [mpWindow setContentView: mpView]; } @@ -285,7 +292,7 @@ void AquaSalFrame::ReleaseGraphics( SalGraphics *pGraphics ) // ----------------------------------------------------------------------- -BOOL AquaSalFrame::PostEvent( void *pData ) +sal_Bool AquaSalFrame::PostEvent( void *pData ) { GetSalData()->mpFirstInstance->PostUserEvent( this, SALEVENT_USEREVENT, pData ); return TRUE; @@ -294,11 +301,17 @@ BOOL AquaSalFrame::PostEvent( void *pData ) // ----------------------------------------------------------------------- void AquaSalFrame::SetTitle(const XubString& rTitle) { + if ( !mpWindow ) + return; + + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + NSString* pTitle = CreateNSString( rTitle ); [mpWindow setTitle: pTitle]; // create an entry in the dock menu - const ULONG nAppWindowStyle = (SAL_FRAME_STYLE_CLOSEABLE | SAL_FRAME_STYLE_MOVEABLE); + const sal_uLong nAppWindowStyle = (SAL_FRAME_STYLE_CLOSEABLE | SAL_FRAME_STYLE_MOVEABLE); if( mpParent == NULL && (mnStyle & nAppWindowStyle) == nAppWindowStyle ) { @@ -324,7 +337,7 @@ void AquaSalFrame::SetTitle(const XubString& rTitle) // ----------------------------------------------------------------------- -void AquaSalFrame::SetIcon( USHORT ) +void AquaSalFrame::SetIcon( sal_uInt16 ) { } @@ -332,6 +345,9 @@ void AquaSalFrame::SetIcon( USHORT ) void AquaSalFrame::SetRepresentedURL( const rtl::OUString& i_rDocURL ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + if( i_rDocURL.indexOfAsciiL( "file:", 5 ) == 0 ) { rtl::OUString aSysPath; @@ -357,12 +373,12 @@ void AquaSalFrame::initShow() if( mpParent ) // center relative to parent { // center on parent - long nNewX = mpParent->maGeometry.nX + (mpParent->maGeometry.nWidth - maGeometry.nWidth)/2; + long nNewX = mpParent->maGeometry.nX + ((long)mpParent->maGeometry.nWidth - (long)maGeometry.nWidth)/2; if( nNewX < aScreenRect.Left() ) nNewX = aScreenRect.Left(); if( long(nNewX + maGeometry.nWidth) > aScreenRect.Right() ) nNewX = aScreenRect.Right() - maGeometry.nWidth-1; - long nNewY = mpParent->maGeometry.nY + (mpParent->maGeometry.nHeight - maGeometry.nHeight)/2; + long nNewY = mpParent->maGeometry.nY + ((long)mpParent->maGeometry.nHeight - (long)maGeometry.nHeight)/2; if( nNewY < aScreenRect.Top() ) nNewY = aScreenRect.Top(); if( nNewY > aScreenRect.Bottom() ) @@ -400,8 +416,14 @@ void AquaSalFrame::SendPaintEvent( const Rectangle* pRect ) // ----------------------------------------------------------------------- -void AquaSalFrame::Show(BOOL bVisible, BOOL bNoActivate) +void AquaSalFrame::Show(sal_Bool bVisible, sal_Bool bNoActivate) { + if ( !mpWindow ) + return; + + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + mbShown = bVisible; if(bVisible) { @@ -412,8 +434,6 @@ void AquaSalFrame::Show(BOOL bVisible, BOOL bNoActivate) // trigger filling our backbuffer SendPaintEvent(); - //YieldMutexReleaser aRel; - if( bNoActivate || [mpWindow canBecomeKeyWindow] == NO ) [mpWindow orderFront: NSApp]; else @@ -444,8 +464,6 @@ void AquaSalFrame::Show(BOOL bVisible, BOOL bNoActivate) if( mpMenu && mpMenu->mbMenuBar && AquaSalMenu::pCurrentMenuBar == mpMenu ) AquaSalMenu::setDefaultMenu(); - //YieldMutexReleaser aRel; - // #i90440# #i94443# work around the focus going back to some other window // if a child gets hidden for a parent window if( mpParent && mpParent->mbShown && [mpWindow isKeyWindow] ) @@ -461,7 +479,7 @@ void AquaSalFrame::Show(BOOL bVisible, BOOL bNoActivate) // ----------------------------------------------------------------------- -void AquaSalFrame::Enable( BOOL bEnable ) +void AquaSalFrame::Enable( sal_Bool bEnable ) { } @@ -469,6 +487,9 @@ void AquaSalFrame::Enable( BOOL bEnable ) void AquaSalFrame::SetMinClientSize( long nWidth, long nHeight ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + mnMinWidth = nWidth; mnMinHeight = nHeight; @@ -491,6 +512,9 @@ void AquaSalFrame::SetMinClientSize( long nWidth, long nHeight ) void AquaSalFrame::SetMaxClientSize( long nWidth, long nHeight ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + mnMaxWidth = nWidth; mnMaxHeight = nHeight; @@ -517,6 +541,9 @@ void AquaSalFrame::SetMaxClientSize( long nWidth, long nHeight ) void AquaSalFrame::SetClientSize( long nWidth, long nHeight ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + if( mpWindow ) { NSSize aSize = { nWidth, nHeight }; @@ -549,6 +576,11 @@ void AquaSalFrame::GetClientSize( long& rWidth, long& rHeight ) void AquaSalFrame::SetWindowState( const SalFrameState* pState ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + + if ( mpWindow ) + { // set normal state NSRect aStateRect = [mpWindow frame]; aStateRect = [NSWindow contentRectForFrameRect: aStateRect styleMask: mnStyleMask]; @@ -564,18 +596,33 @@ void AquaSalFrame::SetWindowState( const SalFrameState* pState ) VCLToCocoa( aStateRect ); aStateRect = [NSWindow frameRectForContentRect: aStateRect styleMask: mnStyleMask]; - // relase and acquire mutex again since this call can block waiting for an internal lock + [mpWindow setFrame: aStateRect display: NO]; + if( pState->mnState == SAL_FRAMESTATE_MINIMIZED ) + [mpWindow miniaturize: NSApp]; + else if( [mpWindow isMiniaturized] ) + [mpWindow deminiaturize: NSApp]; + + + /* ZOOMED is not really maximized (actually it toggles between a user set size and + the program specified one), but comes closest since the default behavior is + "maximized" if the user did not intervene + */ + if( pState->mnState == SAL_FRAMESTATE_MAXIMIZED ) { - //YieldMutexReleaser aRel; - [mpWindow setFrame: aStateRect display: NO]; + if(! [mpWindow isZoomed]) + [mpWindow zoom: NSApp]; + } + else + { + if( [mpWindow isZoomed] ) + [mpWindow zoom: NSApp]; + } } - - // FIXME: HTH maximized state ? // get new geometry UpdateFrameGeometry(); - USHORT nEvent = 0; + sal_uInt16 nEvent = 0; if( pState->mnMask & (SAL_FRAMESTATE_MASK_X | SAL_FRAMESTATE_MASK_X) ) { mbPositioned = true; @@ -591,22 +638,26 @@ void AquaSalFrame::SetWindowState( const SalFrameState* pState ) if( nEvent ) CallCallback( nEvent, NULL ); - if( mbShown ) + if( mbShown && mpWindow ) { // trigger filling our backbuffer SendPaintEvent(); // tell the system the views need to be updated - //YieldMutexReleaser aRel; - [mpWindow display]; } } // ----------------------------------------------------------------------- -BOOL AquaSalFrame::GetWindowState( SalFrameState* pState ) +sal_Bool AquaSalFrame::GetWindowState( SalFrameState* pState ) { + if ( !mpWindow ) + return FALSE; + + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + pState->mnMask = SAL_FRAMESTATE_MASK_X | SAL_FRAMESTATE_MASK_Y | SAL_FRAMESTATE_MASK_WIDTH | @@ -621,8 +672,6 @@ BOOL AquaSalFrame::GetWindowState( SalFrameState* pState ) pState->mnWidth = long(aStateRect.size.width); pState->mnHeight = long(aStateRect.size.height); - // FIXME: HTH maximized state ? - if( [mpWindow isMiniaturized] ) pState->mnState = SAL_FRAMESTATE_MINIMIZED; else if( ! [mpWindow isZoomed] ) @@ -637,6 +686,12 @@ BOOL AquaSalFrame::GetWindowState( SalFrameState* pState ) void AquaSalFrame::SetScreenNumber(unsigned int nScreen) { + if ( !mpWindow ) + return; + + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + NSArray* pScreens = [NSScreen screens]; Rectangle aRet; NSScreen* pScreen = nil; @@ -670,8 +725,14 @@ void AquaSalFrame::SetApplicationID( const rtl::OUString &/*rApplicationID*/ ) // ----------------------------------------------------------------------- -void AquaSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay ) +void AquaSalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nDisplay ) { + if ( !mpWindow ) + return; + + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + if( mbFullScreen == bFullScreen ) return; @@ -730,7 +791,6 @@ void AquaSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay ) maFullScreenRect = [mpWindow frame]; { - //YieldMutexReleaser aRel; [mpWindow setFrame: [NSWindow frameRectForContentRect: aNewContentRect styleMask: mnStyleMask] display: mbShown ? YES : NO]; } @@ -742,7 +802,6 @@ void AquaSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay ) else { { - //YieldMutexReleaser aRel; [mpWindow setFrame: maFullScreenRect display: mbShown ? YES : NO]; } UpdateFrameGeometry(); @@ -779,8 +838,14 @@ public: } }; -void AquaSalFrame::StartPresentation( BOOL bStart ) +void AquaSalFrame::StartPresentation( sal_Bool bStart ) { + if ( !mpWindow ) + return; + + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + if( bStart ) { mpActivityTimer.reset( new PreventSleepTimer() ); @@ -797,14 +862,23 @@ void AquaSalFrame::StartPresentation( BOOL bStart ) // ----------------------------------------------------------------------- -void AquaSalFrame::SetAlwaysOnTop( BOOL bOnTop ) +void AquaSalFrame::SetAlwaysOnTop( sal_Bool bOnTop ) { } // ----------------------------------------------------------------------- -void AquaSalFrame::ToTop(USHORT nFlags) +void AquaSalFrame::ToTop(sal_uInt16 nFlags) { + if ( !mpWindow ) + return; + + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + if( ! (nFlags & SAL_FRAME_TOTOP_RESTOREWHENMIN) ) { if( ! [mpWindow isVisible] || [mpWindow isMiniaturized] ) @@ -858,6 +932,12 @@ NSCursor* AquaSalFrame::getCurrentCursor() const void AquaSalFrame::SetPointer( PointerStyle ePointerStyle ) { + if ( !mpWindow ) + return; + + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + if( ePointerStyle >= POINTER_COUNT || ePointerStyle == mePointerStyle ) return; mePointerStyle = ePointerStyle; @@ -884,6 +964,10 @@ void AquaSalFrame::Flush( void ) if( !(mbGraphics && mpGraphics && mpView && mbShown) ) return; + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + + [mpView setNeedsDisplay: YES]; // outside of the application's event loop (e.g. IntroWindow) @@ -902,6 +986,9 @@ void AquaSalFrame::Flush( const Rectangle& rRect ) if( !(mbGraphics && mpGraphics && mpView && mbShown) ) return; + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + NSRect aNSRect = { {rRect.Left(), rRect.Top()}, { rRect.GetWidth(), rRect.GetHeight() } }; VCLToCocoa( aNSRect, false ); [mpView setNeedsDisplayInRect: aNSRect]; @@ -921,7 +1008,8 @@ void AquaSalFrame::Sync() { if( mbGraphics && mpGraphics && mpView && mbShown ) { - //YieldMutexReleaser aRel; + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); [mpView setNeedsDisplay: YES]; [mpView display]; @@ -946,18 +1034,18 @@ void AquaSalFrame::SetInputContext( SalInputContext* pContext ) // ----------------------------------------------------------------------- -void AquaSalFrame::EndExtTextInput( USHORT nFlags ) +void AquaSalFrame::EndExtTextInput( sal_uInt16 nFlags ) { } // ----------------------------------------------------------------------- -XubString AquaSalFrame::GetKeyName( USHORT nKeyCode ) +XubString AquaSalFrame::GetKeyName( sal_uInt16 nKeyCode ) { - static std::map< USHORT, rtl::OUString > aKeyMap; + static std::map< sal_uInt16, rtl::OUString > aKeyMap; if( aKeyMap.empty() ) { - USHORT i; + sal_uInt16 i; for( i = KEY_A; i <= KEY_Z; i++ ) aKeyMap[ i ] = rtl::OUString( sal_Unicode( 'A' + (i - KEY_A) ) ); for( i = KEY_0; i <= KEY_9; i++ ) @@ -1018,8 +1106,8 @@ XubString AquaSalFrame::GetKeyName( USHORT nKeyCode ) rtl::OUStringBuffer aResult( 16 ); - USHORT nUnmodifiedCode = (nKeyCode & KEY_CODE); - std::map< USHORT, rtl::OUString >::const_iterator it = aKeyMap.find( nUnmodifiedCode ); + sal_uInt16 nUnmodifiedCode = (nKeyCode & KEY_CODE); + std::map< sal_uInt16, rtl::OUString >::const_iterator it = aKeyMap.find( nUnmodifiedCode ); if( it != aKeyMap.end() ) { if( (nKeyCode & KEY_SHIFT) != 0 ) @@ -1039,7 +1127,7 @@ XubString AquaSalFrame::GetKeyName( USHORT nKeyCode ) // ----------------------------------------------------------------------- -XubString AquaSalFrame::GetSymbolKeyName( const XubString&, USHORT nKeyCode ) +XubString AquaSalFrame::GetSymbolKeyName( const XubString&, sal_uInt16 nKeyCode ) { return GetKeyName( nKeyCode ); } @@ -1145,6 +1233,12 @@ void AquaSalFrame::getResolution( long& o_rDPIX, long& o_rDPIY ) // doesn't make the anything cleaner for now void AquaSalFrame::UpdateSettings( AllSettings& rSettings ) { + if ( !mpWindow ) + return; + + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + [mpView lockFocus]; StyleSettings aStyleSettings = rSettings.GetStyleSettings(); @@ -1256,9 +1350,15 @@ void AquaSalFrame::Beep( SoundType eSoundType ) // ----------------------------------------------------------------------- -void AquaSalFrame::SetPosSize(long nX, long nY, long nWidth, long nHeight, USHORT nFlags) +void AquaSalFrame::SetPosSize(long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags) { - USHORT nEvent = 0; + if ( !mpWindow ) + return; + + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + + sal_uInt16 nEvent = 0; if( [mpWindow isMiniaturized] ) [mpWindow deminiaturize: NSApp]; // expand the window @@ -1322,7 +1422,6 @@ void AquaSalFrame::SetPosSize(long nX, long nY, long nWidth, long nHeight, USHOR // do not display yet, we need to update our backbuffer { - //YieldMutexReleaser aRel; [mpWindow setFrame: [NSWindow frameRectForContentRect: aContentRect styleMask: mnStyleMask] display: NO]; } @@ -1337,13 +1436,18 @@ void AquaSalFrame::SetPosSize(long nX, long nY, long nWidth, long nHeight, USHOR SendPaintEvent(); // now inform the system that the views need to be drawn - //YieldMutexReleaser aRel; [mpWindow display]; } } void AquaSalFrame::GetWorkArea( Rectangle& rRect ) { + if ( !mpWindow ) + return; + + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + NSScreen* pScreen = [mpWindow screen]; if( pScreen == nil ) pScreen = [NSScreen mainScreen]; @@ -1357,6 +1461,9 @@ void AquaSalFrame::GetWorkArea( Rectangle& rRect ) SalPointerState AquaSalFrame::GetPointerState() { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + SalPointerState state; state.mnState = 0; @@ -1444,7 +1551,7 @@ SalFrame::SalIndicatorState AquaSalFrame::GetIndicatorState() return aState; } -void AquaSalFrame::SimulateKeyPress( USHORT /*nKeyCode*/ ) +void AquaSalFrame::SimulateKeyPress( sal_uInt16 /*nKeyCode*/ ) { } @@ -1457,7 +1564,7 @@ bool AquaSalFrame::SetPluginParent( SystemParentData* pNewParent ) return sal_False; } -BOOL AquaSalFrame::MapUnicodeToKeyCode( sal_Unicode , LanguageType , KeyCode& ) +sal_Bool AquaSalFrame::MapUnicodeToKeyCode( sal_Unicode , LanguageType , KeyCode& ) { // not supported yet return FALSE; @@ -1475,6 +1582,9 @@ void AquaSalFrame::DrawMenuBar() void AquaSalFrame::SetMenu( SalMenu* pSalMenu ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + AquaSalMenu* pMenu = static_cast<AquaSalMenu*>(pSalMenu); DBG_ASSERT( ! pMenu || pMenu->mbMenuBar, "setting non menubar on frame" ); mpMenu = pMenu; @@ -1484,8 +1594,15 @@ void AquaSalFrame::SetMenu( SalMenu* pSalMenu ) void AquaSalFrame::SetExtendedFrameStyle( SalExtStyle nStyle ) { + if ( mpWindow ) + { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + if( (mnExtStyle & SAL_FRAME_EXT_STYLE_DOCMODIFIED) != (nStyle & SAL_FRAME_EXT_STYLE_DOCMODIFIED) ) [mpWindow setDocumentEdited: (nStyle & SAL_FRAME_EXT_STYLE_DOCMODIFIED) ? YES : NO]; + } + mnExtStyle = nStyle; } @@ -1516,6 +1633,11 @@ void AquaSalFrame::SetParent( SalFrame* pNewParent ) void AquaSalFrame::UpdateFrameGeometry() { + if ( !mpWindow ) + { + return; + } + // keep in mind that view and window coordinates are lower left // whereas vcl's are upper left @@ -1559,7 +1681,7 @@ void AquaSalFrame::UpdateFrameGeometry() // ----------------------------------------------------------------------- -void AquaSalFrame::CaptureMouse( BOOL bCapture ) +void AquaSalFrame::CaptureMouse( sal_Bool bCapture ) { /* Remark: we'll try to use a pidgin version of capture mouse @@ -1588,6 +1710,14 @@ void AquaSalFrame::CaptureMouse( BOOL bCapture ) void AquaSalFrame::ResetClipRegion() { + if ( !mpWindow ) + { + return; + } + + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + // release old path and indicate no clipping CGPathRelease( mrClippingPath ); mrClippingPath = NULL; @@ -1601,8 +1731,16 @@ void AquaSalFrame::ResetClipRegion() } } -void AquaSalFrame::BeginSetClipRegion( ULONG nRects ) +void AquaSalFrame::BeginSetClipRegion( sal_uLong nRects ) { + if ( !mpWindow ) + { + return; + } + + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + // release old path if( mrClippingPath ) { @@ -1621,6 +1759,9 @@ void AquaSalFrame::BeginSetClipRegion( ULONG nRects ) void AquaSalFrame::UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + if( nWidth && nHeight ) { NSRect aRect = { { nX, nY }, { nWidth, nHeight } }; @@ -1631,6 +1772,14 @@ void AquaSalFrame::UnionClipRegion( long nX, long nY, long nWidth, long nHeight void AquaSalFrame::EndSetClipRegion() { + if ( !mpWindow ) + { + return; + } + + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + if( ! maClippingRects.empty() ) { mrClippingPath = CGPathCreateMutable(); diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm index 8da1bf9f3085..a72810986c76 100755 --- a/vcl/aqua/source/window/salframeview.mm +++ b/vcl/aqua/source/window/salframeview.mm @@ -41,9 +41,9 @@ #define WHEEL_EVENT_FACTOR 1.5 -static USHORT ImplGetModifierMask( unsigned int nMask ) +static sal_uInt16 ImplGetModifierMask( unsigned int nMask ) { - USHORT nRet = 0; + sal_uInt16 nRet = 0; if( (nMask & NSShiftKeyMask) != 0 ) nRet |= KEY_SHIFT; if( (nMask & NSControlKeyMask) != 0 ) @@ -55,9 +55,9 @@ static USHORT ImplGetModifierMask( unsigned int nMask ) return nRet; } -static USHORT ImplMapCharCode( sal_Unicode aCode ) +static sal_uInt16 ImplMapCharCode( sal_Unicode aCode ) { - static USHORT aKeyCodeMap[ 128 ] = + static sal_uInt16 aKeyCodeMap[ 128 ] = { 0, 0, 0, 0, 0, 0, 0, 0, KEY_BACKSPACE, KEY_TAB, KEY_RETURN, 0, 0, KEY_RETURN, 0, 0, @@ -85,7 +85,7 @@ static USHORT ImplMapCharCode( sal_Unicode aCode ) // tab alone is reported as 0x09 (as expected) but shift-tab is // reported as 0x19 (end of medium) - static USHORT aFunctionKeyCodeMap[ 128 ] = + static sal_uInt16 aFunctionKeyCodeMap[ 128 ] = { KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11, KEY_F12, @@ -105,7 +105,7 @@ static USHORT ImplMapCharCode( sal_Unicode aCode ) 0, 0, 0, 0, 0, 0, 0, 0 }; - USHORT nKeyCode = 0; + sal_uInt16 nKeyCode = 0; if( aCode < SAL_N_ELEMENTS( aKeyCodeMap) ) nKeyCode = aKeyCodeMap[ aCode ]; else if( aCode >= 0xf700 && aCode < 0xf780 ) @@ -117,12 +117,12 @@ static USHORT ImplMapCharCode( sal_Unicode aCode ) static AquaSalFrame* s_pMouseFrame = NULL; // store the last pressed button for enter/exit events // which lack that information -static USHORT s_nLastButton = 0; +static sal_uInt16 s_nLastButton = 0; // combinations of keys we need to handle ourselves static const struct ExceptionalKey { - const USHORT nKeyCode; + const sal_uInt16 nKeyCode; const unsigned int nModifierMask; } aExceptionalKeys[] = { @@ -155,7 +155,9 @@ static AquaSalFrame* getMouseContainerFrame() NSRect aRect = { { pFrame->maGeometry.nX, pFrame->maGeometry.nY }, { pFrame->maGeometry.nWidth, pFrame->maGeometry.nHeight } }; pFrame->VCLToCocoa( aRect ); - return [super initWithContentRect: aRect styleMask: mpFrame->getStyleMask() backing: NSBackingStoreBuffered defer: NO ]; + NSWindow* pNSWindow = [super initWithContentRect: aRect styleMask: mpFrame->getStyleMask() backing: NSBackingStoreBuffered defer: NO ]; + [pNSWindow useOptimizedDrawing: YES]; // OSX recommendation when there are no overlapping subviews within the receiver + return pNSWindow; } -(AquaSalFrame*)getSalFrame @@ -163,16 +165,30 @@ static AquaSalFrame* getMouseContainerFrame() return mpFrame; } --(MacOSBOOL)containsMouse +-(void)displayIfNeeded +{ + if( GetSalData() && GetSalData()->mpFirstInstance ) + { + osl::SolarMutex* pMutex = GetSalData()->mpFirstInstance->GetYieldMutex(); + if( pMutex ) + { + pMutex->acquire(); + [super displayIfNeeded]; + pMutex->release(); + } + } +} + +-(BOOL)containsMouse { // is this event actually inside that NSWindow ? NSPoint aPt = [NSEvent mouseLocation]; NSRect aFrameRect = [self frame]; - MacOSBOOL bInRect = NSPointInRect( aPt, aFrameRect ); + BOOL bInRect = NSPointInRect( aPt, aFrameRect ); return bInRect; } --(MacOSBOOL)canBecomeKeyWindow +-(BOOL)canBecomeKeyWindow { if( (mpFrame->mnStyle & ( SAL_FRAME_STYLE_FLOAT | @@ -195,7 +211,7 @@ static AquaSalFrame* getMouseContainerFrame() if( mpFrame && AquaSalFrame::isAlive( mpFrame ) ) { - static const ULONG nGuessDocument = SAL_FRAME_STYLE_MOVEABLE| + static const sal_uLong nGuessDocument = SAL_FRAME_STYLE_MOVEABLE| SAL_FRAME_STYLE_SIZEABLE| SAL_FRAME_STYLE_CLOSEABLE; @@ -285,11 +301,11 @@ static AquaSalFrame* getMouseContainerFrame() } } --(MacOSBOOL)windowShouldClose: (NSNotification*)pNotification +-(BOOL)windowShouldClose: (NSNotification*)pNotification { YIELD_GUARD; - MacOSBOOL bRet = YES; + BOOL bRet = YES; if( mpFrame && AquaSalFrame::isAlive( mpFrame ) ) { // #i84461# end possible input @@ -332,12 +348,12 @@ static AquaSalFrame* getMouseContainerFrame() [mDraggingDestinationHandler draggingExited: sender]; } --(MacOSBOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender +-(BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender { return [mDraggingDestinationHandler prepareForDragOperation: sender]; } --(MacOSBOOL)performDragOperation:(id <NSDraggingInfo>)sender +-(BOOL)performDragOperation:(id <NSDraggingInfo>)sender { return [mDraggingDestinationHandler performDragOperation: sender]; } @@ -393,17 +409,17 @@ static AquaSalFrame* getMouseContainerFrame() } } --(MacOSBOOL)acceptsFirstResponder +-(BOOL)acceptsFirstResponder { return YES; } --(MacOSBOOL)acceptsFirstMouse: (NSEvent*)pEvent +-(BOOL)acceptsFirstMouse: (NSEvent*)pEvent { return YES; } --(MacOSBOOL)isOpaque +-(BOOL)isOpaque { return mpFrame ? (mpFrame->getClipPath() != 0 ? NO : YES) : YES; } @@ -451,7 +467,7 @@ private: } } --(void)sendMouseEventToFrame: (NSEvent*)pEvent button:(USHORT)nButton eventtype:(USHORT)nEvent +-(void)sendMouseEventToFrame: (NSEvent*)pEvent button:(sal_uInt16)nButton eventtype:(sal_uInt16)nEvent { YIELD_GUARD; @@ -507,13 +523,13 @@ private: if( pDispatchFrame && AquaSalFrame::isAlive( pDispatchFrame ) ) { - pDispatchFrame->mnLastEventTime = static_cast<ULONG>( [pEvent timestamp] * 1000.0 ); + pDispatchFrame->mnLastEventTime = static_cast<sal_uLong>( [pEvent timestamp] * 1000.0 ); pDispatchFrame->mnLastModifierFlags = [pEvent modifierFlags]; NSPoint aPt = [NSEvent mouseLocation]; pDispatchFrame->CocoaToVCL( aPt ); - USHORT nModMask = ImplGetModifierMask( [pEvent modifierFlags] ); + sal_uInt16 nModMask = ImplGetModifierMask( [pEvent modifierFlags] ); // #i82284# emulate ctrl left if( nModMask == KEY_MOD3 && nButton == MOUSE_LEFT ) { @@ -574,8 +590,11 @@ private: -(void)mouseEntered: (NSEvent*)pEvent { s_pMouseFrame = mpFrame; - - [self sendMouseEventToFrame:pEvent button:s_nLastButton eventtype:SALEVENT_MOUSEMOVE]; + + // #i107215# the only mouse events we get when inactive are enter/exit + // actually we would like to have all of them, but better none than some + if( [NSApp isActive] ) + [self sendMouseEventToFrame:pEvent button:s_nLastButton eventtype:SALEVENT_MOUSEMOVE]; } -(void)mouseExited: (NSEvent*)pEvent @@ -583,7 +602,10 @@ private: if( s_pMouseFrame == mpFrame ) s_pMouseFrame = NULL; - [self sendMouseEventToFrame:pEvent button:s_nLastButton eventtype:SALEVENT_MOUSELEAVE]; + // #i107215# the only mouse events we get when inactive are enter/exit + // actually we would like to have all of them, but better none than some + if( [NSApp isActive] ) + [self sendMouseEventToFrame:pEvent button:s_nLastButton eventtype:SALEVENT_MOUSELEAVE]; } -(void)rightMouseDown: (NSEvent*)pEvent @@ -641,7 +663,7 @@ private: if( AquaSalFrame::isAlive( mpFrame ) ) { const NSTimeInterval fMagnifyTime = [pEvent timestamp]; - mpFrame->mnLastEventTime = static_cast<ULONG>( fMagnifyTime * 1000.0 ); + mpFrame->mnLastEventTime = static_cast<sal_uLong>( fMagnifyTime * 1000.0 ); mpFrame->mnLastModifierFlags = [pEvent modifierFlags]; // check if this is a new series of magnify events @@ -712,7 +734,7 @@ private: if( AquaSalFrame::isAlive( mpFrame ) ) { - mpFrame->mnLastEventTime = static_cast<ULONG>( [pEvent timestamp] * 1000.0 ); + mpFrame->mnLastEventTime = static_cast<sal_uLong>( [pEvent timestamp] * 1000.0 ); mpFrame->mnLastModifierFlags = [pEvent modifierFlags]; // merge pending scroll wheel events @@ -772,7 +794,7 @@ private: if( AquaSalFrame::isAlive( mpFrame ) ) { - mpFrame->mnLastEventTime = static_cast<ULONG>( [pEvent timestamp] * 1000.0 ); + mpFrame->mnLastEventTime = static_cast<sal_uLong>( [pEvent timestamp] * 1000.0 ); mpFrame->mnLastModifierFlags = [pEvent modifierFlags]; // merge pending scroll wheel events @@ -844,7 +866,7 @@ private: mbNeedSpecialKeyHandle = false; mbKeyHandled = false; - mpFrame->mnLastEventTime = static_cast<ULONG>( [pEvent timestamp] * 1000.0 ); + mpFrame->mnLastEventTime = static_cast<sal_uLong>( [pEvent timestamp] * 1000.0 ); mpFrame->mnLastModifierFlags = [pEvent modifierFlags]; if( ! [self handleKeyDownException: pEvent] ) @@ -857,7 +879,7 @@ private: } } --(MacOSBOOL)handleKeyDownException:(NSEvent*)pEvent +-(BOOL)handleKeyDownException:(NSEvent*)pEvent { // check for a very special set of modified characters NSString* pUnmodifiedString = [pEvent charactersIgnoringModifiers]; @@ -875,7 +897,7 @@ private: return YES; } unichar keyChar = [pUnmodifiedString characterAtIndex: 0]; - USHORT nKeyCode = ImplMapCharCode( keyChar ); + sal_uInt16 nKeyCode = ImplMapCharCode( keyChar ); // Caution: should the table grow to more than 5 or 6 entries, // we must consider moving it to a kind of hash map @@ -901,7 +923,7 @@ private: if( AquaSalFrame::isAlive( mpFrame ) ) { - mpFrame->mnLastEventTime = static_cast<ULONG>( [pEvent timestamp] * 1000.0 ); + mpFrame->mnLastEventTime = static_cast<sal_uLong>( [pEvent timestamp] * 1000.0 ); mpFrame->mnLastModifierFlags = [pEvent modifierFlags]; } } @@ -931,7 +953,7 @@ private: ! [self hasMarkedText ] ) { - USHORT nKeyCode = ImplMapCharCode( aCharCode ); + sal_uInt16 nKeyCode = ImplMapCharCode( aCharCode ); unsigned int nLastModifiers = mpFrame->mnLastModifierFlags; // #i99567# @@ -1307,18 +1329,18 @@ private: } } --(MacOSBOOL)sendKeyInputAndReleaseToFrame: (USHORT)nKeyCode character: (sal_Unicode)aChar +-(BOOL)sendKeyInputAndReleaseToFrame: (sal_uInt16)nKeyCode character: (sal_Unicode)aChar { return [self sendKeyInputAndReleaseToFrame: nKeyCode character: aChar modifiers: mpFrame->mnLastModifierFlags]; } --(MacOSBOOL)sendKeyInputAndReleaseToFrame: (USHORT)nKeyCode character: (sal_Unicode)aChar modifiers: (unsigned int)nMod +-(BOOL)sendKeyInputAndReleaseToFrame: (sal_uInt16)nKeyCode character: (sal_Unicode)aChar modifiers: (unsigned int)nMod { return [self sendKeyToFrameDirect: nKeyCode character: aChar modifiers: nMod] || [self sendSingleCharacter: mpLastEvent]; } --(MacOSBOOL)sendKeyToFrameDirect: (USHORT)nKeyCode character: (sal_Unicode)aChar modifiers: (unsigned int)nMod +-(BOOL)sendKeyToFrameDirect: (sal_uInt16)nKeyCode character: (sal_Unicode)aChar modifiers: (unsigned int)nMod { YIELD_GUARD; @@ -1341,20 +1363,20 @@ private: } --(MacOSBOOL)sendSingleCharacter: (NSEvent *)pEvent +-(BOOL)sendSingleCharacter: (NSEvent *)pEvent { NSString* pUnmodifiedString = [pEvent charactersIgnoringModifiers]; if( pUnmodifiedString && [pUnmodifiedString length] == 1 ) { unichar keyChar = [pUnmodifiedString characterAtIndex: 0]; - USHORT nKeyCode = ImplMapCharCode( keyChar ); + sal_uInt16 nKeyCode = ImplMapCharCode( keyChar ); if( nKeyCode != 0 ) { // don't send unicodes in the private use area if( keyChar >= 0xf700 && keyChar < 0xf780 ) keyChar = 0; - MacOSBOOL bRet = [self sendKeyToFrameDirect: nKeyCode character: keyChar modifiers: mpFrame->mnLastModifierFlags]; + BOOL bRet = [self sendKeyToFrameDirect: nKeyCode character: keyChar modifiers: mpFrame->mnLastModifierFlags]; mbInKeyInput = false; return bRet; @@ -1370,9 +1392,9 @@ private: return [NSArray arrayWithObjects:NSUnderlineStyleAttributeName, nil]; } -- (MacOSBOOL)hasMarkedText +- (BOOL)hasMarkedText { - MacOSBOOL bHasMarkedText; + BOOL bHasMarkedText; bHasMarkedText = ( mMarkedRange.location != NSNotFound ) && ( mMarkedRange.length != 0 ); @@ -1439,7 +1461,7 @@ private: if( len > 0 ) { NSString *pString = [aString string]; OUString aInsertString( GetOUString( pString ) ); - std::vector<USHORT> aInputFlags = std::vector<USHORT>( std::max( 1, len ), 0 ); + std::vector<sal_uInt16> aInputFlags = std::vector<sal_uInt16>( std::max( 1, len ), 0 ); for ( int i = 0; i < len; i++ ) { unsigned int nUnderlineValue; @@ -1598,12 +1620,12 @@ private: [mDraggingDestinationHandler draggingExited: sender]; } --(MacOSBOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender +-(BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender { return [mDraggingDestinationHandler prepareForDragOperation: sender]; } --(MacOSBOOL)performDragOperation:(id <NSDraggingInfo>)sender +-(BOOL)performDragOperation:(id <NSDraggingInfo>)sender { return [mDraggingDestinationHandler performDragOperation: sender]; } diff --git a/vcl/aqua/source/window/salmenu.cxx b/vcl/aqua/source/window/salmenu.cxx index a124201480b5..0b4f41651aa0 100644 --- a/vcl/aqua/source/window/salmenu.cxx +++ b/vcl/aqua/source/window/salmenu.cxx @@ -80,10 +80,14 @@ const AquaSalMenu* AquaSalMenu::pCurrentMenuBar = NULL; -(void)showPreferences: (id) sender { + YIELD_GUARD; + [self showDialog: SHOWDIALOG_ID_PREFERENCES]; } -(void)showAbout: (id) sender { + YIELD_GUARD; + [self showDialog: SHOWDIALOG_ID_ABOUT]; } @end @@ -204,11 +208,12 @@ static void initAppMenu() // ======================================================================= -SalMenu* AquaSalInstance::CreateMenu( BOOL bMenuBar ) +SalMenu* AquaSalInstance::CreateMenu( sal_Bool bMenuBar, Menu* pVCLMenu ) { initAppMenu(); AquaSalMenu *pAquaSalMenu = new AquaSalMenu( bMenuBar ); + pAquaSalMenu->mpVCLMenu = pVCLMenu; return pAquaSalMenu; } @@ -335,9 +340,9 @@ sal_Int32 removeUnusedItemsRunner(NSMenu * pMenu) return drawnItems; } -bool AquaSalMenu::ShowNativePopupMenu(FloatingWindow * pWin, const Rectangle& rRect, ULONG nFlags) +bool AquaSalMenu::ShowNativePopupMenu(FloatingWindow * pWin, const Rectangle& rRect, sal_uLong nFlags) { - // do not use native popup menu when AQUA_NATIVE_MENUS is set to FALSE + // do not use native popup menu when AQUA_NATIVE_MENUS is set to sal_False if( ! VisibleMenuBar() ) { return false; } @@ -365,7 +370,7 @@ bool AquaSalMenu::ShowNativePopupMenu(FloatingWindow * pWin, const Rectangle& rR // do the same strange semantics as vcl popup windows to arrive at a frame geometry // in mirrored UI case; best done by actually executing the same code - USHORT nArrangeIndex; + sal_uInt16 nArrangeIndex; pWin->SetPosPixel( pWin->ImplCalcPos( pWin, rRect, nFlags, nArrangeIndex ) ); displayPopupFrame.origin.x = pWin->ImplGetFrame()->maGeometry.nX - pParentAquaSalFrame->maGeometry.nX + offset; displayPopupFrame.origin.y = pWin->ImplGetFrame()->maGeometry.nY - pParentAquaSalFrame->maGeometry.nY + offset; @@ -389,7 +394,7 @@ bool AquaSalMenu::ShowNativePopupMenu(FloatingWindow * pWin, const Rectangle& rR return true; } -int AquaSalMenu::getItemIndexByPos( USHORT nPos ) const +int AquaSalMenu::getItemIndexByPos( sal_uInt16 nPos ) const { int nIndex = 0; if( nPos == MENU_APPEND ) @@ -515,7 +520,7 @@ void AquaSalMenu::removeFallbackMenuItem( NSMenuItem* pOldItem ) } } -BOOL AquaSalMenu::VisibleMenuBar() +sal_Bool AquaSalMenu::VisibleMenuBar() { // Enable/disable experimental native menus code? // @@ -524,11 +529,11 @@ BOOL AquaSalMenu::VisibleMenuBar() static const char *pExperimental = getenv ("AQUA_NATIVE_MENUS"); if ( ImplGetSVData()->mbIsTestTool || (pExperimental && !strcasecmp(pExperimental, "FALSE")) ) - return FALSE; + return sal_False; // End of experimental code enable/disable part - return TRUE; + return sal_True; } void AquaSalMenu::SetFrame( const SalFrame *pFrame ) @@ -627,7 +632,7 @@ void AquaSalMenu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsi } } -void AquaSalMenu::CheckItem( unsigned nPos, BOOL bCheck ) +void AquaSalMenu::CheckItem( unsigned nPos, sal_Bool bCheck ) { if( nPos < maItems.size() ) { @@ -636,7 +641,7 @@ void AquaSalMenu::CheckItem( unsigned nPos, BOOL bCheck ) } } -void AquaSalMenu::EnableItem( unsigned nPos, BOOL bEnable ) +void AquaSalMenu::EnableItem( unsigned nPos, sal_Bool bEnable ) { if( nPos < maItems.size() ) { @@ -697,10 +702,10 @@ void AquaSalMenu::SetItemText( unsigned i_nPos, SalMenuItem* i_pSalMenuItem, con void AquaSalMenu::SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const KeyCode& rKeyCode, const XubString& rKeyName ) { - USHORT nModifier; + sal_uInt16 nModifier; sal_Unicode nCommandKey = 0; - USHORT nKeyCode=rKeyCode.GetCode(); + sal_uInt16 nKeyCode=rKeyCode.GetCode(); if( nKeyCode ) { if ((nKeyCode>=KEY_A) && (nKeyCode<=KEY_Z)) // letter A..Z @@ -782,7 +787,7 @@ void AquaSalMenu::GetSystemMenuData( SystemMenuData* pData ) { } -AquaSalMenu::MenuBarButtonEntry* AquaSalMenu::findButtonItem( USHORT i_nItemId ) +AquaSalMenu::MenuBarButtonEntry* AquaSalMenu::findButtonItem( sal_uInt16 i_nItemId ) { for( size_t i = 0; i < maButtons.size(); ++i ) { @@ -848,7 +853,7 @@ bool AquaSalMenu::AddMenuBarButton( const SalMenuButtonItem& i_rNewItem ) return true; } -void AquaSalMenu::RemoveMenuBarButton( USHORT i_nId ) +void AquaSalMenu::RemoveMenuBarButton( sal_uInt16 i_nId ) { MenuBarButtonEntry* pEntry = findButtonItem( i_nId ); if( pEntry ) @@ -862,7 +867,7 @@ void AquaSalMenu::RemoveMenuBarButton( USHORT i_nId ) statusLayout(); } -Rectangle AquaSalMenu::GetMenuBarButtonRectPixel( USHORT i_nItemId, SalFrame* i_pReferenceFrame ) +Rectangle AquaSalMenu::GetMenuBarButtonRectPixel( sal_uInt16 i_nItemId, SalFrame* i_pReferenceFrame ) { if( GetSalData()->mnSystemVersion < VER_LEOPARD ) return Rectangle( Point( -1, -1 ), Size( 1, 1 ) ); diff --git a/vcl/aqua/source/window/salobj.cxx b/vcl/aqua/source/window/salobj.cxx index 23df35581ecb..5bc239e26f29 100644 --- a/vcl/aqua/source/window/salobj.cxx +++ b/vcl/aqua/source/window/salobj.cxx @@ -108,14 +108,14 @@ void AquaSalObject::ResetClipRegion() // ----------------------------------------------------------------------- -USHORT AquaSalObject::GetClipRegionType() +sal_uInt16 AquaSalObject::GetClipRegionType() { return SAL_OBJECT_CLIP_INCLUDERECTS; } // ----------------------------------------------------------------------- -void AquaSalObject::BeginSetClipRegion( ULONG nRectCount ) +void AquaSalObject::BeginSetClipRegion( sal_uLong nRectCount ) { mbClip = false; } @@ -201,7 +201,7 @@ void AquaSalObject::setClippedPosSize() // ----------------------------------------------------------------------- -void AquaSalObject::Show( BOOL bVisible ) +void AquaSalObject::Show( sal_Bool bVisible ) { if( mpClipView ) [mpClipView setHidden: (bVisible ? NO : YES)]; @@ -209,7 +209,7 @@ void AquaSalObject::Show( BOOL bVisible ) // ----------------------------------------------------------------------- -void AquaSalObject::Enable( BOOL bEnable ) +void AquaSalObject::Enable( sal_Bool bEnable ) { } @@ -238,4 +238,10 @@ const SystemEnvData* AquaSalObject::GetSystemData() const return &maSysData; } +// ----------------------------------------------------------------------- + +void AquaSalObject::InterceptChildWindowKeyDown( sal_Bool /*bIntercept*/ ) +{ +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |