diff options
author | Thomas Lange [tl] <tl@openoffice.org> | 2010-06-09 14:50:43 +0200 |
---|---|---|
committer | Thomas Lange [tl] <tl@openoffice.org> | 2010-06-09 14:50:43 +0200 |
commit | 4e653694b634c30f052ba3288f71e6905377b9c6 (patch) | |
tree | 26a5f1f33235d10b4a6cd42b488c9ef4cfb93eb0 /vcl | |
parent | d72138f1408df33e07f6b33fd23bdfb101229a41 (diff) | |
parent | a51dc52262038e9c72eea188cfe9a6812bbc2f8d (diff) |
cws tl74: merge with DEV300_m81
Diffstat (limited to 'vcl')
97 files changed, 2455 insertions, 1151 deletions
diff --git a/vcl/aqua/inc/salframe.h b/vcl/aqua/inc/salframe.h index fd783270875e..c2ded3267f45 100644 --- a/vcl/aqua/inc/salframe.h +++ b/vcl/aqua/inc/salframe.h @@ -184,6 +184,8 @@ public: NSView* getView() const { return mpView; } unsigned int getStyleMask() const { return mnStyleMask; } + void getResolution( long& o_rDPIX, long& o_rDPIY ); + // actually the follwing methods do the same thing: flipping y coordinates // but having two of them makes clearer what the coordinate system // is supposed to be before and after diff --git a/vcl/aqua/inc/salgdi.h b/vcl/aqua/inc/salgdi.h index d83067cb64b8..247de1b95dec 100644 --- a/vcl/aqua/inc/salgdi.h +++ b/vcl/aqua/inc/salgdi.h @@ -230,15 +230,15 @@ public: CGPoint* makeCGptArray(ULONG nPoints, const SalPoint* pPtAry); // native widget rendering methods that require mirroring virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside ); + const Point& aPos, BOOL& rIsInside ); virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, + ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption ); virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const rtl::OUString& aCaption ); + const rtl::OUString& aCaption ); virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const rtl::OUString& aCaption, + const ImplControlValue& aValue, const rtl::OUString& aCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion ); // get device resolution diff --git a/vcl/aqua/inc/salinst.h b/vcl/aqua/inc/salinst.h index 8a44f7ef3304..0bceb99d1d0e 100644 --- a/vcl/aqua/inc/salinst.h +++ b/vcl/aqua/inc/salinst.h @@ -32,6 +32,7 @@ #include "vos/mutex.hxx" #include "vos/thread.hxx" #include "vcl/salinst.hxx" +#include "osl/conditn.h" #include "aquavcltypes.h" @@ -96,6 +97,7 @@ public: int mnActivePrintJobs; std::list< SalUserEvent > maUserEvents; oslMutex maUserEventListMutex; + oslCondition maWaitingYieldCond; typedef std::list<const ApplicationEvent*> AppEventList; static AppEventList aAppEventList; diff --git a/vcl/aqua/source/a11y/aqua11yfactory.mm b/vcl/aqua/source/a11y/aqua11yfactory.mm index eb745ea24aa5..7732ce202cd2 100644 --- a/vcl/aqua/source/a11y/aqua11yfactory.mm +++ b/vcl/aqua/source/a11y/aqua11yfactory.mm @@ -48,6 +48,7 @@ #include "aqua11ywrappersplitter.h" #include "aqua11ywrappertabgroup.h" #include "aqua11ywrappertoolbar.h" +#include "aqua11ytablewrapper.h" #include <com/sun/star/accessibility/AccessibleStateType.hpp> using namespace ::com::sun::star::accessibility; @@ -142,6 +143,8 @@ static bool enabled = false; aWrapper = [ [ AquaA11yWrapperList alloc ] initWithAccessibleContext: rxAccessibleContext ]; } else if ( [ nativeRole isEqualToString: NSAccessibilitySplitterRole ] ) { aWrapper = [ [ AquaA11yWrapperSplitter alloc ] initWithAccessibleContext: rxAccessibleContext ]; + } else if ( [ nativeRole isEqualToString: NSAccessibilityTableRole ] ) { + aWrapper = [ [ AquaA11yTableWrapper alloc ] initWithAccessibleContext: rxAccessibleContext ]; } else { aWrapper = [ [ AquaA11yWrapper alloc ] initWithAccessibleContext: rxAccessibleContext ]; } diff --git a/vcl/aqua/source/a11y/aqua11ytablewrapper.h b/vcl/aqua/source/a11y/aqua11ytablewrapper.h index 8753365377e3..7bf3e44a2945 100644 --- a/vcl/aqua/source/a11y/aqua11ytablewrapper.h +++ b/vcl/aqua/source/a11y/aqua11ytablewrapper.h @@ -30,9 +30,15 @@ #include "aqua11ywrapper.h" -@interface AquaA11yTableWrapper : NSObject +#define MAXIMUM_ACCESSIBLE_TABLE_CELLS 1000 + +@interface AquaA11yTableWrapper : AquaA11yWrapper { } -+(id)childrenAttributeForElement:(AquaA11yWrapper *)wrapper; ++(id)childrenAttributeForElement:(AquaA11yTableWrapper *)wrapper; ++(void)addAttributeNamesTo: (NSMutableArray *)attributeNames object: (AquaA11yWrapper*)pObject; + +-(id)rowsAttribute; +-(id)columnsAttribute; @end #endif // _SV_AQUA11TABLEWRAPPER_H diff --git a/vcl/aqua/source/a11y/aqua11ytablewrapper.mm b/vcl/aqua/source/a11y/aqua11ytablewrapper.mm index 08205ac8a66b..98454ab8d57b 100644 --- a/vcl/aqua/source/a11y/aqua11ytablewrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ytablewrapper.mm @@ -35,38 +35,120 @@ using namespace ::com::sun::star::accessibility; using namespace ::com::sun::star::awt; using namespace ::com::sun::star::uno; -@implementation AquaA11yTableWrapper : NSObject +@implementation AquaA11yTableWrapper : AquaA11yWrapper -+(id)childrenAttributeForElement:(AquaA11yWrapper *)wrapper ++(id)childrenAttributeForElement:(AquaA11yTableWrapper *)wrapper { - try + XAccessibleTable * accessibleTable = [ wrapper accessibleTable ]; + NSArray* pResult = nil; + if( accessibleTable ) { NSMutableArray * cells = [ [ NSMutableArray alloc ] init ]; - XAccessibleComponent * accessibleComponent = [ wrapper accessibleComponent ]; - XAccessibleTable * accessibleTable = [ wrapper accessibleTable ]; - // find out which cells are actually visible by determining the top-left-cell and the bottom-right-cell - Size tableSize = accessibleComponent -> getSize(); - Point point; - point.X = 0; - point.Y = 0; - Reference < XAccessible > rAccessibleTopLeft = accessibleComponent -> getAccessibleAtPoint ( point ); - point.X = tableSize.Width - 1; - point.Y = tableSize.Height - 1; - Reference < XAccessible > rAccessibleBottomRight = accessibleComponent -> getAccessibleAtPoint ( point ); - if ( rAccessibleTopLeft.is() && rAccessibleBottomRight.is() ) + try { - sal_Int32 idxTopLeft = rAccessibleTopLeft -> getAccessibleContext() -> getAccessibleIndexInParent(); - sal_Int32 idxBottomRight = rAccessibleBottomRight -> getAccessibleContext() -> getAccessibleIndexInParent(); - sal_Int32 rowTopLeft = accessibleTable -> getAccessibleRow ( idxTopLeft ); - sal_Int32 columnTopLeft = accessibleTable -> getAccessibleColumn ( idxTopLeft ); - sal_Int32 rowBottomRight = accessibleTable -> getAccessibleRow ( idxBottomRight ); - sal_Int32 columnBottomRight = accessibleTable -> getAccessibleColumn ( idxBottomRight ); - // create an array containing the visible cells - for ( sal_Int32 rowCount = rowTopLeft; rowCount <= rowBottomRight; rowCount++ ) + sal_Int32 nRows = accessibleTable->getAccessibleRowCount(); + sal_Int32 nCols = accessibleTable->getAccessibleColumnCount(); + + if( nRows * nCols < MAXIMUM_ACCESSIBLE_TABLE_CELLS ) { - for ( sal_Int32 columnCount = columnTopLeft; columnCount <= columnBottomRight; columnCount++ ) + // make all children visible to the hierarchy + for ( sal_Int32 rowCount = 0; rowCount < nRows; rowCount++ ) { - Reference < XAccessible > rAccessibleCell = accessibleTable -> getAccessibleCellAt ( rowCount, columnCount ); + for ( sal_Int32 columnCount = 0; columnCount < nCols; columnCount++ ) + { + Reference < XAccessible > rAccessibleCell = accessibleTable -> getAccessibleCellAt ( rowCount, columnCount ); + if ( rAccessibleCell.is() ) + { + id cell_wrapper = [ AquaA11yFactory wrapperForAccessibleContext: rAccessibleCell -> getAccessibleContext() ]; + [ cells addObject: cell_wrapper ]; + [ cell_wrapper release ]; + } + } + } + } + else + { + XAccessibleComponent * accessibleComponent = [ wrapper accessibleComponent ]; + // find out which cells are actually visible by determining the top-left-cell and the bottom-right-cell + Size tableSize = accessibleComponent -> getSize(); + Point point; + point.X = 0; + point.Y = 0; + Reference < XAccessible > rAccessibleTopLeft = accessibleComponent -> getAccessibleAtPoint ( point ); + point.X = tableSize.Width - 1; + point.Y = tableSize.Height - 1; + Reference < XAccessible > rAccessibleBottomRight = accessibleComponent -> getAccessibleAtPoint ( point ); + if ( rAccessibleTopLeft.is() && rAccessibleBottomRight.is() ) + { + sal_Int32 idxTopLeft = rAccessibleTopLeft -> getAccessibleContext() -> getAccessibleIndexInParent(); + sal_Int32 idxBottomRight = rAccessibleBottomRight -> getAccessibleContext() -> getAccessibleIndexInParent(); + sal_Int32 rowTopLeft = accessibleTable -> getAccessibleRow ( idxTopLeft ); + sal_Int32 columnTopLeft = accessibleTable -> getAccessibleColumn ( idxTopLeft ); + sal_Int32 rowBottomRight = accessibleTable -> getAccessibleRow ( idxBottomRight ); + sal_Int32 columnBottomRight = accessibleTable -> getAccessibleColumn ( idxBottomRight ); + // create an array containing the visible cells + for ( sal_Int32 rowCount = rowTopLeft; rowCount <= rowBottomRight; rowCount++ ) + { + for ( sal_Int32 columnCount = columnTopLeft; columnCount <= columnBottomRight; columnCount++ ) + { + Reference < XAccessible > rAccessibleCell = accessibleTable -> getAccessibleCellAt ( rowCount, columnCount ); + if ( rAccessibleCell.is() ) + { + id cell_wrapper = [ AquaA11yFactory wrapperForAccessibleContext: rAccessibleCell -> getAccessibleContext() ]; + [ cells addObject: cell_wrapper ]; + [ cell_wrapper release ]; + } + } + } + } + } + pResult = NSAccessibilityUnignoredChildren( cells ); + } + catch (const Exception &e) + { + } + [cells autorelease]; + } + + return pResult; +} + ++(void)addAttributeNamesTo: (NSMutableArray *)attributeNames object: (AquaA11yWrapper*)pObject +{ + XAccessibleTable * accessibleTable = [ pObject accessibleTable ]; + if( accessibleTable ) + { + sal_Int32 nRows = accessibleTable->getAccessibleRowCount(); + sal_Int32 nCols = accessibleTable->getAccessibleColumnCount(); + + + if( nRows*nCols < MAXIMUM_ACCESSIBLE_TABLE_CELLS ) + { + [ attributeNames addObject: NSAccessibilityRowsAttribute ]; + [ attributeNames addObject: NSAccessibilityColumnsAttribute ]; + } + } +} + +-(id)rowsAttribute +{ + NSArray* pResult = nil; + + XAccessibleTable * accessibleTable = [ self accessibleTable ]; + if( accessibleTable ) + { + sal_Int32 nRows = accessibleTable->getAccessibleRowCount(); + sal_Int32 nCols = accessibleTable->getAccessibleColumnCount(); + if( nRows * nCols < MAXIMUM_ACCESSIBLE_TABLE_CELLS ) + { + NSMutableArray * cells = [ [ NSMutableArray alloc ] init ]; + try + { + // find out number of rows + sal_Int32 nRows = accessibleTable->getAccessibleRowCount(); + for( sal_Int32 n = 0; n < nRows; n++ ) + { + Reference < XAccessible > rAccessibleCell = accessibleTable -> getAccessibleCellAt ( n, 0 ); if ( rAccessibleCell.is() ) { id cell_wrapper = [ AquaA11yFactory wrapperForAccessibleContext: rAccessibleCell -> getAccessibleContext() ]; @@ -74,16 +156,56 @@ using namespace ::com::sun::star::uno; [ cell_wrapper release ]; } } + pResult = NSAccessibilityUnignoredChildren( cells ); + } + catch (const Exception &e) + { + pResult = nil; } + [ cells autorelease ]; } - [ cells autorelease ]; - return NSAccessibilityUnignoredChildren( cells ); } - catch (const Exception &e) + + return pResult; +} + +-(id)columnsAttribute +{ + NSArray* pResult = nil; + + XAccessibleTable * accessibleTable = [ self accessibleTable ]; + + if( accessibleTable ) { - // TODO: Log - return nil; + sal_Int32 nRows = accessibleTable->getAccessibleRowCount(); + sal_Int32 nCols = accessibleTable->getAccessibleColumnCount(); + if( nRows * nCols < MAXIMUM_ACCESSIBLE_TABLE_CELLS ) + { + NSMutableArray * cells = [ [ NSMutableArray alloc ] init ]; + try + { + // find out number of columns + for( sal_Int32 n = 0; n < nCols; n++ ) + { + Reference < XAccessible > rAccessibleCell = accessibleTable -> getAccessibleCellAt ( 0, n ); + if ( rAccessibleCell.is() ) + { + id cell_wrapper = [ AquaA11yFactory wrapperForAccessibleContext: rAccessibleCell -> getAccessibleContext() ]; + [ cells addObject: cell_wrapper ]; + [ cell_wrapper release ]; + } + } + pResult = NSAccessibilityUnignoredChildren( cells ); + } + catch (const Exception &e) + { + pResult = nil; + } + [ cells autorelease ]; + } } + + return pResult; } @end diff --git a/vcl/aqua/source/a11y/aqua11ywrapper.mm b/vcl/aqua/source/a11y/aqua11ywrapper.mm index 959746d533dc..e86676e725f2 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapper.mm @@ -29,6 +29,8 @@ #include "precompiled_vcl.hxx" #include "salinst.h" +#include "saldata.hxx" + #include "aqua11ywrapper.h" #include "aqua11yactionwrapper.h" #include "aqua11ycomponentwrapper.h" @@ -41,6 +43,7 @@ #include "aqua11yfocuslistener.hxx" #include "aqua11yfocustracker.hxx" #include "aqua11yrolehelper.h" + #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> @@ -217,7 +220,8 @@ static MacOSBOOL isPopupMenuOpen = NO; -(id)roleAttribute { if ( mActsAsRadioGroup ) { return NSAccessibilityRadioGroupRole; - } else { + } + else { return [ AquaA11yRoleHelper getNativeRoleFrom: [ self accessibleContext ] ]; } } @@ -323,8 +327,10 @@ static MacOSBOOL isPopupMenuOpen = NO; } } return children; - } else if ( [ self accessibleTable ] != nil ) { - return [ AquaA11yTableWrapper childrenAttributeForElement: self ]; + } else if ( [ self accessibleTable ] != nil ) + { + AquaA11yTableWrapper* pTable = [self isKindOfClass: [AquaA11yTableWrapper class]] ? (AquaA11yTableWrapper*)self : nil; + return [ AquaA11yTableWrapper childrenAttributeForElement: pTable ]; } else { try { NSMutableArray * children = [ [ NSMutableArray alloc ] init ]; @@ -663,6 +669,7 @@ static MacOSBOOL isPopupMenuOpen = NO; if ( isPopupMenuOpen ) { return nil; } + id value = nil; // if we are no longer in the wrapper repository, we have been disposed AquaA11yWrapper * theWrapper = [ AquaA11yFactory wrapperForAccessibleContext: [ self accessibleContext ] createIfNotExists: NO ]; @@ -717,6 +724,7 @@ static MacOSBOOL isPopupMenuOpen = NO; NSString * nativeSubrole = nil; NSString * title = nil; NSMutableArray * attributeNames = nil; + sal_Int32 nAccessibleChildren = 0; try { // Default Attributes attributeNames = [ NSMutableArray arrayWithObjects: @@ -737,8 +745,9 @@ static MacOSBOOL isPopupMenuOpen = NO; } try { - if ( [ self accessibleContext ] -> getAccessibleChildCount() > 0 ) { - [ attributeNames addObject: NSAccessibilityChildrenAttribute ]; + nAccessibleChildren = [ self accessibleContext ] -> getAccessibleChildCount(); + if ( nAccessibleChildren > 0 ) { + [ attributeNames addObject: NSAccessibilityChildrenAttribute ]; } } catch( DisposedException& ) {} @@ -754,6 +763,9 @@ static MacOSBOOL isPopupMenuOpen = NO; [ attributeNames addObject: NSAccessibilityServesAsTitleForUIElementsAttribute ]; } // Special Attributes depending on interface + if( [self accessibleContext ] -> getAccessibleRole() == AccessibleRole::TABLE ) + [AquaA11yTableWrapper addAttributeNamesTo: attributeNames object: self]; + if ( [ self accessibleText ] != nil ) { [ AquaA11yTextWrapper addAttributeNamesTo: attributeNames ]; } @@ -953,14 +965,15 @@ static MacOSBOOL isPopupMenuOpen = NO; return hit; } -Reference < XAccessibleContext > hitTestRunner ( Point point, Reference < XAccessibleContext > rxAccessibleContext ) { +Reference < XAccessibleContext > hitTestRunner ( com::sun::star::awt::Point point, + Reference < XAccessibleContext > rxAccessibleContext ) { Reference < XAccessibleContext > hitChild; Reference < XAccessibleContext > emptyReference; try { Reference < XAccessibleComponent > rxAccessibleComponent ( rxAccessibleContext, UNO_QUERY ); if ( rxAccessibleComponent.is() ) { - Point location = rxAccessibleComponent -> getLocationOnScreen(); - Point hitPoint ( point.X - location.X , point.Y - location.Y); + com::sun::star::awt::Point location = rxAccessibleComponent -> getLocationOnScreen(); + com::sun::star::awt::Point hitPoint ( point.X - location.X , point.Y - location.Y); Reference < XAccessible > rxAccessible = rxAccessibleComponent -> getAccessibleAtPoint ( hitPoint ); if ( rxAccessible.is() && rxAccessible -> getAccessibleContext().is() ) { if ( rxAccessible -> getAccessibleContext() -> getAccessibleChildCount() > 0 ) { @@ -999,7 +1012,7 @@ Reference < XAccessibleContext > hitTestRunner ( Point point, Reference < XAcces } Reference < XAccessibleContext > hitChild; NSRect screenRect = [ [ NSScreen mainScreen ] frame ]; - Point hitPoint ( static_cast<long>(point.x) , static_cast<long>(screenRect.size.height - point.y) ); + com::sun::star::awt::Point hitPoint ( static_cast<long>(point.x) , static_cast<long>(screenRect.size.height - point.y) ); // check child windows first NSWindow * window = (NSWindow *) [ self accessibilityAttributeValue: NSAccessibilityWindowAttribute ]; NSArray * childWindows = [ window childWindows ]; diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx index 62c59e78c963..b8a2261ed9db 100644 --- a/vcl/aqua/source/app/salinst.cxx +++ b/vcl/aqua/source/app/salinst.cxx @@ -474,6 +474,7 @@ AquaSalInstance::AquaSalInstance() mbWaitingYield = false; maUserEventListMutex = osl_createMutex(); mnActivePrintJobs = 0; + maWaitingYieldCond = osl_createCondition(); } // ----------------------------------------------------------------------- @@ -484,6 +485,7 @@ AquaSalInstance::~AquaSalInstance() mpSalYieldMutex->release(); delete mpSalYieldMutex; osl_destroyMutex( maUserEventListMutex ); + osl_destroyCondition( maWaitingYieldCond ); } // ----------------------------------------------------------------------- @@ -713,6 +715,7 @@ void AquaSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) if( aEvent.mpFrame && AquaSalFrame::isAlive( aEvent.mpFrame ) ) { aEvent.mpFrame->CallCallback( aEvent.mnType, aEvent.mpData ); + osl_setCondition( maWaitingYieldCond ); // return if only one event is asked for if( ! bHandleAllCurrentEvents ) return; @@ -785,6 +788,18 @@ void AquaSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) (*it)->maInvalidRect.SetEmpty(); } } + osl_setCondition( maWaitingYieldCond ); + } + else if( bWait ) + { + // #i103162# + // wait until any thread (most likely the main thread) + // has dispatched an event, cop out at 200 ms + osl_resetCondition( maWaitingYieldCond ); + TimeValue aVal = { 0, 200000000 }; + ULONG nCount = ReleaseYieldMutex(); + osl_waitCondition( maWaitingYieldCond, &aVal ); + AcquireYieldMutex( nCount ); } // we get some apple events way too early diff --git a/vcl/aqua/source/dtrans/aqua_clipboard.cxx b/vcl/aqua/source/dtrans/aqua_clipboard.cxx index d3a4e9bc604c..52fb13e1e11f 100644 --- a/vcl/aqua/source/dtrans/aqua_clipboard.cxx +++ b/vcl/aqua/source/dtrans/aqua_clipboard.cxx @@ -189,6 +189,10 @@ void SAL_CALL AquaClipboard::setContents(const Reference<XTransferable>& xTransf const Reference<XClipboardOwner>& xClipboardOwner) throw( RuntimeException ) { + NSArray* types = xTransferable.is() ? + mpDataFlavorMapper->flavorSequenceToTypesArray(xTransferable->getTransferDataFlavors()) : + [NSArray array]; + ClearableMutexGuard aGuard(m_aMutex); Reference<XClipboardOwner> oldOwner(mXClipboardOwner); @@ -197,11 +201,10 @@ void SAL_CALL AquaClipboard::setContents(const Reference<XTransferable>& xTransf Reference<XTransferable> oldContent(mXClipboardContent); mXClipboardContent = xTransferable; - NSArray* types = mXClipboardContent.is() ? - mpDataFlavorMapper->flavorSequenceToTypesArray(mXClipboardContent->getTransferDataFlavors()) : - [NSArray array]; mPasteboardChangeCount = [mPasteboard declareTypes: types owner: mEventListener]; + aGuard.clear(); + // if we are already the owner of the clipboard // then fire lost ownership event if (oldOwner.is()) @@ -253,7 +256,7 @@ void SAL_CALL AquaClipboard::removeClipboardListener(const Reference< XClipboard void AquaClipboard::applicationDidBecomeActive(NSNotification* aNotification) { - MutexGuard aGuard(m_aMutex); + ClearableMutexGuard aGuard(m_aMutex); int currentPboardChgCount = [mPasteboard changeCount]; @@ -270,6 +273,8 @@ void AquaClipboard::applicationDidBecomeActive(NSNotification* aNotification) Reference<XTransferable> oldContent(mXClipboardContent); mXClipboardContent = Reference<XTransferable>(); + aGuard.clear(); + if (oldOwner.is()) { fireLostClipboardOwnershipEvent(oldOwner, oldContent); diff --git a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm index 74c66ab1401d..d00fc9a6cd0e 100644 --- a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm +++ b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm @@ -318,6 +318,12 @@ class ControllerProperties double fScaleX = double(aLogicSize.Width())/double(aPageSize.aSize.Width()); double fScaleY = double(aLogicSize.Height())/double(aPageSize.aSize.Height()); double fScale = (fScaleX < fScaleY) ? fScaleX : fScaleY; + // #i104784# if we render the page too small then rounding issues result in + // layout artifacts looking really bad. So scale the page unto a device that is not + // full page size but not too small either. This also results in much better visual + // quality of the preview, e.g. when its height approaches the number of text lines + if( fScale < 0.1 ) + fScale = 0.1; aMtf.WindStart(); aMtf.Scale( fScale, fScale ); aMtf.WindStart(); @@ -358,9 +364,10 @@ class ControllerProperties NSSize aMargins = [mpPreviewBox contentViewMargins]; aPreviewFrame.origin.x = 0; aPreviewFrame.origin.y = 34; + aPreviewFrame.size.width -= 2*(aMargins.width+1); aPreviewFrame.size.height -= 61; mpPreview = [[NSImageView alloc] initWithFrame: aPreviewFrame]; - [mpPreview setImageScaling: NSScaleNone]; + [mpPreview setImageScaling: NSScaleProportionally]; [mpPreview setImageAlignment: NSImageAlignCenter]; [mpPreview setImageFrameStyle: NSImageFrameNone]; [mpPreviewBox addSubview: [mpPreview autorelease]]; diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index a54a7fad7ac5..1ef370f43a92 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -694,6 +694,13 @@ void AquaSalGraphics::drawPixel( long nX, long nY, SalColor nSalColor ) void AquaSalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 ) { + if( nX1 == nX2 && nY1 == nY2 ) + { + // #i109453# platform independent code expects at least one pixel to be drawn + drawPixel( nX1, nY1 ); + return; + } + if( !CheckContext() ) return; @@ -1095,7 +1102,8 @@ void AquaSalGraphics::copyBits( const SalTwoRect *pPosAry, SalGraphics *pSrcGrap DBG_ASSERT( pSrc->mxLayer!=NULL, "AquaSalGraphics::copyBits() from non-layered graphics" ); const CGPoint aDstPoint = { +pPosAry->mnDestX - pPosAry->mnSrcX, pPosAry->mnDestY - pPosAry->mnSrcY }; - if( !mnBitmapDepth || (aDstPoint.x + pSrc->mnWidth) <= mnWidth ) // workaround a Quartz crasher + if( (pPosAry->mnSrcWidth == pPosAry->mnDestWidth && pPosAry->mnSrcHeight == pPosAry->mnDestHeight) && + (!mnBitmapDepth || (aDstPoint.x + pSrc->mnWidth) <= mnWidth) ) // workaround a Quartz crasher { // in XOR mode the drawing context is redirected to the XOR mask // if source and target are identical then copyBits() paints onto the target context though diff --git a/vcl/aqua/source/gdi/salnativewidgets.cxx b/vcl/aqua/source/gdi/salnativewidgets.cxx index b4b843eaca58..5eccf88dc523 100644 --- a/vcl/aqua/source/gdi/salnativewidgets.cxx +++ b/vcl/aqua/source/gdi/salnativewidgets.cxx @@ -380,7 +380,7 @@ BOOL AquaSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart n * nType/nPart combination. */ BOOL AquaSalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - const Point& rPos, SalControlHandle& rControlHandle, BOOL& rIsInside ) + const Point& rPos, BOOL& rIsInside ) { if ( nType == CTRL_SCROLLBAR ) { @@ -468,7 +468,6 @@ UInt32 AquaSalGraphics::getTrackState( ControlState nState ) * * rControlRegion: The bounding region of the complete control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the AquaSalGraphics implementation. * aCaption: A caption or title string (like button text etc) */ BOOL AquaSalGraphics::drawNativeControl(ControlType nType, @@ -476,7 +475,6 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const rtl::OUString& aCaption ) { BOOL bOK = FALSE; @@ -1226,12 +1224,11 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType, * * rControlRegion: The bounding region of the complete control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the AquaSalGraphics implementation. * aCaption: A caption or title string (like button text etc) */ BOOL AquaSalGraphics::drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const rtl::OUString& aCaption ) + const rtl::OUString& aCaption ) { return( FALSE ); } @@ -1248,11 +1245,10 @@ BOOL AquaSalGraphics::drawNativeControlText( ControlType nType, ControlPart nPar * * rControlRegion: The bounding region of the control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the AquaSalGraphics implementation. * aCaption: A caption or title string (like button text etc) */ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const rtl::OUString& aCaption, + const ImplControlValue& aValue, const rtl::OUString& aCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion ) { diff --git a/vcl/aqua/source/gdi/salprn.cxx b/vcl/aqua/source/gdi/salprn.cxx index cee243093ff3..1c0401f769b5 100644 --- a/vcl/aqua/source/gdi/salprn.cxx +++ b/vcl/aqua/source/gdi/salprn.cxx @@ -532,8 +532,6 @@ BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName, PrintAccessoryViewState aAccViewState; sal_Int32 nAllPages = 0; - aAccViewState.bNeedRestart = true; - // reset IsLastPage i_rController.setLastPage( sal_False ); @@ -549,111 +547,133 @@ BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName, if( ! i_rController.isShowDialogs() ) bShowProgressPanel = sal_False; + // possibly create one job for collated output + sal_Bool bSinglePrintJobs = sal_False; + beans::PropertyValue* pSingleValue = i_rController.getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintCollateAsSingleJobs" ) ) ); + if( pSingleValue ) + { + pSingleValue->Value >>= bSinglePrintJobs; + } + // FIXME: jobStarted() should be done after the print dialog has ended (if there is one) // how do I know when that might be ? i_rController.jobStarted(); - do - { - if( aAccViewState.bNeedRestart ) - { - mnCurPageRangeStart = 0; - mnCurPageRangeCount = 0; - nAllPages = i_rController.getFilteredPageCount(); - } - aAccViewState.bNeedRestart = false; - Size aCurSize( 21000, 29700 ); - if( nAllPages > 0 ) + int nCopies = i_rController.getPrinter()->GetCopyCount(); + int nJobs = 1; + if( bSinglePrintJobs ) + { + nJobs = nCopies; + nCopies = 1; + } + + for( int nCurJob = 0; nCurJob < nJobs; nCurJob++ ) + { + aAccViewState.bNeedRestart = true; + do { - mnCurPageRangeCount = 1; - aCurSize = getPageSize( i_rController, mnCurPageRangeStart ); - Size aNextSize( aCurSize ); + if( aAccViewState.bNeedRestart ) + { + mnCurPageRangeStart = 0; + mnCurPageRangeCount = 0; + nAllPages = i_rController.getFilteredPageCount(); + } - // print pages up to a different size - while( mnCurPageRangeCount + mnCurPageRangeStart < nAllPages ) + aAccViewState.bNeedRestart = false; + + Size aCurSize( 21000, 29700 ); + if( nAllPages > 0 ) { - aNextSize = getPageSize( i_rController, mnCurPageRangeStart + mnCurPageRangeCount ); - if( aCurSize == aNextSize // same page size - || - (aCurSize.Width() == aNextSize.Height() && aCurSize.Height() == aNextSize.Width()) // same size, but different orientation - ) + mnCurPageRangeCount = 1; + aCurSize = getPageSize( i_rController, mnCurPageRangeStart ); + Size aNextSize( aCurSize ); + + // print pages up to a different size + while( mnCurPageRangeCount + mnCurPageRangeStart < nAllPages ) { - mnCurPageRangeCount++; + aNextSize = getPageSize( i_rController, mnCurPageRangeStart + mnCurPageRangeCount ); + if( aCurSize == aNextSize // same page size + || + (aCurSize.Width() == aNextSize.Height() && aCurSize.Height() == aNextSize.Width()) // same size, but different orientation + ) + { + mnCurPageRangeCount++; + } + else + break; } - else - break; } - } - else - mnCurPageRangeCount = 0; - - // now for the current run - mnStartPageOffsetX = mnStartPageOffsetY = 0; - // setup the paper size and orientation - // do this on our associated Printer object, since that is - // out interface to the applications which occasionally rely on the paper - // information (e.g. brochure printing scales to the found paper size) - // also SetPaperSizeUser has the advantage that we can share a - // platform independent paper matching algorithm - boost::shared_ptr<Printer> pPrinter( i_rController.getPrinter() ); - pPrinter->SetMapMode( MapMode( MAP_100TH_MM ) ); - pPrinter->SetPaperSizeUser( aCurSize, true ); - - // create view - NSView* pPrintView = [[AquaPrintView alloc] initWithController: &i_rController withInfoPrinter: this]; - - NSMutableDictionary* pPrintDict = [mpPrintInfo dictionary]; - - // set filename - if( i_pFileName ) - { - [mpPrintInfo setJobDisposition: NSPrintSaveJob]; - NSString* pPath = CreateNSString( *i_pFileName ); - [pPrintDict setObject: pPath forKey: NSPrintSavePath]; - [pPath release]; - } + else + mnCurPageRangeCount = 0; + + // now for the current run + mnStartPageOffsetX = mnStartPageOffsetY = 0; + // setup the paper size and orientation + // do this on our associated Printer object, since that is + // out interface to the applications which occasionally rely on the paper + // information (e.g. brochure printing scales to the found paper size) + // also SetPaperSizeUser has the advantage that we can share a + // platform independent paper matching algorithm + boost::shared_ptr<Printer> pPrinter( i_rController.getPrinter() ); + pPrinter->SetMapMode( MapMode( MAP_100TH_MM ) ); + pPrinter->SetPaperSizeUser( aCurSize, true ); + + // create view + NSView* pPrintView = [[AquaPrintView alloc] initWithController: &i_rController withInfoPrinter: this]; + + NSMutableDictionary* pPrintDict = [mpPrintInfo dictionary]; + + // set filename + if( i_pFileName ) + { + [mpPrintInfo setJobDisposition: NSPrintSaveJob]; + NSString* pPath = CreateNSString( *i_pFileName ); + [pPrintDict setObject: pPath forKey: NSPrintSavePath]; + [pPath release]; + } - [pPrintDict setObject: [[NSNumber numberWithInt: (int)i_rController.getPrinter()->GetCopyCount()] autorelease] forKey: NSPrintCopies]; - [pPrintDict setObject: [[NSNumber numberWithBool: YES] autorelease] forKey: NSPrintDetailedErrorReporting]; - [pPrintDict setObject: [[NSNumber numberWithInt: 1] autorelease] forKey: NSPrintFirstPage]; - // #i103253# weird: for some reason, autoreleasing the value below like the others above - // leads do a double free malloc error. Why this value should behave differently from all the others - // is a mystery. - [pPrintDict setObject: [NSNumber numberWithInt: mnCurPageRangeCount] forKey: NSPrintLastPage]; + [pPrintDict setObject: [[NSNumber numberWithInt: nCopies] autorelease] forKey: NSPrintCopies]; + [pPrintDict setObject: [[NSNumber numberWithBool: YES] autorelease] forKey: NSPrintDetailedErrorReporting]; + [pPrintDict setObject: [[NSNumber numberWithInt: 1] autorelease] forKey: NSPrintFirstPage]; + // #i103253# weird: for some reason, autoreleasing the value below like the others above + // leads do a double free malloc error. Why this value should behave differently from all the others + // is a mystery. + [pPrintDict setObject: [NSNumber numberWithInt: mnCurPageRangeCount] forKey: NSPrintLastPage]; - // create print operation - NSPrintOperation* pPrintOperation = [NSPrintOperation printOperationWithView: pPrintView printInfo: mpPrintInfo]; + // create print operation + NSPrintOperation* pPrintOperation = [NSPrintOperation printOperationWithView: pPrintView printInfo: mpPrintInfo]; - if( pPrintOperation ) - { - NSObject* pReleaseAfterUse = nil; - bool bShowPanel = (! i_rController.isDirectPrint() && getUseNativeDialog() && i_rController.isShowDialogs() ); - [pPrintOperation setShowsPrintPanel: bShowPanel ? YES : NO ]; - [pPrintOperation setShowsProgressPanel: bShowProgressPanel ? YES : NO]; - - // set job title (since MacOSX 10.5) - if( [pPrintOperation respondsToSelector: @selector(setJobTitle:)] ) - [pPrintOperation performSelector: @selector(setJobTitle:) withObject: [CreateNSString( i_rJobName ) autorelease]]; - - if( bShowPanel && mnCurPageRangeStart == 0 ) // only the first range of pages gets the accesory view - pReleaseAfterUse = [AquaPrintAccessoryView setupPrinterPanel: pPrintOperation withController: &i_rController withState: &aAccViewState]; - - bSuccess = TRUE; - mbJob = true; - pInst->startedPrintJob(); - [pPrintOperation runOperation]; - pInst->endedPrintJob(); - bWasAborted = [[[pPrintOperation printInfo] jobDisposition] compare: NSPrintCancelJob] == NSOrderedSame; - mbJob = false; - if( pReleaseAfterUse ) - [pReleaseAfterUse release]; - } + if( pPrintOperation ) + { + NSObject* pReleaseAfterUse = nil; + bool bShowPanel = (! i_rController.isDirectPrint() && getUseNativeDialog() && i_rController.isShowDialogs() ); + [pPrintOperation setShowsPrintPanel: bShowPanel ? YES : NO ]; + [pPrintOperation setShowsProgressPanel: bShowProgressPanel ? YES : NO]; + + // set job title (since MacOSX 10.5) + if( [pPrintOperation respondsToSelector: @selector(setJobTitle:)] ) + [pPrintOperation performSelector: @selector(setJobTitle:) withObject: [CreateNSString( i_rJobName ) autorelease]]; + + 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; + mbJob = true; + pInst->startedPrintJob(); + [pPrintOperation runOperation]; + pInst->endedPrintJob(); + bWasAborted = [[[pPrintOperation printInfo] jobDisposition] compare: NSPrintCancelJob] == NSOrderedSame; + mbJob = false; + if( pReleaseAfterUse ) + [pReleaseAfterUse release]; + } - mnCurPageRangeStart += mnCurPageRangeCount; - mnCurPageRangeCount = 1; - } while( aAccViewState.bNeedRestart || mnCurPageRangeStart + mnCurPageRangeCount < nAllPages ); + mnCurPageRangeStart += mnCurPageRangeCount; + mnCurPageRangeCount = 1; + } while( aAccViewState.bNeedRestart || mnCurPageRangeStart + mnCurPageRangeCount < nAllPages ); + } // inform application that it can release its data // this is awkward, but the XRenderable interface has no method for this, diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx index 71c84ee0c2f1..0fd028864bf4 100644 --- a/vcl/aqua/source/window/salframe.cxx +++ b/vcl/aqua/source/window/salframe.cxx @@ -1128,6 +1128,16 @@ static Font getFont( NSFont* pFont, long nDPIY, const Font& rDefault ) return aResult; } +void AquaSalFrame::getResolution( long& o_rDPIX, long& o_rDPIY ) +{ + if( ! mpGraphics ) + { + GetGraphics(); + ReleaseGraphics( mpGraphics ); + } + mpGraphics->GetResolution( o_rDPIX, o_rDPIY ); +} + // on OSX-Aqua the style settings are independent of the frame, so it does // not really belong here. Since the connection to the Appearance_Manager // is currently done in salnativewidgets.cxx this would be a good place. @@ -1157,13 +1167,8 @@ void AquaSalFrame::UpdateSettings( AllSettings& rSettings ) // get the system font settings Font aAppFont = aStyleSettings.GetAppFont(); - if( ! mpGraphics ) - { - GetGraphics(); - ReleaseGraphics( mpGraphics ); - } long nDPIX = 72, nDPIY = 72; - mpGraphics->GetResolution( nDPIX, nDPIY ); + getResolution( nDPIX, nDPIY ); aAppFont = getFont( [NSFont systemFontOfSize: 0], nDPIY, aAppFont ); // TODO: better mapping of aqua<->ooo font settings diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm index 67926a38608d..0dfa0fa356aa 100755 --- a/vcl/aqua/source/window/salframeview.mm +++ b/vcl/aqua/source/window/salframeview.mm @@ -37,7 +37,9 @@ #include "vcl/window.hxx" #include "vcl/svapp.hxx" - + +#define WHEEL_EVENT_FACTOR 1.5 + static USHORT ImplGetModifierMask( unsigned int nMask ) { USHORT nRet = 0; @@ -654,11 +656,12 @@ private: mpFrame->CocoaToVCL( aPt ); SalWheelMouseEvent aEvent; - aEvent.mnTime = mpFrame->mnLastEventTime; - aEvent.mnX = static_cast<long>(aPt.x) - mpFrame->maGeometry.nX; - aEvent.mnY = static_cast<long>(aPt.y) - mpFrame->maGeometry.nY; - aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags ); - aEvent.mnCode |= KEY_MOD1; // we want zooming, no scrolling + aEvent.mnTime = mpFrame->mnLastEventTime; + aEvent.mnX = static_cast<long>(aPt.x) - mpFrame->maGeometry.nX; + aEvent.mnY = static_cast<long>(aPt.y) - mpFrame->maGeometry.nY; + aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags ); + aEvent.mnCode |= KEY_MOD1; // we want zooming, no scrolling + aEvent.mbDeltaIsPixel = TRUE; // --- RTL --- (mirror mouse pos) if( Application::GetSettings().GetLayoutRTL() ) @@ -667,11 +670,11 @@ private: if( dZ != 0.0 ) { aEvent.mnDelta = static_cast<long>(floor(dZ)); - aEvent.mnNotchDelta = aEvent.mnDelta / 8; - if( aEvent.mnNotchDelta == 0 ) - aEvent.mnNotchDelta = dZ < 0.0 ? -1 : 1; + aEvent.mnNotchDelta = dZ < 0 ? -1 : 1; + if( aEvent.mnDelta == 0 ) + aEvent.mnDelta = aEvent.mnNotchDelta; aEvent.mbHorz = FALSE; - aEvent.mnScrollLines = aEvent.mnNotchDelta > 0 ? aEvent.mnNotchDelta : -aEvent.mnNotchDelta; + aEvent.mnScrollLines = dZ > 0 ? dZ/WHEEL_EVENT_FACTOR : -dZ/WHEEL_EVENT_FACTOR; if( aEvent.mnScrollLines == 0 ) aEvent.mnScrollLines = 1; mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent ); @@ -712,10 +715,11 @@ private: mpFrame->CocoaToVCL( aPt ); SalWheelMouseEvent aEvent; - aEvent.mnTime = mpFrame->mnLastEventTime; - aEvent.mnX = static_cast<long>(aPt.x) - mpFrame->maGeometry.nX; - aEvent.mnY = static_cast<long>(aPt.y) - mpFrame->maGeometry.nY; - aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags ); + aEvent.mnTime = mpFrame->mnLastEventTime; + aEvent.mnX = static_cast<long>(aPt.x) - mpFrame->maGeometry.nX; + aEvent.mnY = static_cast<long>(aPt.y) - mpFrame->maGeometry.nY; + aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags ); + aEvent.mbDeltaIsPixel = TRUE; // --- RTL --- (mirror mouse pos) if( Application::GetSettings().GetLayoutRTL() ) @@ -724,9 +728,9 @@ private: if( dX != 0.0 ) { aEvent.mnDelta = static_cast<long>(floor(dX)); - aEvent.mnNotchDelta = aEvent.mnDelta / 8; - if( aEvent.mnNotchDelta == 0 ) - aEvent.mnNotchDelta = dX < 0.0 ? -1 : 1; + aEvent.mnNotchDelta = dX < 0 ? -1 : 1; + if( aEvent.mnDelta == 0 ) + aEvent.mnDelta = aEvent.mnNotchDelta; aEvent.mbHorz = TRUE; aEvent.mnScrollLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL; mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent ); @@ -734,9 +738,9 @@ private: if( dY != 0.0 && AquaSalFrame::isAlive( mpFrame )) { aEvent.mnDelta = static_cast<long>(floor(dY)); - aEvent.mnNotchDelta = aEvent.mnDelta / 8; - if( aEvent.mnNotchDelta == 0 ) - aEvent.mnNotchDelta = dY < 0.0 ? -1 : 1; + aEvent.mnNotchDelta = dY < 0 ? -1 : 1; + if( aEvent.mnDelta == 0 ) + aEvent.mnDelta = aEvent.mnNotchDelta; aEvent.mbHorz = FALSE; aEvent.mnScrollLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL; mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent ); @@ -771,10 +775,11 @@ private: mpFrame->CocoaToVCL( aPt ); SalWheelMouseEvent aEvent; - aEvent.mnTime = mpFrame->mnLastEventTime; - aEvent.mnX = static_cast<long>(aPt.x) - mpFrame->maGeometry.nX; - aEvent.mnY = static_cast<long>(aPt.y) - mpFrame->maGeometry.nY; - aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags ); + aEvent.mnTime = mpFrame->mnLastEventTime; + aEvent.mnX = static_cast<long>(aPt.x) - mpFrame->maGeometry.nX; + aEvent.mnY = static_cast<long>(aPt.y) - mpFrame->maGeometry.nY; + aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags ); + aEvent.mbDeltaIsPixel = TRUE; // --- RTL --- (mirror mouse pos) if( Application::GetSettings().GetLayoutRTL() ) @@ -783,30 +788,27 @@ private: if( dX != 0.0 ) { aEvent.mnDelta = static_cast<long>(floor(dX)); - aEvent.mnNotchDelta = aEvent.mnDelta / 8; - if( aEvent.mnNotchDelta == 0 ) - aEvent.mnNotchDelta = dX < 0.0 ? -1 : 1; + aEvent.mnNotchDelta = dX < 0 ? -1 : 1; + if( aEvent.mnDelta == 0 ) + aEvent.mnDelta = aEvent.mnNotchDelta; aEvent.mbHorz = TRUE; - aEvent.mnScrollLines = aEvent.mnNotchDelta > 0 ? aEvent.mnNotchDelta : -aEvent.mnNotchDelta; + aEvent.mnScrollLines = dY > 0 ? dX/WHEEL_EVENT_FACTOR : -dX/WHEEL_EVENT_FACTOR; if( aEvent.mnScrollLines == 0 ) aEvent.mnScrollLines = 1; - if( aEvent.mnScrollLines > 15 ) - aEvent.mnScrollLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL; + mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent ); } if( dY != 0.0 && AquaSalFrame::isAlive( mpFrame ) ) { aEvent.mnDelta = static_cast<long>(floor(dY)); - aEvent.mnNotchDelta = aEvent.mnDelta / 8; - if( aEvent.mnNotchDelta == 0 ) - aEvent.mnNotchDelta = dY < 0.0 ? -1 : 1; + aEvent.mnNotchDelta = dY < 0 ? -1 : 1; + if( aEvent.mnDelta == 0 ) + aEvent.mnDelta = aEvent.mnNotchDelta; aEvent.mbHorz = FALSE; - aEvent.mnScrollLines = aEvent.mnNotchDelta > 0 ? aEvent.mnNotchDelta : -aEvent.mnNotchDelta; - if( aEvent.mnScrollLines == 0 ) + aEvent.mnScrollLines = dY > 0 ? dY/WHEEL_EVENT_FACTOR : -dY/WHEEL_EVENT_FACTOR; + if( aEvent.mnScrollLines < 1 ) aEvent.mnScrollLines = 1; - if( aEvent.mnScrollLines > 15 ) - aEvent.mnScrollLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL; - + mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent ); } } diff --git a/vcl/inc/postgraphitestl.h b/vcl/inc/postgraphitestl.h deleted file mode 100644 index 736aa248b7ff..000000000000 --- a/vcl/inc/postgraphitestl.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifdef std_was_redefined_as_stlport -// put things back the way they were -# define std std_was_redefined_as_stlport -# undef _STLP_OUTERMOST_HEADER_ID -// force config to be re-read -# undef _STLP_NOTHROW_INHERENTLY -# undef _STLP_CONFIG_H -# include <stddef.h> -#endif diff --git a/vcl/inc/pregraphitestl.h b/vcl/inc/pregraphitestl.h deleted file mode 100644 index ece0af477113..000000000000 --- a/vcl/inc/pregraphitestl.h +++ /dev/null @@ -1,30 +0,0 @@ -#if defined(GRAPHITEADAPTSTL) && defined(std) -# include <ostream> -# include <istream> -# include <fstream> -# include <iostream> -# include <vector> -# include <algorithm> -# define std_was_redefined_as_stlport std -# undef std -# define _STLP_OUTERMOST_HEADER_ID 0xdeadbeaf -# pragma GCC visibility push(default) -# include _STLP_NATIVE_HEADER(exception_defines.h) -# include _STLP_NATIVE_HEADER(limits) -# include _STLP_NATIVE_HEADER(memory) -# include _STLP_NATIVE_HEADER(exception) -# include _STLP_NATIVE_HEADER(iosfwd) -# include _STLP_NATIVE_HEADER(algorithm) -# include _STLP_NATIVE_HEADER(string) -# include _STLP_NATIVE_HEADER(streambuf) -# include _STLP_NATIVE_HEADER(ios) -# include _STLP_NATIVE_HEADER(locale) -# include _STLP_NATIVE_HEADER(stdexcept) -# include _STLP_NATIVE_HEADER(ostream) -# include _STLP_NATIVE_HEADER(istream) -# include _STLP_NATIVE_HEADER(iostream) -# include _STLP_NATIVE_HEADER(vector) -# pragma GCC visibility pop -#endif -//sil_std resolves to the std that Graphite was built with -namespace sil_std = std; diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx index 317a98026f45..8f4b94bf7b18 100644 --- a/vcl/inc/vcl/button.hxx +++ b/vcl/inc/vcl/button.hxx @@ -60,7 +60,7 @@ public: SAL_DLLPRIVATE USHORT ImplGetTextStyle( XubString& rText, WinBits nWinStyle, ULONG nDrawFlags ); SAL_DLLPRIVATE void ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, Size& rSize, BOOL bLayout, ULONG nImageSep, ULONG nDrawFlags, - USHORT nTextStyle, Rectangle *pSymbolRect=NULL ); + USHORT nTextStyle, Rectangle *pSymbolRect=NULL, bool bAddImageSep = false ); SAL_DLLPRIVATE void ImplSetFocusRect( const Rectangle &rFocusRect ); SAL_DLLPRIVATE const Rectangle& ImplGetFocusRect() const; SAL_DLLPRIVATE void ImplSetSymbolAlign( SymbolAlign eAlign ); diff --git a/vcl/inc/vcl/cmdevt.hxx b/vcl/inc/vcl/cmdevt.hxx index 0faac8472253..7e968b6c7a54 100644 --- a/vcl/inc/vcl/cmdevt.hxx +++ b/vcl/inc/vcl/cmdevt.hxx @@ -138,18 +138,20 @@ private: USHORT mnMode; USHORT mnCode; BOOL mbHorz; + BOOL mbDeltaIsPixel; public: CommandWheelData(); CommandWheelData( long nWheelDelta, long nWheelNotchDelta, ULONG nScrollLines, USHORT nWheelMode, USHORT nKeyModifier, - BOOL mbHorz = FALSE ); + BOOL bHorz = FALSE, BOOL bDeltaIsPixel = FALSE ); long GetDelta() const { return mnDelta; } long GetNotchDelta() const { return mnNotchDelta; } ULONG GetScrollLines() const { return mnLines; } BOOL IsHorz() const { return mbHorz; } + BOOL IsDeltaPixel() const { return mbDeltaIsPixel; } USHORT GetMode() const { return mnMode; } @@ -173,12 +175,13 @@ inline CommandWheelData::CommandWheelData() mnMode = 0; mnCode = 0; mbHorz = FALSE; + mbDeltaIsPixel = FALSE; } inline CommandWheelData::CommandWheelData( long nWheelDelta, long nWheelNotchDelta, ULONG nScrollLines, USHORT nWheelMode, USHORT nKeyModifier, - BOOL bHorz ) + BOOL bHorz, BOOL bDeltaIsPixel ) { mnDelta = nWheelDelta; mnNotchDelta = nWheelNotchDelta; @@ -186,6 +189,7 @@ inline CommandWheelData::CommandWheelData( long nWheelDelta, long nWheelNotchDel mnMode = nWheelMode; mnCode = nKeyModifier; mbHorz = bHorz; + mbDeltaIsPixel = bDeltaIsPixel; } // --------------------- diff --git a/vcl/inc/vcl/dockwin.hxx b/vcl/inc/vcl/dockwin.hxx index 3a1dca044bb7..61464400d595 100644 --- a/vcl/inc/vcl/dockwin.hxx +++ b/vcl/inc/vcl/dockwin.hxx @@ -152,7 +152,7 @@ public: void Unlock(); BOOL IsLocked() const; - void StartPopupMode( ToolBox* pParentToolBox ); + void StartPopupMode( ToolBox* pParentToolBox, ULONG nPopupModeFlags ); BOOL IsInPopupMode() const; void TitleButtonClick( USHORT nButton ); @@ -234,7 +234,10 @@ public: BOOL IsLocked( const Window *pWin ); void StartPopupMode( ToolBox *pParentToolBox, const Window *pWin ); + void StartPopupMode( ToolBox *pParentToolBox, const Window *pWin, ULONG nPopupModeFlags ); + BOOL IsInPopupMode( const Window *pWin ); + void EndPopupMode( const Window *pWin ); // required because those methods are not virtual in Window (!!!) and must // be availbale from the toolkit diff --git a/vcl/inc/vcl/glyphcache.hxx b/vcl/inc/vcl/glyphcache.hxx index fa3e99f2373f..a77c1626dc24 100644 --- a/vcl/inc/vcl/glyphcache.hxx +++ b/vcl/inc/vcl/glyphcache.hxx @@ -51,6 +51,7 @@ class RawBitmap; class CmapResult; #include <vcl/outfont.hxx> +#include <vcl/impfont.hxx> class ServerFontLayout; #include <vcl/sallayout.hxx> @@ -258,11 +259,15 @@ class VCL_DLLPUBLIC ImplServerFontEntry : public ImplFontEntry { private: ServerFont* mpServerFont; + ImplFontOptions maFontOptions; + bool mbGotFontOptions; + bool mbValidFontOptions; public: ImplServerFontEntry( ImplFontSelectData& ); virtual ~ImplServerFontEntry(); void SetServerFont( ServerFont* p) { mpServerFont = p; } + void HandleFontOptions(); }; // ======================================================================= diff --git a/vcl/inc/vcl/graphite_adaptors.hxx b/vcl/inc/vcl/graphite_adaptors.hxx index 0b5f88184ce4..43c2e37a5fb2 100644 --- a/vcl/inc/vcl/graphite_adaptors.hxx +++ b/vcl/inc/vcl/graphite_adaptors.hxx @@ -55,11 +55,11 @@ #include "vcl/dllapi.h" // Libraries -#include "pregraphitestl.h" +#include <tools/preextstl.h> #include <graphite/GrClient.h> #include <graphite/Font.h> #include <graphite/ITextSource.h> -#include "postgraphitestl.h" +#include <tools/postextstl.h> // Module type definitions and forward declarations. // @@ -119,7 +119,7 @@ public: const grutils::GrFeatureParser * features() const { return mpFeatures; }; private: - virtual void UniqueCacheInfo(sil_std::wstring &, bool &, bool &); + virtual void UniqueCacheInfo(ext_std::wstring &, bool &, bool &); FreetypeServerFont& mrFont; FontProperties maFontProperties; diff --git a/vcl/inc/vcl/graphite_features.hxx b/vcl/inc/vcl/graphite_features.hxx index 9f63a029eb5f..47f4c3a01e7f 100644 --- a/vcl/inc/vcl/graphite_features.hxx +++ b/vcl/inc/vcl/graphite_features.hxx @@ -29,11 +29,11 @@ // Parse a string of features specified as ; separated pairs. // e.g. // 1001=1&2002=2&fav1=0 -#include "pregraphitestl.h" +#include <tools/preextstl.h> #include <graphite/GrClient.h> #include <graphite/Font.h> #include <graphite/GrFeature.h> -#include "postgraphitestl.h" +#include <tools/postextstl.h> namespace grutils { diff --git a/vcl/inc/vcl/graphite_layout.hxx b/vcl/inc/vcl/graphite_layout.hxx index b3a3814e9ce6..1fbb11211ca0 100644 --- a/vcl/inc/vcl/graphite_layout.hxx +++ b/vcl/inc/vcl/graphite_layout.hxx @@ -40,13 +40,13 @@ #include <vector> #include <utility> // Libraries -#include "pregraphitestl.h" +#include <tools/preextstl.h> #include <graphite/GrClient.h> #include <graphite/Font.h> #include <graphite/GrConstants.h> #include <graphite/GrAppData.h> #include <graphite/SegmentAux.h> -#include "postgraphitestl.h" +#include <tools/postextstl.h> // Platform #include <vcl/sallayout.hxx> #include <vcl/dllapi.h> diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx index 70c1e6aa624d..9b748f2b5937 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -39,6 +39,7 @@ #include <vcl/mapmod.hxx> #include <vcl/wall.hxx> #include <vcl/settings.hxx> +#include <vcl/salnativewidgets.hxx> #include <tools/poly.hxx> #include <basegfx/vector/b2enums.hxx> #include <com/sun/star/uno/Reference.h> @@ -1177,6 +1178,49 @@ public: BitmapEx GetDownsampledBitmapEx( const Size& rDstSz, const Point& rSrcPt, const Size& rSrcSz, const BitmapEx& rBmpEx, long nMaxBmpDPIX, long nMaxBmpDPIY ); + + //------------------------------------- + // Native Widget Rendering functions + //------------------------------------- + + // These all just call through to the private mpGraphics functions of the same name. + + // Query the platform layer for control support + BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart ); + + // Query the native control to determine if it was acted upon + BOOL HitTestNativeControl( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + const Point& aPos, + BOOL& rIsInside ); + + // Request rendering of a particular control and/or part + BOOL DrawNativeControl( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + ::rtl::OUString aCaption ); + + // Request rendering of a caption string for a control + BOOL DrawNativeControlText( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + ::rtl::OUString aCaption ); + + // Query the native control's actual drawing region (including adornment) + BOOL GetNativeControlRegion( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + ::rtl::OUString aCaption, + Region &rNativeBoundingRegion, + Region &rNativeContentRegion ); + }; #endif // _SV_OUTDEV_HXX diff --git a/vcl/inc/vcl/outfont.hxx b/vcl/inc/vcl/outfont.hxx index 995fcd6009ff..4bbf7176ddb2 100644 --- a/vcl/inc/vcl/outfont.hxx +++ b/vcl/inc/vcl/outfont.hxx @@ -39,6 +39,8 @@ #include <hash_map> +#include <com/sun/star/linguistic2/XLinguServiceManager.hpp> + class ImplDevFontListData; class ImplGetDevFontList; class ImplGetDevSizeList; @@ -186,6 +188,7 @@ public: // TODO: change to private class VCL_DLLPUBLIC ImplDevFontList { private: + friend class WinGlyphFallbackSubstititution; mutable bool mbMatchData; // true if matching attributes are initialized bool mbMapNames; // true if MapNames are available @@ -222,6 +225,9 @@ public: ImplGetDevFontList* GetDevFontList() const; ImplGetDevSizeList* GetDevSizeList( const String& rFontName ) const; + //used by 2-level font fallback + ImplDevFontListData* ImplFindByLocale(com::sun::star::lang::Locale lc) const; + protected: void InitMatchData() const; bool AreMapNamesAvailable() const { return mbMapNames; } diff --git a/vcl/inc/vcl/ppdparser.hxx b/vcl/inc/vcl/ppdparser.hxx index 12e8a16f6264..c7a1e09b81e4 100644 --- a/vcl/inc/vcl/ppdparser.hxx +++ b/vcl/inc/vcl/ppdparser.hxx @@ -221,7 +221,7 @@ public: bool isType42Capable() const { return m_bType42Capable; } ULONG getLanguageLevel() const { return m_nLanguageLevel; } - const String& getDefaultPaperDimension() const; + String getDefaultPaperDimension() const; void getDefaultPaperDimension( int& rWidth, int& rHeight ) const { getPaperDimension( getDefaultPaperDimension(), rWidth, rHeight ); } bool getPaperDimension( const String& rPaperName, @@ -230,12 +230,12 @@ public: // returns false if paper not found int getPaperDimensions() const { return m_pPaperDimensions ? m_pPaperDimensions->countValues() : 0; } - const String& getPaperDimension( int ) const; - const String& getPaperDimensionCommand( int ) const; - const String& getPaperDimensionCommand( const String & ) const; + String getPaperDimension( int ) const; + String getPaperDimensionCommand( int ) const; + String getPaperDimensionCommand( const String & ) const; // match the best paper for width and height - const String& matchPaper( int nWidth, int nHeight ) const; + String matchPaper( int nWidth, int nHeight ) const; bool getMargins( const String& rPaperName, int &rLeft, int& rRight, @@ -245,27 +245,27 @@ public: // values int pt - const String& getDefaultInputSlot() const; + String getDefaultInputSlot() const; int getInputSlots() const { return m_pInputSlots ? m_pInputSlots->countValues() : 0; } - const String& getSlot( int ) const; - const String& getSlotCommand( int ) const; - const String& getSlotCommand( const String& ) const; + String getSlot( int ) const; + String getSlotCommand( int ) const; + String getSlotCommand( const String& ) const; void getDefaultResolution( int& rXRes, int& rYRes ) const; int getResolutions() const; void getResolution( int, int& rXRes, int& rYRes ) const; - const String& getResolutionCommand( int nXRes, int nYRes ) const; + String getResolutionCommand( int nXRes, int nYRes ) const; // values in dpi void getResolutionFromString( const String&, int&, int& ) const; // helper function - const String& getDefaultDuplexType() const; + String getDefaultDuplexType() const; int getDuplexTypes() const { return m_pDuplexTypes ? m_pDuplexTypes->countValues() : 0; } - const String& getDuplex( int ) const; - const String& getDuplexCommand( int ) const; - const String& getDuplexCommand( const String& ) const; + String getDuplex( int ) const; + String getDuplexCommand( int ) const; + String getDuplexCommand( const String& ) const; int getFonts() const { return m_pFontList ? m_pFontList->countValues() : 0; } @@ -275,7 +275,7 @@ public: void getFontAttributes( const String&, String& rEncoding, String& rCharset ) const; - const String& getFont( int ) const; + String getFont( int ) const; rtl::OUString translateKey( const rtl::OUString& i_rKey, diff --git a/vcl/inc/vcl/prndlg.hxx b/vcl/inc/vcl/prndlg.hxx index bec612b65593..fdaf06c9854e 100644 --- a/vcl/inc/vcl/prndlg.hxx +++ b/vcl/inc/vcl/prndlg.hxx @@ -55,9 +55,12 @@ namespace vcl { GDIMetaFile maMtf; Size maOrigSize; + Size maPreviewSize; VirtualDevice maPageVDev; rtl::OUString maReplacementString; rtl::OUString maToolTipString; + + bool useHCColorReplacement() const; public: PrintPreviewWindow( Window* pParent, const ResId& ); virtual ~PrintPreviewWindow(); @@ -293,6 +296,7 @@ namespace vcl bool isPrintToFile(); int getCopyCount(); bool isCollate(); + bool isSingleJobs(); void previewForward(); void previewBackward(); @@ -321,6 +325,7 @@ namespace vcl bool isCanceled() const { return mbCanceled; } void setProgress( int i_nCurrent, int i_nMax = -1 ); void tick(); + void reset(); virtual void Paint( const Rectangle& ); }; diff --git a/vcl/inc/vcl/salgdi.hxx b/vcl/inc/vcl/salgdi.hxx index 02e9efbc0f94..510e797678b0 100644 --- a/vcl/inc/vcl/salgdi.hxx +++ b/vcl/inc/vcl/salgdi.hxx @@ -159,15 +159,15 @@ protected: // native widget rendering methods that require mirroring virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside ); + const Point& aPos, BOOL& rIsInside ); virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, + ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption ); virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const rtl::OUString& aCaption ); + const rtl::OUString& aCaption ); virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const rtl::OUString& aCaption, + const ImplControlValue& aValue, const rtl::OUString& aCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion ); /** Render bitmap with alpha channel @@ -442,7 +442,6 @@ public: ControlPart nPart, const Region& rControlRegion, const Point& aPos, - SalControlHandle& rControlHandle, BOOL& rIsInside, const OutputDevice *pOutDev ); @@ -452,7 +451,6 @@ public: const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const rtl::OUString& aCaption, const OutputDevice *pOutDev ); @@ -462,7 +460,6 @@ public: const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const rtl::OUString& aCaption, const OutputDevice *pOutDev ); @@ -472,7 +469,6 @@ public: const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const rtl::OUString& aCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion, diff --git a/vcl/inc/vcl/salwtype.hxx b/vcl/inc/vcl/salwtype.hxx index c67d36ac4ea9..95b3806d648b 100644 --- a/vcl/inc/vcl/salwtype.hxx +++ b/vcl/inc/vcl/salwtype.hxx @@ -180,6 +180,11 @@ struct SalWheelMouseEvent ULONG mnScrollLines; // Aktuelle Anzahl zu scrollende Zeilen USHORT mnCode; // SV-ModifierCode (KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT) BOOL mbHorz; // Horizontal + BOOL mbDeltaIsPixel; // delta value is a pixel value (on mac) + + SalWheelMouseEvent() + : mnTime( 0 ), mnX( 0 ), mnY( 0 ), mnDelta( 0 ), mnNotchDelta( 0 ), mnScrollLines( 0 ), mnCode( 0 ), mbHorz( FALSE ), mbDeltaIsPixel( FALSE ) + {} }; // MOUSEACTIVATE diff --git a/vcl/inc/vcl/vclevent.hxx b/vcl/inc/vcl/vclevent.hxx index 048eb1d5a670..8ccb880fce34 100644 --- a/vcl/inc/vcl/vclevent.hxx +++ b/vcl/inc/vcl/vclevent.hxx @@ -154,8 +154,8 @@ namespace com { namespace sun { namespace star { #define VCLEVENT_TOOLBOX_FORMATCHANGED 1172 // request new layout #define VCLEVENT_COMBOBOX_SETTEXT 1173 // --> OD 2009-04-01 #i92103# -#define VCLEVENT_LISTBOX_ENTRY_EXPANDED 1174 -#define VCLEVENT_LISTBOX_ENTRY_COLLAPSED 1175 +#define VCLEVENT_ITEM_EXPANDED 1174 +#define VCLEVENT_ITEM_COLLAPSED 1175 // <-- #define VCLEVENT_DROPDOWN_PRE_OPEN 1176 @@ -192,6 +192,7 @@ namespace com { namespace sun { namespace star { #define VCLEVENT_TOOLBOX_BUTTONSTATECHANGED 1223 // pData = itempos #define VCLEVENT_TABLECELL_NAMECHANGED 1224 // pData = struct(Entry, Column, oldText) +#define VCLEVENT_TABLEROW_SELECT 1225 class VCL_DLLPUBLIC VclSimpleEvent { diff --git a/vcl/inc/vcl/window.h b/vcl/inc/vcl/window.h index 9d917a09b6de..691c3ed18421 100644 --- a/vcl/inc/vcl/window.h +++ b/vcl/inc/vcl/window.h @@ -56,7 +56,6 @@ class VirtualDevice; class Cursor; class ImplDevFontList; class ImplFontCache; -class SalControlHandle; class SmartId; class VCLXWindow; class SalFrame; @@ -120,7 +119,6 @@ struct ImplWinData USHORT mnTrackFlags; USHORT mnIsTopWindow; BOOL mbMouseOver; // tracks mouse over for native widget paint effect - SalControlHandle* mpSalControlHandle; // native data for NWF BOOL mbEnableNativeWidget; // toggle native widget rendering SmartId* mpSmartHelpId; SmartId* mpSmartUniqueId; diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index 3d1cc91ee468..8264767e59ad 100644 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -124,6 +124,8 @@ namespace dnd { namespace vcl { struct ControlLayoutData; } +namespace svt { class PopupWindowControllerImpl; } + // --------------- // - WindowTypes - // --------------- @@ -362,6 +364,8 @@ class VCL_DLLPUBLIC Window : public OutputDevice friend class ImplPopupFloatWin; friend class MenuFloatingWindow; + friend class svt::PopupWindowControllerImpl; + private: // NOTE: to remove many dependencies of other modules // to this central file, all members are now hidden @@ -548,20 +552,18 @@ public: SAL_DLLPRIVATE ::std::vector<Window *>& ImplGetOwnerDrawList(); SAL_DLLPRIVATE Window* ImplGetTopmostFrameWindow(); - SAL_DLLPRIVATE Rectangle ImplGetWindowExtentsRelative( Window *pRelativeWindow, BOOL bClientOnly ); + SAL_DLLPRIVATE Rectangle ImplGetWindowExtentsRelative( Window *pRelativeWindow, BOOL bClientOnly ) const; SAL_DLLPRIVATE void ImplNotifyIconifiedState( BOOL bIconified ); SAL_DLLPRIVATE bool ImplStopDnd(); SAL_DLLPRIVATE void ImplStartDnd(); SAL_DLLPRIVATE static void ImplInitAppFontData( Window* pWindow ); - SAL_DLLPRIVATE void ImplInitSalControlHandle(); SAL_DLLPRIVATE void ImplPaintToDevice( OutputDevice* pTargetOutDev, const Point& rPos ); SAL_DLLPRIVATE BOOL ImplIsInTaskPaneList(); SAL_DLLPRIVATE void ImplIsInTaskPaneList( BOOL mbIsInTaskList ); SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvas > ImplGetCanvas( const Size& rFullscreenSize, bool bFullscreen, bool bSpriteCanvas ) const; - SAL_DLLPRIVATE void ImplMoveControlValue( ControlType, const ImplControlValue&, const Point& ) const; private: // Default construction is forbidden and not implemented. @@ -856,9 +858,9 @@ public: Point AbsoluteScreenToOutputPixel( const Point& rPos ) const; Rectangle GetDesktopRectPixel() const; // window extents including border and decoratrion - Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ); + Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const; // window extents of the client window, coordinates to be used in SetPosPixel - Rectangle GetClientWindowExtentsRelative( Window *pRelativeWindow ); + Rectangle GetClientWindowExtentsRelative( Window *pRelativeWindow ) const; virtual BOOL IsScrollable() const; virtual void Scroll( long nHorzScroll, long nVertScroll, @@ -1092,44 +1094,6 @@ public: void EnableNativeWidget( BOOL bEnable = TRUE ); BOOL IsNativeWidgetEnabled() const; - // These all just call through to the private mpWindowImpl->mpFrame functions of the same name. - - // Query the platform layer for control support - BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart ); - - // Query the native control to determine if it was acted upon - BOOL HitTestNativeControl( ControlType nType, - ControlPart nPart, - const Region& rControlRegion, - const Point& aPos, - BOOL& rIsInside ); - - // Request rendering of a particular control and/or part - BOOL DrawNativeControl( ControlType nType, - ControlPart nPart, - const Region& rControlRegion, - ControlState nState, - const ImplControlValue& aValue, - rtl::OUString aCaption ); - - // Request rendering of a caption string for a control - BOOL DrawNativeControlText( ControlType nType, - ControlPart nPart, - const Region& rControlRegion, - ControlState nState, - const ImplControlValue& aValue, - rtl::OUString aCaption ); - - // Query the native control's actual drawing region (including adornment) - BOOL GetNativeControlRegion( ControlType nType, - ControlPart nPart, - const Region& rControlRegion, - ControlState nState, - const ImplControlValue& aValue, - rtl::OUString aCaption, - Region &rNativeBoundingRegion, - Region &rNativeContentRegion ); - // a helper method for a Control's Draw method void PaintToDevice( OutputDevice* pDevice, const Point& rPos, const Size& rSize ); diff --git a/vcl/os2/inc/salgdi.h b/vcl/os2/inc/salgdi.h index ce486084a5b1..b8dc4eba0199 100644 --- a/vcl/os2/inc/salgdi.h +++ b/vcl/os2/inc/salgdi.h @@ -197,15 +197,15 @@ protected: #if 0 // native widget rendering methods that require mirroring virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside ); + const Point& aPos, BOOL& rIsInside ); virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, + ControlState nState, const ImplControlValue& aValue, rtl::OUString aCaption ); virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, rtl::OUString aCaption ); + rtl::OUString aCaption ); virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, rtl::OUString aCaption, + const ImplControlValue& aValue, rtl::OUString aCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion ); #endif diff --git a/vcl/os2/source/window/salframe.cxx b/vcl/os2/source/window/salframe.cxx index 7ecc27ff9754..f3314c725255 100644 --- a/vcl/os2/source/window/salframe.cxx +++ b/vcl/os2/source/window/salframe.cxx @@ -3032,10 +3032,8 @@ static void ImplHandleMoveMsg( HWND hWnd) // ----------------------------------------------------------------------- -static long ImplHandleSizeMsg( HWND hWnd, MPARAM nMP2 ) +static void ImplHandleSizeMsg( HWND hWnd, MPARAM nMP2 ) { - long nRet; - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); if ( pFrame ) { @@ -3047,11 +3045,10 @@ static long ImplHandleSizeMsg( HWND hWnd, MPARAM nMP2 ) pFrame->mpGraphics->mnHeight = (int)SHORT2FROMMP(nMP2); // Status merken ImplSaveFrameState( pFrame ); - nRet = pFrame->CallCallback( SALEVENT_RESIZE, 0 ); + pFrame->CallCallback( SALEVENT_RESIZE, 0 ); if ( WinIsWindowVisible( pFrame->mhWndFrame ) && !pFrame->mbInShow ) WinUpdateWindow( pFrame->mhWndClient ); } - return nRet; } // ----------------------------------------------------------------------- diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx index b22a7d21f357..dd9a5b4a15ee 100644 --- a/vcl/source/app/dbggui.cxx +++ b/vcl/source/app/dbggui.cxx @@ -1783,8 +1783,6 @@ void DbgDialogTest( Window* pWindow ) } // ======================================================================= -void DbgPrintShell( const char* pLine ); - #ifndef WNT #define USE_VCL_MSGBOX #define COPY_BUTTON_ID 25 @@ -1963,27 +1961,6 @@ void DbgPrintWindow( const char* pLine ) bIn = FALSE; } -// ----------------------------------------------------------------------- - -void DbgPrintShell( const char* pLine ) -{ -#if defined( WNT ) - // TODO: Shouldn't this be a IsDebuggerPresent()? - if ( GetSystemMetrics( SM_DEBUG ) ) - { - strcpy( aDbgOutBuf, pLine ); - strcat( aDbgOutBuf, "\r\n" ); - OutputDebugString( aDbgOutBuf ); - return; - } - - DbgPrintWindow( pLine ); -#endif -#ifdef UNX - fprintf( stderr, "%s\n", pLine ); -#endif -} - // ======================================================================= #ifdef WNT @@ -1996,7 +1973,6 @@ void DbgGUIInit() { DbgSetPrintMsgBox( DbgPrintMsgBox ); DbgSetPrintWindow( DbgPrintWindow ); - DbgSetPrintShell( DbgPrintShell ); #ifdef WNT DbgSetTestSolarMutex( ImplDbgTestSolarMutex ); #endif @@ -2008,7 +1984,6 @@ void DbgGUIDeInit() { DbgSetPrintMsgBox( NULL ); DbgSetPrintWindow( NULL ); - DbgSetPrintShell( NULL ); #ifdef WNT DbgSetTestSolarMutex( NULL ); #endif diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 5ad3f6787461..980e0f1c5b58 100644..100755 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -188,7 +188,7 @@ ImplMouseData::ImplMouseData() mnActionDelay = 250; mnMenuDelay = 150; mnFollow = MOUSE_FOLLOW_MENU | MOUSE_FOLLOW_DDLIST; - mnWheelBehavior = MOUSE_WHEEL_FOCUS_ONLY; + mnWheelBehavior = MOUSE_WHEEL_ALWAYS; } // ----------------------------------------------------------------------- diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 7cec6867e0a3..e503172eb2c6 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1975,11 +1975,14 @@ BOOL Application::IsHeadlessModeEnabled() void Application::ShowNativeErrorBox(const String& sTitle , const String& sMessage) { - ImplGetSalSystem()->ShowNativeMessageBox ( + int btn = ImplGetSalSystem()->ShowNativeMessageBox ( sTitle, sMessage, SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK); + if (btn != SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK) { + OSL_TRACE("ShowNativeMessageBox returned %d\n", btn); + } } // ----------------------------------------------------------------------- diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 1f45b5902381..08759f37d7a6 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -367,7 +367,8 @@ USHORT Button::ImplGetTextStyle( XubString& rText, WinBits nWinStyle, void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, Size& rSize, BOOL bLayout, ULONG nImageSep, ULONG nDrawFlags, - USHORT nTextStyle, Rectangle *pSymbolRect ) + USHORT nTextStyle, Rectangle *pSymbolRect, + bool bAddImageSep ) { XubString aText( GetText() ); BOOL bDrawImage = HasImage() && ! ( ImplGetButtonState() & BUTTON_DRAW_NOIMAGE ); @@ -502,6 +503,13 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, if ( aTSSize.Height() < aTextSize.Height() ) aTSSize.Height() = aTextSize.Height(); + + if( bAddImageSep && bDrawImage ) + { + long nDiff = (aImageSize.Height() - aTextSize.Height()) / 3; + if( nDiff > 0 ) + nImageSep += nDiff; + } } aMax.Width() = aTSSize.Width() > aImageSize.Width() ? aTSSize.Width() : aImageSize.Width(); @@ -880,7 +888,9 @@ void PushButton::ImplInitSettings( BOOL bFont, EnableChildTransparentMode( TRUE ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); SetPaintTransparent( TRUE ); - mpWindowImpl->mbUseNativeFocus = ImplGetSVData()->maNWFData.mbNoFocusRects; + mpWindowImpl->mbUseNativeFocus = (GetStyle() & WB_FLATBUTTON) + ? false + : ImplGetSVData()->maNWFData.mbNoFocusRects; } else { @@ -1194,8 +1204,10 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags ULONG nImageSep = 1 + (pDev->GetTextHeight()-10)/2; if( nImageSep < 1 ) nImageSep = 1; + // FIXME: (GetStyle() & WB_FLATBUTTON) != 0 is preliminary + // in the next major this should be replaced by "true" ImplDrawAlignedImage( pDev, aPos, aSize, bLayout, nImageSep, nDrawFlags, - nTextStyle, IsSymbol() ? &aSymbolRect : NULL ); + nTextStyle, IsSymbol() ? &aSymbolRect : NULL, (GetStyle() & WB_FLATBUTTON) != 0 ); if ( IsSymbol() && ! bLayout ) { @@ -1363,7 +1375,7 @@ void PushButton::ImplDrawPushButton( bool bLayout ) Size aInRectSize( LogicToPixel( Size( aInRect.GetWidth(), aInRect.GetHeight() ) ) ); aPBVal.mbSingleLine = (aInRectSize.Height() < 2 * aFontSize.Height() ); - if( ((nState & CTRL_STATE_ROLLOVER) || HasFocus()) || ! (GetStyle() & WB_FLATBUTTON) ) + if( ((nState & CTRL_STATE_ROLLOVER)) || ! (GetStyle() & WB_FLATBUTTON) ) { bNativeOK = DrawNativeControl( CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL, aCtrlRegion, nState, aControlValue, rtl::OUString()/*PushButton::GetText()*/ ); @@ -1388,7 +1400,7 @@ void PushButton::ImplDrawPushButton( bool bLayout ) if( (GetStyle() & WB_FLATBUTTON) ) { Rectangle aTempRect( aInRect ); - if( ! bLayout && (bRollOver || HasFocus()) ) + if( ! bLayout && bRollOver ) ImplDrawPushButtonFrame( this, aTempRect, nButtonStyle ); aInRect.Left() += 2; aInRect.Top() += 2; @@ -1879,7 +1891,8 @@ long PushButton::PreNotify( NotifyEvent& rNEvt ) pBorder->Update(); } } - else if( IsNativeControlSupported(CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL) ) + else if( (GetStyle() & WB_FLATBUTTON) || + IsNativeControlSupported(CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL) ) { Invalidate(); } diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index cd74a4cd88ce..ebccfdc1e6bb 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -741,6 +741,13 @@ void ImplListBoxWindow::ImplUpdateEntryMetrics( ImplEntryType& rEntry ) aMetrics.nEntryHeight ); } + if ( !aMetrics.bText && !aMetrics.bImage && !IsUserDrawEnabled() ) + { + // entries which have no (aka an empty) text, and no image, and are not user-drawn, should be + // shown nonetheless + aMetrics.nEntryHeight = mnTextHeight + mnBorder; + } + if ( aMetrics.nEntryWidth > mnMaxWidth ) mnMaxWidth = aMetrics.nEntryWidth; if ( aMetrics.nEntryHeight > mnMaxHeight ) diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 741267044829..95f84626b582 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -408,6 +408,9 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth ) if( aImageSize.Height() > aSize.Height() ) aSize.Height() = aImageSize.Height(); + aSize.Width() += TAB_TABOFFSET_X*2; + aSize.Height() += TAB_TABOFFSET_Y*2; + Region aCtrlRegion( Rectangle( (const Point&)Point( 0, 0 ), aSize ) ); Region aBoundingRgn, aContentRgn; const ImplControlValue aControlValue( BUTTONVALUE_DONTKNOW, rtl::OUString(), 0 ); @@ -419,8 +422,6 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth ) return aCont.GetSize(); } - aSize.Width() += TAB_TABOFFSET_X*2; - aSize.Height() += TAB_TABOFFSET_Y*2; // For systems without synthetic bold support if ( mbExtraSpace ) aSize.Width() += TAB_EXTRASPACE_X; @@ -1156,8 +1157,6 @@ void TabControl::MouseButtonDown( const MouseEvent& rMEvt ) ImplTabItem* pItem = ImplGetItem( nPageId ); if( pItem && pItem->mbEnabled ) SelectTabPage( nPageId ); - else - Sound::Beep( SOUND_ERROR, this ); } } } diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx index 9884e7016fee..620ca64f44d9 100644 --- a/vcl/source/fontsubset/cff.cxx +++ b/vcl/source/fontsubset/cff.cxx @@ -33,6 +33,7 @@ #include <assert.h> #include <vcl/fontsubset.hxx> +#include <vcl/strhelper.hxx> //#define IGNORE_HINTS @@ -2027,6 +2028,17 @@ void Type1Emitter::emitAllCrypted( void) // -------------------------------------------------------------------- +// #i110387# quick-and-dirty double->ascii conversion +// needed because sprintf/ecvt/etc. alone are too localized (LC_NUMERIC) +// also strip off trailing zeros in fraction while we are at it +inline int dbl2str( char* pOut, double fVal, int nPrecision=6) +{ + const int nLen = psp::getValueOfDouble( pOut, fVal, nPrecision); + return nLen; +} + +// -------------------------------------------------------------------- + void Type1Emitter::emitValVector( const char* pLineHead, const char* pLineTail, const ValVector& rVector) { @@ -2042,10 +2054,11 @@ void Type1Emitter::emitValVector( const char* pLineHead, const char* pLineTail, aVal = *it; if( ++it == rVector.end() ) break; - mpPtr += sprintf( mpPtr, "%g ", aVal); + mpPtr += dbl2str( mpPtr, aVal); + *(mpPtr++) = ' '; } // emit the last value - mpPtr += sprintf( mpPtr, "%g", aVal); + mpPtr += dbl2str( mpPtr, aVal); // emit the line tail mpPtr += sprintf( mpPtr, pLineTail); } @@ -2202,18 +2215,33 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, rEmitter.emitValVector( "/FamilyBlues [", "]ND\n", mpCffLocal->maFamilyBlues); rEmitter.emitValVector( "/FamilyOtherBlues [", "]ND\n", mpCffLocal->maFamilyOtherBlues); - if( mpCffLocal->mfBlueScale) - pOut += sprintf( pOut, "/BlueScale %.6f def\n", mpCffLocal->mfBlueScale); - if( mpCffLocal->mfBlueShift) // default BlueShift==7 - pOut += sprintf( pOut, "/BlueShift %.1f def\n", mpCffLocal->mfBlueShift); - if( mpCffLocal->mfBlueFuzz) // default BlueFuzz==1 - pOut += sprintf( pOut, "/BlueFuzz %.1f def\n", mpCffLocal->mfBlueFuzz); + if( mpCffLocal->mfBlueScale) { + pOut += sprintf( pOut, "/BlueScale "); + pOut += dbl2str( pOut, mpCffLocal->mfBlueScale, 6); + pOut += sprintf( pOut, " def\n"); + } + if( mpCffLocal->mfBlueShift) { // default BlueShift==7 + pOut += sprintf( pOut, "/BlueShift "); + pOut += dbl2str( pOut, mpCffLocal->mfBlueShift); + pOut += sprintf( pOut, " def\n"); + } + if( mpCffLocal->mfBlueFuzz) { // default BlueFuzz==1 + pOut += sprintf( pOut, "/BlueFuzz "); + pOut += dbl2str( pOut, mpCffLocal->mfBlueFuzz); + pOut += sprintf( pOut, " def\n"); + } // emit stem hint related privdict entries - if( mpCffLocal->maStemStdHW) - pOut += sprintf( pOut, "/StdHW [%g] def\n", mpCffLocal->maStemStdHW); - if( mpCffLocal->maStemStdVW) - pOut += sprintf( pOut, "/StdVW [%g] def\n", mpCffLocal->maStemStdVW); + if( mpCffLocal->maStemStdHW) { + pOut += sprintf( pOut, "/StdHW ["); + pOut += dbl2str( pOut, mpCffLocal->maStemStdHW); + pOut += sprintf( pOut, "] def\n"); + } + if( mpCffLocal->maStemStdVW) { + pOut += sprintf( pOut, "/StdVW ["); + pOut += dbl2str( pOut, mpCffLocal->maStemStdVW); + pOut += sprintf( pOut, "] def\n"); + } rEmitter.emitValVector( "/StemSnapH [", "]ND\n", mpCffLocal->maStemSnapH); rEmitter.emitValVector( "/StemSnapV [", "]ND\n", mpCffLocal->maStemSnapV); @@ -2224,8 +2252,11 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, pOut += sprintf( pOut, "/LanguageGroup %d def\n", mpCffLocal->mnLangGroup); if( mpCffLocal->mnLangGroup == 1) // compatibility with ancient printers pOut += sprintf( pOut, "/RndStemUp false def\n"); - if( mpCffLocal->mfExpFactor) - pOut += sprintf( pOut, "/ExpansionFactor %.2f def\n", mpCffLocal->mfExpFactor); + if( mpCffLocal->mfExpFactor) { + pOut += sprintf( pOut, "/ExpansionFactor "); + pOut += dbl2str( pOut, mpCffLocal->mfExpFactor); + pOut += sprintf( pOut, " def\n"); + } #endif // IGNORE_HINTS // emit remaining privdict entries @@ -2248,6 +2279,7 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, // emit used GlobalSubr charstrings // these are the just the default subrs + // TODO: do we need them as the flex hints are resolved differently? static const char aSubrs[] = "/Subrs 5 array\n" "dup 0 15 RD \x5F\x3D\x6B\xAC\x3C\xBD\x74\x3D\x3E\x17\xA0\x86\x58\x08\x85 NP\n" diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx index 51c76b5a4626..074935086b0b 100644 --- a/vcl/source/gdi/bitmap.cxx +++ b/vcl/source/gdi/bitmap.cxx @@ -323,7 +323,23 @@ BOOL Bitmap::HasGreyPalette() const BOOL bRet = FALSE; if( 1 == nBitCount ) - bRet = TRUE; + { + BitmapReadAccess* pRAcc = ( (Bitmap*) this )->AcquireReadAccess(); + + if( pRAcc ) + { + const BitmapColor& rCol0( pRAcc->GetPaletteColor( 0 ) ); + const BitmapColor& rCol1( pRAcc->GetPaletteColor( 1 ) ); + if( rCol0.GetRed() == rCol0.GetGreen() && rCol0.GetRed() == rCol0.GetBlue() && + rCol1.GetRed() == rCol1.GetGreen() && rCol1.GetRed() == rCol1.GetBlue() ) + { + bRet = TRUE; + } + ( (Bitmap*) this )->ReleaseAccess( pRAcc ); + } + else + bRet = TRUE; + } else if( 4 == nBitCount || 8 == nBitCount ) { BitmapReadAccess* pRAcc = ( (Bitmap*) this )->AcquireReadAccess(); diff --git a/vcl/source/gdi/image.cxx b/vcl/source/gdi/image.cxx index e3f63a03d081..e79308b2664e 100644 --- a/vcl/source/gdi/image.cxx +++ b/vcl/source/gdi/image.cxx @@ -50,6 +50,10 @@ #include <vcl/image.h> #include <vcl/image.hxx> +#if OSL_DEBUG_LEVEL > 0 +#include <rtl/strbuf.hxx> +#endif + DBG_NAME( Image ) DBG_NAME( ImageList ) @@ -543,11 +547,19 @@ void ImageAryData::Load(const rtl::OUString &rPrefix) rtl::OUString aFileName = rPrefix; aFileName += maName; -#ifdef DBG_UTIL - bool bSuccess = aImageTree->loadImage( aFileName, aSymbolsStyle, maBitmapEx, true ); - DBG_ASSERT (bSuccess, "ImageAryData::Failed to load image"); -#else - aImageTree->loadImage( aFileName, aSymbolsStyle, maBitmapEx, true ); +#if OSL_DEBUG_LEVEL > 0 + bool bSuccess = +#endif + aImageTree->loadImage( aFileName, aSymbolsStyle, maBitmapEx, true ); +#if OSL_DEBUG_LEVEL > 0 + if ( !bSuccess ) + { + ::rtl::OStringBuffer aMessage; + aMessage.append( "ImageAryData::Load: failed to load image '" ); + aMessage.append( ::rtl::OUStringToOString( aFileName, RTL_TEXTENCODING_UTF8 ).getStr() ); + aMessage.append( "'" ); + OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() ); + } #endif } diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk index 75f2b3fffc64..f069828f25f9 100644 --- a/vcl/source/gdi/makefile.mk +++ b/vcl/source/gdi/makefile.mk @@ -106,6 +106,7 @@ SLOFILES= $(EXCEPTIONSFILES) \ $(SLO)$/outdev4.obj \ $(SLO)$/outdev5.obj \ $(SLO)$/outdev6.obj \ + $(SLO)$/outdevnative.obj \ $(SLO)$/regband.obj \ $(SLO)$/region.obj \ $(SLO)$/wall.obj \ diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index e13ae6cbe64a..f4fcba72b0c2 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -1672,6 +1672,18 @@ void ImplDevFontList::InitMatchData() const } } +//---------------------------------------------------------------------------- +ImplDevFontListData* ImplDevFontList::ImplFindByLocale(com::sun::star::lang::Locale lc) const +{ + // get the default font for a specified locale + const DefaultFontConfiguration& rDefaults = *DefaultFontConfiguration::get(); + String aDefault = rDefaults.getUserInterfaceFont( lc ); + ImplDevFontListData* pFontData = ImplFindByTokenNames( aDefault ); + if( pFontData ) + return pFontData; + return 0; +} + // ----------------------------------------------------------------------- ImplDevFontListData* ImplDevFontList::ImplFindByAttributes( ULONG nSearchType, @@ -2091,11 +2103,14 @@ ImplDevFontListData* ImplDevFontList::FindDefaultFont() const ImplDevFontList* ImplDevFontList::Clone( bool bScalable, bool bEmbeddable ) const { ImplDevFontList* pClonedList = new ImplDevFontList; - pClonedList->mbMatchData = mbMatchData; +// pClonedList->mbMatchData = mbMatchData; pClonedList->mbMapNames = mbMapNames; pClonedList->mpPreMatchHook = mpPreMatchHook; pClonedList->mpFallbackHook = mpFallbackHook; + // TODO: clone the config-font attributes too? + pClonedList->mbMatchData = false; + DevFontList::const_iterator it = maDevFontList.begin(); for(; it != maDevFontList.end(); ++it ) { diff --git a/vcl/source/gdi/outdevnative.cxx b/vcl/source/gdi/outdevnative.cxx new file mode 100644 index 000000000000..fed41ec4de85 --- /dev/null +++ b/vcl/source/gdi/outdevnative.cxx @@ -0,0 +1,290 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_vcl.hxx" + +#include "vcl/outdev.hxx" +#include "vcl/window.hxx" +#include "vcl/salgdi.hxx" +#include "vcl/salnativewidgets.hxx" +#include "vcl/pdfextoutdevdata.hxx" + +// ----------------------------------------------------------------------- + +static bool lcl_enableNativeWidget( const OutputDevice& i_rDevice ) +{ + const OutDevType eType( i_rDevice.GetOutDevType() ); + switch ( eType ) + { + + case OUTDEV_WINDOW: + return dynamic_cast< const Window* >( &i_rDevice )->IsNativeWidgetEnabled(); + + case OUTDEV_VIRDEV: + { + const ::vcl::ExtOutDevData* pOutDevData( i_rDevice.GetExtOutDevData() ); + const ::vcl::PDFExtOutDevData* pPDFData( dynamic_cast< const ::vcl::PDFExtOutDevData* >( pOutDevData ) ); + if ( pPDFData != NULL ) + return false; + return true; + } + + default: + return false; + } +} + +// ----------------------------------------------------------------------- +// These functions are mainly passthrough functions that allow access to +// the SalFrame behind a Window object for native widget rendering purposes. +// ----------------------------------------------------------------------- + +// ----------------------------------------------------------------------- + +BOOL OutputDevice::IsNativeControlSupported( ControlType nType, ControlPart nPart ) +{ + if( !lcl_enableNativeWidget( *this ) ) + return FALSE; + + if ( !mpGraphics ) + if ( !ImplGetGraphics() ) + return FALSE; + + return( mpGraphics->IsNativeControlSupported(nType, nPart) ); +} + + +// ----------------------------------------------------------------------- + +BOOL OutputDevice::HitTestNativeControl( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + const Point& aPos, + BOOL& rIsInside ) +{ + if( !lcl_enableNativeWidget( *this ) ) + return FALSE; + + if ( !mpGraphics ) + if ( !ImplGetGraphics() ) + return FALSE; + + Point aWinOffs( mnOutOffX, mnOutOffY ); + Region screenRegion( rControlRegion ); + screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); + + return( mpGraphics->HitTestNativeControl(nType, nPart, screenRegion, Point( aPos.X() + mnOutOffX, aPos.Y() + mnOutOffY ), + rIsInside, this ) ); +} + +// ----------------------------------------------------------------------- + +static void lcl_moveControlValue( ControlType nType, const ImplControlValue& aValue, const Point& rDelta ) +{ + if( aValue.getOptionalVal() ) + { + switch( nType ) + { + case CTRL_SLIDER: + { + SliderValue* pSlVal = reinterpret_cast<SliderValue*>(aValue.getOptionalVal()); + pSlVal->maThumbRect.Move( rDelta.X(), rDelta.Y() ); + } + break; + case CTRL_SCROLLBAR: + { + ScrollbarValue* pScVal = reinterpret_cast<ScrollbarValue*>(aValue.getOptionalVal()); + pScVal->maThumbRect.Move( rDelta.X(), rDelta.Y() ); + pScVal->maButton1Rect.Move( rDelta.X(), rDelta.Y() ); + pScVal->maButton2Rect.Move( rDelta.X(), rDelta.Y() ); + } + break; + case CTRL_SPINBOX: + case CTRL_SPINBUTTONS: + { + SpinbuttonValue* pSpVal = reinterpret_cast<SpinbuttonValue*>(aValue.getOptionalVal()); + pSpVal->maUpperRect.Move( rDelta.X(), rDelta.Y() ); + pSpVal->maLowerRect.Move( rDelta.X(), rDelta.Y() ); + } + break; + case CTRL_TOOLBAR: + { + ToolbarValue* pTVal = reinterpret_cast<ToolbarValue*>(aValue.getOptionalVal()); + pTVal->maGripRect.Move( rDelta.X(), rDelta.Y() ); + } + break; + } + } +} + +BOOL OutputDevice::DrawNativeControl( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + ::rtl::OUString aCaption ) +{ + if( !lcl_enableNativeWidget( *this ) ) + return FALSE; + + /* + if( !IsInPaint() && IsPaintTransparent() ) + { + // only required if called directly (ie, we're not in Paint() ): + // force redraw (Paint()) for transparent controls + // to trigger a repaint of the background + Region aClipRgn( GetClipRegion() ); + if( !rControlRegion.IsEmpty() ) + aClipRgn.Intersect( rControlRegion ); + Invalidate( aClipRgn, INVALIDATE_UPDATE ); + return TRUE; + } + */ + + // make sure the current clip region is initialized correctly + if ( !mpGraphics ) + if ( !ImplGetGraphics() ) + return FALSE; + + if ( mbInitClipRegion ) + ImplInitClipRegion(); + if ( mbOutputClipped ) + return TRUE; + + if ( mbInitLineColor ) + ImplInitLineColor(); + if ( mbInitFillColor ) + ImplInitFillColor(); + + // Convert the coordinates from relative to Window-absolute, so we draw + // in the correct place in platform code + Point aWinOffs( mnOutOffX, mnOutOffY ); + Region screenRegion( rControlRegion ); + screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); + + // do so for ImplControlValue members, also + lcl_moveControlValue( nType, aValue, aWinOffs ); + + Region aTestRegion( GetActiveClipRegion() ); + aTestRegion.Intersect( rControlRegion ); + if( aTestRegion == rControlRegion ) + nState |= CTRL_CACHING_ALLOWED; // control is not clipped, caching allowed + + BOOL bRet = mpGraphics->DrawNativeControl(nType, nPart, screenRegion, nState, aValue, aCaption, this ); + + // transform back ImplControlValue members + lcl_moveControlValue( nType, aValue, Point()-aWinOffs ); + + return bRet; +} + + +// ----------------------------------------------------------------------- + +BOOL OutputDevice::DrawNativeControlText(ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + ::rtl::OUString aCaption ) +{ + if( !lcl_enableNativeWidget( *this ) ) + return FALSE; + + // make sure the current clip region is initialized correctly + if ( !mpGraphics ) + if ( !ImplGetGraphics() ) + return false; + + if ( mbInitClipRegion ) + ImplInitClipRegion(); + if ( mbOutputClipped ) + return true; + + if ( mbInitLineColor ) + ImplInitLineColor(); + if ( mbInitFillColor ) + ImplInitFillColor(); + + // Convert the coordinates from relative to Window-absolute, so we draw + // in the correct place in platform code + Point aWinOffs( mnOutOffX, mnOutOffY ); + Region screenRegion( rControlRegion ); + screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); + lcl_moveControlValue( nType, aValue, aWinOffs ); + + BOOL bRet = mpGraphics->DrawNativeControlText(nType, nPart, screenRegion, nState, aValue, aCaption, this ); + + // transform back ImplControlValue members + lcl_moveControlValue( nType, aValue, Point()-aWinOffs ); + + return bRet; +} + + +// ----------------------------------------------------------------------- + +BOOL OutputDevice::GetNativeControlRegion( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + ::rtl::OUString aCaption, + Region &rNativeBoundingRegion, + Region &rNativeContentRegion ) +{ + if( !lcl_enableNativeWidget( *this ) ) + return FALSE; + + if ( !mpGraphics ) + if ( !ImplGetGraphics() ) + return FALSE; + + // Convert the coordinates from relative to Window-absolute, so we draw + // in the correct place in platform code + Point aWinOffs( mnOutOffX, mnOutOffY ); + Region screenRegion( rControlRegion ); + screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); + lcl_moveControlValue( nType, aValue, aWinOffs ); + + BOOL bRet = mpGraphics->GetNativeControlRegion(nType, nPart, screenRegion, nState, aValue, + aCaption, rNativeBoundingRegion, + rNativeContentRegion, this ); + if( bRet ) + { + // transform back native regions + rNativeBoundingRegion.Move( -aWinOffs.X(), -aWinOffs.Y() ); + rNativeContentRegion.Move( -aWinOffs.X(), -aWinOffs.Y() ); + } + // transform back ImplControlValue members + lcl_moveControlValue( nType, aValue, Point()-aWinOffs ); + + return bRet; +} + + diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 6a24775219d9..7ee5889ba532 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -11733,7 +11733,7 @@ sal_Int32 PDFWriterImpl::findRadioGroupWidget( const PDFWriter::RadioButtonWidge m_aWidgets.back().m_nPage = m_nCurrentPage; m_aWidgets.back().m_eType = PDFWriter::RadioButton; m_aWidgets.back().m_nRadioGroup = rBtn.RadioGroup; - m_aWidgets.back().m_nFlags |= 0x00008000; + m_aWidgets.back().m_nFlags |= 0x0000C000; // NoToggleToOff and Radio bits createWidgetFieldName( sal_Int32(m_aWidgets.size()-1), rBtn ); } diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index de7cd2e139da..191f8f26dc75 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -36,6 +36,7 @@ #include "vcl/svids.hrc" #include "vcl/metaact.hxx" #include "vcl/msgbox.hxx" +#include "vcl/configsettings.hxx" #include "tools/urlobj.hxx" @@ -171,13 +172,15 @@ public: // set by user through printer config dialog // if set, pages are centered and trimmed onto the fixed page Size maFixedPageSize; + sal_Int32 mnDefaultPaperBin; ImplPrinterControllerData() : mbFirstPage( sal_True ), mbLastPage( sal_False ), mbReversePageOrder( sal_False ), meJobState( view::PrintableState_JOB_STARTED ), - mpProgress( NULL ) + mpProgress( NULL ), + mnDefaultPaperBin( -1 ) {} ~ImplPrinterControllerData() { delete mpProgress; } @@ -327,9 +330,25 @@ void Printer::ImplPrintJob( const boost::shared_ptr<PrinterController>& i_pContr // setup printer // if no specific printer is already set, create one + + // #i108686# + // in case of a UI (platform independent or system dialog) print job, make the printer persistent over jobs + // however if no printer was already set by the print job's originator, + // and this is an API job, then use the system default location (because + // this is the only sensible default available if the user has no means of changing + // the destination if( ! pController->getPrinter() ) { - boost::shared_ptr<Printer> pPrinter( new Printer( i_rInitSetup.GetPrinterName() ) ); + rtl::OUString aPrinterName( i_rInitSetup.GetPrinterName() ); + if( ! aPrinterName.getLength() && pController->isShowDialogs() && ! pController->isDirectPrint() ) + { + // get printer name from configuration + SettingsConfigItem* pItem = SettingsConfigItem::get(); + aPrinterName = pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LastPrinterUsed" ) ) ); + } + + boost::shared_ptr<Printer> pPrinter( new Printer( aPrinterName ) ); pController->setPrinter( pPrinter ); } @@ -440,7 +459,12 @@ void Printer::ImplPrintJob( const boost::shared_ptr<PrinterController>& i_pContr return; } pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LocalFileName" ) ), - makeAny( aFile ) ); + makeAny( aFile ) ); + } + else if( aDlg.isSingleJobs() ) + { + pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintCollateAsSingleJobs" ) ), + makeAny( sal_True ) ); } } catch( std::bad_alloc& ) @@ -501,6 +525,13 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl:: if ( !mpPrinter ) return FALSE; + sal_Bool bSinglePrintJobs = sal_False; + beans::PropertyValue* pSingleValue = i_pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintCollateAsSingleJobs" ) ) ); + if( pSingleValue ) + { + pSingleValue->Value >>= bSinglePrintJobs; + } + // remark: currently it is still possible to use EnablePrintFile and // SetPrintFileName to redirect printout into file // it can be argued that those methods should be removed in favor @@ -514,6 +545,7 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl:: { mbPrintFile = TRUE; maPrintFile = aFile; + bSinglePrintJobs = sal_False; } } @@ -561,49 +593,90 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl:: i_pController->setJobState( view::PrintableState_JOB_STARTED ); i_pController->jobStarted(); - if( mpPrinter->StartJob( pPrintFile, - i_rJobName, - Application::GetDisplayName(), - nCopies, - bCollateCopy, - i_pController->isDirectPrint(), - maJobSetup.ImplGetConstData() ) ) + int nJobs = 1; + int nRepeatCount = bUserCopy ? mnCopyCount : 1; + if( bSinglePrintJobs ) { - mbJobActive = TRUE; - i_pController->createProgressDialog(); - int nPages = i_pController->getFilteredPageCount(); - int nRepeatCount = bUserCopy ? mnCopyCount : 1; - for( int nIteration = 0; nIteration < nRepeatCount; nIteration++ ) + nJobs = mnCopyCount; + nCopies = 1; + nRepeatCount = 1; + } + + for( int nJobIteration = 0; nJobIteration < nJobs; nJobIteration++ ) + { + bool bError = false; + if( mpPrinter->StartJob( pPrintFile, + i_rJobName, + Application::GetDisplayName(), + nCopies, + bCollateCopy, + i_pController->isDirectPrint(), + maJobSetup.ImplGetConstData() ) ) { - for( int nPage = 0; nPage < nPages; nPage++ ) + mbJobActive = TRUE; + i_pController->createProgressDialog(); + int nPages = i_pController->getFilteredPageCount(); + for( int nIteration = 0; nIteration < nRepeatCount; nIteration++ ) { - if( nPage == nPages-1 && nIteration == nRepeatCount-1 ) - i_pController->setLastPage( sal_True ); - i_pController->printFilteredPage( nPage ); + for( int nPage = 0; nPage < nPages; nPage++ ) + { + if( nPage == nPages-1 && nIteration == nRepeatCount-1 && nJobIteration == nJobs-1 ) + i_pController->setLastPage( sal_True ); + i_pController->printFilteredPage( nPage ); + } + // FIXME: duplex ? + } + EndJob(); + + if( nJobIteration < nJobs-1 ) + { + mpPrinter = pSVData->mpDefInst->CreatePrinter( mpInfoPrinter ); + + if ( mpPrinter ) + { + maJobName = i_rJobName; + mnCurPage = 1; + mnCurPrintPage = 1; + mbPrinting = TRUE; + } + else + bError = true; } - // FIXME: duplex ? } - EndJob(); + else + bError = true; - if( i_pController->getJobState() == view::PrintableState_JOB_STARTED ) - i_pController->setJobState( view::PrintableState_JOB_SPOOLED ); + if( bError ) + { + mnError = ImplSalPrinterErrorCodeToVCL( mpPrinter->GetErrorCode() ); + if ( !mnError ) + mnError = PRINTER_GENERALERROR; + i_pController->setJobState( mnError == PRINTER_ABORT + ? view::PrintableState_JOB_ABORTED + : view::PrintableState_JOB_FAILED ); + if( mpPrinter ) + pSVData->mpDefInst->DestroyPrinter( mpPrinter ); + mnCurPage = 0; + mnCurPrintPage = 0; + mbPrinting = FALSE; + mpPrinter = NULL; + + return false; + } } - else - { - mnError = ImplSalPrinterErrorCodeToVCL( mpPrinter->GetErrorCode() ); - if ( !mnError ) - mnError = PRINTER_GENERALERROR; - i_pController->setJobState( mnError == PRINTER_ABORT - ? view::PrintableState_JOB_ABORTED - : view::PrintableState_JOB_FAILED ); - pSVData->mpDefInst->DestroyPrinter( mpPrinter ); - mnCurPage = 0; - mnCurPrintPage = 0; - mbPrinting = FALSE; - mpPrinter = NULL; - return false; - } + if( i_pController->getJobState() == view::PrintableState_JOB_STARTED ) + i_pController->setJobState( view::PrintableState_JOB_SPOOLED ); + } + + // make last used printer persistent for UI jobs + if( i_pController->isShowDialogs() && ! i_pController->isDirectPrint() ) + { + SettingsConfigItem* pItem = SettingsConfigItem::get(); + pItem->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LastPrinterUsed" ) ), + GetName() + ); } return true; @@ -634,6 +707,7 @@ void PrinterController::setPrinter( const boost::shared_ptr<Printer>& i_rPrinter mpImplData->mpPrinter = i_rPrinter; setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ), makeAny( rtl::OUString( i_rPrinter->GetName() ) ) ); + mpImplData->mnDefaultPaperBin = mpImplData->mpPrinter->GetPaperBin(); } bool PrinterController::setupPrinter( Window* i_pParent ) @@ -668,27 +742,55 @@ PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( cons { PrinterController::PageSize aPageSize; aPageSize.aSize = mpPrinter->GetPaperSize(); + awt::Size aSetSize, aIsSize; + sal_Int32 nPaperBin = mnDefaultPaperBin; for( sal_Int32 nProperty = 0, nPropertyCount = i_rProps.getLength(); nProperty < nPropertyCount; ++nProperty ) { - if( i_rProps[ nProperty ].Name.equalsAscii( "PageSize" ) ) + if( i_rProps[ nProperty ].Name.equalsAscii( "PreferredPageSize" ) ) { - awt::Size aSize; - i_rProps[ nProperty].Value >>= aSize; - aPageSize.aSize.Width() = aSize.Width; - aPageSize.aSize.Height() = aSize.Height; - - Size aCurSize( mpPrinter->GetPaperSize() ); - Size aRealPaperSize( getRealPaperSize( aPageSize.aSize ) ); - if( aRealPaperSize != aCurSize ) - mpPrinter->SetPaperSizeUser( aRealPaperSize, ! isFixedPageSize() ); + i_rProps[ nProperty ].Value >>= aSetSize; } - if( i_rProps[ nProperty ].Name.equalsAscii( "PageIncludesNonprintableArea" ) ) + else if( i_rProps[ nProperty ].Name.equalsAscii( "PageSize" ) ) + { + i_rProps[ nProperty ].Value >>= aIsSize; + } + else if( i_rProps[ nProperty ].Name.equalsAscii( "PageIncludesNonprintableArea" ) ) { sal_Bool bVal = sal_False; - i_rProps[ nProperty].Value >>= bVal; + i_rProps[ nProperty ].Value >>= bVal; aPageSize.bFullPaper = static_cast<bool>(bVal); } + else if( i_rProps[ nProperty ].Name.equalsAscii( "PrinterPaperTray" ) ) + { + sal_Int32 nBin = -1; + i_rProps[ nProperty ].Value >>= nBin; + if( nBin >= 0 && nBin < mpPrinter->GetPaperBinCount() ) + nPaperBin = nBin; + } + } + + Size aCurSize( mpPrinter->GetPaperSize() ); + if( aSetSize.Width && aSetSize.Height ) + { + Size aSetPaperSize( aSetSize.Width, aSetSize.Height ); + Size aRealPaperSize( getRealPaperSize( aSetPaperSize ) ); + if( aRealPaperSize != aCurSize ) + aIsSize = aSetSize; } + + if( aIsSize.Width && aIsSize.Height ) + { + aPageSize.aSize.Width() = aIsSize.Width; + aPageSize.aSize.Height() = aIsSize.Height; + + Size aRealPaperSize( getRealPaperSize( aPageSize.aSize ) ); + if( aRealPaperSize != aCurSize ) + mpPrinter->SetPaperSizeUser( aRealPaperSize, ! isFixedPageSize() ); + } + + if( nPaperBin != -1 && nPaperBin != mpPrinter->GetPaperBin() ) + mpPrinter->SetPaperBin( nPaperBin ); + return aPageSize; } @@ -1393,6 +1495,8 @@ void PrinterController::createProgressDialog() mpImplData->mpProgress->Show(); } } + else + mpImplData->mpProgress->reset(); } void PrinterController::setMultipage( const MultiPageSetup& i_rMPS ) diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 55d6f7bdd892..84e45979d679 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -669,7 +669,7 @@ BOOL SalGraphics::DrawEPS( long nX, long nY, long nWidth, long nHeight, void* } BOOL SalGraphics::HitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside, const OutputDevice *pOutDev ) + const Point& aPos, BOOL& rIsInside, const OutputDevice *pOutDev ) { if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { @@ -677,10 +677,10 @@ BOOL SalGraphics::HitTestNativeControl( ControlType nType, ControlPart nPart, co Region rgn( rControlRegion ); mirror( pt.X(), pOutDev ); mirror( rgn, pOutDev ); - return hitTestNativeControl( nType, nPart, rgn, pt, rControlHandle, rIsInside ); + return hitTestNativeControl( nType, nPart, rgn, pt, rIsInside ); } else - return hitTestNativeControl( nType, nPart, rControlRegion, aPos, rControlHandle, rIsInside ); + return hitTestNativeControl( nType, nPart, rControlRegion, aPos, rIsInside ); } void SalGraphics::mirror( ControlType nType, const ImplControlValue& rVal, const OutputDevice* pOutDev, bool bBack ) const @@ -722,7 +722,7 @@ void SalGraphics::mirror( ControlType nType, const ImplControlValue& rVal, const } BOOL SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, + ControlState nState, const ImplControlValue& aValue, const OUString& aCaption, const OutputDevice *pOutDev ) { if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) @@ -730,33 +730,33 @@ BOOL SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const Region rgn( rControlRegion ); mirror( rgn, pOutDev ); mirror( nType, aValue, pOutDev ); - BOOL bRet = drawNativeControl( nType, nPart, rgn, nState, aValue, rControlHandle, aCaption ); + BOOL bRet = drawNativeControl( nType, nPart, rgn, nState, aValue, aCaption ); mirror( nType, aValue, pOutDev, true ); return bRet; } else - return drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rControlHandle, aCaption ); + return drawNativeControl( nType, nPart, rControlRegion, nState, aValue, aCaption ); } BOOL SalGraphics::DrawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& aCaption, const OutputDevice *pOutDev ) + const OUString& aCaption, const OutputDevice *pOutDev ) { if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { Region rgn( rControlRegion ); mirror( rgn, pOutDev ); mirror( nType, aValue, pOutDev ); - BOOL bRet = drawNativeControlText( nType, nPart, rgn, nState, aValue, rControlHandle, aCaption ); + BOOL bRet = drawNativeControlText( nType, nPart, rgn, nState, aValue, aCaption ); mirror( nType, aValue, pOutDev, true ); return bRet; } else - return drawNativeControlText( nType, nPart, rControlRegion, nState, aValue, rControlHandle, aCaption ); + return drawNativeControlText( nType, nPart, rControlRegion, nState, aValue, aCaption ); } BOOL SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& aCaption, + const ImplControlValue& aValue, const OUString& aCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion, const OutputDevice *pOutDev ) { if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) @@ -764,7 +764,7 @@ BOOL SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart, Region rgn( rControlRegion ); mirror( rgn, pOutDev ); mirror( nType, aValue, pOutDev ); - if( getNativeControlRegion( nType, nPart, rgn, nState, aValue, rControlHandle, aCaption, + if( getNativeControlRegion( nType, nPart, rgn, nState, aValue, aCaption, rNativeBoundingRegion, rNativeContentRegion ) ) { mirror( rNativeBoundingRegion, pOutDev, true ); @@ -779,7 +779,7 @@ BOOL SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart, } } else - return getNativeControlRegion( nType, nPart, rControlRegion, nState, aValue, rControlHandle, aCaption, + return getNativeControlRegion( nType, nPart, rControlRegion, nState, aValue, aCaption, rNativeBoundingRegion, rNativeContentRegion ); } diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index bf462d1d8add..80ae3a3a8c7f 100755 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -1800,8 +1800,8 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs ) int nRunStart, nRunEnd; while (rArgs.GetNextRun(&nRunStart, &nRunEnd, &bRtl)) { - if (bRtl) std::fill(vRtl.begin() + nRunStart - rArgs.mnMinCharPos, - vRtl.begin() + nRunEnd - rArgs.mnMinCharPos, true); + if (bRtl) std::fill(vRtl.begin() + ( nRunStart - rArgs.mnMinCharPos ), + vRtl.begin() + ( nRunEnd - rArgs.mnMinCharPos ), true); } rArgs.ResetPos(); diff --git a/vcl/source/gdi/salnativewidgets-none.cxx b/vcl/source/gdi/salnativewidgets-none.cxx index 8b87f142ba25..7faf12d062fe 100644 --- a/vcl/source/gdi/salnativewidgets-none.cxx +++ b/vcl/source/gdi/salnativewidgets-none.cxx @@ -60,7 +60,6 @@ BOOL SalGraphics::hitTestNativeControl( ControlType, ControlPart, const Region&, const Point&, - SalControlHandle&, BOOL& ) { return( FALSE ); @@ -74,7 +73,6 @@ BOOL SalGraphics::hitTestNativeControl( ControlType, * * rControlRegion: The bounding region of the complete control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation. * aCaption: A caption or title string (like button text etc) */ BOOL SalGraphics::drawNativeControl( ControlType, @@ -82,7 +80,6 @@ BOOL SalGraphics::drawNativeControl( ControlType, const Region&, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString& ) { return( FALSE ); @@ -97,7 +94,6 @@ BOOL SalGraphics::drawNativeControl( ControlType, * * rControlRegion: The bounding region of the complete control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation. * aCaption: A caption or title string (like button text etc) */ BOOL SalGraphics::drawNativeControlText( ControlType, @@ -105,7 +101,6 @@ BOOL SalGraphics::drawNativeControlText( ControlType, const Region&, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString& ) { return( FALSE ); @@ -123,7 +118,6 @@ BOOL SalGraphics::drawNativeControlText( ControlType, * * rControlRegion: The bounding region of the control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation. * aCaption: A caption or title string (like button text etc) */ BOOL SalGraphics::getNativeControlRegion( ControlType, @@ -131,7 +125,6 @@ BOOL SalGraphics::getNativeControlRegion( ControlType, const Region&, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString&, Region &, Region & ) diff --git a/vcl/source/glyphs/glyphcache.cxx b/vcl/source/glyphs/glyphcache.cxx index ea0f18896b7a..1953ecf553c4 100644 --- a/vcl/source/glyphs/glyphcache.cxx +++ b/vcl/source/glyphs/glyphcache.cxx @@ -519,8 +519,10 @@ bool ServerFont::IsGlyphInvisible( int nGlyphIndex ) // ======================================================================= ImplServerFontEntry::ImplServerFontEntry( ImplFontSelectData& rFSD ) -: ImplFontEntry( rFSD ), - mpServerFont( NULL ) +: ImplFontEntry( rFSD ) +, mpServerFont( NULL ) +, mbGotFontOptions( false ) +, mbValidFontOptions( false ) {} // ----------------------------------------------------------------------- diff --git a/vcl/source/glyphs/graphite_adaptors.cxx b/vcl/source/glyphs/graphite_adaptors.cxx index 4afced765612..f66f5b48e39e 100644 --- a/vcl/source/glyphs/graphite_adaptors.cxx +++ b/vcl/source/glyphs/graphite_adaptors.cxx @@ -168,7 +168,7 @@ GraphiteFontAdaptor::~GraphiteFontAdaptor() throw() mpFeatures = NULL; } -void GraphiteFontAdaptor::UniqueCacheInfo(sil_std::wstring & face_name_out, bool & bold_out, bool & italic_out) +void GraphiteFontAdaptor::UniqueCacheInfo(ext_std::wstring & face_name_out, bool & bold_out, bool & italic_out) { face_name_out = maFontProperties.szFaceName; bold_out = maFontProperties.fBold; diff --git a/vcl/source/glyphs/graphite_cache.cxx b/vcl/source/glyphs/graphite_cache.cxx index 713f3c1ed088..64bbb0a38d60 100644 --- a/vcl/source/glyphs/graphite_cache.cxx +++ b/vcl/source/glyphs/graphite_cache.cxx @@ -36,10 +36,10 @@ #include <tools/debug.hxx> #include <vcl/sallayout.hxx> -#include "pregraphitestl.h" +#include <tools/preextstl.h> #include <graphite/GrClient.h> #include <graphite/Segment.h> -#include "postgraphitestl.h" +#include <tools/postextstl.h> #include <rtl/ustring.hxx> #include <vcl/graphite_layout.hxx> diff --git a/vcl/source/glyphs/graphite_features.cxx b/vcl/source/glyphs/graphite_features.cxx index bae96642da30..1cb25306c4ee 100644 --- a/vcl/source/glyphs/graphite_features.cxx +++ b/vcl/source/glyphs/graphite_features.cxx @@ -88,7 +88,7 @@ GrFeatureParser::GrFeatureParser(gr::Font & font, const std::string features, co gr::isocode aLang = maLang; for (size_t i = pos; i < nFeatEnd; i++) aLang.rgch[i-pos] = features[i]; - sil_std::pair<gr::LanguageIterator,gr::LanguageIterator> aSupported + ext_std::pair<gr::LanguageIterator,gr::LanguageIterator> aSupported = font.getSupportedLanguages(); gr::LanguageIterator iL = aSupported.first; while (iL != aSupported.second) @@ -139,7 +139,7 @@ void GrFeatureParser::setLang(gr::Font & font, const std::string & lang) if (lang[i] == '-') break; aLang.rgch[i] = lang[i]; } - sil_std::pair<gr::LanguageIterator,gr::LanguageIterator> aSupported + ext_std::pair<gr::LanguageIterator,gr::LanguageIterator> aSupported = font.getSupportedLanguages(); gr::LanguageIterator iL = aSupported.first; while (iL != aSupported.second) @@ -186,7 +186,7 @@ bool GrFeatureParser::isValid(gr::Font & font, gr::FeatureSetting & setting) { return false; } - sil_std::pair< gr::FeatureSettingIterator, gr::FeatureSettingIterator > + ext_std::pair< gr::FeatureSettingIterator, gr::FeatureSettingIterator > validValues = font.getFeatureSettings(i); gr::FeatureSettingIterator j = validValues.first; while (j != validValues.second) diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx index 25ea77dd07a3..6e75d1fde868 100644 --- a/vcl/source/glyphs/graphite_layout.cxx +++ b/vcl/source/glyphs/graphite_layout.cxx @@ -63,13 +63,13 @@ #include <unicode/uscript.h> // Graphite Libraries (must be after vcl headers on windows) -#include "pregraphitestl.h" +#include <tools/preextstl.h> #include <graphite/GrClient.h> #include <graphite/Font.h> #include <graphite/ITextSource.h> #include <graphite/Segment.h> #include <graphite/SegmentPainter.h> -#include "postgraphitestl.h" +#include <tools/postextstl.h> #include <vcl/graphite_layout.hxx> #include <vcl/graphite_features.hxx> @@ -104,8 +104,8 @@ FILE * grLog() namespace { - typedef sil_std::pair<gr::GlyphIterator, gr::GlyphIterator> glyph_range_t; - typedef sil_std::pair<gr::GlyphSetIterator, gr::GlyphSetIterator> glyph_set_range_t; + typedef ext_std::pair<gr::GlyphIterator, gr::GlyphIterator> glyph_range_t; + typedef ext_std::pair<gr::GlyphSetIterator, gr::GlyphSetIterator> glyph_set_range_t; inline long round(const float n) { return long(n + (n < 0 ? -0.5 : 0.5)); @@ -170,7 +170,7 @@ GraphiteLayout::Glyphs::fill_from(gr::Segment & rSegment, ImplLayoutArgs &rArgs, bool bRtl, long &rWidth, float fScaling, std::vector<int> & rChar2Base, std::vector<int> & rGlyph2Char, std::vector<int> & rCharDxs) { // Create a glyph item for each of the glyph and append it to the base class glyph list. - typedef sil_std::pair< gr::GlyphSetIterator, gr::GlyphSetIterator > GrGlyphSet; + typedef ext_std::pair< gr::GlyphSetIterator, gr::GlyphSetIterator > GrGlyphSet; int nChar = rArgs.mnEndCharPos - rArgs.mnMinCharPos; glyph_range_t iGlyphs = rSegment.glyphs(); int nGlyphs = iGlyphs.second - iGlyphs.first; @@ -585,7 +585,7 @@ public: sal_Int32 hashCode(const grutils::GrFeatureParser * mpFeatures) { // is this sufficient? - sil_std::wstring aFace; + ext_std::wstring aFace; bool bBold; bool bItalic; UniqueCacheInfo(aFace, bBold, bItalic); diff --git a/vcl/source/glyphs/graphite_textsrc.cxx b/vcl/source/glyphs/graphite_textsrc.cxx index d7547662e065..5764ba9454c9 100644 --- a/vcl/source/glyphs/graphite_textsrc.cxx +++ b/vcl/source/glyphs/graphite_textsrc.cxx @@ -135,16 +135,16 @@ gr::isocode TextSourceAdaptor::getLanguage(gr::toffset) return unknown; } -sil_std::pair<gr::toffset, gr::toffset> TextSourceAdaptor::propertyRange(gr::toffset nCharIdx) +ext_std::pair<gr::toffset, gr::toffset> TextSourceAdaptor::propertyRange(gr::toffset nCharIdx) { if (nCharIdx < unsigned(maLayoutArgs.mnMinCharPos)) - return sil_std::make_pair(0, maLayoutArgs.mnMinCharPos); + return ext_std::make_pair(0, maLayoutArgs.mnMinCharPos); if (nCharIdx < mnEnd) - return sil_std::make_pair(maLayoutArgs.mnMinCharPos, mnEnd); + return ext_std::make_pair(maLayoutArgs.mnMinCharPos, mnEnd); - return sil_std::make_pair(mnEnd, maLayoutArgs.mnLength); + return ext_std::make_pair(mnEnd, maLayoutArgs.mnLength); } size_t TextSourceAdaptor::getFontFeatures(gr::toffset, gr::FeatureSetting * settings) @@ -156,7 +156,7 @@ size_t TextSourceAdaptor::getFontFeatures(gr::toffset, gr::FeatureSetting * sett bool TextSourceAdaptor::sameSegment(gr::toffset char_idx1, gr::toffset char_idx2) { - const sil_std::pair<gr::toffset, gr::toffset> + const ext_std::pair<gr::toffset, gr::toffset> range1 = propertyRange(char_idx1), range2 = propertyRange(char_idx2); diff --git a/vcl/source/glyphs/graphite_textsrc.hxx b/vcl/source/glyphs/graphite_textsrc.hxx index 2397d6a5f701..2b9c705a5ea7 100644 --- a/vcl/source/glyphs/graphite_textsrc.hxx +++ b/vcl/source/glyphs/graphite_textsrc.hxx @@ -59,11 +59,11 @@ #include "vcl/dllapi.h" // Libraries -#include "pregraphitestl.h" +#include <tools/preextstl.h> #include <graphite/GrClient.h> #include <graphite/Font.h> #include <graphite/ITextSource.h> -#include "postgraphitestl.h" +#include <tools/postextstl.h> // Module type definitions and forward declarations. // @@ -90,7 +90,7 @@ public: virtual float getVerticalOffset(gr::toffset ich); virtual gr::isocode getLanguage(gr::toffset ich); - virtual sil_std::pair<gr::toffset, gr::toffset> propertyRange(gr::toffset ich); + virtual ext_std::pair<gr::toffset, gr::toffset> propertyRange(gr::toffset ich); virtual size_t getFontFeatures(gr::toffset ich, gr::FeatureSetting * prgfset); virtual bool sameSegment(gr::toffset ich1, gr::toffset ich2); diff --git a/vcl/source/helper/xconnection.cxx b/vcl/source/helper/xconnection.cxx index 19ac9103bf96..caf7ee237d67 100644 --- a/vcl/source/helper/xconnection.cxx +++ b/vcl/source/helper/xconnection.cxx @@ -141,12 +141,16 @@ bool DisplayConnection::dispatchEvent( void* pThis, void* pData, int nBytes ) SolarMutexReleaser aRel; DisplayConnection* This = (DisplayConnection*)pThis; - MutexGuard aGuard( This->m_aMutex ); Sequence< sal_Int8 > aSeq( (sal_Int8*)pData, nBytes ); Any aEvent; aEvent <<= aSeq; - for( ::std::list< Reference< XEventHandler > >::const_iterator it = This->m_aHandlers.begin(); it != This->m_aHandlers.end(); ++it ) + ::std::list< Reference< XEventHandler > > handlers; + { + MutexGuard aGuard( This->m_aMutex ); + handlers = This->m_aHandlers; + } + for( ::std::list< Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it ) if( (*it)->handleEvent( aEvent ) ) return true; return false; @@ -157,12 +161,16 @@ bool DisplayConnection::dispatchErrorEvent( void* pThis, void* pData, int nBytes SolarMutexReleaser aRel; DisplayConnection* This = (DisplayConnection*)pThis; - MutexGuard aGuard( This->m_aMutex ); Sequence< sal_Int8 > aSeq( (sal_Int8*)pData, nBytes ); Any aEvent; aEvent <<= aSeq; - for( ::std::list< Reference< XEventHandler > >::const_iterator it = This->m_aErrorHandlers.begin(); it != This->m_aErrorHandlers.end(); ++it ) + ::std::list< Reference< XEventHandler > > handlers; + { + MutexGuard aGuard( This->m_aMutex ); + handlers = This->m_aErrorHandlers; + } + for( ::std::list< Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it ) if( (*it)->handleEvent( aEvent ) ) return true; diff --git a/vcl/source/src/print.src b/vcl/source/src/print.src index 3158926f5e6d..58f0a477c848 100644 --- a/vcl/source/src/print.src +++ b/vcl/source/src/print.src @@ -356,7 +356,7 @@ ModalDialog SV_DLG_PRINT { Pos = MAP_APPFONT( 5, 35 ); Size = MAP_APPFONT( 150, 10 ); - Text [en-US] = "Range and Copies"; + Text [en-US] = "Range and copies"; }; FixedText SV_PRINT_COPYCOUNT { diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx index e3a8d2ce35de..e67c2d9ecfd5 100644 --- a/vcl/source/window/dockmgr.cxx +++ b/vcl/source/window/dockmgr.cxx @@ -426,11 +426,19 @@ void DockingManager::SetFloatingMode( const Window *pWindow, BOOL bFloating ) pWrapper->SetFloatingMode( bFloating ); } -void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const Window *pWindow ) +void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const Window *pWindow, ULONG nFlags ) { ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); if( pWrapper ) - pWrapper->StartPopupMode( pParentToolBox ); + pWrapper->StartPopupMode( pParentToolBox, nFlags ); +} + +void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const Window *pWindow ) +{ + StartPopupMode( pParentToolBox, pWindow, FLOATWIN_POPUPMODE_ALLOWTEAROFF | + FLOATWIN_POPUPMODE_NOFOCUSCLOSE | + FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE | + FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE ); } BOOL DockingManager::IsInPopupMode( const Window *pWindow ) @@ -442,6 +450,17 @@ BOOL DockingManager::IsInPopupMode( const Window *pWindow ) return FALSE; } +// ----------------------------------------------------------------------- + +void DockingManager::EndPopupMode( const Window *pWin ) +{ + ImplDockingWindowWrapper *pWrapper = GetDockingWindowWrapper( pWin ); + if( pWrapper && pWrapper->GetFloatingWindow() && pWrapper->GetFloatingWindow()->IsInPopupMode() ) + pWrapper->GetFloatingWindow()->EndPopupMode(); +} + +// ----------------------------------------------------------------------- + void DockingManager::AddWindow( const Window *pWindow ) { ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); @@ -515,12 +534,15 @@ private: ImplDockingWindowWrapper* mpDockingWin; BOOL mbHighlight; BOOL mbMoving; + bool mbTrackingEnabled; Point maDelta; Point maTearOffPosition; + bool mbGripAtBottom; + bool mbHasGrip; void ImplSetBorder(); public: - ImplPopupFloatWin( Window* pParent, ImplDockingWindowWrapper* pDockingWin ); + ImplPopupFloatWin( Window* pParent, ImplDockingWindowWrapper* pDockingWin, bool bHasGrip ); ~ImplPopupFloatWin(); virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); @@ -537,9 +559,11 @@ public: Point GetTearOffPosition() const; void DrawGrip(); void DrawBorder(); + + bool hasGrip() const { return mbHasGrip; } }; -ImplPopupFloatWin::ImplPopupFloatWin( Window* pParent, ImplDockingWindowWrapper* pDockingWin ) : +ImplPopupFloatWin::ImplPopupFloatWin( Window* pParent, ImplDockingWindowWrapper* pDockingWin, bool bHasGrip ) : FloatingWindow( pParent, WB_NOBORDER | WB_SYSTEMWINDOW | WB_NOSHADOW) { mpWindowImpl->mbToolbarFloatingWindow = TRUE; // indicate window type, required for accessibility @@ -547,6 +571,9 @@ ImplPopupFloatWin::ImplPopupFloatWin( Window* pParent, ImplDockingWindowWrapper* mpDockingWin = pDockingWin; mbHighlight = FALSE; mbMoving = FALSE; + mbTrackingEnabled = FALSE; + mbGripAtBottom = TRUE; + mbHasGrip = bHasGrip; ImplSetBorder(); } @@ -582,7 +609,9 @@ void ImplPopupFloatWin::ImplSetBorder() // we're using a special border for the grip // by setting those members the method SetOutputSizePixel() can // be used to set the proper window size - mpWindowImpl->mnTopBorder = 1 + POPUP_DRAGHEIGHT+2; + mpWindowImpl->mnTopBorder = 1; + if( hasGrip() ) + mpWindowImpl->mnTopBorder += POPUP_DRAGHEIGHT+2; mpWindowImpl->mnBottomBorder = 1; mpWindowImpl->mnLeftBorder = 1; mpWindowImpl->mnRightBorder = 1; @@ -596,13 +625,25 @@ void ImplPopupFloatWin::Resize() Rectangle ImplPopupFloatWin::GetDragRect() const { - return Rectangle( 1, 1, GetOutputSizePixel().Width()-1, 2+POPUP_DRAGHEIGHT ); + Rectangle aRect; + if( hasGrip() ) + { + aRect = Rectangle( 1,1, GetOutputSizePixel().Width()-1, 2+POPUP_DRAGHEIGHT ); + if( mbGripAtBottom ) + { + int height = GetOutputSizePixel().Height(); + aRect.Top() = height - 3 - POPUP_DRAGHEIGHT; + aRect.Bottom() = aRect.Top() + 1 + POPUP_DRAGHEIGHT; + } + } + return aRect; } Point ImplPopupFloatWin::GetToolboxPosition() const { // return inner position where a toolbox could be placed - Point aPt( 1, 1+GetDragRect().getHeight() ); // grip + border + Point aPt( 1, 1 + ((mbGripAtBottom || !hasGrip()) ? 0 : GetDragRect().getHeight()) ); // grip + border + return aPt; } @@ -616,7 +657,6 @@ Point ImplPopupFloatWin::GetTearOffPosition() const void ImplPopupFloatWin::DrawBorder() { SetFillColor(); - SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() ); Point aPt; Rectangle aRect( aPt, GetOutputSizePixel() ); @@ -626,9 +666,16 @@ void ImplPopupFloatWin::DrawBorder() if( !aItemClipRect.IsEmpty() ) { aItemClipRect.SetPos( AbsoluteScreenToOutputPixel( aItemClipRect.TopLeft() ) ); + + // draw the excluded border part with the background color of a toolbox + SetClipRegion( Region( aItemClipRect ) ); + SetLineColor( GetSettings().GetStyleSettings().GetFaceColor() ); + DrawRect( aRect ); + aClipRgn.Exclude( aItemClipRect ); SetClipRegion( aClipRgn ); } + SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() ); DrawRect( aRect ); SetClipRegion( oldClipRgn ); } @@ -724,7 +771,8 @@ void ImplPopupFloatWin::Paint( const Rectangle& ) Rectangle aRect( aPt, GetOutputSizePixel() ); DrawWallpaper( aRect, Wallpaper( GetSettings().GetStyleSettings().GetFaceGradientColor() ) ); DrawBorder(); - DrawGrip(); + if( hasGrip() ) + DrawGrip(); } void ImplPopupFloatWin::MouseMove( const MouseEvent& rMEvt ) @@ -733,7 +781,7 @@ void ImplPopupFloatWin::MouseMove( const MouseEvent& rMEvt ) if( !ToolBox::AlwaysLocked() ) // no tear off if locking is enabled { - if( rMEvt.IsLeft() && GetDragRect().IsInside( aMousePos ) ) + if( mbTrackingEnabled && rMEvt.IsLeft() && GetDragRect().IsInside( aMousePos ) ) { // start window move mbMoving = TRUE; @@ -755,6 +803,7 @@ void ImplPopupFloatWin::MouseMove( const MouseEvent& rMEvt ) void ImplPopupFloatWin::MouseButtonUp( const MouseEvent& rMEvt ) { + mbTrackingEnabled = false; FloatingWindow::MouseButtonUp( rMEvt ); } @@ -769,6 +818,11 @@ void ImplPopupFloatWin::MouseButtonDown( const MouseEvent& rMEvt ) ImplMirrorFramePos(aState.maPos); maTearOffPosition = GetWindow( WINDOW_BORDER )->GetPosPixel(); maDelta = aState.maPos - maTearOffPosition; + mbTrackingEnabled = true; + } + else + { + mbTrackingEnabled = false; } } @@ -1187,7 +1241,7 @@ BOOL ImplDockingWindowWrapper::IsTitleButtonVisible( USHORT nButton ) const // ----------------------------------------------------------------------- -void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox ) +void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, ULONG nFlags ) { // do nothing if window is floating if( IsFloatingMode() ) @@ -1202,7 +1256,7 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox ) mpOldBorderWin = NULL; // no border window found // the new parent for popup mode - ImplPopupFloatWin* pWin = new ImplPopupFloatWin( mpParent, this ); + ImplPopupFloatWin* pWin = new ImplPopupFloatWin( mpParent, this, (nFlags & FLOATWIN_POPUPMODE_ALLOWTEAROFF) != 0 ); pWin->SetPopupModeEndHdl( LINK( this, ImplDockingWindowWrapper, PopupModeEnd ) ); pWin->SetText( GetWindow()->GetText() ); @@ -1232,12 +1286,6 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox ) // (SetPosPixel etc. check for valid mpFloatWin pointer) mpFloatWin = pWin; - ULONG nFlags = FLOATWIN_POPUPMODE_ALLOWTEAROFF | - FLOATWIN_POPUPMODE_NOFOCUSCLOSE | - FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE | - FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE; -// |FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE; - // if the subtoolbar was opened via keyboard make sure that key events // will go into subtoolbar if( pParentToolBox->IsKeyEvent() ) @@ -1339,7 +1387,7 @@ void ImplDockingWindowWrapper::SetFloatingMode( BOOL bFloatMode ) aSettings.SetStyleSettings( aStyleSettings ); pWin->SetSettings( aSettings );*/ - mpFloatWin = pWin; +// mpFloatWin = pWin; GetWindow()->mpWindowImpl->mpBorderWindow = NULL; @@ -1374,6 +1422,8 @@ void ImplDockingWindowWrapper::SetFloatingMode( BOOL bFloatMode ) pWin->SetMinOutputSizePixel( maMinOutSize ); pWin->SetMaxOutputSizePixel( maMaxOutSize ); + mpFloatWin = pWin; + if ( bVisible ) GetWindow()->Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index caf5705cbcd9..35077b1cff0e 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -42,16 +42,22 @@ #include "vcl/help.hxx" #include "vcl/decoview.hxx" #include "vcl/svapp.hxx" +#include "vcl/unohelp.hxx" #include "unotools/localedatawrapper.hxx" #include "rtl/ustrbuf.hxx" +#include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "com/sun/star/container/XNameAccess.hpp" +#include "com/sun/star/beans/PropertyValue.hpp" #include "com/sun/star/awt/Size.hpp" using namespace vcl; using namespace com::sun::star; using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::container; using namespace com::sun::star::beans; #define HELPID_PREFIX ".HelpId:vcl:PrintDialog" @@ -66,7 +72,7 @@ PrintDialog::PrintPreviewWindow::PrintPreviewWindow( Window* i_pParent, const Re { SetPaintTransparent( TRUE ); SetBackground(); - if( GetSettings().GetStyleSettings().GetHighContrastMode() ) + if( useHCColorReplacement() ) maPageVDev.SetBackground( GetSettings().GetStyleSettings().GetWindowColor() ); else maPageVDev.SetBackground( Color( COL_WHITE ) ); @@ -76,12 +82,76 @@ PrintDialog::PrintPreviewWindow::~PrintPreviewWindow() { } +bool PrintDialog::PrintPreviewWindow::useHCColorReplacement() const +{ + bool bRet = false; + if( GetSettings().GetStyleSettings().GetHighContrastMode() ) + { + try + { + // get service provider + Reference< XMultiServiceFactory > xSMgr( unohelper::GetMultiServiceFactory() ); + // create configuration hierachical access name + if( xSMgr.is() ) + { + try + { + Reference< XMultiServiceFactory > xConfigProvider( + Reference< XMultiServiceFactory >( + xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.ConfigurationProvider" ))), + UNO_QUERY ) + ); + if( xConfigProvider.is() ) + { + Sequence< Any > aArgs(1); + PropertyValue aVal; + aVal.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ); + aVal.Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common/Accessibility" ) ); + aArgs.getArray()[0] <<= aVal; + Reference< XNameAccess > xConfigAccess( + Reference< XNameAccess >( + xConfigProvider->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.ConfigurationAccess" )), + aArgs ), + UNO_QUERY ) + ); + if( xConfigAccess.is() ) + { + try + { + sal_Bool bValue = sal_False; + Any aAny = xConfigAccess->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsForPagePreviews" ) ) ); + if( aAny >>= bValue ) + bRet = bool(bValue); + } + catch( NoSuchElementException& ) + { + } + catch( WrappedTargetException& ) + { + } + } + } + } + catch( Exception& ) + { + } + } + } + catch( WrappedTargetException& ) + { + } + } + return bRet; +} + void PrintDialog::PrintPreviewWindow::DataChanged( const DataChangedEvent& i_rDCEvt ) { // react on settings changed if( i_rDCEvt.GetType() == DATACHANGED_SETTINGS ) { - if( GetSettings().GetStyleSettings().GetHighContrastMode() ) + if( useHCColorReplacement() ) maPageVDev.SetBackground( GetSettings().GetStyleSettings().GetWindowColor() ); else maPageVDev.SetBackground( Color( COL_WHITE ) ); @@ -118,6 +188,23 @@ void PrintDialog::PrintPreviewWindow::Resize() } aScaledSize.Width() = long(aScaledSize.Width()*fScale); aScaledSize.Height() = long(aScaledSize.Height()*fScale); + + maPreviewSize = aScaledSize; + + // #i104784# if we render the page too small then rounding issues result in + // layout artifacts looking really bad. So scale the page unto a device that is not + // full page size but not too small either. This also results in much better visual + // quality of the preview, e.g. when its height approaches the number of text lines + // find a good scaling factor + Size aPreviewMMSize( maPageVDev.PixelToLogic( aScaledSize, MapMode( MAP_100TH_MM ) ) ); + double fZoom = double(maOrigSize.Height())/double(aPreviewMMSize.Height()); + while( fZoom > 10 ) + { + aScaledSize.Width() *= 2; + aScaledSize.Height() *= 2; + fZoom /= 2.0; + } + maPageVDev.SetOutputSizePixel( aScaledSize, FALSE ); } @@ -129,9 +216,14 @@ void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& ) // replacement is active Push(); Rectangle aTextRect( Point( 0, 0 ), aSize ); - Font aFont( GetSettings().GetStyleSettings().GetFieldFont() ); - aFont.SetSize( Size( 0, aSize.Height()/12 ) ); - SetFont( aFont ); + DecorationView aVw( this ); + aVw.DrawFrame( aTextRect, FRAME_DRAW_GROUP ); + aTextRect.Left() += 2; + aTextRect.Top() += 2; + aTextRect.Right() -= 2; + aTextRect.Bottom() -= 2; + Font aFont( GetSettings().GetStyleSettings().GetLabelFont() ); + SetZoomedPointFont( aFont ); DrawText( aTextRect, maReplacementString, TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER | TEXT_DRAW_WORDBREAK | TEXT_DRAW_MULTILINE ); @@ -141,11 +233,11 @@ void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& ) { GDIMetaFile aMtf( maMtf ); - Size aPreviewSize = maPageVDev.GetOutputSizePixel(); - Point aOffset( (aSize.Width() - aPreviewSize.Width()) / 2, - (aSize.Height() - aPreviewSize.Height()) / 2 ); + Point aOffset( (aSize.Width() - maPreviewSize.Width()) / 2, + (aSize.Height() - maPreviewSize.Height()) / 2 ); - const Size aLogicSize( maPageVDev.PixelToLogic( aPreviewSize, MapMode( MAP_100TH_MM ) ) ); + Size aVDevSize( maPageVDev.GetOutputSizePixel() ); + const Size aLogicSize( maPageVDev.PixelToLogic( aVDevSize, MapMode( MAP_100TH_MM ) ) ); Size aOrigSize( maOrigSize ); if( aOrigSize.Width() < 1 ) aOrigSize.Width() = aLogicSize.Width(); @@ -165,11 +257,11 @@ void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& ) SetMapMode( MAP_PIXEL ); maPageVDev.SetMapMode( MAP_PIXEL ); - DrawOutDev( aOffset, aPreviewSize, Point( 0, 0 ), aPreviewSize, maPageVDev ); + DrawOutDev( aOffset, maPreviewSize, Point( 0, 0 ), aVDevSize, maPageVDev ); DecorationView aVw( this ); - aOffset.X() -= 1; aOffset.Y() -=1; aPreviewSize.Width() += 2; aPreviewSize.Height() += 2; - aVw.DrawFrame( Rectangle( aOffset, aPreviewSize ), FRAME_DRAW_GROUP ); + Rectangle aFrame( aOffset + Point( -1, -1 ), Size( maPreviewSize.Width() + 2, maPreviewSize.Height() + 2 ) ); + aVw.DrawFrame( aFrame, FRAME_DRAW_GROUP ); } } @@ -211,9 +303,7 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi #endif SetQuickHelpText( aBuf.makeStringAndClear() ); maMtf = i_rNewPreview; - if( GetSettings().GetStyleSettings().GetHighContrastMode() && - GetSettings().GetStyleSettings().GetWindowColor().IsDark() - ) + if( useHCColorReplacement() ) { maMtf.ReplaceColors( Color( COL_BLACK ), Color( COL_WHITE ), 30 ); } @@ -557,7 +647,7 @@ void PrintDialog::JobTabPage::setupLayout() // add printer fixed line maLayout.addWindow( &maPrinterFL ); // add print LB - maLayout.addWindow( &maPrinters ); + maLayout.addWindow( &maPrinters, 3 ); // create a row for details button/text and properties button boost::shared_ptr< vcl::RowOrColumn > xDetRow( new vcl::RowOrColumn( &maLayout, false ) ); @@ -834,6 +924,7 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterCont maNUpPage.maBorderCB.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); maOptionsPage.maToFileBox.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) ); maOptionsPage.maReverseOrderBox.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) ); + maOptionsPage.maCollateSingleJobsBox.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) ); maNUpPage.maPagesBtn.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) ); // setup modify hdl @@ -1027,6 +1118,11 @@ bool PrintDialog::isCollate() return maJobPage.maCopyCountField.GetValue() > 1 ? maJobPage.maCollateBox.IsChecked() : FALSE; } +bool PrintDialog::isSingleJobs() +{ + return maOptionsPage.maCollateSingleJobsBox.IsChecked(); +} + static void setSmartId( Window* i_pWindow, const char* i_pType, sal_Int32 i_nId = -1, const rtl::OUString& i_rPropName = rtl::OUString() ) { rtl::OUStringBuffer aBuf( 256 ); @@ -1049,10 +1145,17 @@ static void setSmartId( Window* i_pWindow, const char* i_pType, sal_Int32 i_nId i_pWindow->SetSmartHelpId( SmartId( aBuf.makeStringAndClear(), HID_PRINTDLG ) ); } -static void setHelpText( Window* i_pWindow, const Sequence< rtl::OUString >& i_rHelpTexts, sal_Int32 i_nIndex ) +static void setHelpText( Window* /*i_pWindow*/, const Sequence< rtl::OUString >& /*i_rHelpTexts*/, sal_Int32 /*i_nIndex*/ ) { + // without a help text set and the correct smartID, + // help texts will be retrieved from the online help system + + // passed help texts for optional UI is used only for native dialogs which currently + // cannot access the same (rather implicit) mechanism + #if 0 if( i_nIndex >= 0 && i_nIndex < i_rHelpTexts.getLength() ) i_pWindow->SetHelpText( i_rHelpTexts.getConstArray()[i_nIndex] ); + #endif } void updateMaxSize( const Size& i_rCheckSize, Size& o_rMaxSize ) @@ -1572,6 +1675,12 @@ void PrintDialog::setupOptionalUI() maJobPage.maLayout.setBorders( nIndex-1, 0, 0, 0, aBorder.Width() ); #endif + // create auto mnemomnics now so they can be calculated in layout + ImplWindowAutoMnemonic( &maJobPage ); + ImplWindowAutoMnemonic( &maNUpPage ); + ImplWindowAutoMnemonic( &maOptionsPage ); + ImplWindowAutoMnemonic( this ); + // calculate job page Size aMaxSize = maJobPage.maLayout.getOptimalSize( WINDOWSIZE_PREFERRED ); // and layout page @@ -1654,6 +1763,7 @@ void PrintDialog::checkControlDependencies() maJobPage.maCollateImage.SetSizePixel( aImgSize ); maJobPage.maCollateImage.SetImage( bHC ? aHCImg : aImg ); maJobPage.maCollateImage.SetModeImage( aHCImg, BMP_COLOR_HIGHCONTRAST ); + maJobPage.maLayout.resize(); // enable setup button only for printers that can be setup bool bHaveSetup = maPController->getPrinter()->HasSupport( SUPPORT_SETUPDIALOG ); @@ -2444,6 +2554,11 @@ void PrintProgressDialog::tick() setProgress( ++mnCur ); } +void PrintProgressDialog::reset() +{ + setProgress( 0 ); +} + void PrintProgressDialog::Paint( const Rectangle& ) { if( maProgressRect.IsEmpty() ) diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 8906edaa5046..ca92d9ed6c5b 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -98,6 +98,7 @@ #include "vcl/lazydelete.hxx" #include <set> +#include <typeinfo> using namespace rtl; using namespace ::com::sun::star::uno; @@ -1322,7 +1323,6 @@ ImplWinData* Window::ImplGetWinData() const mpWindowImpl->mpWinData->mnIsTopWindow = (USHORT) ~0; // not initialized yet, 0/1 will indicate TopWindow (see IsTopWindow()) mpWindowImpl->mpWinData->mbMouseOver = FALSE; mpWindowImpl->mpWinData->mbEnableNativeWidget = (pNoNWF && *pNoNWF) ? FALSE : TRUE; // TRUE: try to draw this control with native theme API - mpWindowImpl->mpWinData->mpSalControlHandle = NULL; mpWindowImpl->mpWinData->mpSmartHelpId = NULL; mpWindowImpl->mpWinData->mpSmartUniqueId = NULL; } @@ -4328,6 +4328,27 @@ Window::Window( Window* pParent, const ResId& rResId ) } // ----------------------------------------------------------------------- +#if OSL_DEBUG_LEVEL > 0 +namespace +{ + void lcl_appendWindowInfo( ByteString& io_rErrorString, const Window& i_rWindow ) + { + // skip border windows, they don't carry information which helps diagnosing the problem + const Window* pWindow( &i_rWindow ); + while ( pWindow && ( pWindow->GetType() == WINDOW_BORDERWINDOW ) ) + pWindow = pWindow->GetWindow( WINDOW_FIRSTCHILD ); + if ( !pWindow ) + pWindow = &i_rWindow; + + io_rErrorString += char(13); + io_rErrorString += typeid( *pWindow ).name(); + io_rErrorString += " (window text: '"; + io_rErrorString += ByteString( pWindow->GetText(), RTL_TEXTENCODING_UTF8 ); + io_rErrorString += "')"; + } +} +#endif +// ----------------------------------------------------------------------- Window::~Window() { @@ -4460,9 +4481,7 @@ Window::~Window() if ( ImplIsRealParentPath( pTempWin ) ) { bError = TRUE; - if ( aErrorStr.Len() ) - aErrorStr += "; "; - aErrorStr += ByteString( pTempWin->GetText(), RTL_TEXTENCODING_UTF8 ); + lcl_appendWindowInfo( aErrorStr, *pTempWin ); } pTempWin = pTempWin->mpWindowImpl->mpNextOverlap; } @@ -4483,9 +4502,7 @@ Window::~Window() if ( ImplIsRealParentPath( pTempWin ) ) { bError = TRUE; - if ( aErrorStr.Len() ) - aErrorStr += "; "; - aErrorStr += ByteString( pTempWin->GetText(), RTL_TEXTENCODING_UTF8 ); + lcl_appendWindowInfo( aErrorStr, *pTempWin ); } pTempWin = pTempWin->mpWindowImpl->mpFrameData->mpNextFrame; } @@ -4507,10 +4524,8 @@ Window::~Window() pTempWin = mpWindowImpl->mpFirstChild; while ( pTempWin ) { - aTempStr += ByteString( pTempWin->GetText(), RTL_TEXTENCODING_UTF8 ); + lcl_appendWindowInfo( aTempStr, *pTempWin ); pTempWin = pTempWin->mpWindowImpl->mpNext; - if ( pTempWin ) - aTempStr += "; "; } DBG_ERROR( aTempStr.GetBuffer() ); GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed! @@ -4524,10 +4539,8 @@ Window::~Window() pTempWin = mpWindowImpl->mpFirstOverlap; while ( pTempWin ) { - aTempStr += ByteString( pTempWin->GetText(), RTL_TEXTENCODING_UTF8 ); + lcl_appendWindowInfo( aTempStr, *pTempWin ); pTempWin = pTempWin->mpWindowImpl->mpNext; - if ( pTempWin ) - aTempStr += "; "; } DBG_ERROR( aTempStr.GetBuffer() ); GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed! @@ -4722,10 +4735,6 @@ Window::~Window() delete mpWindowImpl->mpWinData->mpFocusRect; if ( mpWindowImpl->mpWinData->mpTrackRect ) delete mpWindowImpl->mpWinData->mpTrackRect; - // Native widget support - delete mpWindowImpl->mpWinData->mpSalControlHandle; - mpWindowImpl->mpWinData->mpSalControlHandle = NULL; - if ( mpWindowImpl->mpWinData->mpSmartHelpId ) delete mpWindowImpl->mpWinData->mpSmartHelpId; if ( mpWindowImpl->mpWinData->mpSmartUniqueId ) @@ -7444,13 +7453,13 @@ Rectangle Window::ImplOutputToUnmirroredAbsoluteScreenPixel( const Rectangle &rR // ----------------------------------------------------------------------- -Rectangle Window::GetWindowExtentsRelative( Window *pRelativeWindow ) +Rectangle Window::GetWindowExtentsRelative( Window *pRelativeWindow ) const { // with decoration return ImplGetWindowExtentsRelative( pRelativeWindow, FALSE ); } -Rectangle Window::GetClientWindowExtentsRelative( Window *pRelativeWindow ) +Rectangle Window::GetClientWindowExtentsRelative( Window *pRelativeWindow ) const { // without decoration return ImplGetWindowExtentsRelative( pRelativeWindow, TRUE ); @@ -7458,12 +7467,12 @@ Rectangle Window::GetClientWindowExtentsRelative( Window *pRelativeWindow ) // ----------------------------------------------------------------------- -Rectangle Window::ImplGetWindowExtentsRelative( Window *pRelativeWindow, BOOL bClientOnly ) +Rectangle Window::ImplGetWindowExtentsRelative( Window *pRelativeWindow, BOOL bClientOnly ) const { SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry(); // make sure we use the extent of our border window, // otherwise we miss a few pixels - Window *pWin = (!bClientOnly && mpWindowImpl->mpBorderWindow) ? mpWindowImpl->mpBorderWindow : this; + const Window *pWin = (!bClientOnly && mpWindowImpl->mpBorderWindow) ? mpWindowImpl->mpBorderWindow : this; Point aPos( pWin->OutputToScreenPixel( Point(0,0) ) ); aPos.X() += g.nX; @@ -8154,7 +8163,7 @@ const XubString& Window::GetHelpText() const { rtl::OUStringBuffer aTxt( 64+mpWindowImpl->maHelpText.Len() ); aTxt.append( mpWindowImpl->maHelpText ); - aTxt.appendAscii( "\n+++++++++++++++\n" ); + aTxt.appendAscii( "\n------------------\n" ); if( bStrHelpId ) aTxt.append( rtl::OUString( aStrHelpId ) ); else diff --git a/vcl/source/window/window3.cxx b/vcl/source/window/window3.cxx index aecbc9c3ef0c..65019ba2a4af 100644 --- a/vcl/source/window/window3.cxx +++ b/vcl/source/window/window3.cxx @@ -28,269 +28,10 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#define _SV_WINDOW_CXX - -#include "svsys.h" -#include "vcl/window.h" #include "vcl/window.hxx" #include "vcl/waitobj.hxx" -#include "vcl/salgdi.hxx" -#include "vcl/salnativewidgets.hxx" -#include "vcl/salctrlhandle.hxx" -#include "rtl/ustring.hxx" #include "vcl/button.hxx" -using namespace rtl; - -// ----------------------------------------------------------------------- -// These functions are mainly passthrough functions that allow access to -// the SalFrame behind a Window object for native widget rendering purposes. -// ----------------------------------------------------------------------- - -void Window::ImplInitSalControlHandle() -{ - // create SalControlHandle on demand - // not needed for ordinary windows - // TODO: move creation to SalGraphics - //if( !ImplGetWinData()->mpSalControlHandle ) - // ImplGetWinData()->mpSalControlHandle = new SalControlHandle; -} - -// ----------------------------------------------------------------------- - -BOOL Window::IsNativeControlSupported( ControlType nType, ControlPart nPart ) -{ - if( !IsNativeWidgetEnabled() ) - return FALSE; - - if ( !mpGraphics ) - if ( !ImplGetGraphics() ) - return FALSE; - - return( mpGraphics->IsNativeControlSupported(nType, nPart) ); -} - - -// ----------------------------------------------------------------------- - -BOOL Window::HitTestNativeControl( ControlType nType, - ControlPart nPart, - const Region& rControlRegion, - const Point& aPos, - BOOL& rIsInside ) -{ - if( !IsNativeWidgetEnabled() ) - return FALSE; - - if ( !mpGraphics ) - if ( !ImplGetGraphics() ) - return FALSE; - - ImplInitSalControlHandle(); - - Point aWinOffs; - aWinOffs = OutputToScreenPixel( aWinOffs ); - Region screenRegion( rControlRegion ); - screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); - - return( mpGraphics->HitTestNativeControl(nType, nPart, screenRegion, OutputToScreenPixel( aPos ), *ImplGetWinData()->mpSalControlHandle, rIsInside, this ) ); -} - -// ----------------------------------------------------------------------- - -void Window::ImplMoveControlValue( ControlType nType, const ImplControlValue& aValue, const Point& rDelta ) const -{ - if( aValue.getOptionalVal() ) - { - switch( nType ) - { - case CTRL_SLIDER: - { - SliderValue* pSlVal = reinterpret_cast<SliderValue*>(aValue.getOptionalVal()); - pSlVal->maThumbRect.Move( rDelta.X(), rDelta.Y() ); - } - break; - case CTRL_SCROLLBAR: - { - ScrollbarValue* pScVal = reinterpret_cast<ScrollbarValue*>(aValue.getOptionalVal()); - pScVal->maThumbRect.Move( rDelta.X(), rDelta.Y() ); - pScVal->maButton1Rect.Move( rDelta.X(), rDelta.Y() ); - pScVal->maButton2Rect.Move( rDelta.X(), rDelta.Y() ); - } - break; - case CTRL_SPINBOX: - case CTRL_SPINBUTTONS: - { - SpinbuttonValue* pSpVal = reinterpret_cast<SpinbuttonValue*>(aValue.getOptionalVal()); - pSpVal->maUpperRect.Move( rDelta.X(), rDelta.Y() ); - pSpVal->maLowerRect.Move( rDelta.X(), rDelta.Y() ); - } - break; - case CTRL_TOOLBAR: - { - ToolbarValue* pTVal = reinterpret_cast<ToolbarValue*>(aValue.getOptionalVal()); - pTVal->maGripRect.Move( rDelta.X(), rDelta.Y() ); - } - break; - } - } -} - -BOOL Window::DrawNativeControl( ControlType nType, - ControlPart nPart, - const Region& rControlRegion, - ControlState nState, - const ImplControlValue& aValue, - OUString aCaption ) -{ - if( !IsNativeWidgetEnabled() ) - return FALSE; - - /* - if( !IsInPaint() && IsPaintTransparent() ) - { - // only required if called directly (ie, we're not in Paint() ): - // force redraw (Paint()) for transparent controls - // to trigger a repaint of the background - Region aClipRgn( GetClipRegion() ); - if( !rControlRegion.IsEmpty() ) - aClipRgn.Intersect( rControlRegion ); - Invalidate( aClipRgn, INVALIDATE_UPDATE ); - return TRUE; - } - */ - - ImplInitSalControlHandle(); - - // make sure the current clip region is initialized correctly - if ( !mpGraphics ) - if ( !ImplGetGraphics() ) - return FALSE; - - if ( mbInitClipRegion ) - ImplInitClipRegion(); - if ( mbOutputClipped ) - return TRUE; - - if ( mbInitLineColor ) - ImplInitLineColor(); - if ( mbInitFillColor ) - ImplInitFillColor(); - - // Convert the coordinates from relative to Window-absolute, so we draw - // in the correct place in platform code - Point aWinOffs; - aWinOffs = OutputToScreenPixel( aWinOffs ); - Region screenRegion( rControlRegion ); - screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); - - // do so for ImplControlValue members, also - ImplMoveControlValue( nType, aValue, aWinOffs ); - - Region aTestRegion( GetActiveClipRegion() ); - aTestRegion.Intersect( rControlRegion ); - if( aTestRegion == rControlRegion ) - nState |= CTRL_CACHING_ALLOWED; // control is not clipped, caching allowed - - BOOL bRet = mpGraphics->DrawNativeControl(nType, nPart, screenRegion, nState, aValue, *ImplGetWinData()->mpSalControlHandle, aCaption, this ); - - // transform back ImplControlValue members - ImplMoveControlValue( nType, aValue, Point()-aWinOffs ); - - return bRet; -} - - -// ----------------------------------------------------------------------- - -BOOL Window::DrawNativeControlText(ControlType nType, - ControlPart nPart, - const Region& rControlRegion, - ControlState nState, - const ImplControlValue& aValue, - OUString aCaption ) -{ - if( !IsNativeWidgetEnabled() ) - return FALSE; - - ImplInitSalControlHandle(); - - // make sure the current clip region is initialized correctly - if ( !mpGraphics ) - if ( !ImplGetGraphics() ) - return false; - - if ( mbInitClipRegion ) - ImplInitClipRegion(); - if ( mbOutputClipped ) - return true; - - if ( mbInitLineColor ) - ImplInitLineColor(); - if ( mbInitFillColor ) - ImplInitFillColor(); - - // Convert the coordinates from relative to Window-absolute, so we draw - // in the correct place in platform code - Point aWinOffs; - aWinOffs = OutputToScreenPixel( aWinOffs ); - Region screenRegion( rControlRegion ); - screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); - ImplMoveControlValue( nType, aValue, aWinOffs ); - - BOOL bRet = mpGraphics->DrawNativeControlText(nType, nPart, screenRegion, nState, aValue, *ImplGetWinData()->mpSalControlHandle, aCaption, this ); - - // transform back ImplControlValue members - ImplMoveControlValue( nType, aValue, Point()-aWinOffs ); - - return bRet; -} - - -// ----------------------------------------------------------------------- - -BOOL Window::GetNativeControlRegion( ControlType nType, - ControlPart nPart, - const Region& rControlRegion, - ControlState nState, - const ImplControlValue& aValue, - OUString aCaption, - Region &rNativeBoundingRegion, - Region &rNativeContentRegion ) -{ - if( !IsNativeWidgetEnabled() ) - return FALSE; - - if ( !mpGraphics ) - if ( !ImplGetGraphics() ) - return FALSE; - - ImplInitSalControlHandle(); - - // Convert the coordinates from relative to Window-absolute, so we draw - // in the correct place in platform code - Point aWinOffs; - aWinOffs = OutputToScreenPixel( aWinOffs ); - Region screenRegion( rControlRegion ); - screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); - ImplMoveControlValue( nType, aValue, aWinOffs ); - - BOOL bRet = mpGraphics->GetNativeControlRegion(nType, nPart, screenRegion, nState, aValue, - *ImplGetWinData()->mpSalControlHandle, aCaption, rNativeBoundingRegion, - rNativeContentRegion, this ); - if( bRet ) - { - // transform back native regions - rNativeBoundingRegion.Move( -aWinOffs.X(), -aWinOffs.Y() ); - rNativeContentRegion.Move( -aWinOffs.X(), -aWinOffs.Y() ); - } - // transform back ImplControlValue members - ImplMoveControlValue( nType, aValue, Point()-aWinOffs ); - - return bRet; -} - - // ----------------------------------------------------------------------- WaitObject::~WaitObject() diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 95ac5940b6d2..7b0512a1320b 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -1474,6 +1474,7 @@ static long ImplHandleWheelEvent( Window* pWindow, const SalWheelMouseEvent& rEv USHORT nMode; USHORT nCode = rEvt.mnCode; bool bHorz = rEvt.mbHorz; + bool bPixel = rEvt.mbDeltaIsPixel; if ( nCode & KEY_MOD1 ) nMode = COMMAND_WHEEL_ZOOM; else if ( nCode & KEY_MOD2 ) @@ -1486,7 +1487,7 @@ static long ImplHandleWheelEvent( Window* pWindow, const SalWheelMouseEvent& rEv bHorz = true; } - CommandWheelData aWheelData( rEvt.mnDelta, rEvt.mnNotchDelta, rEvt.mnScrollLines, nMode, nCode, bHorz ); + CommandWheelData aWheelData( rEvt.mnDelta, rEvt.mnNotchDelta, rEvt.mnScrollLines, nMode, nCode, bHorz, bPixel ); Point aMousePos( rEvt.mnX, rEvt.mnY ); BOOL bRet = TRUE; diff --git a/vcl/unx/gtk/a11y/atkbridge.cxx b/vcl/unx/gtk/a11y/atkbridge.cxx index 47efde7d3dfd..25add8e0dd18 100644 --- a/vcl/unx/gtk/a11y/atkbridge.cxx +++ b/vcl/unx/gtk/a11y/atkbridge.cxx @@ -40,10 +40,7 @@ bool InitAtkBridge(void) { const char* pVersion = atk_get_toolkit_version(); if( ! pVersion ) - { - // g_warning( "unable to get gail version number" ); return false; - } unsigned int major, minor, micro; diff --git a/vcl/unx/gtk/a11y/atktext.cxx b/vcl/unx/gtk/a11y/atktext.cxx index f346a6a5a02c..e6d3276891de 100644 --- a/vcl/unx/gtk/a11y/atktext.cxx +++ b/vcl/unx/gtk/a11y/atktext.cxx @@ -454,6 +454,84 @@ text_wrapper_set_caret_offset (AtkText *text, return FALSE; } +// --> OD 2010-03-04 #i92232# +AtkAttributeSet* +handle_text_markup_as_run_attribute( accessibility::XAccessibleTextMarkup* pTextMarkup, + const gint nTextMarkupType, + const gint offset, + AtkAttributeSet* pSet, + gint *start_offset, + gint *end_offset ) +{ + const gint nTextMarkupCount( pTextMarkup->getTextMarkupCount( nTextMarkupType ) ); + if ( nTextMarkupCount > 0 ) + { + for ( gint nTextMarkupIndex = 0; + nTextMarkupIndex < nTextMarkupCount; + ++nTextMarkupIndex ) + { + accessibility::TextSegment aTextSegment = + pTextMarkup->getTextMarkup( nTextMarkupIndex, nTextMarkupType ); + const gint nStartOffsetTextMarkup = aTextSegment.SegmentStart; + const gint nEndOffsetTextMarkup = aTextSegment.SegmentEnd; + if ( nStartOffsetTextMarkup <= offset ) + { + if ( offset < nEndOffsetTextMarkup ) + { + // text markup at <offset> + *start_offset = ::std::max( *start_offset, + nStartOffsetTextMarkup ); + *end_offset = ::std::min( *end_offset, + nEndOffsetTextMarkup ); + switch ( nTextMarkupType ) + { + case com::sun::star::text::TextMarkupType::SPELLCHECK: + { + pSet = attribute_set_prepend_misspelled( pSet ); + } + break; + case com::sun::star::text::TextMarkupType::TRACK_CHANGE_INSERTION: + { + pSet = attribute_set_prepend_tracked_change_insertion( pSet ); + } + break; + case com::sun::star::text::TextMarkupType::TRACK_CHANGE_DELETION: + { + pSet = attribute_set_prepend_tracked_change_deletion( pSet ); + } + break; + case com::sun::star::text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE: + { + pSet = attribute_set_prepend_tracked_change_formatchange( pSet ); + } + break; + default: + { + OSL_ASSERT( false ); + } + } + break; // no further iteration needed. + } + else + { + *start_offset = ::std::max( *start_offset, + nEndOffsetTextMarkup ); + // continue iteration. + } + } + else + { + *end_offset = ::std::min( *end_offset, + nStartOffsetTextMarkup ); + break; // no further iteration. + } + } // eof iteration over text markups + } + + return pSet; +} +// <-- + static AtkAttributeSet * text_wrapper_get_run_attributes( AtkText *text, gint offset, @@ -491,41 +569,41 @@ text_wrapper_get_run_attributes( AtkText *text, } } - // Special handling for missspelled + // Special handling for misspelled text + // --> OD 2010-03-01 #i92232# + // - add special handling for tracked changes and refactor the + // corresponding code for handling misspelled text. accessibility::XAccessibleTextMarkup* pTextMarkup = getTextMarkup( text ); if( pTextMarkup ) { - uno::Sequence< accessibility::TextSegment > aTextSegmentSeq = - pTextMarkup->getTextMarkupAtIndex( offset, com::sun::star::text::TextMarkupType::SPELLCHECK ); - if( aTextSegmentSeq.getLength() > 0 ) + // Get attribute run here if it hasn't been done before + if( !bOffsetsAreValid ) { - accessibility::TextSegment aTextSegment = aTextSegmentSeq[0]; - gint nStartOffsetMisspelled = aTextSegment.SegmentStart; - gint nEndOffsetMisspelled = aTextSegment.SegmentEnd; - - // Get attribute run here if it hasn't been done before - if( !bOffsetsAreValid ) - { - accessibility::TextSegment aAttributeTextSegment = - pText->getTextAtIndex(offset, accessibility::AccessibleTextType::ATTRIBUTE_RUN); - *start_offset = aAttributeTextSegment.SegmentStart; - *end_offset = aAttributeTextSegment.SegmentEnd; - } - - if( nEndOffsetMisspelled <= offset ) - *start_offset = ::std::max( *start_offset, nEndOffsetMisspelled ); - else if( nStartOffsetMisspelled <= offset ) - *start_offset = ::std::max( *start_offset, nStartOffsetMisspelled ); - - if( nStartOffsetMisspelled > offset ) - *end_offset = ::std::min( *end_offset, nStartOffsetMisspelled ); - else if( nEndOffsetMisspelled > offset ) - *end_offset = ::std::min( *end_offset, nEndOffsetMisspelled ); - - if( nStartOffsetMisspelled <= offset && nEndOffsetMisspelled > offset ) - pSet = attribute_set_prepend_misspelled( pSet ); + accessibility::TextSegment aAttributeTextSegment = + pText->getTextAtIndex(offset, accessibility::AccessibleTextType::ATTRIBUTE_RUN); + *start_offset = aAttributeTextSegment.SegmentStart; + *end_offset = aAttributeTextSegment.SegmentEnd; } + // handle misspelled text + pSet = handle_text_markup_as_run_attribute( + pTextMarkup, + com::sun::star::text::TextMarkupType::SPELLCHECK, + offset, pSet, start_offset, end_offset ); + // handle tracked changes + pSet = handle_text_markup_as_run_attribute( + pTextMarkup, + com::sun::star::text::TextMarkupType::TRACK_CHANGE_INSERTION, + offset, pSet, start_offset, end_offset ); + pSet = handle_text_markup_as_run_attribute( + pTextMarkup, + com::sun::star::text::TextMarkupType::TRACK_CHANGE_DELETION, + offset, pSet, start_offset, end_offset ); + pSet = handle_text_markup_as_run_attribute( + pTextMarkup, + com::sun::star::text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE, + offset, pSet, start_offset, end_offset ); } + // <-- } catch(const uno::Exception& e){ diff --git a/vcl/unx/gtk/a11y/atktextattributes.cxx b/vcl/unx/gtk/a11y/atktextattributes.cxx index 02624a9628cf..04498810597f 100644 --- a/vcl/unx/gtk/a11y/atktextattributes.cxx +++ b/vcl/unx/gtk/a11y/atktextattributes.cxx @@ -74,6 +74,12 @@ static AtkTextAttribute atk_text_attribute_tab_stops = ATK_TEXT_ATTR_INVALID; static AtkTextAttribute atk_text_attribute_writing_mode = ATK_TEXT_ATTR_INVALID; static AtkTextAttribute atk_text_attribute_vertical_align = ATK_TEXT_ATTR_INVALID; static AtkTextAttribute atk_text_attribute_misspelled = ATK_TEXT_ATTR_INVALID; +// --> OD 2010-03-01 #i92232# +static AtkTextAttribute atk_text_attribute_tracked_change = ATK_TEXT_ATTR_INVALID; +// <-- +// --> OD 2010-03-05 #i92233# +static AtkTextAttribute atk_text_attribute_mm_to_pixel_ratio = ATK_TEXT_ATTR_INVALID; +// <-- /*****************************************************************************/ @@ -103,6 +109,9 @@ enum ExportedAttribute TEXT_ATTRIBUTE_STRIKETHROUGH, TEXT_ATTRIBUTE_UNDERLINE, TEXT_ATTRIBUTE_WEIGHT, + // --> OD 2010-03-05 #i92233# + TEXT_ATTRIBUTE_MM_TO_PIXEL_RATIO, + // <-- TEXT_ATTRIBUTE_JUSTIFICATION, TEXT_ATTRIBUTE_BOTTOM_MARGIN, TEXT_ATTRIBUTE_FIRST_LINE_INDENT, @@ -137,6 +146,9 @@ static const char * ExportedTextAttributes[TEXT_ATTRIBUTE_LAST] = "CharStrikeout", // TEXT_ATTRIBUTE_STRIKETHROUGH "CharUnderline", // TEXT_ATTRIBUTE_UNDERLINE "CharWeight", // TEXT_ATTRIBUTE_WEIGHT + // --> OD 2010-03-05 #i92233# + "MMToPixelRatio", // TEXT_ATTRIBUTE_MM_TO_PIXEL_RATIO + // <-- "ParaAdjust", // TEXT_ATTRIBUTE_JUSTIFICATION "ParaBottomMargin", // TEXT_ATTRIBUTE_BOTTOM_MARGIN "ParaFirstLineIndent", // TEXT_ATTRIBUTE_FIRST_LINE_INDENT @@ -1293,6 +1305,14 @@ attribute_set_new_from_property_values( attribute_set = attribute_set_prepend(attribute_set, atk_text_attribute_tab_stops, get_value(rAttributeList, aIndexList[TEXT_ATTRIBUTE_TAB_STOPS], TabStops2String)); + // --> OD 2010-03-05 #i92233# + if( ATK_TEXT_ATTR_INVALID == atk_text_attribute_mm_to_pixel_ratio ) + atk_text_attribute_mm_to_pixel_ratio = atk_text_attribute_register("mm-to-pixel-ratio"); + + attribute_set = attribute_set_prepend( attribute_set, atk_text_attribute_mm_to_pixel_ratio, + get_value(rAttributeList, aIndexList[TEXT_ATTRIBUTE_MM_TO_PIXEL_RATIO], Float2String)); + // <-- + return attribute_set; } @@ -1308,6 +1328,49 @@ AtkAttributeSet* attribute_set_prepend_misspelled( AtkAttributeSet* attribute_se return attribute_set; } +// --> OD 2010-03-01 #i92232# +AtkAttributeSet* attribute_set_prepend_tracked_change_insertion( AtkAttributeSet* attribute_set ) +{ + if ( ATK_TEXT_ATTR_INVALID == atk_text_attribute_tracked_change ) + { + atk_text_attribute_tracked_change = atk_text_attribute_register( "text-tracked-change" ); + } + + attribute_set = attribute_set_prepend( attribute_set, + atk_text_attribute_tracked_change, + g_strdup_printf( "insertion" ) ); + + return attribute_set; +} + +AtkAttributeSet* attribute_set_prepend_tracked_change_deletion( AtkAttributeSet* attribute_set ) +{ + if ( ATK_TEXT_ATTR_INVALID == atk_text_attribute_tracked_change ) + { + atk_text_attribute_tracked_change = atk_text_attribute_register( "text-tracked-change" ); + } + + attribute_set = attribute_set_prepend( attribute_set, + atk_text_attribute_tracked_change, + g_strdup_printf( "deletion" ) ); + + return attribute_set; +} + +AtkAttributeSet* attribute_set_prepend_tracked_change_formatchange( AtkAttributeSet* attribute_set ) +{ + if ( ATK_TEXT_ATTR_INVALID == atk_text_attribute_tracked_change ) + { + atk_text_attribute_tracked_change = atk_text_attribute_register( "text-tracked-change" ); + } + + attribute_set = attribute_set_prepend( attribute_set, + atk_text_attribute_tracked_change, + g_strdup_printf( "attribute-change" ) ); + + return attribute_set; +} +// <-- /*****************************************************************************/ diff --git a/vcl/unx/gtk/a11y/atktextattributes.hxx b/vcl/unx/gtk/a11y/atktextattributes.hxx index e363460bb578..9c7628bf927e 100644 --- a/vcl/unx/gtk/a11y/atktextattributes.hxx +++ b/vcl/unx/gtk/a11y/atktextattributes.hxx @@ -45,5 +45,10 @@ attribute_set_map_to_property_values( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rValueList ); AtkAttributeSet* attribute_set_prepend_misspelled( AtkAttributeSet* attribute_set ); +// --> OD 2010-03-01 #i92232# +AtkAttributeSet* attribute_set_prepend_tracked_change_insertion( AtkAttributeSet* attribute_set ); +AtkAttributeSet* attribute_set_prepend_tracked_change_deletion( AtkAttributeSet* attribute_set ); +AtkAttributeSet* attribute_set_prepend_tracked_change_formatchange( AtkAttributeSet* attribute_set ); +// <-- #endif diff --git a/vcl/unx/gtk/a11y/atkwindow.cxx b/vcl/unx/gtk/a11y/atkwindow.cxx index f588c1e345e4..5448235998e8 100644 --- a/vcl/unx/gtk/a11y/atkwindow.cxx +++ b/vcl/unx/gtk/a11y/atkwindow.cxx @@ -143,6 +143,22 @@ ooo_window_wrapper_real_focus_gtk (GtkWidget *, GdkEventFocus *) return FALSE; } +static gboolean ooo_tooltip_map( GtkWidget* pToolTip, gpointer ) +{ + AtkObject* pAccessible = gtk_widget_get_accessible( pToolTip ); + if( pAccessible ) + atk_object_notify_state_change( pAccessible, ATK_STATE_SHOWING, TRUE ); + return FALSE; +} + +static gboolean ooo_tooltip_unmap( GtkWidget* pToolTip, gpointer ) +{ + AtkObject* pAccessible = gtk_widget_get_accessible( pToolTip ); + if( pAccessible ) + atk_object_notify_state_change( pAccessible, ATK_STATE_SHOWING, FALSE ); + return FALSE; +} + /*****************************************************************************/ static bool @@ -208,6 +224,16 @@ ooo_window_wrapper_real_initialize(AtkObject *obj, gpointer data) g_signal_connect_after( GTK_WIDGET( data ), "focus-out-event", G_CALLBACK (ooo_window_wrapper_real_focus_gtk), NULL); + + if( obj->role == ATK_ROLE_TOOL_TIP ) + { + g_signal_connect_after( GTK_WIDGET( data ), "map-event", + G_CALLBACK (ooo_tooltip_map), + NULL); + g_signal_connect_after( GTK_WIDGET( data ), "unmap-event", + G_CALLBACK (ooo_tooltip_unmap), + NULL); + } } /*****************************************************************************/ diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx index 5beb838c0e82..10f75309708d 100644 --- a/vcl/unx/gtk/a11y/atkwrapper.cxx +++ b/vcl/unx/gtk/a11y/atkwrapper.cxx @@ -283,7 +283,9 @@ static AtkRole mapToAtkRole( sal_Int16 nRole ) ATK_ROLE_RULER, ATK_ROLE_UNKNOWN, // SECTION - registered below ATK_ROLE_UNKNOWN, // TREE_ITEM - registered below - ATK_ROLE_TREE_TABLE + ATK_ROLE_TREE_TABLE, + ATK_ROLE_SCROLL_PANE, // COMMENT - mapped to atk_role_scroll_pane + ATK_ROLE_UNKNOWN // COMMENT_END - mapped to atk_role_unknown }; static bool initialized = false; diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index d1e5c5954352..f63f999738a7 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -800,15 +800,12 @@ void GtkXLib::Yield( bool bWait, bool bHandleAllCurrentEvents ) */ bool bDispatchThread = false; + gboolean wasEvent = FALSE; { // release YieldMutex (and re-acquire at block end) YieldMutexReleaser aReleaser; if( osl_tryToAcquireMutex( m_aDispatchMutex ) ) - { - // we are the dispatch thread - osl_resetCondition( m_aDispatchCondition ); bDispatchThread = true; - } else if( ! bWait ) return; // someone else is waiting already, return @@ -816,7 +813,7 @@ void GtkXLib::Yield( bool bWait, bool bHandleAllCurrentEvents ) if( bDispatchThread ) { int nMaxEvents = bHandleAllCurrentEvents ? 100 : 1; - gboolean wasEvent = FALSE, wasOneEvent = TRUE; + gboolean wasOneEvent = TRUE; while( nMaxEvents-- && wasOneEvent ) { wasOneEvent = g_main_context_iteration( NULL, FALSE ); @@ -824,17 +821,17 @@ void GtkXLib::Yield( bool bWait, bool bHandleAllCurrentEvents ) wasEvent = TRUE; } if( bWait && ! wasEvent ) - g_main_context_iteration( NULL, TRUE ); + wasEvent = g_main_context_iteration( NULL, TRUE ); } - else if( userEventFn( this ) ) + else if( bWait ) { /* #i41693# in case the dispatch thread hangs in join * for this thread the condition will never be set * workaround: timeout of 1 second a emergency exit */ - TimeValue aValue; - aValue.Seconds = 1; - aValue.Nanosec = 0; + // we are the dispatch thread + osl_resetCondition( m_aDispatchCondition ); + TimeValue aValue = { 1, 0 }; osl_waitCondition( m_aDispatchCondition, &aValue ); } } @@ -842,8 +839,8 @@ void GtkXLib::Yield( bool bWait, bool bHandleAllCurrentEvents ) if( bDispatchThread ) { osl_releaseMutex( m_aDispatchMutex ); - osl_setCondition( m_aDispatchCondition ); // trigger non dispatch thread yields - osl_resetCondition( m_aDispatchCondition ); + if( wasEvent ) + osl_setCondition( m_aDispatchCondition ); // trigger non dispatch thread yields } } diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index de4d55b0230a..244c001b3aa0 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -191,34 +191,34 @@ static void NWCalcArrowRect( const Rectangle& rButton, Rectangle& rArrow ); //--- static Rectangle NWGetButtonArea( int nScreen, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption ); + const ImplControlValue& aValue, const OUString& rCaption ); //--- static Rectangle NWGetEditBoxPixmapRect( int nScreen, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption ); + const ImplControlValue& aValue, const OUString& rCaption ); static void NWPaintOneEditBox( int nScreen, GdkDrawable * gdkDrawable, GdkRectangle *gdkRect, ControlType nType, ControlPart nPart, Rectangle aEditBoxRect, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); //--- static Rectangle NWGetSpinButtonRect( int nScreen, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption ); + const ImplControlValue& aValue, const OUString& rCaption ); static void NWPaintOneSpinButton( int nScreen, GdkPixmap * pixmap, ControlType nType, ControlPart nPart, Rectangle aAreaRect, - ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, + ControlState nState, const ImplControlValue& aValue, const OUString& rCaption ); //--- static Rectangle NWGetComboBoxButtonRect( int nScreen, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption ); + const ImplControlValue& aValue, const OUString& rCaption ); //--- static Rectangle NWGetListBoxButtonRect( int nScreen, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption ); + const ImplControlValue& aValue, const OUString& rCaption ); static Rectangle NWGetListBoxIndicatorRect( int nScreen, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption ); + const ImplControlValue& aValue, const OUString& rCaption ); static Rectangle NWGetToolbarRect( int nScreen, ControlType nType, @@ -226,7 +226,6 @@ static Rectangle NWGetToolbarRect( int nScreen, Rectangle aAreaRect, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); //--- @@ -620,7 +619,6 @@ BOOL GtkSalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, const Point& aPos, - SalControlHandle&, BOOL& rIsInside ) { if ( ( nType == CTRL_SCROLLBAR ) && @@ -725,7 +723,6 @@ BOOL GtkSalGraphics::hitTestNativeControl( ControlType nType, * * rControlRegion: The bounding region of the complete control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation. * rCaption: A caption or title string (like button text etc) */ BOOL GtkSalGraphics::drawNativeControl( ControlType nType, @@ -733,13 +730,12 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ) { if( (nType==CTRL_CHECKBOX) && (nPart==PART_ENTIRE_CONTROL) && aValue.getTristateVal() == BUTTONVALUE_MIXED ) { - return drawNativeMixedStateCheck( nType, nPart, rControlRegion, nState, aValue, rControlHandle, rCaption ); + return drawNativeMixedStateCheck( nType, nPart, rControlRegion, nState, aValue, rCaption ); } BOOL returnVal = FALSE; @@ -802,61 +798,61 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType, if ( (nType==CTRL_PUSHBUTTON) && (nPart==PART_ENTIRE_CONTROL) ) { - returnVal = NWPaintGTKButton( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKButton( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if ( (nType==CTRL_RADIOBUTTON) && (nPart==PART_ENTIRE_CONTROL) ) { - returnVal = NWPaintGTKRadio( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKRadio( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if ( (nType==CTRL_CHECKBOX) && (nPart==PART_ENTIRE_CONTROL) ) { - returnVal = NWPaintGTKCheck( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKCheck( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if ( (nType==CTRL_SCROLLBAR) && ((nPart==PART_DRAW_BACKGROUND_HORZ) || (nPart==PART_DRAW_BACKGROUND_VERT)) ) { - returnVal = NWPaintGTKScrollbar( nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKScrollbar( nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if ( ((nType==CTRL_EDITBOX) && ((nPart==PART_ENTIRE_CONTROL) || (nPart==HAS_BACKGROUND_TEXTURE)) ) || ((nType==CTRL_SPINBOX) && (nPart==HAS_BACKGROUND_TEXTURE)) || ((nType==CTRL_COMBOBOX) && (nPart==HAS_BACKGROUND_TEXTURE)) || ((nType==CTRL_LISTBOX) && (nPart==HAS_BACKGROUND_TEXTURE)) ) { - returnVal = NWPaintGTKEditBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKEditBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if ( ((nType==CTRL_MULTILINE_EDITBOX) && ((nPart==PART_ENTIRE_CONTROL) || (nPart==HAS_BACKGROUND_TEXTURE)) ) ) { - returnVal = NWPaintGTKEditBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKEditBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if ( ((nType==CTRL_SPINBOX) || (nType==CTRL_SPINBUTTONS)) && ((nPart==PART_ENTIRE_CONTROL) || (nPart==PART_ALL_BUTTONS)) ) { - returnVal = NWPaintGTKSpinBox( nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKSpinBox( nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if ( (nType == CTRL_COMBOBOX) && ( (nPart==PART_ENTIRE_CONTROL) ||(nPart==PART_BUTTON_DOWN) ) ) { - returnVal = NWPaintGTKComboBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKComboBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if ( (nType==CTRL_TAB_ITEM) || (nType==CTRL_TAB_PANE) || (nType==CTRL_TAB_BODY) || (nType==CTRL_FIXEDBORDER) ) { if ( nType == CTRL_TAB_BODY ) returnVal = TRUE; else - returnVal = NWPaintGTKTabItem( nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption); + returnVal = NWPaintGTKTabItem( nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption); } else if ( (nType==CTRL_LISTBOX) && ((nPart==PART_ENTIRE_CONTROL) || (nPart==PART_WINDOW)) ) { - returnVal = NWPaintGTKListBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKListBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if ( (nType== CTRL_TOOLBAR) ) { - returnVal = NWPaintGTKToolbar( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKToolbar( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if ( (nType== CTRL_MENUBAR) ) { - returnVal = NWPaintGTKMenubar( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKMenubar( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if( (nType == CTRL_MENU_POPUP) && ( (nPart == PART_ENTIRE_CONTROL) @@ -866,19 +862,19 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType, ) ) { - returnVal = NWPaintGTKPopupMenu( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKPopupMenu( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if( (nType == CTRL_TOOLTIP) && (nPart == PART_ENTIRE_CONTROL) ) { - returnVal = NWPaintGTKTooltip( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKTooltip( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if( (nType == CTRL_PROGRESS) && (nPart == PART_ENTIRE_CONTROL) ) { - returnVal = NWPaintGTKProgress( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKProgress( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if( (nType == CTRL_LISTNODE) && (nPart == PART_ENTIRE_CONTROL) ) { - returnVal = NWPaintGTKListNode( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKListNode( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if( (nType == CTRL_LISTNET) && (nPart == PART_ENTIRE_CONTROL) ) { @@ -887,7 +883,7 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType, } else if( (nType == CTRL_SLIDER) ) { - returnVal = NWPaintGTKSlider( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKSlider( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } if( pixmap ) @@ -904,7 +900,6 @@ BOOL GtkSalGraphics::drawNativeMixedStateCheck( ControlType nType, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ) { // need to emulate something for mixed state @@ -927,7 +922,7 @@ BOOL GtkSalGraphics::drawNativeMixedStateCheck( ControlType nType, SetClipRegion( pFontGC_, aRegion ); XDestroyRegion( aRegion ); - returnVal = drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rControlHandle, rCaption ); + returnVal = drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rCaption ); if( returnVal ) { @@ -938,7 +933,7 @@ BOOL GtkSalGraphics::drawNativeMixedStateCheck( ControlType nType, XUnionRectWithRegion( &aXRect, aRegion, aRegion ); SetClipRegion( pFontGC_, aRegion ); XDestroyRegion( aRegion ); - returnVal = drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rControlHandle, rCaption ); + returnVal = drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rCaption ); } // clean up @@ -957,7 +952,6 @@ BOOL GtkSalGraphics::drawNativeMixedStateCheck( ControlType nType, * * rControlRegion: The bounding region of the complete control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation. * rCaption: A caption or title string (like button text etc) */ BOOL GtkSalGraphics::drawNativeControlText( ControlType, @@ -965,7 +959,6 @@ BOOL GtkSalGraphics::drawNativeControlText( ControlType, const Region&, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString& ) { return( FALSE ); @@ -983,7 +976,6 @@ BOOL GtkSalGraphics::drawNativeControlText( ControlType, * * rControlRegion: The bounding region of the control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation. * rCaption: A caption or title string (like button text etc) */ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, @@ -991,7 +983,6 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion ) @@ -1003,7 +994,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, && (rControlRegion.GetBoundRect().GetHeight() > 16) ) { rNativeBoundingRegion = NWGetButtonArea( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), - nState, aValue, rControlHandle, rCaption ); + nState, aValue, rCaption ); rNativeContentRegion = rControlRegion; returnVal = TRUE; @@ -1011,7 +1002,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, if ( (nType==CTRL_COMBOBOX) && ((nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) ) { rNativeBoundingRegion = NWGetComboBoxButtonRect( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), nState, - aValue, rControlHandle, rCaption ); + aValue, rCaption ); rNativeContentRegion = rNativeBoundingRegion; returnVal = TRUE; @@ -1020,7 +1011,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, { rNativeBoundingRegion = NWGetSpinButtonRect( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), nState, - aValue, rControlHandle, rCaption ); + aValue, rCaption ); rNativeContentRegion = rNativeBoundingRegion; returnVal = TRUE; @@ -1028,7 +1019,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, if ( (nType==CTRL_LISTBOX) && ((nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) ) { rNativeBoundingRegion = NWGetListBoxButtonRect( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), nState, - aValue, rControlHandle, rCaption ); + aValue, rCaption ); rNativeContentRegion = rNativeBoundingRegion; returnVal = TRUE; @@ -1041,7 +1032,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, (nPart==PART_BUTTON) )) { - rNativeBoundingRegion = NWGetToolbarRect( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), nState, aValue, rControlHandle, rCaption ); + rNativeBoundingRegion = NWGetToolbarRect( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), nState, aValue, rCaption ); rNativeContentRegion = rNativeBoundingRegion; returnVal = TRUE; } @@ -1155,7 +1146,7 @@ BOOL GtkSalGraphics::NWPaintGTKButton( const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue&, - SalControlHandle&, const OUString& ) + const OUString& ) { GtkStateType stateType; GtkShadowType shadowType; @@ -1268,7 +1259,7 @@ BOOL GtkSalGraphics::NWPaintGTKButton( static Rectangle NWGetButtonArea( int nScreen, ControlType, ControlPart, Rectangle aAreaRect, ControlState nState, - const ImplControlValue&, SalControlHandle&, const OUString& ) + const ImplControlValue&, const OUString& ) { gboolean interiorFocus; gint focusWidth; @@ -1324,7 +1315,7 @@ BOOL GtkSalGraphics::NWPaintGTKRadio( GdkDrawable* gdkDrawable, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, - const ImplControlValue& aValue, SalControlHandle&, + const ImplControlValue& aValue, const OUString& ) { GtkStateType stateType; @@ -1383,7 +1374,7 @@ BOOL GtkSalGraphics::NWPaintGTKCheck( GdkDrawable* gdkDrawable, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle&, const OUString& ) + const OUString& ) { GtkStateType stateType; GtkShadowType shadowType; @@ -1438,7 +1429,7 @@ BOOL GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList&, ControlState nState, - const ImplControlValue& aValue, SalControlHandle&, + const ImplControlValue& aValue, const OUString& ) { ScrollbarValue* pScrollbarVal = (ScrollbarValue *)(aValue.getOptionalVal()); @@ -1844,7 +1835,7 @@ BOOL GtkSalGraphics::NWPaintGTKEditBox( GdkDrawable* gdkDrawable, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, + const ImplControlValue& aValue, const OUString& rCaption ) { Rectangle pixmapRect; @@ -1853,7 +1844,7 @@ BOOL GtkSalGraphics::NWPaintGTKEditBox( GdkDrawable* gdkDrawable, // Find the overall bounding rect of the buttons's drawing area, // plus its actual draw rect excluding adornment pixmapRect = NWGetEditBoxPixmapRect( m_nScreen, nType, nPart, rControlRectangle, - nState, aValue, rControlHandle, rCaption ); + nState, aValue, rCaption ); for( clipList::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it ) { clipRect.x = it->Left(); @@ -1861,7 +1852,7 @@ BOOL GtkSalGraphics::NWPaintGTKEditBox( GdkDrawable* gdkDrawable, clipRect.width = it->GetWidth(); clipRect.height = it->GetHeight(); - NWPaintOneEditBox( m_nScreen, gdkDrawable, &clipRect, nType, nPart, pixmapRect, nState, aValue, rControlHandle, rCaption ); + NWPaintOneEditBox( m_nScreen, gdkDrawable, &clipRect, nType, nPart, pixmapRect, nState, aValue, rCaption ); } return( TRUE ); @@ -1878,7 +1869,6 @@ static Rectangle NWGetEditBoxPixmapRect(int nScreen, Rectangle aAreaRect, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString& ) { Rectangle pixmapRect = aAreaRect; @@ -1915,7 +1905,6 @@ static void NWPaintOneEditBox( int nScreen, Rectangle aEditBoxRect, ControlState nState, const ImplControlValue&, - SalControlHandle&, const OUString& ) { GtkStateType stateType; @@ -1984,7 +1973,7 @@ BOOL GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart, const clipList&, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ) + const OUString& rCaption ) { GdkPixmap * pixmap; Rectangle pixmapRect; @@ -2032,8 +2021,8 @@ BOOL GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart, if ( !pixmap ) return( FALSE ); - upBtnRect = NWGetSpinButtonRect( m_nScreen, nType, upBtnPart, pixmapRect, upBtnState, aValue, rControlHandle, rCaption ); - downBtnRect = NWGetSpinButtonRect( m_nScreen, nType, downBtnPart, pixmapRect, downBtnState, aValue, rControlHandle, rCaption ); + upBtnRect = NWGetSpinButtonRect( m_nScreen, nType, upBtnPart, pixmapRect, upBtnState, aValue, rCaption ); + downBtnRect = NWGetSpinButtonRect( m_nScreen, nType, downBtnPart, pixmapRect, downBtnState, aValue, rCaption ); if ( (nType==CTRL_SPINBOX) && (nPart!=PART_ALL_BUTTONS) ) { @@ -2043,7 +2032,7 @@ BOOL GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart, aEditBoxRect.setX( 0 ); aEditBoxRect.setY( 0 ); - NWPaintOneEditBox( m_nScreen, pixmap, NULL, nType, nPart, aEditBoxRect, nState, aValue, rControlHandle, rCaption ); + NWPaintOneEditBox( m_nScreen, pixmap, NULL, nType, nPart, aEditBoxRect, nState, aValue, rCaption ); } NWSetWidgetState( gWidgetData[m_nScreen].gSpinButtonWidget, nState, stateType ); @@ -2060,8 +2049,8 @@ BOOL GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart, shadowRect.GetWidth(), shadowRect.GetHeight() ); } - NWPaintOneSpinButton( m_nScreen, pixmap, nType, upBtnPart, pixmapRect, upBtnState, aValue, rControlHandle, rCaption ); - NWPaintOneSpinButton( m_nScreen, pixmap, nType, downBtnPart, pixmapRect, downBtnState, aValue, rControlHandle, rCaption ); + NWPaintOneSpinButton( m_nScreen, pixmap, nType, upBtnPart, pixmapRect, upBtnState, aValue, rCaption ); + NWPaintOneSpinButton( m_nScreen, pixmap, nType, downBtnPart, pixmapRect, downBtnState, aValue, rCaption ); if( !NWRenderPixmapToScreen(pixmap, pixmapRect) ) { @@ -2081,7 +2070,6 @@ static Rectangle NWGetSpinButtonRect( int nScreen, Rectangle aAreaRect, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString& ) { gint buttonSize; @@ -2125,7 +2113,6 @@ static void NWPaintOneSpinButton( int nScreen, Rectangle aAreaRect, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ) { Rectangle buttonRect; @@ -2137,7 +2124,7 @@ static void NWPaintOneSpinButton( int nScreen, NWEnsureGTKSpinButton( nScreen ); NWConvertVCLStateToGTKState( nState, &stateType, &shadowType ); - buttonRect = NWGetSpinButtonRect( nScreen, nType, nPart, aAreaRect, nState, aValue, rControlHandle, rCaption ); + buttonRect = NWGetSpinButtonRect( nScreen, nType, nPart, aAreaRect, nState, aValue, rCaption ); NWSetWidgetState( gWidgetData[nScreen].gSpinButtonWidget, nState, stateType ); gtk_paint_box( gWidgetData[nScreen].gSpinButtonWidget->style, pixmap, stateType, shadowType, NULL, gWidgetData[nScreen].gSpinButtonWidget, @@ -2169,7 +2156,7 @@ BOOL GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ) + const OUString& rCaption ) { Rectangle pixmapRect; Rectangle buttonRect; @@ -2194,7 +2181,7 @@ BOOL GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable, NWSetWidgetState( gWidgetData[m_nScreen].gComboWidget, nState, stateType ); NWSetWidgetState( gWidgetData[m_nScreen].gArrowWidget, nState, stateType ); - buttonRect = NWGetComboBoxButtonRect( m_nScreen, nType, PART_BUTTON_DOWN, pixmapRect, nState, aValue, rControlHandle, rCaption ); + buttonRect = NWGetComboBoxButtonRect( m_nScreen, nType, PART_BUTTON_DOWN, pixmapRect, nState, aValue, rCaption ); if( nPart == PART_BUTTON_DOWN ) buttonRect.Left() += 1; @@ -2216,7 +2203,7 @@ BOOL GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable, if( nPart == PART_ENTIRE_CONTROL ) NWPaintOneEditBox( m_nScreen, gdkDrawable, &clipRect, nType, nPart, aEditBoxRect, - nState, aValue, rControlHandle, rCaption ); + nState, aValue, rCaption ); // Buttons must paint opaque since some themes have alpha-channel enabled buttons gtk_paint_flat_box( gWidgetData[m_nScreen].gBtnWidget->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE, @@ -2247,7 +2234,6 @@ static Rectangle NWGetComboBoxButtonRect( int nScreen, Rectangle aAreaRect, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString& ) { Rectangle aButtonRect; @@ -2302,7 +2288,7 @@ BOOL GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart, const clipList&, ControlState nState, const ImplControlValue& aValue, - SalControlHandle&, const OUString& ) + const OUString& ) { GdkPixmap * pixmap; Rectangle pixmapRect; @@ -2444,7 +2430,7 @@ BOOL GtkSalGraphics::NWPaintGTKListBox( GdkDrawable* gdkDrawable, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ) + const OUString& rCaption ) { Rectangle pixmapRect; Rectangle widgetRect; @@ -2511,7 +2497,7 @@ BOOL GtkSalGraphics::NWPaintGTKListBox( GdkDrawable* gdkDrawable, y+(widgetRect.Top() - pixmapRect.Top()), widgetRect.GetWidth(), widgetRect.GetHeight() ); aIndicatorRect = NWGetListBoxIndicatorRect( m_nScreen, nType, nPart, widgetRect, nState, - aValue, rControlHandle, rCaption ); + aValue, rCaption ); gtk_paint_tab( gWidgetData[m_nScreen].gOptionMenuWidget->style, gdkDrawable, stateType, shadowType, &clipRect, gWidgetData[m_nScreen].gOptionMenuWidget, "optionmenutab", x+(aIndicatorRect.Left() - pixmapRect.Left()), @@ -2538,7 +2524,7 @@ BOOL GtkSalGraphics::NWPaintGTKToolbar( const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle&, const OUString& ) + const OUString& ) { GtkStateType stateType; GtkShadowType shadowType; @@ -2685,7 +2671,7 @@ BOOL GtkSalGraphics::NWPaintGTKMenubar( const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue&, - SalControlHandle&, const OUString& ) + const OUString& ) { GtkStateType stateType; GtkShadowType shadowType; @@ -2770,7 +2756,7 @@ BOOL GtkSalGraphics::NWPaintGTKPopupMenu( const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue&, - SalControlHandle&, const OUString& ) + const OUString& ) { // #i50745# gtk does not draw disabled menu entries (and crux theme // even crashes), draw them using vcl functionality. @@ -2900,7 +2886,7 @@ BOOL GtkSalGraphics::NWPaintGTKTooltip( const Rectangle& rControlRectangle, const clipList& rClipList, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString& ) + const OUString& ) { NWEnsureGTKTooltip( m_nScreen ); @@ -2938,7 +2924,7 @@ BOOL GtkSalGraphics::NWPaintGTKListNode( const Rectangle& rControlRectangle, const clipList&, ControlState nState, const ImplControlValue& rValue, - SalControlHandle&, const OUString& ) + const OUString& ) { NWEnsureGTKTreeView( m_nScreen ); @@ -2992,7 +2978,7 @@ BOOL GtkSalGraphics::NWPaintGTKProgress( const Rectangle& rControlRectangle, const clipList&, ControlState, const ImplControlValue& rValue, - SalControlHandle&, const OUString& ) + const OUString& ) { NWEnsureGTKProgressBar( m_nScreen ); @@ -3056,7 +3042,7 @@ BOOL GtkSalGraphics::NWPaintGTKSlider( const Rectangle& rControlRectangle, const clipList&, ControlState nState, const ImplControlValue& rValue, - SalControlHandle&, const OUString& ) + const OUString& ) { NWEnsureGTKSlider( m_nScreen ); @@ -3185,7 +3171,6 @@ static Rectangle NWGetListBoxButtonRect( int nScreen, Rectangle aAreaRect, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString& ) { Rectangle aPartRect; @@ -3248,7 +3233,6 @@ static Rectangle NWGetListBoxIndicatorRect( int nScreen, Rectangle aAreaRect, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString& ) { Rectangle aIndicatorRect; @@ -3295,7 +3279,6 @@ static Rectangle NWGetToolbarRect( int nScreen, Rectangle aAreaRect, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString& ) { Rectangle aRet; diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index ef356eb57aa9..3d11ce8a37ea 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -566,6 +566,7 @@ void GtkSalFrame::InitCommon() m_nExtStyle = 0; m_pRegion = NULL; m_ePointerStyle = 0xffff; + m_bSetFocusOnMap = false; gtk_widget_set_app_paintable( m_pWindow, TRUE ); gtk_widget_set_double_buffered( m_pWindow, FALSE ); @@ -690,7 +691,7 @@ static void lcl_set_accept_focus( GtkWindow* pWindow, gboolean bAccept, bool bBe XFree( pHints ); if (GetX11SalData()->GetDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("compiz")) - return; + return; /* remove WM_TAKE_FOCUS protocol; this would usually be the * right thing, but gtk handles it internally whereas we @@ -803,18 +804,6 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) ( ! (nStyle & SAL_FRAME_STYLE_FLOAT) || (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION|SAL_FRAME_STYLE_FLOAT_FOCUSABLE) ) ); - /* #i100116# metacity has a peculiar behavior regarding WM_HINT accept focus and _NET_WM_USER_TIME - at some point that may be fixed in metacity and we will have to revisit this - */ - - // MT/PL 2010/02: #i102694# and #i102803# have been introduced by this hack - // Nowadays the original issue referenced above doesn't seem to exist anymore, tested different szenarious described in the issues - // If some older versions of MetaCity are still in use somewhere, they need to be updated, instead of using strange hacks in OOo. - // As a work around for such old systems, people might consider to not use the GTK plugin. - - bool bMetaCityToolWindowHack = false; - // bMetaCityToolWindowHack = getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity") && (nStyle & SAL_FRAME_STYLE_TOOLWINDOW ); - if( bDecoHandling ) { bool bNoDecor = ! (nStyle & (SAL_FRAME_STYLE_MOVEABLE | SAL_FRAME_STYLE_SIZEABLE | SAL_FRAME_STYLE_CLOSEABLE ) ); @@ -830,8 +819,6 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) { eType = GDK_WINDOW_TYPE_HINT_UTILITY; gtk_window_set_skip_taskbar_hint( GTK_WINDOW(m_pWindow), true ); - if( bMetaCityToolWindowHack ) - lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, true ); } else if( (nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) ) { @@ -844,7 +831,8 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) eType = GDK_WINDOW_TYPE_HINT_UTILITY; } - if( (nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ) ) + if( (nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ) + && getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) { eType = GDK_WINDOW_TYPE_HINT_TOOLBAR; gtk_window_set_keep_above( GTK_WINDOW(m_pWindow), true ); @@ -881,7 +869,7 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) if( bDecoHandling ) { gtk_window_set_resizable( GTK_WINDOW(m_pWindow), (nStyle & SAL_FRAME_STYLE_SIZEABLE) ? TRUE : FALSE ); - if( ( (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION)) ) || bMetaCityToolWindowHack ) + if( ( (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION)) ) ) lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, false ); } @@ -1304,7 +1292,8 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate ) { if( m_pWindow ) { - if( m_pParent && (m_pParent->m_nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN) ) + if( m_pParent && (m_pParent->m_nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN) + && getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) gtk_window_set_keep_above( GTK_WINDOW(m_pWindow), bVisible ); if( bVisible ) { @@ -1364,9 +1353,9 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate ) // // i.e. having a time < that of the toplevel frame means that the toplevel frame gets unfocused. // awesome. + bool bMetaCity = getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity"); if( nUserTime == 0 && - ( - getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity") || + ( bMetaCity || ( getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("compiz") && (m_nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION)) @@ -1378,9 +1367,11 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate ) nUserTime= getDisplay()->GetLastUserEventTime( true ); //nUserTime = gdk_x11_get_server_time(GTK_WIDGET (m_pWindow)->window); } - lcl_set_user_time( GTK_WIDGET(m_pWindow)->window, nUserTime ); + if( bMetaCity && ! bNoActivate && (m_nStyle & SAL_FRAME_STYLE_TOOLWINDOW) ) + m_bSetFocusOnMap = true; + gtk_widget_show( m_pWindow ); if( isFloatGrabWindow() ) @@ -1465,6 +1456,12 @@ void GtkSalFrame::setMinMaxSize() aHints |= GDK_HINT_MAX_SIZE; } } + if( m_bFullscreen ) + { + aGeo.max_width = m_aMaxSize.Width(); + aGeo.max_height = m_aMaxSize.Height(); + aHints |= GDK_HINT_MAX_SIZE; + } if( aHints ) gtk_window_set_geometry_hints( GTK_WINDOW(m_pWindow), NULL, @@ -1816,8 +1813,6 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) { m_aRestorePosSize = Rectangle( Point( maGeometry.nX, maGeometry.nY ), Size( maGeometry.nWidth, maGeometry.nHeight ) ); - // workaround different window managers have different opinions about - // _NET_WM_STATE_FULLSCREEN (Metacity <-> KWin) bool bVisible = GTK_WIDGET_MAPPED(m_pWindow); if( bVisible ) Show( FALSE ); @@ -1834,12 +1829,22 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) gtk_window_move( GTK_WINDOW(m_pWindow), maGeometry.nX = aNewPosSize.Left(), maGeometry.nY = aNewPosSize.Top() ); + // #i110881# for the benefit of compiz set a max size here + // else setting to fullscreen fails for unknown reasons + m_aMaxSize.Width() = aNewPosSize.GetWidth()+100; + m_aMaxSize.Height() = aNewPosSize.GetHeight()+100; + // workaround different legacy version window managers have different opinions about + // _NET_WM_STATE_FULLSCREEN (Metacity <-> KWin) + if( ! getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) + gtk_window_fullscreen( GTK_WINDOW( m_pWindow ) ); if( bVisible ) Show( TRUE ); } else { bool bVisible = GTK_WIDGET_MAPPED(m_pWindow); + if( ! getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) + gtk_window_unfullscreen( GTK_WINDOW(m_pWindow) ); if( bVisible ) Show( FALSE ); m_nStyle &= ~SAL_FRAME_STYLE_PARTIAL_FULLSCREEN; @@ -1862,8 +1867,11 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) { if( bFullScreen ) { - if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) - gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE ); + if( getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) + { + if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) + gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE ); + } gtk_window_fullscreen( GTK_WINDOW(m_pWindow) ); moveToScreen( nScreen ); Size aScreenSize = pDisp->GetScreenSize( m_nScreen ); @@ -1875,8 +1883,11 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) else { gtk_window_unfullscreen( GTK_WINDOW(m_pWindow) ); - if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) - gtk_window_set_resizable( GTK_WINDOW(m_pWindow), FALSE ); + if( getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) + { + if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) + gtk_window_set_resizable( GTK_WINDOW(m_pWindow), FALSE ); + } moveToScreen( nScreen ); } } @@ -2848,6 +2859,8 @@ gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, gpointer frame ) GTK_YIELD_GRAB(); + bool bSetFocus = pThis->m_bSetFocusOnMap; + pThis->m_bSetFocusOnMap = false; if( ImplGetSVData()->mbIsTestTool ) { /* #i76541# testtool needs the focus to be in a new document @@ -2857,9 +2870,14 @@ gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, gpointer frame ) * so this is done when running in testtool only */ if( ! pThis->m_pParent && (pThis->m_nStyle & SAL_FRAME_STYLE_MOVEABLE) != 0 ) - XSetInputFocus( pThis->getDisplay()->GetDisplay(), - GDK_WINDOW_XWINDOW( GTK_WIDGET(pThis->m_pWindow)->window), - RevertToParent, CurrentTime ); + bSetFocus = true; + } + + if( bSetFocus ) + { + XSetInputFocus( pThis->getDisplay()->GetDisplay(), + GDK_WINDOW_XWINDOW( GTK_WIDGET(pThis->m_pWindow)->window), + RevertToParent, CurrentTime ); } pThis->CallCallback( SALEVENT_RESIZE, NULL ); @@ -3184,6 +3202,15 @@ gboolean GtkSalFrame::signalState( GtkWidget*, GdkEvent* pEvent, gpointer frame } pThis->m_nState = pEvent->window_state.new_window_state; + #if OSL_DEBUG_LEVEL > 1 + if( (pEvent->window_state.changed_mask & GDK_WINDOW_STATE_FULLSCREEN) ) + { + fprintf( stderr, "window %p %s full screen state\n", + pThis, + (pEvent->window_state.new_window_state & GDK_WINDOW_STATE_FULLSCREEN) ? "enters" : "leaves"); + } + #endif + return FALSE; } diff --git a/vcl/unx/headless/svpinst.cxx b/vcl/unx/headless/svpinst.cxx index 485062bf0617..466b56868900 100644 --- a/vcl/unx/headless/svpinst.cxx +++ b/vcl/unx/headless/svpinst.cxx @@ -55,6 +55,19 @@ extern "C" } } +bool SvpSalInstance::isFrameAlive( const SalFrame* pFrame ) const +{ + for( std::list< SalFrame* >::const_iterator it = m_aFrames.begin(); + it != m_aFrames.end(); ++it ) + { + if( *it == pFrame ) + { + return true; + } + } + return false; +} + SvpSalInstance* SvpSalInstance::s_pDefaultInstance = NULL; SvpSalInstance::SvpSalInstance() @@ -346,12 +359,15 @@ void SvpSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) { for( std::list<SalUserEvent>::const_iterator it = aEvents.begin(); it != aEvents.end(); ++it ) { - it->m_pFrame->CallCallback( it->m_nEvent, it->m_pData ); - if( it->m_nEvent == SALEVENT_RESIZE ) + if ( isFrameAlive( it->m_pFrame ) ) { - // this would be a good time to post a paint - const SvpSalFrame* pSvpFrame = static_cast<const SvpSalFrame*>(it->m_pFrame); - pSvpFrame->PostPaint(); + it->m_pFrame->CallCallback( it->m_nEvent, it->m_pData ); + if( it->m_nEvent == SALEVENT_RESIZE ) + { + // this would be a good time to post a paint + const SvpSalFrame* pSvpFrame = static_cast<const SvpSalFrame*>(it->m_pFrame); + pSvpFrame->PostPaint(); + } } } } diff --git a/vcl/unx/headless/svpinst.hxx b/vcl/unx/headless/svpinst.hxx index d37c1c7e126e..284a2d11cd82 100644 --- a/vcl/unx/headless/svpinst.hxx +++ b/vcl/unx/headless/svpinst.hxx @@ -108,6 +108,9 @@ class SvpSalInstance : public SalInstance std::list< SalUserEvent > m_aUserEvents; std::list< SalFrame* > m_aFrames; + + bool isFrameAlive( const SalFrame* pFrame ) const; + public: static SvpSalInstance* s_pDefaultInstance; diff --git a/vcl/unx/inc/plugins/gtk/gtkframe.hxx b/vcl/unx/inc/plugins/gtk/gtkframe.hxx index 0a91d99fd839..88a26b401eed 100644 --- a/vcl/unx/inc/plugins/gtk/gtkframe.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkframe.hxx @@ -185,6 +185,7 @@ class GtkSalFrame : public SalFrame bool m_bDefaultSize; bool m_bSendModChangeOnRelease; bool m_bWindowIsGtkPlug; + bool m_bSetFocusOnMap; String m_aTitle; IMHandler* m_pIMHandler; diff --git a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx index ed3f782c8576..065b5435eeb0 100644 --- a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx @@ -64,15 +64,15 @@ public: // native widget methods virtual BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart ); virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside ); + const Point& aPos, BOOL& rIsInside ); virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, + ControlState nState, const ImplControlValue& aValue, const rtl::OUString& rCaption ); virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const rtl::OUString& rCaption ); + const rtl::OUString& rCaption ); virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const rtl::OUString& rCaption, + const ImplControlValue& aValue, const rtl::OUString& rCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion ); //helper methods for frame's UpdateSettings @@ -101,86 +101,86 @@ protected: const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKRadio( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKCheck( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKScrollbar( ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKEditBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKSpinBox( ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKComboBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKTabItem( ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKListBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKToolbar( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKMenubar( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKPopupMenu( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKTooltip( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKProgress( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKSlider( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKListNode( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL drawNativeMixedStateCheck( ControlType nType, ControlPart nPart, const Region& rControlRegion, - ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, + ControlState nState, const ImplControlValue& aValue, const rtl::OUString& rCaption ); }; diff --git a/vcl/unx/inc/saldata.hxx b/vcl/unx/inc/saldata.hxx index 3810558d470d..7e38e0a89bf2 100644 --- a/vcl/unx/inc/saldata.hxx +++ b/vcl/unx/inc/saldata.hxx @@ -62,6 +62,7 @@ protected: SalXLib *pXLib_; SalDisplay *m_pSalDisplay; pthread_t hMainThread_; + rtl::OUString maLocalHostName; public: X11SalData(); @@ -87,6 +88,9 @@ public: inline void StopTimer(); void Timeout() const; + const rtl::OUString& GetLocalHostName() const + { return maLocalHostName; } + static int XErrorHdl( Display*, XErrorEvent* ); static int XIOErrorHdl( Display* ); diff --git a/vcl/unx/inc/wmadaptor.hxx b/vcl/unx/inc/wmadaptor.hxx index c628cfe091ef..cbedede2cc99 100644 --- a/vcl/unx/inc/wmadaptor.hxx +++ b/vcl/unx/inc/wmadaptor.hxx @@ -58,6 +58,8 @@ public: NET_WM_NAME, NET_WM_DESKTOP, NET_WM_ICON_NAME, + NET_WM_PID, + NET_WM_PING, NET_WM_STATE, NET_WM_STATE_MAXIMIZED_HORZ, NET_WM_STATE_MAXIMIZED_VERT, @@ -160,6 +162,7 @@ protected: m_aWMWorkAreas; bool m_bTransientBehaviour; bool m_bEnableAlwaysOnTopWorks; + bool m_bLegacyPartialFullscreen; int m_nWinGravity; int m_nInitWinGravity; @@ -220,6 +223,18 @@ public: virtual void setWMName( X11SalFrame* pFrame, const String& rWMName ) const; /* + * set NET_WM_PID + */ + virtual void setPID( X11SalFrame* pFrame ) const; + + /* + * set WM_CLIENT_MACHINE + */ + virtual void setClientMachine( X11SalFrame* pFrame ) const; + + virtual void answerPing( X11SalFrame*, XClientMessageEvent* ) const; + + /* * maximizes frame * maximization can be toggled in either direction * to get the original position and size @@ -231,6 +246,15 @@ public: */ virtual void showFullScreen( X11SalFrame* pFrame, bool bFullScreen ) const; /* + * tell whether legacy partial full screen handling is necessary + * see #i107249#: NET_WM_STATE_FULLSCREEN is not well defined, but de facto + * modern WM's interpret it the "right" way, namely they make "full screen" + * taking twin view or Xinerama into accound and honor the positioning hints + * to see which screen actually was meant to use for fullscreen. + */ + bool isLegacyPartialFullscreen() const + { return m_bLegacyPartialFullscreen; } + /* * set window struts */ virtual void setFrameStruts( X11SalFrame*pFrame, diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx index ea9161235ac9..3adc9f5c679a 100644 --- a/vcl/unx/kde/salnativewidgets-kde.cxx +++ b/vcl/unx/kde/salnativewidgets-kde.cxx @@ -1177,18 +1177,18 @@ class KDESalGraphics : public X11SalGraphics virtual BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart ); virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, const Point& aPos, - SalControlHandle& rControlHandle, BOOL& rIsInside ); + BOOL& rIsInside ); virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, + const ImplControlValue& aValue, const OUString& aCaption ); virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, + const ImplControlValue& aValue, const OUString& aCaption ); virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, + const ImplControlValue& aValue, const OUString& aCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion ); }; @@ -1242,7 +1242,7 @@ BOOL KDESalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP */ BOOL KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, const Point& rPos, - SalControlHandle&, BOOL& rIsInside ) + BOOL& rIsInside ) { if ( nType == CTRL_SCROLLBAR ) { @@ -1344,15 +1344,12 @@ BOOL KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, @param aValue An optional value (tristate/numerical/string). - @param rControlHandle - Carries platform dependent data and is maintained by the SalFrame implementation. - @param aCaption A caption or title string (like button text etc.) */ BOOL KDESalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue& aValue, SalControlHandle&, + const ImplControlValue& aValue, const OUString& ) { BOOL bReturn = FALSE; @@ -1489,15 +1486,12 @@ BOOL KDESalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, @param aValue An optional value (tristate/numerical/string) - @param rControlHandle - Carries platform dependent data and is maintained by the SalFrame implementation. - @param aCaption A caption or title string (like button text etc.) */ BOOL KDESalGraphics::drawNativeControlText( ControlType, ControlPart, const Region&, ControlState, - const ImplControlValue&, SalControlHandle&, + const ImplControlValue&, const OUString& ) { return FALSE; @@ -1517,15 +1511,12 @@ BOOL KDESalGraphics::drawNativeControlText( ControlType, ControlPart, @param aValue An optional value (tristate/numerical/string) - @param rControlHandle - Carries platform dependent data and is maintained by the SalFrame implementation. - @param aCaption A caption or title string (like button text etc.) */ BOOL KDESalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue&, SalControlHandle&, + const ImplControlValue&, const OUString&, Region &rNativeBoundingRegion, Region &rNativeContentRegion ) { diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index 25dd50ce3958..e8d184e6539b 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -158,7 +158,7 @@ BOOL KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart par BOOL KDESalGraphics::hitTestNativeControl( ControlType, ControlPart, const Region&, const Point&, - SalControlHandle&, BOOL& ) + BOOL& ) { return FALSE; } @@ -220,7 +220,7 @@ namespace BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, const Region& rControlRegion, ControlState nControlState, - const ImplControlValue& value, SalControlHandle&, + const ImplControlValue& value, const OUString& ) { // put not implemented types here @@ -567,7 +567,7 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, const Region& controlRegion, ControlState controlState, - const ImplControlValue& val, SalControlHandle&, + const ImplControlValue& val, const OUString&, Region &nativeBoundingRegion, Region &nativeContentRegion ) { diff --git a/vcl/unx/kde4/KDESalGraphics.hxx b/vcl/unx/kde4/KDESalGraphics.hxx index b5328f462a16..5661d743e0cd 100644 --- a/vcl/unx/kde4/KDESalGraphics.hxx +++ b/vcl/unx/kde4/KDESalGraphics.hxx @@ -59,7 +59,7 @@ class KDESalGraphics : public X11SalGraphics */ virtual BOOL hitTestNativeControl( ControlType type, ControlPart part, const Region& rControlRegion, const Point& aPos, - SalControlHandle& rControlHandle, BOOL& rIsInside ); + BOOL& rIsInside ); /** Draw the requested control described by part/nControlState. @param rControlRegion @@ -68,15 +68,12 @@ class KDESalGraphics : public X11SalGraphics @param aValue An optional value (tristate/numerical/string). - @param rControlHandle - Carries platform dependent data and is maintained by the SalFrame implementation. - @param aCaption A caption or title string (like button text etc.) */ virtual BOOL drawNativeControl( ControlType type, ControlPart part, const Region& rControlRegion, ControlState nControlState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, + const ImplControlValue& aValue, const rtl::OUString& aCaption ); /** Draw text on the widget. @@ -85,12 +82,11 @@ class KDESalGraphics : public X11SalGraphics @param rControlRegion The bounding region of the complete control in VCL frame coordinates. @param aValue An optional value (tristate/numerical/string) - @param rControlHandle Carries platform dependent data and is maintained by the SalFrame implementation. @param aCaption A caption or title string (like button text etc.) */ virtual BOOL drawNativeControlText( ControlType, ControlPart, const Region&, ControlState, - const ImplControlValue&, SalControlHandle&, + const ImplControlValue&, const rtl::OUString& ) { return false; } /** Check if the bounding regions match. @@ -106,15 +102,12 @@ class KDESalGraphics : public X11SalGraphics @param aValue An optional value (tristate/numerical/string) - @param rControlHandle - Carries platform dependent data and is maintained by the SalFrame implementation. - @param aCaption A caption or title string (like button text etc.) */ virtual BOOL getNativeControlRegion( ControlType type, ControlPart part, const Region& rControlRegion, ControlState nControlState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, + const ImplControlValue& aValue, const rtl::OUString& aCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion ); };
\ No newline at end of file diff --git a/vcl/unx/source/app/saldata.cxx b/vcl/unx/source/app/saldata.cxx index 4155887a9875..75d18de0787a 100644 --- a/vcl/unx/source/app/saldata.cxx +++ b/vcl/unx/source/app/saldata.cxx @@ -276,6 +276,7 @@ X11SalData::X11SalData() m_pPlugin = NULL; hMainThread_ = pthread_self(); + osl_getLocalHostname( &maLocalHostName.pData ); } X11SalData::~X11SalData() diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx index 2ed699ad0eb5..aa2afab93657 100644 --- a/vcl/unx/source/app/saldisp.cxx +++ b/vcl/unx/source/app/saldisp.cxx @@ -322,12 +322,12 @@ sal_IsLocalDisplay( Display *pDisplay ) if( pPtr != NULL ) { - OUString aLocalHostname; - if( osl_getLocalHostname( &aLocalHostname.pData ) == osl_Socket_Ok) + const OUString& rLocalHostname( GetX11SalData()->GetLocalHostName() ); + if( rLocalHostname.getLength() ) { *pPtr = '\0'; OUString aDisplayHostname( pDisplayHost, strlen( pDisplayHost ), osl_getThreadTextEncoding() ); - bEqual = sal_EqualHosts( aLocalHostname, aDisplayHostname ); + bEqual = sal_EqualHosts( rLocalHostname, aDisplayHostname ); bEqual = bEqual && sal_IsDisplayNumber( pPtr + 1 ); } } diff --git a/vcl/unx/source/app/wmadaptor.cxx b/vcl/unx/source/app/wmadaptor.cxx index 89c8bb56291c..fb2317e19573 100644 --- a/vcl/unx/source/app/wmadaptor.cxx +++ b/vcl/unx/source/app/wmadaptor.cxx @@ -34,6 +34,7 @@ #include <sal/alloca.h> #include <wmadaptor.hxx> #include <saldisp.hxx> +#include <saldata.hxx> #include <salframe.h> #include <vcl/salgdi.hxx> #include <osl/thread.h> @@ -118,6 +119,7 @@ static const WMAdaptorProtocol aProtocolTab[] = { "_NET_NUMBER_OF_DESKTOPS", WMAdaptor::NET_NUMBER_OF_DESKTOPS }, { "_NET_WM_DESKTOP", WMAdaptor::NET_WM_DESKTOP }, { "_NET_WM_ICON_NAME", WMAdaptor::NET_WM_ICON_NAME }, + { "_NET_WM_PING", WMAdaptor::NET_WM_PING }, { "_NET_WM_STATE", WMAdaptor::NET_WM_STATE }, { "_NET_WM_STATE_ABOVE", WMAdaptor::NET_WM_STATE_STAYS_ON_TOP }, { "_NET_WM_STATE_FULLSCREEN", WMAdaptor::NET_WM_STATE_FULLSCREEN }, @@ -179,7 +181,8 @@ static const WMAdaptorProtocol aAtomTab[] = { "_XSETTINGS_SETTINGS", WMAdaptor::XSETTINGS }, { "_XEMBED", WMAdaptor::XEMBED }, { "_XEMBED_INFO", WMAdaptor::XEMBED_INFO }, - { "_NET_WM_USER_TIME", WMAdaptor::NET_WM_USER_TIME } + { "_NET_WM_USER_TIME", WMAdaptor::NET_WM_USER_TIME }, + { "_NET_WM_PID", WMAdaptor::NET_WM_PID } }; extern "C" { @@ -233,6 +236,7 @@ WMAdaptor::WMAdaptor( SalDisplay* pDisplay ) : m_pSalDisplay( pDisplay ), m_bTransientBehaviour( true ), m_bEnableAlwaysOnTopWorks( false ), + m_bLegacyPartialFullscreen( false ), m_nWinGravity( StaticGravity ), m_nInitWinGravity( StaticGravity ) { @@ -909,6 +913,40 @@ bool WMAdaptor::getNetWmName() XFree( pProperty ); pProperty = NULL; } + // if this is metacity, check for version to enable a legacy workaround + if( m_aWMName.EqualsAscii( "Metacity" ) ) + { + int nVersionMajor = 0, nVersionMinor = 0; + Atom nVersionAtom = XInternAtom( m_pDisplay, "_METACITY_VERSION", True ); + if( nVersionAtom ) + { + if( XGetWindowProperty( m_pDisplay, + aWMChild, + nVersionAtom, + 0, 256, + False, + m_aWMAtoms[ UTF8_STRING ], + &aRealType, + &nFormat, + &nItems, + &nBytesLeft, + &pProperty ) == 0 + && nItems != 0 + ) + { + String aMetaVersion( (sal_Char*)pProperty, nItems, RTL_TEXTENCODING_UTF8 ); + nVersionMajor = aMetaVersion.GetToken( 0, '.' ).ToInt32(); + nVersionMinor = aMetaVersion.GetToken( 1, '.' ).ToInt32(); + } + if( pProperty ) + { + XFree( pProperty ); + pProperty = NULL; + } + } + if( nVersionMajor < 2 || (nVersionMajor == 2 && nVersionMinor < 12) ) + m_bLegacyPartialFullscreen = true; + } } } else if( pProperty ) @@ -2412,3 +2450,52 @@ void NetWMAdaptor::setUserTime( X11SalFrame* i_pFrame, long i_nUserTime ) const ); } } + +/* + * WMAdaptor::setPID + */ +void WMAdaptor::setPID( X11SalFrame* i_pFrame ) const +{ + if( m_aWMAtoms[NET_WM_PID] ) + { + long nPID = (long)getpid(); + XChangeProperty( m_pDisplay, + i_pFrame->GetShellWindow(), + m_aWMAtoms[NET_WM_PID], + XA_CARDINAL, + 32, + PropModeReplace, + (unsigned char*)&nPID, + 1 + ); + } +} + +/* +* WMAdaptor::setClientMachine +*/ +void WMAdaptor::setClientMachine( X11SalFrame* i_pFrame ) const +{ + rtl::OString aWmClient( rtl::OUStringToOString( GetX11SalData()->GetLocalHostName(), RTL_TEXTENCODING_ASCII_US ) ); + XTextProperty aClientProp = { (unsigned char*)aWmClient.getStr(), XA_STRING, 8, aWmClient.getLength() }; + XSetWMClientMachine( m_pDisplay, i_pFrame->GetShellWindow(), &aClientProp ); +} + +void WMAdaptor::answerPing( X11SalFrame* i_pFrame, XClientMessageEvent* i_pEvent ) const +{ + if( m_aWMAtoms[NET_WM_PING] && + i_pEvent->message_type == m_aWMAtoms[ WM_PROTOCOLS ] && + (Atom)i_pEvent->data.l[0] == m_aWMAtoms[ NET_WM_PING ] ) + { + XEvent aEvent; + aEvent.xclient = *i_pEvent; + aEvent.xclient.window = m_pSalDisplay->GetRootWindow( i_pFrame->GetScreenNumber() ); + XSendEvent( m_pDisplay, + m_pSalDisplay->GetRootWindow( i_pFrame->GetScreenNumber() ), + False, + SubstructureNotifyMask | SubstructureRedirectMask, + &aEvent + ); + XFlush( m_pDisplay ); + } +} diff --git a/vcl/unx/source/dtrans/X11_selection.cxx b/vcl/unx/source/dtrans/X11_selection.cxx index 2d63489dac3d..7f205407b21b 100644 --- a/vcl/unx/source/dtrans/X11_selection.cxx +++ b/vcl/unx/source/dtrans/X11_selection.cxx @@ -70,6 +70,7 @@ #include <osl/process.h> #include <comphelper/processfactory.hxx> +#include <vos/mutex.hxx> #define DRAG_EVENT_MASK ButtonPressMask |\ ButtonReleaseMask |\ @@ -3807,7 +3808,10 @@ void SelectionManager::shutdown() throw() */ aGuard.clear(); while (osl_isThreadRunning(m_aThread)) + { + vos::OGuard guard2(Application::GetSolarMutex()); Application::Reschedule(); + } osl_joinWithThread( m_aThread ); osl_destroyThread( m_aThread ); m_aThread = NULL; diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx index bc6de4fbc94a..816c8fb0b4c4 100644 --- a/vcl/unx/source/fontmanager/fontconfig.cxx +++ b/vcl/unx/source/fontmanager/fontconfig.cxx @@ -123,6 +123,8 @@ class FontCfgWrapper FcPattern* (*m_pFcFontSetMatch)(FcConfig*,FcFontSet**, int, FcPattern*,FcResult*); FcBool (*m_pFcConfigAppFontAddFile)(FcConfig*, const FcChar8*); FcBool (*m_pFcConfigAppFontAddDir)(FcConfig*, const FcChar8*); + FcBool (*m_pFcConfigParseAndLoad)(FcConfig*,const FcChar8*,FcBool); + FcBool (*m_pFcConfigSubstitute)(FcConfig*,FcPattern*,FcMatchKind); FcBool (*m_pFcPatternAddInteger)(FcPattern*,const char*,int); FcBool (*m_pFcPatternAddDouble)(FcPattern*,const char*,double); @@ -221,6 +223,9 @@ public: { return m_pFcConfigAppFontAddFile( pConfig, pFileName ); } FcBool FcConfigAppFontAddDir(FcConfig* pConfig, const FcChar8* pDirName ) { return m_pFcConfigAppFontAddDir( pConfig, pDirName ); } + FcBool FcConfigParseAndLoad( FcConfig* pConfig, const FcChar8* pFileName, FcBool bComplain ) + { return m_pFcConfigParseAndLoad( pConfig, pFileName, bComplain ); } + void FcDefaultSubstitute( FcPattern* pPattern ) { m_pFcDefaultSubstitute( pPattern ); } FcPattern* FcFontSetMatch( FcConfig* pConfig, FcFontSet **ppFontSet, int nset, FcPattern* pPattern, FcResult* pResult ) @@ -326,6 +331,8 @@ FontCfgWrapper::FontCfgWrapper() loadSymbol( "FcConfigAppFontAddFile" ); m_pFcConfigAppFontAddDir = (FcBool(*)(FcConfig*, const FcChar8*)) loadSymbol( "FcConfigAppFontAddDir" ); + m_pFcConfigParseAndLoad = (FcBool(*)(FcConfig*, const FcChar8*, FcBool)) + loadSymbol( "FcConfigParseAndLoad" ); m_pFcDefaultSubstitute = (void(*)(FcPattern *)) loadSymbol( "FcDefaultSubstitute" ); m_pFcFontSetMatch = (FcPattern*(*)(FcConfig*,FcFontSet**,int,FcPattern*,FcResult*)) @@ -383,6 +390,7 @@ FontCfgWrapper::FontCfgWrapper() m_pFcPatternGetBool && m_pFcConfigAppFontAddFile && m_pFcConfigAppFontAddDir && + m_pFcConfigParseAndLoad && m_pFcDefaultSubstitute && m_pFcConfigSubstitute && m_pFcPatternAddInteger && @@ -767,10 +775,14 @@ int PrintFontManager::countFontconfigFonts( std::hash_map<rtl::OString, int, rtl // set family name if( pUpdate->m_nFamilyName != nFamilyName ) { +#if 0 // fontconfig prefers nameid=16 for the family name which is all fine + // but Writer suffers from #i79878# + // the only reasonable workaround for now is to use the classic nameid=1 pUpdate->m_aAliases.remove( pUpdate->m_nFamilyName ); pUpdate->m_aAliases.push_back( pUpdate->m_nFamilyName ); pUpdate->m_aAliases.remove( nFamilyName ); pUpdate->m_nFamilyName = nFamilyName; +#endif } if( eWeightRes == FcResultMatch ) pUpdate->m_eWeight = convertWeight(weight); @@ -836,13 +848,25 @@ bool PrintFontManager::addFontconfigDir( const rtl::OString& rDirName ) if( nVersion <= 20400 ) return false; const char* pDirName = (const char*)rDirName.getStr(); - bool bRet = (rWrapper.FcConfigAppFontAddDir( rWrapper.FcConfigGetCurrent(), (FcChar8*)pDirName ) == FcTrue); + bool bDirOk = (rWrapper.FcConfigAppFontAddDir( rWrapper.FcConfigGetCurrent(), (FcChar8*)pDirName ) == FcTrue); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "FcConfigAppFontAddDir( \"%s\") => %d\n", pDirName, bRet ); #endif - return bRet; + if( bDirOk ) + { + const rtl::OString aConfFileName = rDirName + "/fc_local.conf"; + bool bCfgOk = rWrapper.FcConfigParseAndLoad( rWrapper.FcConfigGetCurrent(), + (FcChar8*)aConfFileName.getStr(), FcTrue ); + (void)bCfgOk; // silence compiler warning + +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "FcConfigParseAndLoad( \"%s\") => %d\n", aConfFileName.getStr(), bCfgOk ); +#endif + } + + return bDirOk; } static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern, diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx index 7cf2009a3e07..f00ee26c0d4d 100644 --- a/vcl/unx/source/gdi/salgdi3.cxx +++ b/vcl/unx/source/gdi/salgdi3.cxx @@ -641,13 +641,11 @@ bool X11SalGraphics::setFont( const ImplFontSelectData *pEntry, int nFallbackLev mpServerFont[ nFallbackLevel ] = pServerFont; // apply font specific-hint settings if needed + // TODO: also disable it for reference devices if( !bPrinter_ ) { - // TODO: is it worth it to cache the hint settings, e.g. in the ImplFontEntry? - ImplFontOptions aFontOptions; - bool GetFCFontOptions( const ImplFontAttributes&, int nSize, ImplFontOptions&); - if( GetFCFontOptions( *pEntry->mpFontData, pEntry->mnHeight, aFontOptions ) ) - pServerFont->SetFontOptions( aFontOptions ); + ImplServerFontEntry* pSFE = static_cast<ImplServerFontEntry*>( pEntry->mpFontEntry ); + pSFE->HandleFontOptions(); } return true; @@ -656,6 +654,24 @@ bool X11SalGraphics::setFont( const ImplFontSelectData *pEntry, int nFallbackLev return false; } +void ImplServerFontEntry::HandleFontOptions( void ) +{ + bool GetFCFontOptions( const ImplFontAttributes&, int nSize, ImplFontOptions& ); + + if( !mpServerFont ) + return; + if( !mbGotFontOptions ) + { + // get and cache the font options + mbGotFontOptions = true; + mbValidFontOptions = GetFCFontOptions( *maFontSelData.mpFontData, + maFontSelData.mnHeight, maFontOptions ); + } + // apply the font options + if( mbValidFontOptions ) + mpServerFont->SetFontOptions( maFontOptions ); +} + //-------------------------------------------------------------------------- inline sal_Unicode SwapBytes( const sal_Unicode nIn ) @@ -1633,11 +1649,13 @@ void X11SalGraphics::GetDevFontSubstList( OutputDevice* ) void cairosubcallback( void* pPattern ) { CairoWrapper& rCairo = CairoWrapper::get(); - if( rCairo.isValid() ) - { + if( !rCairo.isValid() ) + return; const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - rCairo.ft_font_options_substitute( rStyleSettings.GetCairoFontOptions(), pPattern); - } + const void* pFontOptions = rStyleSettings.GetCairoFontOptions(); + if( !pFontOptions ) + return; + rCairo.ft_font_options_substitute( pFontOptions, pPattern ); } bool GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize, @@ -1664,7 +1682,6 @@ bool GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize, default: aInfo.m_eItalic = psp::italic::Unknown; break; - } // set weight switch( rFontAttributes.GetWeight() ) @@ -1740,7 +1757,6 @@ bool GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize, const psp::PrintFontManager& rPFM = psp::PrintFontManager::get(); bool bOK = rPFM.getFontOptions( aInfo, nSize, cairosubcallback, rFontOptions); - return bOK; } diff --git a/vcl/unx/source/plugadapt/salplug.cxx b/vcl/unx/source/plugadapt/salplug.cxx index c42c22bc0592..a438760cffba 100644 --- a/vcl/unx/source/plugadapt/salplug.cxx +++ b/vcl/unx/source/plugadapt/salplug.cxx @@ -98,6 +98,14 @@ static SalInstance* tryInstance( const OUString& rModuleBase ) { pCloseModule = NULL; } + /* + * #i109007# KDE3 seems to have the same problem; an atexit cleanup + * handler, which cannot be resolved anymore if the plugin is already unloaded. + */ + else if( rModuleBase.equalsAscii("kde") ) + { + pCloseModule = NULL; + } GetSalData()->m_pPlugin = aMod; } diff --git a/vcl/unx/source/printer/ppdparser.cxx b/vcl/unx/source/printer/ppdparser.cxx index 971db860cf42..b2549573d099 100644 --- a/vcl/unx/source/printer/ppdparser.cxx +++ b/vcl/unx/source/printer/ppdparser.cxx @@ -258,7 +258,6 @@ using namespace rtl; std::list< PPDParser* > PPDParser::aAllParsers; std::hash_map< OUString, OUString, OUStringHash >* PPDParser::pAllPPDFiles = NULL; -static String aEmptyString; class PPDDecompressStream { @@ -1284,12 +1283,12 @@ void PPDParser::parseConstraint( const ByteString& rLine ) m_aConstraints.push_back( aConstraint ); } -const String& PPDParser::getDefaultPaperDimension() const +String PPDParser::getDefaultPaperDimension() const { if( m_pDefaultPaperDimension ) return m_pDefaultPaperDimension->m_aOption; - return aEmptyString; + return String(); } bool PPDParser::getMargins( @@ -1356,10 +1355,10 @@ bool PPDParser::getPaperDimension( return true; } -const String& PPDParser::matchPaper( int nWidth, int nHeight ) const +String PPDParser::matchPaper( int nWidth, int nHeight ) const { if( ! m_pPaperDimensions ) - return aEmptyString; + return String(); int nPDim = -1; double PDWidth, PDHeight; @@ -1393,51 +1392,51 @@ const String& PPDParser::matchPaper( int nWidth, int nHeight ) const { // swap portrait/landscape and try again bDontSwap = true; - const String& rRet = matchPaper( nHeight, nWidth ); + String rRet = matchPaper( nHeight, nWidth ); bDontSwap = false; return rRet; } - return nPDim != -1 ? m_pPaperDimensions->getValue( nPDim )->m_aOption : aEmptyString; + return nPDim != -1 ? m_pPaperDimensions->getValue( nPDim )->m_aOption : String(); } -const String& PPDParser::getDefaultInputSlot() const +String PPDParser::getDefaultInputSlot() const { if( m_pDefaultInputSlot ) return m_pDefaultInputSlot->m_aValue; - return aEmptyString; + return String(); } -const String& PPDParser::getSlot( int nSlot ) const +String PPDParser::getSlot( int nSlot ) const { if( ! m_pInputSlots ) - return aEmptyString; + return String(); if( nSlot > 0 && nSlot < m_pInputSlots->countValues() ) return m_pInputSlots->getValue( nSlot )->m_aOption; else if( m_pInputSlots->countValues() > 0 ) return m_pInputSlots->getValue( (ULONG)0 )->m_aOption; - return aEmptyString; + return String(); } -const String& PPDParser::getSlotCommand( int nSlot ) const +String PPDParser::getSlotCommand( int nSlot ) const { if( ! m_pInputSlots ) - return aEmptyString; + return String(); if( nSlot > 0 && nSlot < m_pInputSlots->countValues() ) return m_pInputSlots->getValue( nSlot )->m_aValue; else if( m_pInputSlots->countValues() > 0 ) return m_pInputSlots->getValue( (ULONG)0 )->m_aValue; - return aEmptyString; + return String(); } -const String& PPDParser::getSlotCommand( const String& rSlot ) const +String PPDParser::getSlotCommand( const String& rSlot ) const { if( ! m_pInputSlots ) - return aEmptyString; + return String(); for( int i=0; i < m_pInputSlots->countValues(); i++ ) { @@ -1445,39 +1444,39 @@ const String& PPDParser::getSlotCommand( const String& rSlot ) const if( pValue->m_aOption == rSlot ) return pValue->m_aValue; } - return aEmptyString; + return String(); } -const String& PPDParser::getPaperDimension( int nPaperDimension ) const +String PPDParser::getPaperDimension( int nPaperDimension ) const { if( ! m_pPaperDimensions ) - return aEmptyString; + return String(); if( nPaperDimension > 0 && nPaperDimension < m_pPaperDimensions->countValues() ) return m_pPaperDimensions->getValue( nPaperDimension )->m_aOption; else if( m_pPaperDimensions->countValues() > 0 ) return m_pPaperDimensions->getValue( (ULONG)0 )->m_aOption; - return aEmptyString; + return String(); } -const String& PPDParser::getPaperDimensionCommand( int nPaperDimension ) const +String PPDParser::getPaperDimensionCommand( int nPaperDimension ) const { if( ! m_pPaperDimensions ) - return aEmptyString; + return String(); if( nPaperDimension > 0 && nPaperDimension < m_pPaperDimensions->countValues() ) return m_pPaperDimensions->getValue( nPaperDimension )->m_aValue; else if( m_pPaperDimensions->countValues() > 0 ) return m_pPaperDimensions->getValue( (ULONG)0 )->m_aValue; - return aEmptyString; + return String(); } -const String& PPDParser::getPaperDimensionCommand( const String& rPaperDimension ) const +String PPDParser::getPaperDimensionCommand( const String& rPaperDimension ) const { if( ! m_pPaperDimensions ) - return aEmptyString; + return String(); for( int i=0; i < m_pPaperDimensions->countValues(); i++ ) { @@ -1485,7 +1484,7 @@ const String& PPDParser::getPaperDimensionCommand( const String& rPaperDimension if( pValue->m_aOption == rPaperDimension ) return pValue->m_aValue; } - return aEmptyString; + return String(); } void PPDParser::getResolutionFromString( @@ -1543,13 +1542,13 @@ void PPDParser::getResolution( int nNr, int& rXRes, int& rYRes ) const rXRes, rYRes ); } -const String& PPDParser::getResolutionCommand( int nXRes, int nYRes ) const +String PPDParser::getResolutionCommand( int nXRes, int nYRes ) const { if( ( ! m_pResolutions || m_pResolutions->countValues() == 0 ) && m_pDefaultResolution ) return m_pDefaultResolution->m_aValue; if( ! m_pResolutions ) - return aEmptyString; + return String(); int nX, nY; for( int i = 0; i < m_pResolutions->countValues(); i++ ) @@ -1559,46 +1558,46 @@ const String& PPDParser::getResolutionCommand( int nXRes, int nYRes ) const if( nX == nXRes && nY == nYRes ) return m_pResolutions->getValue( i )->m_aValue; } - return aEmptyString; + return String(); } -const String& PPDParser::getDefaultDuplexType() const +String PPDParser::getDefaultDuplexType() const { if( m_pDefaultDuplexType ) return m_pDefaultDuplexType->m_aValue; - return aEmptyString; + return String(); } -const String& PPDParser::getDuplex( int nDuplex ) const +String PPDParser::getDuplex( int nDuplex ) const { if( ! m_pDuplexTypes ) - return aEmptyString; + return String(); if( nDuplex > 0 && nDuplex < m_pDuplexTypes->countValues() ) return m_pDuplexTypes->getValue( nDuplex )->m_aOption; else if( m_pDuplexTypes->countValues() > 0 ) return m_pDuplexTypes->getValue( (ULONG)0 )->m_aOption; - return aEmptyString; + return String(); } -const String& PPDParser::getDuplexCommand( int nDuplex ) const +String PPDParser::getDuplexCommand( int nDuplex ) const { if( ! m_pDuplexTypes ) - return aEmptyString; + return String(); if( nDuplex > 0 && nDuplex < m_pDuplexTypes->countValues() ) return m_pDuplexTypes->getValue( nDuplex )->m_aValue; else if( m_pDuplexTypes->countValues() > 0 ) return m_pDuplexTypes->getValue( (ULONG)0 )->m_aValue; - return aEmptyString; + return String(); } -const String& PPDParser::getDuplexCommand( const String& rDuplex ) const +String PPDParser::getDuplexCommand( const String& rDuplex ) const { if( ! m_pDuplexTypes ) - return aEmptyString; + return String(); for( int i=0; i < m_pDuplexTypes->countValues(); i++ ) { @@ -1606,7 +1605,7 @@ const String& PPDParser::getDuplexCommand( const String& rDuplex ) const if( pValue->m_aOption == rDuplex ) return pValue->m_aValue; } - return aEmptyString; + return String(); } void PPDParser::getFontAttributes( @@ -1636,14 +1635,14 @@ void PPDParser::getFontAttributes( } } -const String& PPDParser::getFont( int nFont ) const +String PPDParser::getFont( int nFont ) const { if( ! m_pFontList ) - return aEmptyString; + return String(); if( nFont >=0 && nFont < m_pFontList->countValues() ) return m_pFontList->getValue( nFont )->m_aOption; - return aEmptyString; + return String(); } rtl::OUString PPDParser::translateKey( const rtl::OUString& i_rKey, diff --git a/vcl/unx/source/window/salframe.cxx b/vcl/unx/source/window/salframe.cxx index 5b538626a634..6d243e41db8c 100644 --- a/vcl/unx/source/window/salframe.cxx +++ b/vcl/unx/source/window/salframe.cxx @@ -528,6 +528,8 @@ void X11SalFrame::Init( ULONG nSalFrameStyle, int nScreen, SystemParentData* pPa Atom a[4]; int n = 0; a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::WM_DELETE_WINDOW ); + if( pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_PING ) ) + a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_PING ); if( ! s_pSaveYourselfFrame && ! mpParent) { // at all times have only one frame with SaveYourself @@ -549,11 +551,23 @@ void X11SalFrame::Init( ULONG nSalFrameStyle, int nScreen, SystemParentData* pPa pHints->win_gravity = GetDisplay()->getWMAdaptor()->getPositionWinGravity(); pHints->x = 0; pHints->y = 0; + if( mbFullScreen ) + { + pHints->flags |= PMaxSize | PMinSize; + pHints->max_width = w+100; + pHints->max_height = h+100; + pHints->min_width = w; + pHints->min_height = h; + } XSetWMNormalHints( GetXDisplay(), GetShellWindow(), pHints ); XFree (pHints); + // set PID and WM_CLIENT_MACHINE + pDisplay_->getWMAdaptor()->setClientMachine( this ); + pDisplay_->getWMAdaptor()->setPID( this ); + // set client leader if( aClientLeader ) { @@ -605,7 +619,8 @@ void X11SalFrame::Init( ULONG nSalFrameStyle, int nScreen, SystemParentData* pPa eType = WMAdaptor::windowType_Utility; if( nStyle_ & SAL_FRAME_STYLE_OWNERDRAWDECORATION ) eType = WMAdaptor::windowType_Toolbar; - if( nStyle_ & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ) + if( (nStyle_ & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN) + && GetDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) eType = WMAdaptor::windowType_Dock; GetDisplay()->getWMAdaptor()-> @@ -735,6 +750,8 @@ void X11SalFrame::passOnSaveYourSelf() int n = 0; a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::WM_DELETE_WINDOW ); a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::WM_SAVE_YOURSELF ); + if( pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_PING ) ) + a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_PING ); XSetWMProtocols( GetXDisplay(), s_pSaveYourselfFrame->GetShellWindow(), a, n ); } } @@ -1130,7 +1147,7 @@ void X11SalFrame::Show( BOOL bVisible, BOOL bNoActivate ) // even though transient frames should be kept above their parent // this does not necessarily hold true for DOCK type windows // so artificially set ABOVE and remove it again on hide - if( mpParent && (mpParent->nStyle_ & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ) ) + if( mpParent && (mpParent->nStyle_ & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ) && pDisplay_->getWMAdaptor()->isLegacyPartialFullscreen()) pDisplay_->getWMAdaptor()->enableAlwaysOnTop( this, bVisible ); bMapped_ = bVisible; @@ -1322,11 +1339,6 @@ void X11SalFrame::Show( BOOL bVisible, BOOL bNoActivate ) } else { -#if OSL_DEBUG_LEVEL > 1 - if( nStyle_ & SAL_FRAME_STYLE_OWNERDRAWDECORATION ) - fprintf( stderr, "hide on ownerdraw\n" ); -#endif - if( getInputContext() ) getInputContext()->Unmap( this ); @@ -1616,6 +1628,7 @@ void X11SalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, USHOR } else SetPosSize( aPosSize ); + bDefaultPosition_ = False; } @@ -2042,6 +2055,12 @@ void X11SalFrame::SetPosSize( const Rectangle &rPosSize ) pHints->y = values.y; pHints->win_gravity = pDisplay_->getWMAdaptor()->getPositionWinGravity(); } + if( mbFullScreen ) + { + pHints->max_width = 10000; + pHints->max_height = 10000; + pHints->flags |= PMaxSize; + } XSetWMNormalHints( GetXDisplay(), GetShellWindow(), pHints ); @@ -2199,28 +2218,15 @@ void X11SalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) maGeometry.nWidth = aRect.GetWidth(); maGeometry.nHeight = aRect.GetHeight(); mbMaximizedHorz = mbMaximizedVert = false; + mbFullScreen = true; createNewWindow( None, m_nScreen ); - GetDisplay()->getWMAdaptor()->enableAlwaysOnTop( this, true ); - #if 0 - // this would give additional intent to the window - // manager to force the positioning of the window; - // alas all other windows will be expunged from that - // region, leaving us in a pity state afterwards - Size aScreenSize = pDisplay_->GetScreenSize( m_nScreen ); - pDisplay_->getWMAdaptor()->setFrameStruts( this, - aRect.Left(), aRect.Top(), - aScreenSize.Width() - aRect.Right(), - aScreenSize.Height() - aRect.Bottom(), - aRect.Left(), aRect.Right(), - aRect.Top(), aRect.Bottom(), - aRect.Left(), aRect.Right(), - aRect.Top(), aRect.Bottom() - ); - #endif - + if( GetDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) + GetDisplay()->getWMAdaptor()->enableAlwaysOnTop( this, true ); + else + GetDisplay()->getWMAdaptor()->showFullScreen( this, true ); if( bVisible ) Show(TRUE); - mbFullScreen = true; + } else { @@ -3927,52 +3933,56 @@ long X11SalFrame::HandleClientMessage( XClientMessageEvent *pEvent ) Close(); // ??? return 1; } - else if( pEvent->message_type == rWMAdaptor.getAtom( WMAdaptor::WM_PROTOCOLS ) - && ! ( nStyle_ & SAL_FRAME_STYLE_PLUG ) - && ! (( nStyle_ & SAL_FRAME_STYLE_FLOAT ) && (nStyle_ & SAL_FRAME_STYLE_OWNERDRAWDECORATION)) - ) + else if( pEvent->message_type == rWMAdaptor.getAtom( WMAdaptor::WM_PROTOCOLS ) ) { - if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_DELETE_WINDOW ) ) - { - Close(); - return 1; - } - else if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_TAKE_FOCUS ) ) - { - // do nothing, we set the input focus in ToTop() if necessary -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "got WM_TAKE_FOCUS on %s window\n", - (nStyle_&SAL_FRAME_STYLE_OWNERDRAWDECORATION) ? - "ownerdraw" : "NON OWNERDRAW" ); -#endif - } - else if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_SAVE_YOURSELF ) ) + if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::NET_WM_PING ) ) + rWMAdaptor.answerPing( this, pEvent ); + else if( ! ( nStyle_ & SAL_FRAME_STYLE_PLUG ) + && ! (( nStyle_ & SAL_FRAME_STYLE_FLOAT ) && (nStyle_ & SAL_FRAME_STYLE_OWNERDRAWDECORATION)) + ) { - bool bSession = rWMAdaptor.getWindowManagerName().EqualsAscii( "Dtwm" ); - - if( ! bSession ) + if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_DELETE_WINDOW ) ) + { + Close(); + return 1; + } + else if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_TAKE_FOCUS ) ) { - if( this == s_pSaveYourselfFrame ) + // do nothing, we set the input focus in ToTop() if necessary + #if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "got WM_TAKE_FOCUS on %s window\n", + (nStyle_&SAL_FRAME_STYLE_OWNERDRAWDECORATION) ? + "ownerdraw" : "NON OWNERDRAW" ); + #endif + } + else if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_SAVE_YOURSELF ) ) + { + bool bSession = rWMAdaptor.getWindowManagerName().EqualsAscii( "Dtwm" ); + + if( ! bSession ) { - ByteString aExec( SessionManagerClient::getExecName(), osl_getThreadTextEncoding() ); - const char* argv[2]; - argv[0] = "/bin/sh"; - argv[1] = const_cast<char*>(aExec.GetBuffer()); -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "SaveYourself request, setting command: %s %s\n", argv[0], argv[1] ); -#endif - XSetCommand( GetXDisplay(), GetShellWindow(), (char**)argv, 2 ); + if( this == s_pSaveYourselfFrame ) + { + ByteString aExec( SessionManagerClient::getExecName(), osl_getThreadTextEncoding() ); + const char* argv[2]; + argv[0] = "/bin/sh"; + argv[1] = const_cast<char*>(aExec.GetBuffer()); + #if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "SaveYourself request, setting command: %s %s\n", argv[0], argv[1] ); + #endif + XSetCommand( GetXDisplay(), GetShellWindow(), (char**)argv, 2 ); + } + else + // can only happen in race between WM and window closing + XChangeProperty( GetXDisplay(), GetShellWindow(), rWMAdaptor.getAtom( WMAdaptor::WM_COMMAND ), XA_STRING, 8, PropModeReplace, (unsigned char*)"", 0 ); } else - // can only happen in race between WM and window closing - XChangeProperty( GetXDisplay(), GetShellWindow(), rWMAdaptor.getAtom( WMAdaptor::WM_COMMAND ), XA_STRING, 8, PropModeReplace, (unsigned char*)"", 0 ); - } - else - { - // save open documents; would be good for non Dtwm, too, - // but there is no real Shutdown message in the ancient - // SM protocol; on Dtwm SaveYourself really means Shutdown, too. - IceSalSession::handleOldX11SaveYourself( this ); + { + // save open documents; would be good for non Dtwm, too, + // but there is no real Shutdown message in the ancient + // SM protocol; on Dtwm SaveYourself really means Shutdown, too. + IceSalSession::handleOldX11SaveYourself( this ); + } } } } diff --git a/vcl/util/makefile2.pmk b/vcl/util/makefile2.pmk index 56102a256ea3..df9ba1a214d7 100644 --- a/vcl/util/makefile2.pmk +++ b/vcl/util/makefile2.pmk @@ -36,6 +36,6 @@ CFLAGSCXX+=$(OBJCXXFLAGS) #building with stlport, but graphite was not built with stlport .IF "$(USE_SYSTEM_STL)"!="YES" .IF "$(SYSTEM_GRAPHITE)"=="YES" -CDEFS += -DGRAPHITEADAPTSTL +CDEFS += -DADAPT_EXT_STL .ENDIF .ENDIF diff --git a/vcl/win/inc/salgdi.h b/vcl/win/inc/salgdi.h index 6b58e0c5375a..4b97eeb98c0b 100644 --- a/vcl/win/inc/salgdi.h +++ b/vcl/win/inc/salgdi.h @@ -228,15 +228,15 @@ protected: // native widget rendering methods that require mirroring virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside ); + const Point& aPos, BOOL& rIsInside ); virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, + ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption ); virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const rtl::OUString& aCaption ); + const rtl::OUString& aCaption ); virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const rtl::OUString& aCaption, + const ImplControlValue& aValue, const rtl::OUString& aCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion ); virtual bool drawAlphaBitmap( const SalTwoRect&, diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index ebe470d3eb7e..1638c4e1bd36 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -47,11 +47,15 @@ #include "vcl/fontsubset.hxx" #include "vcl/sallayout.hxx" +#include "vcl/outdev.h" // for ImplGlyphFallbackFontSubstitution +#include "unotools/fontcfg.hxx" // for IMPL_FONT_ATTR_SYMBOL + #include "rtl/logfile.hxx" #include "rtl/tencinfo.h" #include "rtl/textcvt.h" #include "rtl/bootstrap.hxx" +#include "i18npool/mslangid.hxx" #include "osl/module.h" #include "osl/file.hxx" @@ -82,7 +86,6 @@ #include <set> #include <map> - using namespace vcl; static const int MAXFONTHEIGHT = 2048; @@ -314,6 +317,308 @@ RawFontData::RawFontData( HDC hDC, DWORD nTableTag ) } } +// =========================================================================== +// platform specific font substitution hooks for glyph fallback enhancement +// TODO: move into i18n module (maybe merge with svx/ucsubset.* +// or merge with i18nutil/source/utility/unicode_data.h) +struct Unicode2LangType +{ + sal_UCS4 mnMinCode; + sal_UCS4 mnMaxCode; + LanguageType mnLangID; +}; + +// entries marked with default-CJK get replaced with the default-CJK language +#define LANGUAGE_DEFAULT_CJK 0xFFF0 + +// map unicode ranges to languages supported by OOo +// NOTE: due to the binary search used this list must be sorted by mnMinCode +static Unicode2LangType aLangFromCodeChart[]= { + {0x0000, 0x007F, LANGUAGE_ENGLISH}, // Basic Latin + {0x0080, 0x024F, LANGUAGE_ENGLISH}, // Latin Extended-A and Latin Extended-B + {0x0250, 0x02AF, LANGUAGE_SYSTEM}, // IPA Extensions + {0x0370, 0x03FF, LANGUAGE_GREEK}, // Greek + {0x0590, 0x05FF, LANGUAGE_HEBREW}, // Hebrew + {0x0600, 0x06FF, LANGUAGE_ARABIC_PRIMARY_ONLY}, // Arabic + {0x0900, 0x097F, LANGUAGE_HINDI}, // Devanagari + {0x0980, 0x09FF, LANGUAGE_BENGALI}, // Bengali + {0x0A80, 0x0AFF, LANGUAGE_GUJARATI}, // Gujarati + {0x0B00, 0x0B7F, LANGUAGE_ORIYA}, // Oriya + {0x0B80, 0x0BFF, LANGUAGE_TAMIL}, // Tamil + {0x0C00, 0x0C7F, LANGUAGE_TELUGU}, // Telugu + {0x0C80, 0x0CFF, LANGUAGE_KANNADA}, // Kannada + {0x0D00, 0x0D7F, LANGUAGE_MALAYALAM}, // Malayalam + {0x0D80, 0x0D7F, LANGUAGE_SINHALESE_SRI_LANKA}, // Sinhala + {0x0E00, 0x0E7F, LANGUAGE_THAI}, // Thai + {0x0E80, 0x0EFF, LANGUAGE_LAO}, // Lao + {0x0F00, 0x0FFF, LANGUAGE_TIBETAN}, // Tibetan + {0x1000, 0x109F, LANGUAGE_BURMESE}, // Burmese + {0x10A0, 0x10FF, LANGUAGE_GEORGIAN}, // Georgian + {0x1100, 0x11FF, LANGUAGE_KOREAN}, // Hangul Jamo, Korean-specific +// {0x1200, 0x139F, LANGUAGE_AMHARIC_ETHIOPIA}, // Ethiopic +// {0x1200, 0x139F, LANGUAGE_TIGRIGNA_ETHIOPIA}, // Ethiopic + {0x13A0, 0x13FF, LANGUAGE_CHEROKEE_UNITED_STATES}, // Cherokee +// {0x1400, 0x167F, LANGUAGE_CANADIAN_ABORIGINAL}, // Canadian Aboriginial Syllabics +// {0x1680, 0x169F, LANGUAGE_OGHAM}, // Ogham +// {0x16A0, 0x16F0, LANGUAGE_RUNIC}, // Runic +// {0x1700, 0x171F, LANGUAGE_TAGALOG}, // Tagalog +// {0x1720, 0x173F, LANGUAGE_HANUNOO}, // Hanunoo +// {0x1740, 0x175F, LANGUAGE_BUHID}, // Buhid +// {0x1760, 0x177F, LANGUAGE_TAGBANWA}, // Tagbanwa + {0x1780, 0x17FF, LANGUAGE_KHMER}, // Khmer + {0x18A0, 0x18AF, LANGUAGE_MONGOLIAN}, // Mongolian +// {0x1900, 0x194F, LANGUAGE_LIMBU}, // Limbu +// {0x1950, 0x197F, LANGUAGE_TAILE}, // Tai Le +// {0x1980, 0x19DF, LANGUAGE_TAILUE}, // Tai Lue + {0x19E0, 0x19FF, LANGUAGE_KHMER}, // Khmer Symbols +// {0x1A00, 0x1A1F, LANGUAGE_BUGINESE}, // Buginese/Lontara +// {0x1B00, 0x1B7F, LANGUAGE_BALINESE}, // Balinese +// {0x1D00, 0x1DFF, LANGUAGE_NONE}, // Phonetic Symbols + {0x1E00, 0x1EFF, LANGUAGE_ENGLISH}, // Latin Extended Additional + {0x1F00, 0x1FFF, LANGUAGE_GREEK}, // Greek Extended + {0x2C60, 0x2C7F, LANGUAGE_ENGLISH}, // Latin Extended-C + {0x2E80, 0x2FFf, LANGUAGE_CHINESE_SIMPLIFIED}, // CJK Radicals Supplement + Kangxi Radical + Ideographic Description Characters + {0x3000, 0x303F, LANGUAGE_DEFAULT_CJK}, // CJK Symbols and punctuation + {0x3040, 0x30FF, LANGUAGE_JAPANESE}, // Japanese Hiragana + Katakana + {0x3100, 0x312F, LANGUAGE_CHINESE_TRADITIONAL}, // Bopomofo + {0x3130, 0x318F, LANGUAGE_KOREAN}, // Hangul Compatibility Jamo, Kocrean-specific + {0x3190, 0x319F, LANGUAGE_JAPANESE}, // Kanbun + {0x31A0, 0x31BF, LANGUAGE_CHINESE_TRADITIONAL}, // Bopomofo Extended + {0x31C0, 0x31EF, LANGUAGE_DEFAULT_CJK}, // CJK Ideographs + {0x31F0, 0x31FF, LANGUAGE_JAPANESE}, // Japanese Katakana Phonetic Extensions + {0x3200, 0x321F, LANGUAGE_KOREAN}, // Parenthesized Hangul + {0x3220, 0x325F, LANGUAGE_DEFAULT_CJK}, // Parenthesized Ideographs + {0x3260, 0x327F, LANGUAGE_KOREAN}, // Circled Hangul + {0x3280, 0x32CF, LANGUAGE_DEFAULT_CJK}, // Circled Ideographs + {0x32d0, 0x32FF, LANGUAGE_JAPANESE}, // Japanese Circled Katakana + {0x3400, 0x4DBF, LANGUAGE_DEFAULT_CJK}, // CJK Unified Ideographs Extension A + {0x4E00, 0x9FCF, LANGUAGE_DEFAULT_CJK}, // Unified CJK Ideographs + {0xA720, 0xA7FF, LANGUAGE_ENGLISH}, // Latin Extended-D + {0xAC00, 0xD7AF, LANGUAGE_KOREAN}, // Hangul Syllables, Korean-specific + {0xF900, 0xFAFF, LANGUAGE_DEFAULT_CJK}, // CJK Compatibility Ideographs + {0xFB00, 0xFB4F, LANGUAGE_HEBREW}, // Hebrew Presentation Forms + {0xFB50, 0xFDFF, LANGUAGE_ARABIC_PRIMARY_ONLY}, // Arabic Presentation Forms-A + {0xFE70, 0xFEFE, LANGUAGE_ARABIC_PRIMARY_ONLY}, // Arabic Presentation Forms-B + {0xFF65, 0xFF9F, LANGUAGE_JAPANESE}, // Japanese Halfwidth Katakana variant + {0xFFA0, 0xFFDC, LANGUAGE_KOREAN}, // Kocrean halfwidth hangual variant + {0x10140, 0x1018F, LANGUAGE_GREEK}, // Ancient Greak numbers + {0x1D200, 0x1D24F, LANGUAGE_GREEK}, // Ancient Greek Musical + {0x20000, 0x2A6DF, LANGUAGE_DEFAULT_CJK}, // CJK Unified Ideographs Extension B + {0x2F800, 0x2FA1F, LANGUAGE_DEFAULT_CJK} // CJK Compatibility Ideographs Supplement +}; + +// get language matching to the missing char +LanguageType MapCharToLanguage( sal_UCS4 uChar ) +{ + // entries marked with default-CJK get replaced with the prefered CJK language + static bool bFirst = true; + if( bFirst ) + { + bFirst = false; + + // use method suggested in #i97086# to determnine the systems default language + // TODO: move into i18npool or sal/osl/w32/nlsupport.c + LanguageType nDefaultLang = 0; + HKEY hKey = NULL; + LONG lResult = ::RegOpenKeyExA( HKEY_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Control\\Nls\\Language", + 0, KEY_QUERY_VALUE, &hKey ); + char aKeyValBuf[16]; + DWORD nKeyValSize = sizeof(aKeyValBuf); + if( ERROR_SUCCESS == lResult ) + lResult = RegQueryValueExA( hKey, "Default", NULL, NULL, (LPBYTE)aKeyValBuf, &nKeyValSize ); + aKeyValBuf[ sizeof(aKeyValBuf)-1 ] = '\0'; + if( ERROR_SUCCESS == lResult ) + nDefaultLang = (LanguageType)rtl_str_toInt32( aKeyValBuf, 16 ); + + // TODO: use the default-CJK language selected in + // Tools->Options->LangSettings->Languages when it becomes available here + if( !nDefaultLang ) + nDefaultLang = Application::GetSettings().GetUILanguage(); + + LanguageType nDefaultCJK = LANGUAGE_CHINESE; + switch( nDefaultLang ) + { + case LANGUAGE_JAPANESE: + case LANGUAGE_KOREAN: + case LANGUAGE_KOREAN_JOHAB: + case LANGUAGE_CHINESE_SIMPLIFIED: + case LANGUAGE_CHINESE_TRADITIONAL: + case LANGUAGE_CHINESE_SINGAPORE: + case LANGUAGE_CHINESE_HONGKONG: + case LANGUAGE_CHINESE_MACAU: + nDefaultCJK = nDefaultLang; + break; + default: + nDefaultCJK = LANGUAGE_CHINESE; + break; + } + + // change the marked entries to prefered language + static const int nCount = (sizeof(aLangFromCodeChart) / sizeof(*aLangFromCodeChart)); + for( int i = 0; i < nCount; ++i ) + { + if( aLangFromCodeChart[ i].mnLangID == LANGUAGE_DEFAULT_CJK ) + aLangFromCodeChart[ i].mnLangID = nDefaultCJK; + } + } + + // binary search + int nLow = 0; + int nHigh = (sizeof(aLangFromCodeChart) / sizeof(*aLangFromCodeChart)) - 1; + while( nLow <= nHigh ) + { + int nMiddle = (nHigh + nLow) / 2; + if( uChar < aLangFromCodeChart[ nMiddle].mnMinCode ) + nHigh = nMiddle - 1; + else if( uChar > aLangFromCodeChart[ nMiddle].mnMaxCode ) + nLow = nMiddle + 1; + else + return aLangFromCodeChart[ nMiddle].mnLangID; + } + + return LANGUAGE_DONTKNOW; +} + +class WinGlyphFallbackSubstititution +: public ImplGlyphFallbackFontSubstitution +{ +public: + explicit WinGlyphFallbackSubstititution( HDC ); + + bool FindFontSubstitute( ImplFontSelectData&, rtl::OUString& rMissingChars ) const; +private: + HDC mhDC; + bool HasMissingChars( const ImplFontData*, const rtl::OUString& rMissingChars ) const; +}; + +inline WinGlyphFallbackSubstititution::WinGlyphFallbackSubstititution( HDC hDC ) +: mhDC( hDC ) +{} + +void ImplGetLogFontFromFontSelect( HDC, const ImplFontSelectData*, + LOGFONTW&, bool /*bTestVerticalAvail*/ ); + +// does a font face hold the given missing characters? +bool WinGlyphFallbackSubstititution::HasMissingChars( const ImplFontData* pFace, const rtl::OUString& rMissingChars ) const +{ + const ImplWinFontData* pWinFont = static_cast<const ImplWinFontData*>(pFace); + const ImplFontCharMap* pCharMap = pWinFont->GetImplFontCharMap(); + if( !pCharMap ) + { + // construct a Size structure as the parameter of constructor of class ImplFontSelectData + const Size aSize( pFace->GetWidth(), pFace->GetHeight() ); + // create a ImplFontSelectData object for getting s LOGFONT + const ImplFontSelectData aFSD( *pFace, aSize, (float)aSize.Height(), 0, false ); + // construct log font + LOGFONTW aLogFont; + ImplGetLogFontFromFontSelect( mhDC, &aFSD, aLogFont, true ); + + // create HFONT from log font + HFONT hNewFont = ::CreateFontIndirectW( &aLogFont ); + // select the new font into device + HFONT hOldFont = ::SelectFont( mhDC, hNewFont ); + + // read CMAP table to update their pCharMap + pWinFont->UpdateFromHDC( mhDC );; + + // cleanup temporary font + ::SelectFont( mhDC, hOldFont ); + ::DeleteFont( hNewFont ); + + // get the new charmap + pCharMap = pWinFont->GetImplFontCharMap(); + } + + // avoid fonts with unknown CMAP subtables for glyph fallback + if( !pCharMap || pCharMap->IsDefaultMap() ) + return false; + + int nMatchCount = 0; + // static const int nMaxMatchCount = 1; // TODO: check more missing characters? + const sal_Int32 nStrLen = rMissingChars.getLength(); + for( sal_Int32 nStrIdx = 0; nStrIdx < nStrLen; ++nStrIdx ) + { + const sal_UCS4 uChar = rMissingChars.iterateCodePoints( &nStrIdx ); + nMatchCount += pCharMap->HasChar( uChar ); + break; // for now + } + + const bool bHasMatches = (nMatchCount > 0); + return bHasMatches; +} + +// find a fallback font for missing characters +// TODO: should stylistic matches be searched and prefered? +bool WinGlyphFallbackSubstititution::FindFontSubstitute( ImplFontSelectData& rFontSelData, rtl::OUString& rMissingChars ) const +{ + // guess a locale matching to the missing chars + com::sun::star::lang::Locale aLocale; + + sal_Int32 nStrIdx = 0; + const sal_Int32 nStrLen = rMissingChars.getLength(); + while( nStrIdx < nStrLen ) + { + const sal_UCS4 uChar = rMissingChars.iterateCodePoints( &nStrIdx ); + const LanguageType eLang = MapCharToLanguage( uChar ); + if( eLang == LANGUAGE_DONTKNOW ) + continue; + MsLangId::convertLanguageToLocale( eLang, aLocale ); + break; + } + + // fall back to default UI locale if the missing characters are inconclusive + if( nStrIdx >= nStrLen ) + aLocale = Application::GetSettings().GetUILocale(); + + // first level fallback: + // try use the locale specific default fonts defined in VCL.xcu + const ImplDevFontList* pDevFontList = ImplGetSVData()->maGDIData.mpScreenFontList; + /*const*/ ImplDevFontListData* pDevFont = pDevFontList->ImplFindByLocale( aLocale ); + if( pDevFont ) + { + const ImplFontData* pFace = pDevFont->FindBestFontFace( rFontSelData ); + if( HasMissingChars( pFace, rMissingChars ) ) + { + rFontSelData.maSearchName = pDevFont->GetSearchName(); + return true; + } + } + + // are the missing characters symbols? + pDevFont = pDevFontList->ImplFindByAttributes( IMPL_FONT_ATTR_SYMBOL, + rFontSelData.meWeight, rFontSelData.meWidthType, + rFontSelData.meFamily, rFontSelData.meItalic, rFontSelData.maSearchName ); + if( pDevFont ) + { + const ImplFontData* pFace = pDevFont->FindBestFontFace( rFontSelData ); + if( HasMissingChars( pFace, rMissingChars ) ) + { + rFontSelData.maSearchName = pDevFont->GetSearchName(); + return true; + } + } + + // last level fallback, check each font type face one by one + const ImplGetDevFontList* pTestFontList = pDevFontList->GetDevFontList(); + // limit the count of fonts to be checked to prevent hangs + static const int MAX_GFBFONT_COUNT = 600; + int nTestFontCount = pTestFontList->Count(); + if( nTestFontCount > MAX_GFBFONT_COUNT ) + nTestFontCount = MAX_GFBFONT_COUNT; + + for( int i = 0; i < nTestFontCount; ++i ) + { + const ImplFontData* pFace = pTestFontList->Get( i ); + if( !HasMissingChars( pFace, rMissingChars ) ) + continue; + rFontSelData.maSearchName = pFace->maName; + return true; + } + + return false; +} + // ======================================================================= struct ImplEnumInfo @@ -903,6 +1208,8 @@ bool ImplWinFontData::IsGSUBstituted( sal_UCS4 cChar ) const ImplFontCharMap* ImplWinFontData::GetImplFontCharMap() const { + if( !mpUnicodeMap ) + return NULL; mpUnicodeMap->AddReference(); return mpUnicodeMap; } @@ -2237,6 +2544,10 @@ void WinSalGraphics::GetDevFontList( ImplDevFontList* pFontList ) bImplSalCourierScalable = aInfo.mbImplSalCourierScalable; bImplSalCourierNew = aInfo.mbImplSalCourierNew; } + + // set glyph fallback hook + static WinGlyphFallbackSubstititution aSubstFallback( mhDC ); + pFontList->SetFallbackHook( &aSubstFallback ); } // ---------------------------------------------------------------------------- diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx index 1b7ed7dcfccb..be5d7f8360bc 100644 --- a/vcl/win/source/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx @@ -295,6 +295,10 @@ BOOL WinSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP if( nPart == PART_TRACK_HORZ_AREA || nPart == PART_TRACK_VERT_AREA ) hTheme = getThemeHandle( mhWnd, L"Trackbar" ); break; + case CTRL_LISTNODE: + if( nPart == PART_ENTIRE_CONTROL ) + hTheme = getThemeHandle( mhWnd, L"TreeView" ); + break; default: hTheme = NULL; break; @@ -315,7 +319,6 @@ BOOL WinSalGraphics::hitTestNativeControl( ControlType, ControlPart, const Region&, const Point&, - SalControlHandle&, BOOL& ) { return FALSE; @@ -421,7 +424,6 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, ControlPart nPart, ControlState nState, const ImplControlValue& aValue, - SalControlHandle&, OUString aCaption ) { // a listbox dropdown is actually a combobox dropdown @@ -926,6 +928,27 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, return ImplDrawTheme( hTheme, hDC, iPart, iState, aThumbRect, aCaption ); } + if( nType == CTRL_LISTNODE ) + { + if( nPart != PART_ENTIRE_CONTROL ) + return FALSE; + + ButtonValue aButtonValue = aValue.getTristateVal(); + iPart = TVP_GLYPH; + switch( aButtonValue ) + { + case BUTTONVALUE_ON: + iState = GLPS_OPENED; + break; + case BUTTONVALUE_OFF: + iState = GLPS_CLOSED; + break; + default: + return FALSE; + } + return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption ); + } + return false; } @@ -936,7 +959,6 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, * * rControlRegion: The bounding region of the complete control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the WinSalGraphics implementation. * aCaption: A caption or title string (like button text etc) */ BOOL WinSalGraphics::drawNativeControl( ControlType nType, @@ -944,7 +966,6 @@ BOOL WinSalGraphics::drawNativeControl( ControlType nType, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& aCaption ) { BOOL bOk = false; @@ -1006,6 +1027,10 @@ BOOL WinSalGraphics::drawNativeControl( ControlType nType, if( nPart == PART_ENTIRE_CONTROL ) hTheme = getThemeHandle( mhWnd, L"Progress"); break; + case CTRL_LISTNODE: + if( nPart == PART_ENTIRE_CONTROL ) + hTheme = getThemeHandle( mhWnd, L"TreeView"); + break; case CTRL_SLIDER: if( nPart == PART_TRACK_HORZ_AREA || nPart == PART_TRACK_VERT_AREA ) hTheme = getThemeHandle( mhWnd, L"Trackbar" ); @@ -1031,7 +1056,7 @@ BOOL WinSalGraphics::drawNativeControl( ControlType nType, OUString aCaptionStr( aCaption.replace('~', '&') ); // translate mnemonics bOk = ImplDrawNativeControl(mhDC, hTheme, rc, nType, nPart, nState, aValue, - rControlHandle, aCaptionStr ); + aCaptionStr ); // restore alignment SetTextAlign( mhDC, ta ); @@ -1051,7 +1076,6 @@ BOOL WinSalGraphics::drawNativeControl( ControlType nType, * * rControlRegion: The bounding region of the complete control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the WinSalGraphics implementation. * aCaption: A caption or title string (like button text etc) */ BOOL WinSalGraphics::drawNativeControlText( ControlType, @@ -1059,7 +1083,6 @@ BOOL WinSalGraphics::drawNativeControlText( ControlType, const Region&, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString& ) { return( false ); @@ -1077,15 +1100,13 @@ BOOL WinSalGraphics::drawNativeControlText( ControlType, * * rControlRegion: The bounding region of the control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the WinSalGraphics implementation. * aCaption: A caption or title string (like button text etc) */ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, - ControlState, - const ImplControlValue&, - SalControlHandle&, + ControlState nState, + const ImplControlValue& rControlValue, const OUString&, Region &rNativeBoundingRegion, Region &rNativeContentRegion ) @@ -1201,6 +1222,7 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, } } } + if( nType == CTRL_SLIDER && ( (nPart == PART_THUMB_HORZ) || (nPart == PART_THUMB_VERT) ) ) { HTHEME hTheme = getThemeHandle( mhWnd, L"Trackbar"); @@ -1229,6 +1251,37 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, } } + if ( ( nType == CTRL_TAB_ITEM ) && ( nPart == PART_ENTIRE_CONTROL ) ) + { + Rectangle aControlRect( rControlRegion.GetBoundRect() ); + rNativeContentRegion = aControlRect; + + --aControlRect.Bottom(); + + TabitemValue *pValue = static_cast< TabitemValue* >( rControlValue.getOptionalVal() ); + if ( pValue ) + { + if ( pValue->isBothAligned() ) + --aControlRect.Right(); + } + + if ( nState & CTRL_STATE_SELECTED ) + { + aControlRect.Left() -= 2; + if ( pValue && !pValue->isBothAligned() ) + { + if ( pValue->isLeftAligned() || pValue->isNotAligned() ) + aControlRect.Right() += 2; + if ( pValue->isRightAligned() ) + aControlRect.Right() += 1; + } + aControlRect.Top() -= 2; + aControlRect.Bottom() += 2; + } + rNativeBoundingRegion = aControlRect; + bRet = TRUE; + } + ReleaseDC( mhWnd, hDC ); return( bRet ); } |