diff options
author | Armin Le Grand <Armin.Le.Grand@Sun.COM> | 2009-12-21 20:40:13 +0100 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@Sun.COM> | 2009-12-21 20:40:13 +0100 |
commit | c15bb1c231307a09254adbc1338019d5a49b6024 (patch) | |
tree | 41360fbd2279c1d1a088d714389fbdd76959478f /vcl | |
parent | 3b790d2e0926c75a8a919e02bfad05d1b1aff800 (diff) | |
parent | 0c5348ff2c5cede4607555fdab45642db10b07ba (diff) |
aw078: resync to DEV300m68for integration
Diffstat (limited to 'vcl')
131 files changed, 3256 insertions, 5431 deletions
diff --git a/vcl/aqua/inc/salframe.h b/vcl/aqua/inc/salframe.h index 1d1eb3cb6bd3..5ddd96dae34d 100644 --- a/vcl/aqua/inc/salframe.h +++ b/vcl/aqua/inc/salframe.h @@ -121,6 +121,7 @@ public: virtual BOOL PostEvent( void* pData ); virtual void SetTitle( const XubString& rTitle ); virtual void SetIcon( USHORT nIcon ); + virtual void SetRepresentedURL( const rtl::OUString& ); virtual void SetMenu( SalMenu* pSalMenu ); virtual void DrawMenuBar(); virtual void Show( BOOL bVisible, BOOL bNoActivate = FALSE ); @@ -140,7 +141,7 @@ public: virtual void SetPointer( PointerStyle ePointerStyle ); virtual void CaptureMouse( BOOL bMouse ); virtual void SetPointerPos( long nX, long nY ); - virtual void Flush( void); + virtual void Flush( void ); virtual void Flush( const Rectangle& ); virtual void Sync(); virtual void SetInputContext( SalInputContext* pContext ); diff --git a/vcl/aqua/inc/salframeview.h b/vcl/aqua/inc/salframeview.h index 7fd4d96c4a45..e823837e7af6 100755 --- a/vcl/aqua/inc/salframeview.h +++ b/vcl/aqua/inc/salframeview.h @@ -132,7 +132,11 @@ -(void)moveWordForwardAndModifySelection: (id)aSender; -(void)moveWordRightAndModifySelection: (id)aSender; -(void)moveToEndOfLine: (id)aSender; +-(void)moveToRightEndOfLine: (id)aSender; +-(void)moveToLeftEndOfLine: (id)aSender; -(void)moveToEndOfLineAndModifySelection: (id)aSender; +-(void)moveToRightEndOfLineAndModifySelection: (id)aSender; +-(void)moveToLeftEndOfLineAndModifySelection: (id)aSender; -(void)moveToBeginningOfLine: (id)aSender; -(void)moveToBeginningOfLineAndModifySelection: (id)aSender; -(void)moveToEndOfParagraph: (id)aSender; @@ -144,8 +148,10 @@ -(void)moveParagraphBackward: (id)aSender; -(void)moveParagraphBackwardAndModifySelection: (id)aSender; -(void)moveToEndOfDocument: (id)aSender; +-(void)scrollToEndOfDocument: (id)aSender; -(void)moveToEndOfDocumentAndModifySelection: (id)aSender; -(void)moveToBeginningOfDocument: (id)aSender; +-(void)scrollToBeginningOfDocument: (id)aSender; -(void)moveToBeginningOfDocumentAndModifySelection: (id)aSender; -(void)insertNewline: (id)aSender; -(void)deleteBackward: (id)aSender; diff --git a/vcl/aqua/inc/salgdi.h b/vcl/aqua/inc/salgdi.h index 11abd6086ce7..4933dbc48586 100644 --- a/vcl/aqua/inc/salgdi.h +++ b/vcl/aqua/inc/salgdi.h @@ -358,6 +358,7 @@ private: void ApplyXorContext(); void Pattern50Fill(); + UInt32 getState( ControlState nState ); }; class XorEmulation diff --git a/vcl/aqua/source/a11y/documentfocuslistener.cxx b/vcl/aqua/source/a11y/documentfocuslistener.cxx index 2bb1429bc9fe..f20a67a85f29 100644 --- a/vcl/aqua/source/a11y/documentfocuslistener.cxx +++ b/vcl/aqua/source/a11y/documentfocuslistener.cxx @@ -102,12 +102,12 @@ DocumentFocusListener::notifyEvent( const AccessibleEventObject& aEvent ) break; case AccessibleEventId::INVALIDATE_ALL_CHILDREN: -/* { + { Reference< XAccessible > xAccessible( getAccessible(aEvent) ); detachRecursive(xAccessible); attachRecursive(xAccessible); } -*/ + OSL_TRACE( "Invalidate all children called\n" ); break; default: diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx index e4037df0c4aa..4ec3339d5372 100644 --- a/vcl/aqua/source/app/salinst.cxx +++ b/vcl/aqua/source/app/salinst.cxx @@ -69,7 +69,7 @@ #import "apple_remote/RemoteMainController.h" #include "apple_remote/RemoteControl.h" #include "postmac.h" - +#include <tools/solarmutex.hxx> using namespace std; using namespace ::com::sun::star; @@ -472,6 +472,7 @@ AquaSalInstance::AquaSalInstance() { mpSalYieldMutex = new SalYieldMutex; mpSalYieldMutex->acquire(); + ::tools::SolarMutex::SetSolarMutex( mpSalYieldMutex ); maMainThread = vos::OThread::getCurrentIdentifier(); mbWaitingYield = false; maUserEventListMutex = osl_createMutex(); @@ -482,6 +483,7 @@ AquaSalInstance::AquaSalInstance() AquaSalInstance::~AquaSalInstance() { + ::tools::SolarMutex::SetSolarMutex( 0 ); mpSalYieldMutex->release(); delete mpSalYieldMutex; osl_destroyMutex( maUserEventListMutex ); diff --git a/vcl/aqua/source/gdi/salatslayout.cxx b/vcl/aqua/source/gdi/salatslayout.cxx index 7ecef01cf0d5..1387a46c6345 100755 --- a/vcl/aqua/source/gdi/salatslayout.cxx +++ b/vcl/aqua/source/gdi/salatslayout.cxx @@ -70,12 +70,13 @@ private: // to prevent ATS overflowing the Fixed16.16 values // ATS font requests get size limited by downscaling huge fonts // in these cases the font scale becomes something bigger than 1.0 - float mfFontScale; + float mfFontScale; private: bool InitGIA( ImplLayoutArgs* pArgs = NULL ) const; bool GetIdealX() const; bool GetDeltaY() const; + void InvalidateMeasurements(); int Fixed2Vcl( Fixed ) const; // convert ATSU-Fixed units to VCL units int AtsuPix2Vcl( int ) const; // convert ATSU-Pixel units to VCL units @@ -302,17 +303,15 @@ void ATSLayout::AdjustLayout( ImplLayoutArgs& rArgs ) nPixelWidth = rArgs.mpDXArray[ mnCharCount - 1 ]; // workaround for ATSUI not using trailing spaces for justification - mnTrailingSpaceWidth = 0; int i = mnCharCount; - while( (--i > 0) && IsSpacingGlyph( rArgs.mpStr[mnMinCharPos+i]|GF_ISCHAR ) ) - mnTrailingSpaceWidth += rArgs.mpDXArray[i] - rArgs.mpDXArray[i-1]; - if( i <= 0 ) + while( (--i >= 0) && IsSpacingGlyph( rArgs.mpStr[mnMinCharPos+i]|GF_ISCHAR ) ) {} + if( i < 0 ) // nothing to do if the text is all spaces return; // #i91685# trailing letters are left aligned (right aligned for RTL) - mnTrailingSpaceWidth += rArgs.mpDXArray[i]; + mnTrailingSpaceWidth = rArgs.mpDXArray[ mnCharCount-1 ]; if( i > 0 ) - mnTrailingSpaceWidth -= rArgs.mpDXArray[i-1]; - InitGIA(); // ensure valid mpCharWidths[] + mnTrailingSpaceWidth -= rArgs.mpDXArray[ i-1 ]; + InitGIA(); // ensure valid mpCharWidths[], TODO: use GetIdealX() instead? mnTrailingSpaceWidth -= Fixed2Vcl( mpCharWidths[i] ); // ignore trailing space for calculating the available width nOrigWidth -= mnTrailingSpaceWidth; @@ -326,11 +325,15 @@ void ATSLayout::AdjustLayout( ImplLayoutArgs& rArgs ) if( !nPixelWidth ) return; - // HACK: justification requests which change the width by just one pixel are probably + // HACK: justification requests which change the width by just one pixel were probably // #i86038# introduced by lossy conversions between integer based coordinate system + // => ignoring such requests has many more benefits than eventual drawbacks if( (nOrigWidth >= nPixelWidth-1) && (nOrigWidth <= nPixelWidth+1) ) return; + // changing the layout will make all previous measurements invalid + InvalidateMeasurements(); + ATSUAttributeTag nTags[3]; ATSUAttributeValuePtr nVals[3]; ByteCount nBytes[3]; @@ -354,7 +357,7 @@ void ATSLayout::AdjustLayout( ImplLayoutArgs& rArgs ) if( eStatus != noErr ) return; - // check result of the justied layout + // update the measurements of the justified layout to match the justification request if( rArgs.mpDXArray ) InitGIA( &rArgs ); } @@ -1071,6 +1074,23 @@ bool ATSLayout::GetDeltaY() const return true; } +// ----------------------------------------------------------------------- + +#define DELETEAZ( X ) { delete[] X; X = NULL; } + +void ATSLayout::InvalidateMeasurements() +{ + mnGlyphCount = -1; + DELETEAZ( mpGlyphIds ); + DELETEAZ( mpCharWidths ); + DELETEAZ( mpChars2Glyphs ); + DELETEAZ( mpGlyphs2Chars ); + DELETEAZ( mpGlyphRTLFlags ); + DELETEAZ( mpGlyphAdvances ); + DELETEAZ( mpGlyphOrigAdvs ); + DELETEAZ( mpDeltaY ); +} + // ======================================================================= #if 0 diff --git a/vcl/aqua/source/gdi/salatsuifontutils.cxx b/vcl/aqua/source/gdi/salatsuifontutils.cxx index 8e38981a3c7c..23755ae2f571 100644 --- a/vcl/aqua/source/gdi/salatsuifontutils.cxx +++ b/vcl/aqua/source/gdi/salatsuifontutils.cxx @@ -207,6 +207,13 @@ static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes& rDF rDFA.meItalic = ITALIC_NONE; rDFA.mbSymbolFlag = false; + // ignore bitmap fonts + ATSFontRef rATSFontRef = FMGetATSFontRefFromFont( nFontID ); + ByteCount nHeadLen = 0; + OSStatus rc = ATSFontGetTable( rATSFontRef, 0x68656164/*head*/, 0, 0, NULL, &nHeadLen ); + if( (rc != noErr) || (nHeadLen <= 0) ) + return false; + // all scalable fonts on this platform are subsettable rDFA.mbSubsettable = true; rDFA.mbEmbeddable = false; @@ -216,7 +223,7 @@ static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes& rDF // prepare iterating over all name strings of the font ItemCount nFontNameCount = 0; - OSStatus rc = ATSUCountFontNames( nFontID, &nFontNameCount ); + rc = ATSUCountFontNames( nFontID, &nFontNameCount ); if( rc != noErr ) return false; int nBestNameValue = 0; diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index f38b9852e57e..263a5b6e6803 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -405,6 +405,16 @@ void AquaSalGraphics::initResolution( NSWindow* pWin ) DBG_ERROR( "no screen found" ); } + // #i107076# maintaining size-WYSIWYG-ness causes many problems for + // low-DPI, high-DPI or for mis-reporting devices + // => it is better to limit the calculation result then + static const int nMinDPI = 72; + if( (mnRealDPIX < nMinDPI) || (mnRealDPIY < nMinDPI) ) + mnRealDPIX = mnRealDPIY = nMinDPI; + static const int nMaxDPI = 200; + if( (mnRealDPIX > nMaxDPI) || (mnRealDPIY > nMaxDPI) ) + mnRealDPIX = mnRealDPIY = nMaxDPI; + // for OSX any anisotropy reported for the display resolution is best ignored (e.g. TripleHead2Go) mnRealDPIX = mnRealDPIY = (mnRealDPIX + mnRealDPIY + 1) / 2; @@ -932,27 +942,29 @@ bool AquaSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPol AddPolygonToPath( xPath, rPolygon, true, !getAntiAliasB2DDraw(), IsPenVisible() ); } - // use the path to prepare the graphics context - CGContextSaveGState( mrContext ); - CGContextBeginPath( mrContext ); - CGContextAddPath( mrContext, xPath ); const CGRect aRefreshRect = CGPathGetBoundingBox( xPath ); - CGPathRelease( xPath ); - #ifndef NO_I97317_WORKAROUND // #i97317# workaround for Quartz having problems with drawing small polygons - if( (aRefreshRect.size.width <= 0.125) && (aRefreshRect.size.height <= 0.125) ) - return true; + if( ! ((aRefreshRect.size.width <= 0.125) && (aRefreshRect.size.height <= 0.125)) ) #endif + { + // use the path to prepare the graphics context + CGContextSaveGState( mrContext ); + CGContextBeginPath( mrContext ); + CGContextAddPath( mrContext, xPath ); + + // draw path with antialiased polygon + CGContextSetShouldAntialias( mrContext, true ); + CGContextSetAlpha( mrContext, 1.0 - fTransparency ); + CGContextDrawPath( mrContext, kCGPathEOFillStroke ); + CGContextRestoreGState( mrContext ); + + // mark modified rectangle as updated + RefreshRect( aRefreshRect ); + } - // draw path with antialiased polygon - CGContextSetShouldAntialias( mrContext, true ); - CGContextSetAlpha( mrContext, 1.0 - fTransparency ); - CGContextDrawPath( mrContext, kCGPathEOFillStroke ); - CGContextRestoreGState( mrContext ); + CGPathRelease( xPath ); - // mark modified rectangle as updated - RefreshRect( aRefreshRect ); return true; } @@ -967,13 +979,15 @@ bool AquaSalGraphics::drawPolyLine( const ::basegfx::B2DPolygon& rPolyLine, if( nPointCount <= 0 ) return true; - // reject strange requests + // reject requests that cannot be handled yet if( rLineWidths.getX() != rLineWidths.getY() ) return false; // #i101491# Aqua does not support B2DLINEJOIN_NONE; return false to use // the fallback (own geometry preparation) - if(basegfx::B2DLINEJOIN_NONE == eLineJoin) + // #i104886# linejoin-mode and thus the above only applies to "fat" lines + if( (basegfx::B2DLINEJOIN_NONE == eLineJoin) + && (rLineWidths.getX() > 1.3) ) return false; // setup line attributes @@ -990,27 +1004,28 @@ bool AquaSalGraphics::drawPolyLine( const ::basegfx::B2DPolygon& rPolyLine, CGMutablePathRef xPath = CGPathCreateMutable(); AddPolygonToPath( xPath, rPolyLine, rPolyLine.isClosed(), !getAntiAliasB2DDraw(), true ); - // use the path to prepare the graphics context - CGContextSaveGState( mrContext ); - CGContextAddPath( mrContext, xPath ); const CGRect aRefreshRect = CGPathGetBoundingBox( xPath ); - CGPathRelease( xPath ); - #ifndef NO_I97317_WORKAROUND // #i97317# workaround for Quartz having problems with drawing small polygons - if( (aRefreshRect.size.width <= 0.125) && (aRefreshRect.size.height <= 0.125) ) - return true; + if( ! ((aRefreshRect.size.width <= 0.125) && (aRefreshRect.size.height <= 0.125)) ) #endif + { + // use the path to prepare the graphics context + CGContextSaveGState( mrContext ); + CGContextAddPath( mrContext, xPath ); + // draw path with antialiased line + CGContextSetShouldAntialias( mrContext, true ); + CGContextSetLineJoin( mrContext, aCGLineJoin ); + CGContextSetLineWidth( mrContext, rLineWidths.getX() ); + CGContextDrawPath( mrContext, kCGPathStroke ); + CGContextRestoreGState( mrContext ); + + // mark modified rectangle as updated + RefreshRect( aRefreshRect ); + } - // draw path with antialiased line - CGContextSetShouldAntialias( mrContext, true ); - CGContextSetLineJoin( mrContext, aCGLineJoin ); - CGContextSetLineWidth( mrContext, rLineWidths.getX() ); - CGContextDrawPath( mrContext, kCGPathStroke ); - CGContextRestoreGState( mrContext ); + CGPathRelease( xPath ); - // mark modified rectangle as updated - RefreshRect( aRefreshRect ); return true; } diff --git a/vcl/aqua/source/gdi/salnativewidgets.cxx b/vcl/aqua/source/gdi/salnativewidgets.cxx index 6cd4e78a2d1a..754358823a93 100644 --- a/vcl/aqua/source/gdi/salnativewidgets.cxx +++ b/vcl/aqua/source/gdi/salnativewidgets.cxx @@ -430,9 +430,10 @@ BOOL AquaSalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart #define CTRL_STATE_SELECTED 0x0040 #define CTRL_CACHING_ALLOWED 0x8000 // set when the control is completely visible (i.e. not clipped) */ -static ThemeDrawState getState( ControlState nState ) +UInt32 AquaSalGraphics::getState( ControlState nState ) { - if( (nState & CTRL_STATE_ENABLED) == 0 ) + bool bDrawActive = mpFrame ? ([mpFrame->getWindow() isKeyWindow] ? true : false) : true; + if( (nState & CTRL_STATE_ENABLED) == 0 || ! bDrawActive ) { if( (nState & CTRL_STATE_HIDDEN) == 0 ) return kThemeStateInactive; diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx index b942c97cead1..7fe3b93ef2e8 100644 --- a/vcl/aqua/source/window/salframe.cxx +++ b/vcl/aqua/source/window/salframe.cxx @@ -54,10 +54,7 @@ #include "boost/assert.hpp" #include "vcl/svapp.hxx" #include "rtl/ustrbuf.hxx" - -#include <premac.h> -#include <CoreFoundation/CoreFoundation.h> -#include <postmac.h> +#include "osl/file.h" using namespace std; @@ -329,8 +326,25 @@ void AquaSalFrame::SetTitle(const XubString& rTitle) // ----------------------------------------------------------------------- -void AquaSalFrame::SetIcon( USHORT nIcon ) +void AquaSalFrame::SetIcon( USHORT ) +{ +} + +// ----------------------------------------------------------------------- + +void AquaSalFrame::SetRepresentedURL( const rtl::OUString& i_rDocURL ) { + if( i_rDocURL.indexOfAsciiL( "file:", 5 ) == 0 ) + { + rtl::OUString aSysPath; + osl_getSystemPathFromFileURL( i_rDocURL.pData, &aSysPath.pData ); + NSString* pStr = CreateNSString( aSysPath ); + if( pStr ) + { + [pStr autorelease]; + [mpWindow setRepresentedFilename: pStr]; + } + } } // ----------------------------------------------------------------------- diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm index 68ea2c2062f2..51f1b1a3b63c 100755 --- a/vcl/aqua/source/window/salframeview.mm +++ b/vcl/aqua/source/window/salframeview.mm @@ -215,6 +215,7 @@ static AquaSalFrame* getMouseContainerFrame() AquaSalMenu::enableMainMenu( false ); #endif mpFrame->CallCallback( SALEVENT_GETFOCUS, 0 ); + mpFrame->SendPaintEvent(); // repaint controls as active } } @@ -223,7 +224,10 @@ static AquaSalFrame* getMouseContainerFrame() YIELD_GUARD; if( mpFrame && AquaSalFrame::isAlive( mpFrame ) ) + { mpFrame->CallCallback(SALEVENT_LOSEFOCUS, 0); + mpFrame->SendPaintEvent(); // repaint controls as inactive + } } -(void)windowDidChangeScreen: (NSNotification*)pNotification @@ -1061,21 +1065,41 @@ private: [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_END_OF_LINE character: 0 modifiers: 0]; } +-(void)moveToRightEndOfLine: (id)aSender +{ + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_END_OF_LINE character: 0 modifiers: 0]; +} + -(void)moveToEndOfLineAndModifySelection: (id)aSender { [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::SELECT_TO_END_OF_LINE character: 0 modifiers: 0]; } +-(void)moveToRightEndOfLineAndModifySelection: (id)aSender +{ + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::SELECT_TO_END_OF_LINE character: 0 modifiers: 0]; +} + -(void)moveToBeginningOfLine: (id)aSender { [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_LINE character: 0 modifiers: 0]; } +-(void)moveToLeftEndOfLine: (id)aSender +{ + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_LINE character: 0 modifiers: 0]; +} + -(void)moveToBeginningOfLineAndModifySelection: (id)aSender { [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_LINE character: 0 modifiers: 0]; } +-(void)moveToLeftEndOfLineAndModifySelection: (id)aSender +{ + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_LINE character: 0 modifiers: 0]; +} + -(void)moveToEndOfParagraph: (id)aSender { [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_END_OF_PARAGRAPH character: 0 modifiers: 0]; @@ -1121,6 +1145,12 @@ private: [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_END_OF_DOCUMENT character: 0 modifiers: 0]; } +-(void)scrollToEndOfDocument: (id)aSender +{ + // this is not exactly what we should do, but it makes "End" and "Shift-End" behave consistent + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_END_OF_DOCUMENT character: 0 modifiers: 0]; +} + -(void)moveToEndOfDocumentAndModifySelection: (id)aSender { [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::SELECT_TO_END_OF_DOCUMENT character: 0 modifiers: 0]; @@ -1131,6 +1161,12 @@ private: [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT character: 0 modifiers: 0]; } +-(void)scrollToBeginningOfDocument: (id)aSender +{ + // this is not exactly what we should do, but it makes "Home" and "Shift-Home" behave consistent + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT character: 0 modifiers: 0]; +} + -(void)moveToBeginningOfDocumentAndModifySelection: (id)aSender { [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT character: 0 modifiers: 0]; @@ -1328,11 +1364,32 @@ private: { mbNeedSpecialKeyHandle = true; } + + // FIXME: + // #i106901# + // if we come here outside of mbInKeyInput, this is likely to be because + // of the keyboard viewer. For unknown reasons having no marked range + // in this case causes a crash. So we say we have a marked range anyway + // This is a hack, since it is not understood what a) causes that crash + // and b) why we should have a marked range at this point. + if( ! mbInKeyInput ) + bHasMarkedText = YES; + return bHasMarkedText; } - (NSRange)markedRange { + // FIXME: + // #i106901# + // if we come here outside of mbInKeyInput, this is likely to be because + // of the keyboard viewer. For unknown reasons having no marked range + // in this case causes a crash. So we say we have a marked range anyway + // This is a hack, since it is not understood what a) causes that crash + // and b) why we should have a marked range at this point. + if( ! mbInKeyInput ) + return NSMakeRange( 0, 0 ); + return [self hasMarkedText] ? mMarkedRange : NSMakeRange( NSNotFound, 0 ); } @@ -1437,6 +1494,9 @@ private: { if( AquaSalFrame::isAlive( mpFrame ) ) { + #if OSL_DEBUG_LEVEL > 1 + // fprintf( stderr, "SalFrameView: doCommandBySelector %s\n", (char*)aSelector ); + #endif if( (mpFrame->mnICOptions & SAL_INPUTCONTEXT_TEXT) != 0 && aSelector != NULL && [self respondsToSelector: aSelector] ) { diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx index 94df24a9cea7..b80edf6712cd 100644 --- a/vcl/inc/vcl/button.hxx +++ b/vcl/inc/vcl/button.hxx @@ -144,10 +144,10 @@ protected: SAL_DLLPRIVATE PushButton( const PushButton & ); SAL_DLLPRIVATE PushButton& operator=( const PushButton & ); -protected: - using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + using Control::ImplInitSettings; + using Window::ImplInit; public: SAL_DLLPRIVATE void ImplSetDefButton( BOOL bSet ); SAL_DLLPRIVATE static void ImplDrawPushButtonFrame( Window* pDev, Rectangle& rRect, USHORT nStyle ); @@ -158,6 +158,10 @@ protected: PushButton( WindowType nType ); virtual void FillLayoutData() const; + virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; public: PushButton( Window* pParent, WinBits nStyle = 0 ); PushButton( Window* pParent, const ResId& rResId ); @@ -307,19 +311,20 @@ private: SAL_DLLPRIVATE void ImplDrawRadioButtonState(); SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, const Point& rPos, const Size& rSize, - const Size& rImageSize, long nImageSep, - Rectangle& rStateRect, Rectangle& rMouseRect, - bool bLayout = false ); + const Size& rImageSize, Rectangle& rStateRect, + Rectangle& rMouseRect, bool bLayout = false ); SAL_DLLPRIVATE void ImplDrawRadioButton( bool bLayout = false ); SAL_DLLPRIVATE void ImplInvalidateOrDrawRadioButtonState(); SAL_DLLPRIVATE void ImplUncheckAllOther(); SAL_DLLPRIVATE Size ImplGetRadioImageSize() const; + SAL_DLLPRIVATE long ImplGetImageToTextDistance() const; // Copy assignment is forbidden and not implemented. SAL_DLLPRIVATE RadioButton(const RadioButton &); SAL_DLLPRIVATE RadioButton& operator= (const RadioButton &); protected: + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); @@ -330,6 +335,10 @@ public: protected: virtual void FillLayoutData() const; + virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; inline void SetMouseRect( const Rectangle& _rMouseRect ) { maMouseRect = _rMouseRect; } inline const Rectangle& GetMouseRect( ) const { return maMouseRect; } @@ -420,10 +429,10 @@ private: SAL_DLLPRIVATE void ImplInvalidateOrDrawCheckBoxState(); SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, const Point& rPos, const Size& rSize, - const Size& rImageSize, long nImageSep, - Rectangle& rStateRect, + const Size& rImageSize, Rectangle& rStateRect, Rectangle& rMouseRect, bool bLayout ); SAL_DLLPRIVATE void ImplDrawCheckBox( bool bLayout = false ); + SAL_DLLPRIVATE long ImplGetImageToTextDistance() const; SAL_DLLPRIVATE Size ImplGetCheckImageSize() const; // Copy assignment is forbidden and not implemented. @@ -431,10 +440,15 @@ private: SAL_DLLPRIVATE CheckBox& operator= (const CheckBox &); protected: + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); SAL_DLLPRIVATE virtual void FillLayoutData() const; + SAL_DLLPRIVATE virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + SAL_DLLPRIVATE virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; public: SAL_DLLPRIVATE void ImplCheck(); diff --git a/vcl/inc/vcl/controldata.hxx b/vcl/inc/vcl/controldata.hxx new file mode 100644 index 000000000000..9ea698e792bd --- /dev/null +++ b/vcl/inc/vcl/controldata.hxx @@ -0,0 +1,60 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* 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. +************************************************************************/ +
+#ifndef VCL_CONTROLDATA_HXX +#define VCL_CONTROLDATA_HXX + +#include <vcl/controllayout.hxx> + +//........................................................................ +namespace vcl +{ +//........................................................................ + + //==================================================================== + //= ImplControlData + //==================================================================== + struct ImplControlData + { + mutable ControlLayoutData* mpLayoutData; + OutputDevice* mpReferenceDevice; + + ImplControlData() + :mpLayoutData( NULL ) + ,mpReferenceDevice( NULL ) + { + } + + ~ImplControlData() + { + delete mpLayoutData; + } + }; + +//........................................................................ +} // namespace vcl +//........................................................................ + +#endif // VCL_CONTROLDATA_HXX diff --git a/vcl/inc/vcl/ctrl.hxx b/vcl/inc/vcl/ctrl.hxx index 7bb5620ef93f..535f75549991 100644 --- a/vcl/inc/vcl/ctrl.hxx +++ b/vcl/inc/vcl/ctrl.hxx @@ -38,7 +38,7 @@ #include <vcl/salnativewidgets.hxx> // forward -namespace vcl { struct ControlLayoutData; } +namespace vcl { struct ImplControlData; struct ControlLayoutData; } // ----------- // - Control - @@ -47,11 +47,12 @@ namespace vcl { struct ControlLayoutData; } class VCL_DLLPUBLIC Control : public Window { protected: - mutable vcl::ControlLayoutData* mpLayoutData; + ::vcl::ImplControlData* mpControlData; + private: - BOOL mbHasFocus; - Link maGetFocusHdl; - Link maLoseFocusHdl; + BOOL mbHasFocus; + Link maGetFocusHdl; + Link maLoseFocusHdl; SAL_DLLPRIVATE void ImplInitControlData(); @@ -66,6 +67,14 @@ protected: // helper method for composite controls void AppendLayoutData( const Control& rSubControl ) const; + /// creates the mpData->mpLayoutData structure + void CreateLayoutData() const; + /// determines whether we currently have layout data + bool HasLayoutData() const; + /// returns the current layout data + ::vcl::ControlLayoutData* + GetLayoutData() const; + /** this calls both our event listeners, and a specified handler If the Control instance is destroyed during any of those calls, the @@ -84,6 +93,25 @@ protected: ULONG nEvent, const Link& rHandler, void* pCaller ); + /** draws the given text onto the given device + + If no reference device is set, the draw request will simply be forwarded to OutputDevice::DrawText. Otherwise, + the text will be rendered according to the metrics at the reference device. + + Note that the given rectangle might be modified, it will contain the result of a GetTextRect call (either + directly at the target device, or taking the reference device into account) when returning. + */ + void DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRect, + const XubString& _rStr, USHORT _nStyle, + MetricVector* _pVector, String* _pDisplayText ) const; + + virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; + + void ImplInitSettings( const BOOL _bFont, const BOOL _bForeground ); + //#if 0 // _SOLAR__PRIVATE public: SAL_DLLPRIVATE void ImplClearLayoutData() const; @@ -157,6 +185,20 @@ public: void SetLayoutDataParent( const Control* pParent ) const; virtual Size GetOptimalSize(WindowSizeType eType) const; + + /** sets a reference device used for rendering control text + @seealso DrawControlText + */ + void SetReferenceDevice( OutputDevice* _referenceDevice ); + OutputDevice* GetReferenceDevice() const; + + Font GetUnzoomedControlPointFont() const + { + Font aFont( GetCanonicalFont( GetSettings().GetStyleSettings() ) ); + if ( IsControlFont() ) + aFont.Merge( GetControlFont() ); + return aFont; + } }; #endif // _SV_CTRL_HXX diff --git a/vcl/inc/vcl/dialog.hxx b/vcl/inc/vcl/dialog.hxx index f34db3a2a5db..c5f032dfff82 100644 --- a/vcl/inc/vcl/dialog.hxx +++ b/vcl/inc/vcl/dialog.hxx @@ -65,6 +65,7 @@ private: SAL_DLLPRIVATE Dialog (const Dialog &); SAL_DLLPRIVATE Dialog & operator= (const Dialog &); + DECL_DLLPRIVATE_LINK( ImplAsyncCloseHdl, void* ); protected: using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); diff --git a/vcl/inc/vcl/edit.hxx b/vcl/inc/vcl/edit.hxx index 534d63b3427c..fb99bd028631 100644 --- a/vcl/inc/vcl/edit.hxx +++ b/vcl/inc/vcl/edit.hxx @@ -124,6 +124,7 @@ private: SAL_DLLPRIVATE ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > ImplGetBreakIterator() const; protected: + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); diff --git a/vcl/inc/vcl/fixbrd.hxx b/vcl/inc/vcl/fixbrd.hxx index 52de68d1c71f..68e1e69b9054 100644 --- a/vcl/inc/vcl/fixbrd.hxx +++ b/vcl/inc/vcl/fixbrd.hxx @@ -57,6 +57,7 @@ private: BOOL mbTransparent; private: + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); diff --git a/vcl/inc/vcl/fixed.hxx b/vcl/inc/vcl/fixed.hxx index ba576f280b83..a5c834fce486 100644 --- a/vcl/inc/vcl/fixed.hxx +++ b/vcl/inc/vcl/fixed.hxx @@ -47,6 +47,7 @@ class VCL_DLLPUBLIC FixedText : public Control { //#if 0 // _SOLAR__PRIVATE private: + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); @@ -58,6 +59,11 @@ public: //#endif protected: virtual void FillLayoutData() const; + virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; + public: FixedText( Window* pParent, WinBits nStyle = 0 ); FixedText( Window* pParent, const ResId& rResId ); @@ -81,6 +87,7 @@ public: class VCL_DLLPUBLIC FixedLine : public Control { private: + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); @@ -89,6 +96,10 @@ private: protected: virtual void FillLayoutData() const; + virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; public: FixedLine( Window* pParent, WinBits nStyle = WB_HORZ ); @@ -113,6 +124,7 @@ private: Bitmap maBitmap; Bitmap maBitmapHC; + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); @@ -153,6 +165,7 @@ private: BOOL mbInUserDraw; private: + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); diff --git a/vcl/inc/vcl/fldunit.hxx b/vcl/inc/vcl/fldunit.hxx index 98bc27cbadba..7417342d95be 100644 --- a/vcl/inc/vcl/fldunit.hxx +++ b/vcl/inc/vcl/fldunit.hxx @@ -31,14 +31,6 @@ #ifndef _VCL_FLDUNIT_HXX #define _VCL_FLDUNIT_HXX -// -------------- -// - FieldTypes - -// -------------- - -// By changes you must also change: rsc/vclrsc.hxx -enum FieldUnit { FUNIT_NONE, FUNIT_MM, FUNIT_CM, FUNIT_M, FUNIT_KM, - FUNIT_TWIP, FUNIT_POINT, FUNIT_PICA, - FUNIT_INCH, FUNIT_FOOT, FUNIT_MILE, FUNIT_CUSTOM, - FUNIT_PERCENT, FUNIT_100TH_MM }; +#include <tools/fldunit.hxx> #endif // _VCL_FLDUNIT_HXX diff --git a/vcl/inc/vcl/fontcfg.hxx b/vcl/inc/vcl/fontcfg.hxx deleted file mode 100644 index 76864f0cb40a..000000000000 --- a/vcl/inc/vcl/fontcfg.hxx +++ /dev/null @@ -1,232 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: fontcfg.hxx,v $ - * $Revision: 1.3 $ - * - * 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. - * - ************************************************************************/ -#ifndef _VCL_FONTCFG_HXX -#define _VCL_FONTCFG_HXX - -#include "dllapi.h" -#include <tools/string.hxx> -#ifndef _VCL_ENUM_HXX -#include <vcl/vclenum.hxx> -#endif -#include <com/sun/star/lang/Locale.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/container/XNameAccess.hpp> - -#include <hash_map> -#include <hash_set> -#include <vector> - -namespace com { -namespace sun { -namespace star { -namespace lang { - -// equality operator needed for hash_map; -// (-> why does this need to be in the namespace of Locale ? g++ fails to compile else) -inline bool operator==( const com::sun::star::lang::Locale& rLeft, const com::sun::star::lang::Locale& rRight ) -{ - return - rLeft.Language.equals( rRight.Language ) && - rLeft.Country.equals( rRight.Country ) && - rLeft.Variant.equals( rRight.Variant ) - ; -} -}}}} - -namespace vcl -{ - -struct LocaleHash -{ - size_t operator()( const com::sun::star::lang::Locale& rLocale ) const - { - return - (size_t)rLocale.Language.hashCode() ^ - (size_t)rLocale.Country.hashCode() ^ - (size_t)rLocale.Variant.hashCode(); - } -}; - -class DefaultFontConfiguration -{ - com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > - m_xConfigProvider; - com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > - m_xConfigAccess; - - struct LocaleAccess - { - // the real string used in the configuration - // used to get rid of upper/lower case problems - rtl::OUString aConfigLocaleString; - // xAccess is mutable to be able to be filled on demand - mutable com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xAccess; - }; - - std::hash_map< com::sun::star::lang::Locale, - LocaleAccess, - vcl::LocaleHash > - m_aConfig; - - rtl::OUString tryLocale( const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rType ) const; - - DefaultFontConfiguration(); - public: - ~DefaultFontConfiguration(); - - static DefaultFontConfiguration* get(); - - rtl::OUString getDefaultFont( const com::sun::star::lang::Locale& rLocale, int nType ) const; - rtl::OUString getUserInterfaceFont( const com::sun::star::lang::Locale& rLocale ) const; -}; - -// IMPL_FONT_ATTR_DEFAULT - Default-Font like Andale Sans UI, Palace Script, Albany, Thorndale, Cumberland, ... -// IMPL_FONT_ATTR_STANDARD - Standard-Font like Arial, Times, Courier, ... -// IMPL_FONT_ATTR_NORMAL - normal Font for writing text like Arial, Verdana, Arial Narrow, Trebuchet, Times, Courier, ... -// IMPL_FONT_ATTR_SYMBOL - Font with symbols -// IMPL_FONT_ATTR_DECORATIVE - Readable and normally used for drawings -// IMPL_FONT_ATTR_SPECIAL - very special design -// IMPL_FONT_ATTR_TITLING - only uppercase characters -// IMPL_FONT_ATTR_FULL - Font with normally all characters -// IMPL_FONT_ATTR_CAPITALS - only uppercase characters, but lowercase characters smaller as the uppercase characters -// IMPL_FONT_ATTR_TYPEWRITER - like a typewriter: Courier, ... -// IMPL_FONT_ATTR_SCRIPT - Handwriting or Script -// IMPL_FONT_ATTR_HANDWRITING - More Handwriting with normal letters -// IMPL_FONT_ATTR_CHANCERY - Like Zapf Chancery -// IMPL_FONT_ATTR_COMIC - Like Comic Sans MS -// IMPL_FONT_ATTR_BRUSHSCRIPT - More Script -// IMPL_FONT_ATTR_OTHERSTYLE - OldStyle, ... so negativ points -#define IMPL_FONT_ATTR_DEFAULT ((ULONG)0x00000001) -#define IMPL_FONT_ATTR_STANDARD ((ULONG)0x00000002) -#define IMPL_FONT_ATTR_NORMAL ((ULONG)0x00000004) -#define IMPL_FONT_ATTR_SYMBOL ((ULONG)0x00000008) -#define IMPL_FONT_ATTR_FIXED ((ULONG)0x00000010) -#define IMPL_FONT_ATTR_SANSSERIF ((ULONG)0x00000020) -#define IMPL_FONT_ATTR_SERIF ((ULONG)0x00000040) -#define IMPL_FONT_ATTR_DECORATIVE ((ULONG)0x00000080) -#define IMPL_FONT_ATTR_SPECIAL ((ULONG)0x00000100) -#define IMPL_FONT_ATTR_ITALIC ((ULONG)0x00000200) -#define IMPL_FONT_ATTR_TITLING ((ULONG)0x00000400) -#define IMPL_FONT_ATTR_CAPITALS ((ULONG)0x00000800) -#define IMPL_FONT_ATTR_CJK ((ULONG)0x00001000) -#define IMPL_FONT_ATTR_CJK_JP ((ULONG)0x00002000) -#define IMPL_FONT_ATTR_CJK_SC ((ULONG)0x00004000) -#define IMPL_FONT_ATTR_CJK_TC ((ULONG)0x00008000) -#define IMPL_FONT_ATTR_CJK_KR ((ULONG)0x00010000) -#define IMPL_FONT_ATTR_CTL ((ULONG)0x00020000) -#define IMPL_FONT_ATTR_NONELATIN ((ULONG)0x00040000) -#define IMPL_FONT_ATTR_FULL ((ULONG)0x00080000) -#define IMPL_FONT_ATTR_OUTLINE ((ULONG)0x00100000) -#define IMPL_FONT_ATTR_SHADOW ((ULONG)0x00200000) -#define IMPL_FONT_ATTR_ROUNDED ((ULONG)0x00400000) -#define IMPL_FONT_ATTR_TYPEWRITER ((ULONG)0x00800000) -#define IMPL_FONT_ATTR_SCRIPT ((ULONG)0x01000000) -#define IMPL_FONT_ATTR_HANDWRITING ((ULONG)0x02000000) -#define IMPL_FONT_ATTR_CHANCERY ((ULONG)0x04000000) -#define IMPL_FONT_ATTR_COMIC ((ULONG)0x08000000) -#define IMPL_FONT_ATTR_BRUSHSCRIPT ((ULONG)0x10000000) -#define IMPL_FONT_ATTR_GOTHIC ((ULONG)0x20000000) -#define IMPL_FONT_ATTR_SCHOOLBOOK ((ULONG)0x40000000) -#define IMPL_FONT_ATTR_OTHERSTYLE ((ULONG)0x80000000) - -#define IMPL_FONT_ATTR_CJK_ALLLANG (IMPL_FONT_ATTR_CJK_JP | IMPL_FONT_ATTR_CJK_SC | IMPL_FONT_ATTR_CJK_TC | IMPL_FONT_ATTR_CJK_KR) -#define IMPL_FONT_ATTR_ALLSCRIPT (IMPL_FONT_ATTR_SCRIPT | IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_COMIC | IMPL_FONT_ATTR_BRUSHSCRIPT) -#define IMPL_FONT_ATTR_ALLSUBSCRIPT (IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_COMIC | IMPL_FONT_ATTR_BRUSHSCRIPT) -#define IMPL_FONT_ATTR_ALLSERIFSTYLE (IMPL_FONT_ATTR_ALLSCRIPT |\ - IMPL_FONT_ATTR_SANSSERIF | IMPL_FONT_ATTR_SERIF |\ - IMPL_FONT_ATTR_FIXED | IMPL_FONT_ATTR_ITALIC |\ - IMPL_FONT_ATTR_GOTHIC | IMPL_FONT_ATTR_SCHOOLBOOK |\ - IMPL_FONT_ATTR_SHADOW | IMPL_FONT_ATTR_OUTLINE) - -struct FontNameAttr -{ - String Name; - ::std::vector< String > Substitutions; - ::std::vector< String > MSSubstitutions; - ::std::vector< String > PSSubstitutions; - ::std::vector< String > HTMLSubstitutions; - FontWeight Weight; - FontWidth Width; - unsigned long Type; // bitfield of IMPL_FONT_ATTR_* -}; - -class VCL_DLLPUBLIC FontSubstConfiguration -{ -private: - com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > - m_xConfigProvider; - com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > - m_xConfigAccess; - struct LocaleSubst - { - rtl::OUString aConfigLocaleString; - mutable bool bConfigRead; - // note: aSubstAttributes must be sorted alphabetically by Name - // searches on the substitutes are done with Name as key, where - // a minimal match is sufficient (that is e.g. "Thorndale" will match - // "Thorndale BlaBlub"). Also names must be lower case. - mutable std::vector< FontNameAttr > aSubstAttributes; - - LocaleSubst() : bConfigRead( false ) {} - }; - std::hash_map< com::sun::star::lang::Locale, LocaleSubst, vcl::LocaleHash > m_aSubst; - typedef std::hash_set< rtl::OUString, rtl::OUStringHash > UniqueSubstHash; - mutable UniqueSubstHash maSubstHash; - - - void fillSubstVector( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xFont, - const rtl::OUString& rType, - std::vector< String >& rSubstVector ) const; - FontWeight getSubstWeight( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xFont, - const rtl::OUString& rType ) const; - FontWidth getSubstWidth( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xFont, - const rtl::OUString& rType ) const; - unsigned long getSubstType( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xFont, - const rtl::OUString& rType ) const; - void readLocaleSubst( const com::sun::star::lang::Locale& rLocale ) const; - FontSubstConfiguration(); -public: - ~FontSubstConfiguration(); - - static FontSubstConfiguration* get(); - - const FontNameAttr* getSubstInfo( - const String& rFontName, - const com::sun::star::lang::Locale& rLocale = - com::sun::star::lang::Locale( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "en" ) ), - rtl::OUString(), - rtl::OUString() ) - ) const; - static void getMapName( const String& rOrgName, String& rShortName, String& rFamilyName, FontWeight& rWeight, FontWidth& rWidth, ULONG& rType ); -}; - -} // namespace vcl - -#endif // _VCL_FONTCFG_HXX diff --git a/vcl/inc/vcl/fontcvt.hxx b/vcl/inc/vcl/fontcvt.hxx deleted file mode 100644 index 8269928dc730..000000000000 --- a/vcl/inc/vcl/fontcvt.hxx +++ /dev/null @@ -1,103 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: fontcvt.hxx,v $ - * $Revision: 1.3 $ - * - * 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. - * - ************************************************************************/ - -#ifndef _SV_FONTCVT_HXX -#define _SV_FONTCVT_HXX - -#include <vcl/dllapi.h> -#include <tools/string.hxx> - -// ------------------ -// - FontToSubsFont - -// ------------------ - -#define FONTTOSUBSFONT_IMPORT ((ULONG)0x00000001) -#define FONTTOSUBSFONT_EXPORT ((ULONG)0x00000002) -#define FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ((ULONG)0x00000004) - -typedef void* FontToSubsFontConverter; -VCL_DLLPUBLIC FontToSubsFontConverter CreateFontToSubsFontConverter( const String& rFontName, ULONG nFlags ); -VCL_DLLPUBLIC void DestroyFontToSubsFontConverter( FontToSubsFontConverter hConverter ); -VCL_DLLPUBLIC sal_Unicode ConvertFontToSubsFontChar( FontToSubsFontConverter hConverter, sal_Unicode c ); -VCL_DLLPUBLIC String GetFontToSubsFontName( FontToSubsFontConverter hConverter ); - -// ---------------- -// - SubsFontName - -// ---------------- - -#define SUBSFONT_ONLYONE ((ULONG)0x00000001) -#define SUBSFONT_MS ((ULONG)0x00000002) -#define SUBSFONT_PS ((ULONG)0x00000004) -#define SUBSFONT_HTML ((ULONG)0x00000008) -VCL_DLLPUBLIC String GetSubsFontName( const String& rName, ULONG nFlags ); - -// ----------------- -// - FontTokenName - -// ----------------- - -VCL_DLLPUBLIC String GetFontToken( const String& rName, xub_StrLen nToken, xub_StrLen& rIndex ); -inline String GetFontToken( const String& rName, xub_StrLen nToken ) -{ - xub_StrLen nTempIndex = 0; - return GetFontToken( rName, nToken, nTempIndex ); -} - -// --------------------------- -// - StarSymbolToMSMultiFont - -// --------------------------- - -class VCL_DLLPUBLIC StarSymbolToMSMultiFont -{ -public: - //Returns the name of the best windows symbol font which this char can be - //mapped to. Sets rChar to the correct position for that font. If no - //match found, then no name is returned, and rChar is unchanged. If you - //want to convert a string, you don't want to use this. - virtual String ConvertChar(sal_Unicode &rChar) = 0; - - //Starts converting the string at position rIndex. It converts as much of - //the string that can be converted to the same symbol font and returns the - //name of that font. rIndex is modified to the last index that was - //converted. Typically you call if continously until rIndex == - //rString.Len() and handle each section as seperate 8bit strings using - //seperate fonts. Will return an empty string for a continous section - //that has no possible mapping. - virtual String ConvertString(String &rString, xub_StrLen &rIndex) = 0; - virtual ~StarSymbolToMSMultiFont() {} -}; - -//with bPerfect set the converter will only try and convert symbols which have -//perfect mappings to the windows symbols fonts. With it not set, it will -//allow somewhat more dubious transformations that are nevertheless -//recognizably similiar. Even in this mode there will be characters that fail. -//The users of this might want to make a distinction between failed characters -//which were inside and those outside the unicode private area. -VCL_DLLPUBLIC StarSymbolToMSMultiFont *CreateStarSymbolToMSMultiFont(bool bPerfectOnly=false); -#endif // _SV_FONTCVT_HXX diff --git a/vcl/inc/vcl/group.hxx b/vcl/inc/vcl/group.hxx index 0e84344587c7..7d5dd43fbee3 100644 --- a/vcl/inc/vcl/group.hxx +++ b/vcl/inc/vcl/group.hxx @@ -42,6 +42,7 @@ class VCL_DLLPUBLIC GroupBox : public Control { private: + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); @@ -50,6 +51,10 @@ private: const Point& rPos, const Size& rSize, bool bLayout = false ); virtual void FillLayoutData() const; + virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; public: GroupBox( Window* pParent, WinBits nStyle = 0 ); diff --git a/vcl/inc/vcl/ilstbox.hxx b/vcl/inc/vcl/ilstbox.hxx index e5f6696005fa..81dd32ef2705 100644 --- a/vcl/inc/vcl/ilstbox.hxx +++ b/vcl/inc/vcl/ilstbox.hxx @@ -369,6 +369,7 @@ public: void SetReadOnly( BOOL bReadOnly ) { mbReadOnly = bReadOnly; } BOOL IsReadOnly() const { return mbReadOnly; } + using Control::ImplInitSettings; void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); USHORT ImplGetTextStyle() const; diff --git a/vcl/inc/vcl/impimagetree.hxx b/vcl/inc/vcl/impimagetree.hxx index dfbcb366fe6a..92761eabdf3c 100644 --- a/vcl/inc/vcl/impimagetree.hxx +++ b/vcl/inc/vcl/impimagetree.hxx @@ -54,14 +54,17 @@ public: ~ImplImageTree(); + // check whether the icon style is installed + bool checkStyle(rtl::OUString const & style); + bool loadImage( rtl::OUString const & name, rtl::OUString const & style, - BitmapEx & bitmap, bool localized = false); + BitmapEx & bitmap, bool localized = false ); void shutDown(); // a crude form of life cycle control (called from DeInitVCL; otherwise, // if the ImplImageTree singleton were destroyed during exit that would - // be too late for the destructors of the bitmaps in m_cache) + // be too late for the destructors of the bitmaps in m_iconCache) private: typedef std::list< @@ -71,20 +74,23 @@ private: com::sun::star::container::XNameAccess > > > Zips; typedef std::hash_map< - rtl::OUString, std::pair< bool, BitmapEx >, rtl::OUStringHash > Cache; + rtl::OUString, bool, rtl::OUStringHash > CheckStyleCache; + typedef std::hash_map< + rtl::OUString, std::pair< bool, BitmapEx >, rtl::OUStringHash > IconCache; rtl::OUString m_style; Zips m_zips; - Cache m_cache; + CheckStyleCache m_checkStyleCache; + IconCache m_iconCache; - void setStyle(rtl::OUString const & style); + void setStyle(rtl::OUString const & style ); void resetZips(); - bool cacheLookup( - rtl::OUString const & name, bool localized, BitmapEx & bitmap); + bool checkStyleCacheLookup( rtl::OUString const & style, bool &exists ); + bool iconCacheLookup( rtl::OUString const & name, bool localized, BitmapEx & bitmap ); - bool find(std::vector< rtl::OUString > const & paths, BitmapEx & bitmap); + bool find(std::vector< rtl::OUString > const & paths, BitmapEx & bitmap ); }; typedef salhelper::SingletonRef< ImplImageTree > ImplImageTreeSingletonRef; diff --git a/vcl/inc/vcl/mapunit.hxx b/vcl/inc/vcl/mapunit.hxx index 6ba500f4fdb7..c50ba49c17bb 100644 --- a/vcl/inc/vcl/mapunit.hxx +++ b/vcl/inc/vcl/mapunit.hxx @@ -31,14 +31,6 @@ #ifndef _VCL_MAPUNIT_HXX #define _VCL_MAPUNIT_HXX -// ----------------- -// - MapMode-Types - -// ----------------- - -// By changes you must also change: rsc/vclrsc.hxx -enum MapUnit { MAP_100TH_MM, MAP_10TH_MM, MAP_MM, MAP_CM, - MAP_1000TH_INCH, MAP_100TH_INCH, MAP_10TH_INCH, MAP_INCH, - MAP_POINT, MAP_TWIP, MAP_PIXEL, MAP_SYSFONT, MAP_APPFONT, - MAP_RELATIVE, MAP_REALAPPFONT, MAP_LASTENUMDUMMY }; +#include <tools/mapunit.hxx> #endif // _VCL_MAPUNIT_HXX diff --git a/vcl/inc/vcl/outdev.h b/vcl/inc/vcl/outdev.h index af671e24ee0a..67dc256ce11c 100644 --- a/vcl/inc/vcl/outdev.h +++ b/vcl/inc/vcl/outdev.h @@ -31,7 +31,7 @@ #ifndef _SV_OUTDEV_H #define _SV_OUTDEV_H -#include <vcl/sv.h> +#include <tools/solar.h> #include <vcl/outfont.hxx> #include <vector> @@ -44,13 +44,6 @@ class VirtualDevice; class ImplServerGraphics; class ImplGetDevFontList; class GetDevSizeList; -namespace vcl { -class FontSubstConfiguration; -} - -// ----------------------------------------------------------------------- - -void ImplGetEnglishSearchFontName( String& rName ); // ----------------------- // - ImplDevFontListData - @@ -80,7 +73,7 @@ public: int GetMinQuality() const { return mnMinQuality; } bool AddFontFace( ImplFontData* ); - void InitMatchData( const vcl::FontSubstConfiguration&, + void InitMatchData( const utl::FontSubstConfiguration&, const String& rSearchName ); ImplFontData* FindBestFontFace( const ImplFontSelectData& rFSD ) const; @@ -106,24 +99,6 @@ friend class ImplDevFontList; // TODO: remove soon }; -// --------------- -// - ImplCvtChar - -// --------------- - -class ImplCvtChar -{ -public: - const sal_Unicode* mpCvtTab; - const char* mpSubsFontName; - sal_Unicode (*mpCvtFunc)( sal_Unicode ); -}; - -sal_Unicode ImplRecodeChar( const ImplCvtChar* pCvtData, sal_Unicode c ); -void ImplRecodeString( const ImplCvtChar* pCvtData, String& rStr, - xub_StrLen nIndex, xub_StrLen nLen ); -const ImplCvtChar* ImplGetRecodeData( const String& rOrgFontName, - const String& rMapFontName ); - // ---------------------- // - ImplGetDevFontList - // ---------------------- diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx index 464b129fdb64..4a5b92444c21 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -45,6 +45,7 @@ #include <tools/poly.hxx> #include <basegfx/vector/b2enums.hxx> #include <com/sun/star/uno/Reference.h> +#include <unotools/fontdefs.hxx> #include <vector> @@ -103,8 +104,12 @@ namespace awt { typedef std::vector< Rectangle > MetricVector; -namespace vcl { class PDFWriterImpl; } -namespace vcl { class ExtOutDevData; } +namespace vcl +{ + class PDFWriterImpl; + class ExtOutDevData; + class ITextLayout; +} #define OUTDEV_BUFFER_SIZE 128 @@ -260,31 +265,6 @@ struct KerningPair #define FONT_SUBSTITUTE_ALWAYS ((USHORT)0x0001) #define FONT_SUBSTITUTE_SCREENONLY ((USHORT)0x0002) -// Default-Font -#define DEFAULTFONT_SANS_UNICODE ((USHORT)1) -#define DEFAULTFONT_SANS ((USHORT)2) -#define DEFAULTFONT_SERIF ((USHORT)3) -#define DEFAULTFONT_FIXED ((USHORT)4) -#define DEFAULTFONT_SYMBOL ((USHORT)5) -#define DEFAULTFONT_UI_SANS ((USHORT)1000) -#define DEFAULTFONT_UI_FIXED ((USHORT)1001) -#define DEFAULTFONT_LATIN_TEXT ((USHORT)2000) -#define DEFAULTFONT_LATIN_PRESENTATION ((USHORT)2001) -#define DEFAULTFONT_LATIN_SPREADSHEET ((USHORT)2002) -#define DEFAULTFONT_LATIN_HEADING ((USHORT)2003) -#define DEFAULTFONT_LATIN_DISPLAY ((USHORT)2004) -#define DEFAULTFONT_LATIN_FIXED ((USHORT)2005) -#define DEFAULTFONT_CJK_TEXT ((USHORT)3000) -#define DEFAULTFONT_CJK_PRESENTATION ((USHORT)3001) -#define DEFAULTFONT_CJK_SPREADSHEET ((USHORT)3002) -#define DEFAULTFONT_CJK_HEADING ((USHORT)3003) -#define DEFAULTFONT_CJK_DISPLAY ((USHORT)3004) -#define DEFAULTFONT_CTL_TEXT ((USHORT)4000) -#define DEFAULTFONT_CTL_PRESENTATION ((USHORT)4001) -#define DEFAULTFONT_CTL_SPREADSHEET ((USHORT)4002) -#define DEFAULTFONT_CTL_HEADING ((USHORT)4003) -#define DEFAULTFONT_CTL_DISPLAY ((USHORT)4004) - #define DEFAULTFONT_FLAGS_ONLYONE ((ULONG)0x00000001) enum OutDevType { OUTDEV_DONTKNOW, OUTDEV_WINDOW, OUTDEV_PRINTER, OUTDEV_VIRDEV }; @@ -431,9 +411,13 @@ public: SAL_DLLPRIVATE SalLayout* ImplGlyphFallbackLayout( SalLayout*, ImplLayoutArgs& ) const; SAL_DLLPRIVATE long ImplGetTextWidth( const SalLayout& ) const; - SAL_DLLPRIVATE void ImplDrawText( const Rectangle& rRect, + static + SAL_DLLPRIVATE XubString ImplGetEllipsisString( const OutputDevice& rTargetDevice, const XubString& rStr, + long nMaxWidth, USHORT nStyle, const ::vcl::ITextLayout& _rLayout ); + static + SAL_DLLPRIVATE void ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& rRect, const String& rOrigStr, USHORT nStyle, - MetricVector* pVector, String* pDisplayText ); + MetricVector* pVector, String* pDisplayText, ::vcl::ITextLayout& _rLayout ); SAL_DLLPRIVATE void ImplDrawTextBackground( const SalLayout& ); SAL_DLLPRIVATE void ImplDrawTextLines( SalLayout&, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, BOOL bWordLine, BOOL bUnderlineAbove ); SAL_DLLPRIVATE bool ImplDrawRotateText( SalLayout& ); @@ -456,7 +440,8 @@ public: SAL_DLLPRIVATE void ImplDrawMnemonicLine( long nX, long nY, long nWidth ); SAL_DLLPRIVATE void ImplGetEmphasisMark( PolyPolygon& rPolyPoly, BOOL& rPolyLine, Rectangle& rRect1, Rectangle& rRect2, long& rYOff, long& rWidth, FontEmphasisMark eEmphasis, long nHeight, short nOrient ); SAL_DLLPRIVATE void ImplDrawEmphasisMark( long nBaseX, long nX, long nY, const PolyPolygon& rPolyPoly, BOOL bPolyLine, const Rectangle& rRect1, const Rectangle& rRect2 ); - SAL_DLLPRIVATE long ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const XubString& rStr, USHORT nStyle ) const; + static + SAL_DLLPRIVATE long ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const XubString& rStr, USHORT nStyle, const ::vcl::ITextLayout& _rLayout ); SAL_DLLPRIVATE void ImplInitFontList() const; SAL_DLLPRIVATE void ImplUpdateFontData( bool bNewFontLists ); SAL_DLLPRIVATE static void ImplUpdateAllFontData( bool bNewFontLists ); @@ -652,10 +637,12 @@ public: GDIMetaFile& rMtf ); void DrawText( const Rectangle& rRect, const XubString& rStr, USHORT nStyle = 0, - MetricVector* pVector = NULL, String* pDisplayText = NULL ); + MetricVector* pVector = NULL, String* pDisplayText = NULL, + ::vcl::ITextLayout* _pTextLayout = NULL ); Rectangle GetTextRect( const Rectangle& rRect, const XubString& rStr, USHORT nStyle = TEXT_DRAW_WORDBREAK, - TextRectInfo* pInfo = NULL ) const; + TextRectInfo* pInfo = NULL, + const ::vcl::ITextLayout* _pTextLayout = NULL ) const; XubString GetEllipsisString( const XubString& rStr, long nMaxWidth, USHORT nStyle = TEXT_DRAW_ENDELLIPSIS ) const; void DrawCtrlText( const Point& rPos, const XubString& rStr, diff --git a/vcl/inc/vcl/outfont.hxx b/vcl/inc/vcl/outfont.hxx index 88316130cc3a..b72e78994a75 100644 --- a/vcl/inc/vcl/outfont.hxx +++ b/vcl/inc/vcl/outfont.hxx @@ -32,9 +32,9 @@ #include <tools/list.hxx> #include <i18npool/lang.h> #include <tools/gen.hxx> -#include <vcl/sv.h> +#include <tools/solar.h> #include <vcl/dllapi.h> - +#include <unotools/fontdefs.hxx> #include <vcl/vclenum.hxx> #include <hash_map> @@ -48,14 +48,10 @@ class ImplPreMatchFontSubstitution; class ImplGlyphFallbackFontSubstitution; class ImplFontSelectData; class Font; -class ImplCvtChar; +class ConvertChar; struct FontMatchStatus; class OutputDevice; -namespace vcl { - struct FontNameAttr; -} - // ---------------------- // - ImplFontAttributes - // ---------------------- @@ -185,8 +181,6 @@ public: // TODO: change to private ImplFontEntry* mpFontEntry; // pointer to the resulting FontCache entry }; -struct FontNameHash { int operator()(const String&) const; }; - // ------------------- // - ImplDevFontList - // ------------------- @@ -238,7 +232,7 @@ protected: ImplDevFontListData* ImplFindByTokenNames( const String& ) const; ImplDevFontListData* ImplFindByAliasName( const String& rSearchName, const String& rShortName ) const; - ImplDevFontListData* ImplFindBySubstFontAttr( const vcl::FontNameAttr& ) const; + ImplDevFontListData* ImplFindBySubstFontAttr( const utl::FontNameAttr& ) const; ImplDevFontListData* ImplFindByAttributes( ULONG nSearchType, FontWeight, FontWidth, FontFamily, FontItalic, const String& rSearchFamily ) const; ImplDevFontListData* FindDefaultFont() const; @@ -337,7 +331,7 @@ public: public: // TODO: make data members private ImplFontSelectData maFontSelData; // FontSelectionData ImplFontMetricData maMetric; // Font Metric - const ImplCvtChar* mpConversion; // used e.g. for StarBats->StarSymbol + const ConvertChar* mpConversion; // used e.g. for StarBats->StarSymbol long mnLineHeight; ULONG mnRefCount; USHORT mnSetFontFlags; // Flags returned by SalGraphics::SetFont() diff --git a/vcl/inc/vcl/pdfwriter.hxx b/vcl/inc/vcl/pdfwriter.hxx index bdf636754c77..dbfaf9eda18d 100644 --- a/vcl/inc/vcl/pdfwriter.hxx +++ b/vcl/inc/vcl/pdfwriter.hxx @@ -546,6 +546,8 @@ The following structure describes the permissions used in PDF security will be submitted. */ PDFWriter::ExportDataFormat SubmitFormat; + bool AllowDuplicateFieldNames; + bool FieldsUseSystemFonts; /* the following data members are used to customize the PDF viewer preferences */ @@ -590,6 +592,8 @@ The following structure describes the permissions used in PDF security Tagged( false ), EmbedStandardFonts( false ), SubmitFormat( PDFWriter::FDF ), + AllowDuplicateFieldNames( false ), + FieldsUseSystemFonts( true ), PDFDocumentMode( PDFWriter::ModeDefault ), PDFDocumentAction( PDFWriter::ActionDefault ), Zoom( 100 ), diff --git a/vcl/inc/vcl/salbtype.hxx b/vcl/inc/vcl/salbtype.hxx index 2a10353bee94..d9be75369a5d 100644 --- a/vcl/inc/vcl/salbtype.hxx +++ b/vcl/inc/vcl/salbtype.hxx @@ -37,6 +37,7 @@ #include <tools/debug.hxx> #include <vcl/salgtype.hxx> #include <tools/color.hxx> +#include <tools/gen.hxx> #include <vcl/sv.h> #include <vcl/dllapi.h> @@ -49,14 +50,6 @@ typedef HPBYTE Scanline; typedef const BYTE* ConstHPBYTE; typedef ConstHPBYTE ConstScanline; -// -------------------- -// - Helper functions - -// -------------------- - -inline long MinMax( long nVal, long nMin, long nMax ); -inline long AlignedWidth4Bytes( long nWidthBits ); -inline long FRound( double fVal ); - // ------------------ // - Bitmap formats - // ------------------ @@ -292,29 +285,6 @@ struct VCL_DLLPUBLIC BitmapBuffer VCL_DLLPUBLIC BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRect& rTwoRect, ULONG nDstBitmapFormat, BitmapPalette* pDstPal = NULL, ColorMask* pDstMask = NULL ); -// --------------- -// - Inlines - -// --------------- - -inline long MinMax( long nVal, long nMin, long nMax ) -{ - return( nVal >= nMin ? ( nVal <= nMax ? nVal : nMax ) : nMin ); -} - -// ------------------------------------------------------------------ - -inline long AlignedWidth4Bytes( long nWidthBits ) -{ - return( ( ( nWidthBits + 31 ) >> 5 ) << 2 ); -} - -// ------------------------------------------------------------------ - -inline long FRound( double fVal ) -{ - return( fVal > 0.0 ? (long) ( fVal + 0.5 ) : -(long) ( -fVal + 0.5 ) ); -} - // ------------------------------------------------------------------ inline BitmapColor::BitmapColor() : diff --git a/vcl/inc/vcl/salframe.hxx b/vcl/inc/vcl/salframe.hxx index 0e3f4e94a0b3..b95f7036ad19 100644 --- a/vcl/inc/vcl/salframe.hxx +++ b/vcl/inc/vcl/salframe.hxx @@ -170,6 +170,7 @@ public: virtual void SetTitle( const XubString& rTitle ) = 0; virtual void SetIcon( USHORT nIcon ) = 0; + virtual void SetRepresentedURL( const rtl::OUString& ); virtual void SetMenu( SalMenu *pSalMenu ) = 0; virtual void DrawMenuBar() = 0; diff --git a/vcl/inc/vcl/salsession.hxx b/vcl/inc/vcl/salsession.hxx index 05aa76cb0f56..bdc698fc63fd 100644 --- a/vcl/inc/vcl/salsession.hxx +++ b/vcl/inc/vcl/salsession.hxx @@ -37,7 +37,8 @@ enum SalSessionEventType { Interaction, SaveRequest, - ShutdownCancel + ShutdownCancel, + Quit }; struct SalSessionEvent @@ -78,6 +79,13 @@ struct SalSessionShutdownCancelEvent : public SalSessionEvent {} }; +struct SalSessionQuitEvent : public SalSessionEvent +{ + SalSessionQuitEvent() + : SalSessionEvent( Quit ) + {} +}; + typedef void(*SessionProc)( SalSessionEvent *pEvent); class VCL_DLLPUBLIC SalSession diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx index decb7d01b2d4..61a970b738e0 100644 --- a/vcl/inc/vcl/settings.hxx +++ b/vcl/inc/vcl/settings.hxx @@ -38,6 +38,7 @@ #include "vcl/accel.hxx" #include "vcl/wall.hxx" #include "com/sun/star/lang/Locale.hpp" +#include <unotools/syslocale.hxx> class CollatorWrapper; class LocaleDataWrapper; @@ -521,9 +522,10 @@ private: #define STYLE_SYMBOLS_HICONTRAST ((ULONG)2) #define STYLE_SYMBOLS_INDUSTRIAL ((ULONG)3) #define STYLE_SYMBOLS_CRYSTAL ((ULONG)4) -#define STYLE_SYMBOLS_TANGO ((ULONG)5) -#define STYLE_SYMBOLS_CLASSIC ((ULONG)6) -#define STYLE_SYMBOLS_THEMES_MAX ((ULONG)6) +#define STYLE_SYMBOLS_TANGO ((ULONG)5) +#define STYLE_SYMBOLS_OXYGEN ((ULONG)6) +#define STYLE_SYMBOLS_CLASSIC ((ULONG)7) +#define STYLE_SYMBOLS_THEMES_MAX ((ULONG)8) #define STYLE_CURSOR_NOBLINKTIME ((ULONG)0xFFFFFFFF) @@ -947,6 +949,8 @@ public: void SetPreferredSymbolsStyleName( const ::rtl::OUString &rName ); ULONG GetPreferredSymbolsStyle() const { return mpData->mnPreferredSymbolsStyle; } + // check whether the symbols style is supported (icons are installed) + bool CheckSymbolStyle( ULONG nStyle ) const; ULONG GetAutoSymbolsStyle() const; ULONG GetCurrentSymbolsStyle() const; @@ -993,7 +997,6 @@ class ImplMiscData private: ULONG mnRefCount; - USHORT mnTwoDigitYearStart; USHORT mnEnableATT; BOOL mbEnableLocalizedDecimalSep; USHORT mnDisablePrinting; @@ -1015,10 +1018,6 @@ public: MiscSettings( const MiscSettings& rSet ); ~MiscSettings(); - void SetTwoDigitYearStart( USHORT nYearStart ) - { CopyData(); mpData->mnTwoDigitYearStart = nYearStart; } - USHORT GetTwoDigitYearStart() const - { return mpData->mnTwoDigitYearStart; } void SetEnableATToolSupport( BOOL bEnable ); BOOL GetEnableATToolSupport() const; void SetDisablePrinting( BOOL bEnable ); @@ -1141,7 +1140,7 @@ public: // ----------------------- // - ImplAllSettingsData - // ----------------------- - +class LocaleConfigurationListener; class ImplAllSettingsData { friend class AllSettings; @@ -1171,6 +1170,8 @@ private: CollatorWrapper* mpUICollatorWrapper; vcl::I18nHelper* mpI18nHelper; vcl::I18nHelper* mpUII18nHelper; + LocaleConfigurationListener* mpLocaleCfgListener; + SvtSysLocale maSysLocale; }; // --------------- @@ -1287,6 +1288,8 @@ public: BOOL operator ==( const AllSettings& rSet ) const; BOOL operator !=( const AllSettings& rSet ) const { return !(*this == rSet); } + static void LocaleSettingsChanged( sal_uInt32 nHint ); + SvtSysLocale& GetSysLocale() { return mpData->maSysLocale; } }; #endif // _SV_SETTINGS_HXX diff --git a/vcl/inc/vcl/slider.hxx b/vcl/inc/vcl/slider.hxx index 396ed0ca83cb..c3dfcfd42608 100644 --- a/vcl/inc/vcl/slider.hxx +++ b/vcl/inc/vcl/slider.hxx @@ -70,6 +70,7 @@ private: Link maSlideHdl; Link maEndSlideHdl; + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); diff --git a/vcl/inc/vcl/svapp.hxx b/vcl/inc/vcl/svapp.hxx index 1e0c5218d1c5..3e9a1cc55019 100644 --- a/vcl/inc/vcl/svapp.hxx +++ b/vcl/inc/vcl/svapp.hxx @@ -287,6 +287,9 @@ public: static vos::OThread::TThreadIdentifier GetMainThreadIdentifier(); static ULONG ReleaseSolarMutex(); static void AcquireSolarMutex( ULONG nCount ); + static void EnableNoYieldMode( bool i_bNoYield ); + static void AddPostYieldListener( const Link& i_rListener ); + static void RemovePostYieldListener( const Link& i_rListener ); static BOOL IsInMain(); static BOOL IsInExecute(); diff --git a/vcl/inc/vcl/svdata.hxx b/vcl/inc/vcl/svdata.hxx index c044364f2064..17ad1aa28c1a 100644 --- a/vcl/inc/vcl/svdata.hxx +++ b/vcl/inc/vcl/svdata.hxx @@ -44,6 +44,7 @@ #include <tools/debug.hxx> #include <vcl/dllapi.h> #include <com/sun/star/uno/Reference.hxx> +#include <unotools/options.hxx> namespace com { namespace sun { @@ -110,14 +111,21 @@ class ImplWheelWindow; class SalTimer; class SalI18NImeStatus; class DockingManager; +class VclEventListeners2; namespace vos { class OMutex; } namespace vos { class OCondition; } -namespace vcl { class DisplayConnection; class FontSubstConfiguration; class SettingsConfigItem; class DefaultFontConfiguration; class DeleteOnDeinitBase; } +namespace vcl { class DisplayConnection; class SettingsConfigItem; class DeleteOnDeinitBase; } +namespace utl { class DefaultFontConfiguration; class FontSubstConfiguration; } // ----------------- // - ImplSVAppData - // ----------------- +class LocaleConfigurationListener : public utl::ConfigurationListener +{ +public: + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); +}; struct ImplSVAppData { @@ -131,6 +139,7 @@ struct ImplSVAppData ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF; String* mpMSFTempFileName; AllSettings* mpSettings; // Application settings + LocaleConfigurationListener* mpCfgListener; VclEventListeners* mpEventListeners; // listeners for vcl events (eg, extended toolkit) VclEventListeners* mpKeyListeners; // listeners for key events only (eg, extended toolkit) ImplAccelManager* mpAccelMgr; // Accelerator Manager @@ -145,19 +154,22 @@ struct ImplSVAppData ImplWheelWindow* mpWheelWindow; // WheelWindow ImplHotKey* mpFirstHotKey; // HotKey-Verwaltung ImplEventHook* mpFirstEventHook; // Event-Hooks - ULONG mnLastInputTime; // GetLastInputTime() - USHORT mnDispatchLevel; // DispatchLevel - USHORT mnModalMode; // ModalMode Count - USHORT mnModalDialog; // ModalDialog Count - USHORT mnAccessCount; // AccessHdl Count - USHORT mnSysWinMode; // Modus, wann SystemWindows erzeugt werden sollen - USHORT mnLayout; // --- RTL-Flags --- currently not used, only for testing - short mnDialogScaleX; // Scale X-Positions and sizes in Dialogs - BOOL mbInAppMain; // is Application::Main() on stack - BOOL mbInAppExecute; // is Application::Execute() on stack - BOOL mbAppQuit; // is Application::Quit() called - BOOL mbSettingsInit; // TRUE: Settings are init - BOOL mbDialogCancel; // TRUE: Alle Dialog::Execute()-Aufrufe werden mit return FALSE sofort beendet + VclEventListeners2* mpPostYieldListeners; // post yield listeners + ULONG mnLastInputTime; // GetLastInputTime() + USHORT mnDispatchLevel; // DispatchLevel + USHORT mnModalMode; // ModalMode Count + USHORT mnModalDialog; // ModalDialog Count + USHORT mnAccessCount; // AccessHdl Count + USHORT mnSysWinMode; // Modus, wann SystemWindows erzeugt werden sollen + USHORT mnLayout; // --- RTL-Flags --- currently not used, only for testing + short mnDialogScaleX; // Scale X-Positions and sizes in Dialogs + BOOL mbInAppMain; // is Application::Main() on stack + BOOL mbInAppExecute; // is Application::Execute() on stack + BOOL mbAppQuit; // is Application::Quit() called + BOOL mbSettingsInit; // TRUE: Settings are initialized + BOOL mbDialogCancel; // TRUE: Alle Dialog::Execute()-Aufrufe werden mit return FALSE sofort beendet + BOOL mbNoYield; // Application::Yield will not wait for events if the queue is empty + // essentially that makes it the same as Application::Reschedule /** Controls whether showing any IME status window is toggled on or off. @@ -196,8 +208,8 @@ struct ImplSVGDIData long mnAppFontX; // AppFont X-Numenator for 40/tel Width + DialogScaleX long mnAppFontY; // AppFont Y-Numenator for 80/tel Height BOOL mbFontSubChanged; // TRUE: FontSubstitution wurde zwischen Begin/End geaendert - vcl::DefaultFontConfiguration* mpDefaultFontConfiguration; - vcl::FontSubstConfiguration* mpFontSubstConfiguration; + utl::DefaultFontConfiguration* mpDefaultFontConfiguration; + utl::FontSubstConfiguration* mpFontSubstConfiguration; bool mbPrinterPullModel; // true: use pull model instead of normal push model when printing bool mbNativeFontConfig; // true: do not override UI font bool mbNoXORClipping; // true: do not use XOR to achieve clipping effects diff --git a/vcl/inc/vcl/syswin.hxx b/vcl/inc/vcl/syswin.hxx index 99a340ae4a58..d590cfe0a37e 100644 --- a/vcl/inc/vcl/syswin.hxx +++ b/vcl/inc/vcl/syswin.hxx @@ -201,6 +201,10 @@ public: void SetIcon( USHORT nIcon ); USHORT GetIcon() const { return mnIcon; } + // for systems like MacOSX which can display the URL a document is loaded from + // separately from the window title + void SetRepresentedURL( const rtl::OUString& ); + const rtl::OUString& GetRepresentedURL() const; void SetZLevel( BYTE nLevel ); BYTE GetZLevel() const; diff --git a/vcl/inc/vcl/tabctrl.hxx b/vcl/inc/vcl/tabctrl.hxx index 378459b9eadb..30edf6227a60 100644 --- a/vcl/inc/vcl/tabctrl.hxx +++ b/vcl/inc/vcl/tabctrl.hxx @@ -78,6 +78,7 @@ private: Link maActivateHdl; Link maDeactivateHdl; + using Control::ImplInitSettings; SAL_DLLPRIVATE void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); SAL_DLLPRIVATE ImplTabItem* ImplGetItem( USHORT nId ) const; SAL_DLLPRIVATE void ImplScrollBtnsColor(); @@ -101,6 +102,8 @@ protected: SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); virtual void FillLayoutData() const; + virtual const Font& GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& GetCanonicalTextColor( const StyleSettings& _rStyle ) const; SAL_DLLPRIVATE Rectangle* ImplFindPartRect( const Point& rPt ); public: diff --git a/vcl/inc/vcl/textlayout.hxx b/vcl/inc/vcl/textlayout.hxx new file mode 100755 index 000000000000..4c290452e2ad --- /dev/null +++ b/vcl/inc/vcl/textlayout.hxx @@ -0,0 +1,134 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* 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. +************************************************************************/ +
+#ifndef VCL_TEXTLAYOUT_HXX +#define VCL_TEXTLAYOUT_HXX + +#include "vcl/outdev.hxx" + +#include <tools/solar.h> +#include <tools/string.hxx> + +#include <memory> + +class Control; + +//........................................................................ +namespace vcl +{ +//........................................................................ + + //==================================================================== + //= ITextLayout + //==================================================================== + class SAL_NO_VTABLE ITextLayout + { + public: + virtual long GetTextWidth( const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const = 0; + virtual void DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength, + MetricVector* _pVector, String* _pDisplayText ) = 0; + virtual bool GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const = 0; + virtual xub_StrLen GetTextBreak( const XubString& _rText, long _nMaxTextWidth, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const = 0; + virtual bool DecomposeTextRectAction() const = 0; + }; + + //==================================================================== + //= DefaultTextLayout + //==================================================================== + /** is an implementation of the ITextLayout interface which simply delegates its calls to the respective + methods of an OutputDevice instance, without any inbetween magic. + */ + class DefaultTextLayout : public ITextLayout + { + public: + DefaultTextLayout( OutputDevice& _rTargetDevice ) + :m_rTargetDevice( _rTargetDevice ) + { + } + virtual ~DefaultTextLayout(); + + // ITextLayout overridables + virtual long GetTextWidth( + const XubString& _rText, + xub_StrLen _nStartIndex, + xub_StrLen _nLength + ) const; + virtual void DrawText( + const Point& _rStartPoint, + const XubString& _rText, + xub_StrLen _nStartIndex, + xub_StrLen _nLength, + MetricVector* _pVector, + String* _pDisplayText + ); + virtual bool GetCaretPositions( + const XubString& _rText, + sal_Int32* _pCaretXArray, + xub_StrLen _nStartIndex, + xub_StrLen _nLength + ) const; + virtual xub_StrLen GetTextBreak( + const XubString& _rText, + long _nMaxTextWidth, + xub_StrLen _nStartIndex, + xub_StrLen _nLength + ) const; + virtual bool DecomposeTextRectAction() const; + + private: + OutputDevice& m_rTargetDevice; + }; + + //==================================================================== + //= ControlTextRenderer + //==================================================================== + class ReferenceDeviceTextLayout; + /** a class which allows rendering text of a Control onto a device, by taking into account the metrics of + a reference device. + */ + class ControlTextRenderer + { + public: + ControlTextRenderer( const Control& _rControl, OutputDevice& _rTargetDevice, OutputDevice& _rReferenceDevice ); + virtual ~ControlTextRenderer(); + + Rectangle DrawText( const Rectangle& _rRect, + const XubString& _rText, USHORT _nStyle = 0, + MetricVector* _pVector = NULL, String* _pDisplayText = NULL ); + + private: + ControlTextRenderer(); // never implemented + ControlTextRenderer( const ControlTextRenderer& ); // never implemented + ControlTextRenderer& operator=( const ControlTextRenderer& ); // never implemented + + private: + ::std::auto_ptr< ReferenceDeviceTextLayout > m_pImpl; + }; + +//........................................................................ +} // namespace vcl +//........................................................................ + +#endif // VCL_TEXTLAYOUT_HXX diff --git a/vcl/inc/vcl/toolbox.h b/vcl/inc/vcl/toolbox.h index 52a0db40b226..2dee85ab6b82 100644 --- a/vcl/inc/vcl/toolbox.h +++ b/vcl/inc/vcl/toolbox.h @@ -51,6 +51,7 @@ #define TB_LARGEIMAGESIZE 26 #define TB_LARGEIMAGESIZE_INDUSTRIAL 24 #define TB_LARGEIMAGESIZE_CRYSTAL 22 +#define TB_LARGEIMAGESIZE_OXYGEN 22 class Window; diff --git a/vcl/inc/vcl/vclevent.hxx b/vcl/inc/vcl/vclevent.hxx index ff0639d70e82..74971f62c5a6 100644 --- a/vcl/inc/vcl/vclevent.hxx +++ b/vcl/inc/vcl/vclevent.hxx @@ -31,11 +31,13 @@ #ifndef _VCL_VCLEVENT_HXX #define _VCL_VCLEVENT_HXX -#include <tools/link.hxx> -#include <tools/rtti.hxx> -#include <vcl/dllapi.h> +#include "tools/link.hxx" +#include "tools/rtti.hxx" +#include "vcl/dllapi.h" +#include "vcl/impdel.hxx" #include <list> +#include <vector> class Window; class Menu; @@ -251,4 +253,29 @@ public: BOOL Process( VclSimpleEvent* pEvent ) const; }; +class VCL_DLLPUBLIC VclEventListeners2 : public vcl::DeletionNotifier +{ + std::list< Link > m_aListeners; + + struct ListenerIt + { + std::list< Link >::iterator m_aIt; + bool m_bWasInvalidated; + + ListenerIt() : m_bWasInvalidated( false ) {} + }; + + std::vector< ListenerIt > m_aIterators; + + +public: + VclEventListeners2(); + ~VclEventListeners2(); + + void addListener( const Link& ); + void removeListener( const Link& ); + + void callListeners( VclSimpleEvent* ); +}; + #endif // _VCL_VCLEVENT_HXX diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index eba46362d94e..56fdb22ddc57 100644 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -321,7 +321,6 @@ typedef USHORT StateChangedType; #define IMPL_MSGBOX_OFFSET_EXTRA_X 0 #define IMPL_MSGBOX_OFFSET_EXTRA_Y 2 #define IMPL_SEP_MSGBOX_IMAGE 8 -#define IMPL_SEP_BUTTON_IMAGE 4 #define DLGWINDOW_PREV 0 #define DLGWINDOW_NEXT 1 diff --git a/vcl/inc/vcl/wintypes.hxx b/vcl/inc/vcl/wintypes.hxx index 968f0e1d255f..9e84648fb6a8 100644 --- a/vcl/inc/vcl/wintypes.hxx +++ b/vcl/inc/vcl/wintypes.hxx @@ -30,308 +30,7 @@ #ifndef _SV_WINTYPES_HXX #define _SV_WINTYPES_HXX -#include <vcl/sv.h> -#include <sal/types.h> - -// ---------------- -// - Window-Types - -// ---------------- - -typedef USHORT WindowType; -#define WINDOW_BASE 0x0100 -#define WINDOW_FIRST (WINDOW_BASE + 0x30) -#define WINDOW_MESSBOX (WINDOW_FIRST) -#define WINDOW_INFOBOX (WINDOW_FIRST + 0x01) -#define WINDOW_WARNINGBOX (WINDOW_FIRST + 0x02) -#define WINDOW_ERRORBOX (WINDOW_FIRST + 0x03) -#define WINDOW_QUERYBOX (WINDOW_FIRST + 0x04) -#define WINDOW_WINDOW (WINDOW_FIRST + 0x05) -#define WINDOW_SYSWINDOW (WINDOW_FIRST + 0x06) -#define WINDOW_WORKWINDOW (WINDOW_FIRST + 0x07) -// #define WINDOW_MDIWINDOW (WINDOW_FIRST + 0x08) -#define WINDOW_FLOATINGWINDOW (WINDOW_FIRST + 0x09) -#define WINDOW_DIALOG (WINDOW_FIRST + 0x0a) -#define WINDOW_MODELESSDIALOG (WINDOW_FIRST + 0x0b) -#define WINDOW_MODALDIALOG (WINDOW_FIRST + 0x0c) -#define WINDOW_SYSTEMDIALOG (WINDOW_FIRST + 0x0d) -#define WINDOW_PATHDIALOG (WINDOW_FIRST + 0x0e) -#define WINDOW_FILEDIALOG (WINDOW_FIRST + 0x0f) -#define WINDOW_PRINTERSETUPDIALOG (WINDOW_FIRST + 0x10) -#define WINDOW_PRINTDIALOG (WINDOW_FIRST + 0x11) -#define WINDOW_COLORDIALOG (WINDOW_FIRST + 0x12) -#define WINDOW_FONTDIALOG (WINDOW_FIRST + 0x13) -#define WINDOW_CONTROL (WINDOW_FIRST + 0x14) -#define WINDOW_BUTTON (WINDOW_FIRST + 0x15) -#define WINDOW_PUSHBUTTON (WINDOW_FIRST + 0x16) -#define WINDOW_OKBUTTON (WINDOW_FIRST + 0x17) -#define WINDOW_CANCELBUTTON (WINDOW_FIRST + 0x18) -#define WINDOW_HELPBUTTON (WINDOW_FIRST + 0x19) -#define WINDOW_IMAGEBUTTON (WINDOW_FIRST + 0x1a) -#define WINDOW_MENUBUTTON (WINDOW_FIRST + 0x1b) -#define WINDOW_MOREBUTTON (WINDOW_FIRST + 0x1c) -#define WINDOW_SPINBUTTON (WINDOW_FIRST + 0x1d) -#define WINDOW_RADIOBUTTON (WINDOW_FIRST + 0x1e) -#define WINDOW_IMAGERADIOBUTTON (WINDOW_FIRST + 0x1f) -#define WINDOW_CHECKBOX (WINDOW_FIRST + 0x20) -#define WINDOW_TRISTATEBOX (WINDOW_FIRST + 0x21) -#define WINDOW_EDIT (WINDOW_FIRST + 0x22) -#define WINDOW_MULTILINEEDIT (WINDOW_FIRST + 0x23) -#define WINDOW_COMBOBOX (WINDOW_FIRST + 0x24) -#define WINDOW_LISTBOX (WINDOW_FIRST + 0x25) -#define WINDOW_MULTILISTBOX (WINDOW_FIRST + 0x26) -#define WINDOW_FIXEDTEXT (WINDOW_FIRST + 0x27) -#define WINDOW_FIXEDLINE (WINDOW_FIRST + 0x28) -#define WINDOW_FIXEDBITMAP (WINDOW_FIRST + 0x29) -#define WINDOW_FIXEDIMAGE (WINDOW_FIRST + 0x2a) -#define WINDOW_GROUPBOX (WINDOW_FIRST + 0x2c) -#define WINDOW_SCROLLBAR (WINDOW_FIRST + 0x2d) -#define WINDOW_SCROLLBARBOX (WINDOW_FIRST + 0x2e) -#define WINDOW_SPLITTER (WINDOW_FIRST + 0x2f) -#define WINDOW_SPLITWINDOW (WINDOW_FIRST + 0x30) -#define WINDOW_SPINFIELD (WINDOW_FIRST + 0x31) -#define WINDOW_PATTERNFIELD (WINDOW_FIRST + 0x32) -#define WINDOW_NUMERICFIELD (WINDOW_FIRST + 0x33) -#define WINDOW_METRICFIELD (WINDOW_FIRST + 0x34) -#define WINDOW_CURRENCYFIELD (WINDOW_FIRST + 0x35) -#define WINDOW_DATEFIELD (WINDOW_FIRST + 0x36) -#define WINDOW_TIMEFIELD (WINDOW_FIRST + 0x37) -#define WINDOW_PATTERNBOX (WINDOW_FIRST + 0x38) -#define WINDOW_NUMERICBOX (WINDOW_FIRST + 0x39) -#define WINDOW_METRICBOX (WINDOW_FIRST + 0x3a) -#define WINDOW_CURRENCYBOX (WINDOW_FIRST + 0x3b) -#define WINDOW_DATEBOX (WINDOW_FIRST + 0x3c) -#define WINDOW_TIMEBOX (WINDOW_FIRST + 0x3d) -#define WINDOW_LONGCURRENCYFIELD (WINDOW_FIRST + 0x3e) -#define WINDOW_LONGCURRENCYBOX (WINDOW_FIRST + 0x3f) -#define WINDOW_TOOLBOX (WINDOW_FIRST + 0x41) -#define WINDOW_DOCKINGWINDOW (WINDOW_FIRST + 0x42) -#define WINDOW_STATUSBAR (WINDOW_FIRST + 0x43) -#define WINDOW_TABPAGE (WINDOW_FIRST + 0x44) -#define WINDOW_TABCONTROL (WINDOW_FIRST + 0x45) -#define WINDOW_TABDIALOG (WINDOW_FIRST + 0x46) -#define WINDOW_BORDERWINDOW (WINDOW_FIRST + 0x47) -#define WINDOW_BUTTONDIALOG (WINDOW_FIRST + 0x48) -#define WINDOW_SYSTEMCHILDWINDOW (WINDOW_FIRST + 0x49) -#define WINDOW_FIXEDBORDER (WINDOW_FIRST + 0x4a) -#define WINDOW_SLIDER (WINDOW_FIRST + 0x4b) -#define WINDOW_MENUBARWINDOW (WINDOW_FIRST + 0x4c) -#define WINDOW_TREELISTBOX (WINDOW_FIRST + 0x4d) -#define WINDOW_HELPTEXTWINDOW (WINDOW_FIRST + 0x4e) -#define WINDOW_INTROWINDOW (WINDOW_FIRST + 0x4f) -#define WINDOW_LISTBOXWINDOW (WINDOW_FIRST + 0x50) -#define WINDOW_DOCKINGAREA (WINDOW_FIRST + 0x51) -#define WINDOW_LAST (WINDOW_DOCKINGAREA) - - -// --------------- -// - Window-Bits - -// --------------- - -// By changes you must also change: rsc/vclrsc.hxx -typedef sal_Int64 WinBits; - -// Window-Bits fuer Window -#define WB_CLIPCHILDREN ((WinBits)0x00000001) -#define WB_DIALOGCONTROL ((WinBits)0x00000002) -#define WB_NODIALOGCONTROL ((WinBits)0x00000004) -#define WB_BORDER ((WinBits)0x00000008) -#define WB_NOBORDER ((WinBits)0x00000010) -#define WB_SIZEABLE ((WinBits)0x00000020) -#define WB_3DLOOK ((WinBits)0x00000040) -#define WB_AUTOSIZE ((WinBits)0x00000080) - -// Window-Bits fuer SystemWindows -#define WB_MOVEABLE ((WinBits)0x00000100) -#define WB_ROLLABLE ((WinBits)0x00000200) -#define WB_CLOSEABLE ((WinBits)0x00000400) -#define WB_STANDALONE ((WinBits)0x00000800) -#define WB_APP ((WinBits)0x00001000) -#define WB_PINABLE ((WinBits)0x00002000) -#define WB_SYSTEMWINDOW ((WinBits)SAL_CONST_INT64(0x40000000)) -// warning: do not confuse WB_SYSTEMCHILDWINDOW with the SystemChildWindow class - -// the SystemChildWindow class was there first and is a very specialized -// sytem child window type for plugged applications. The SystemChildWindow class -// explicitly should never use the WB_SYSTEMCHILDWINDOW WinBit - -// WB_SYSTEMCHILDWINDOW on the other hand is to be used on system windows -// which should be created as system child windows with (more or less) -// normal event handling -#define WB_SYSTEMCHILDWINDOW ((WinBits)SAL_CONST_INT64(0x8000000000)) -#define WB_SIZEMOVE (WB_SIZEABLE | WB_MOVEABLE) - -// Standard-Window-Bits fuer ChildWindows -#define WB_TABSTOP ((WinBits)0x00000100) -#define WB_NOTABSTOP ((WinBits)0x00000200) -#define WB_GROUP ((WinBits)0x00000400) -#define WB_NOGROUP ((WinBits)0x00000800) -#define WB_HORZ ((WinBits)0x00001000) -#define WB_VERT ((WinBits)0x00002000) -#define WB_LEFT ((WinBits)0x00004000) -#define WB_CENTER ((WinBits)0x00008000) -#define WB_RIGHT ((WinBits)0x00010000) -#define WB_TOP ((WinBits)0x00020000) -#define WB_VCENTER ((WinBits)0x00040000) -#define WB_BOTTOM ((WinBits)0x00080000) -#define WB_DRAG ((WinBits)0x00100000) -#define WB_SPIN ((WinBits)0x00200000) -#define WB_REPEAT ((WinBits)0x00400000) -#define WB_NOPOINTERFOCUS ((WinBits)0x00800000) -#define WB_WORDBREAK ((WinBits)0x01000000) -#define WB_NOLABEL ((WinBits)0x02000000) -#define WB_SORT ((WinBits)0x04000000) -#define WB_DROPDOWN ((WinBits)0x08000000) -#define WB_AUTOHSCROLL ((WinBits)SAL_CONST_INT64(0x10000000)) -#define WB_DOCKABLE ((WinBits)SAL_CONST_INT64(0x20000000)) -#define WB_AUTOVSCROLL ((WinBits)SAL_CONST_INT64(0x40000000)) -#define WB_HYPHENATION (((WinBits)SAL_CONST_INT64(0x80000000)) | WB_WORDBREAK) -#define WB_CHILDDLGCTRL ((WinBits)SAL_CONST_INT64(0x100000000000)) - -// system floating window -#define WB_SYSTEMFLOATWIN ((WinBits)SAL_CONST_INT64(0x100000000)) -#define WB_INTROWIN ((WinBits)SAL_CONST_INT64(0x200000000)) -#define WB_NOSHADOW ((WinBits)SAL_CONST_INT64(0x400000000)) -#define WB_TOOLTIPWIN ((WinBits)SAL_CONST_INT64(0x800000000)) -#define WB_OWNERDRAWDECORATION ((WinBits)SAL_CONST_INT64(0x2000000000)) -#define WB_DEFAULTWIN ((WinBits)SAL_CONST_INT64(0x4000000000)) -#define WB_NEEDSFOCUS ((WinBits)SAL_CONST_INT64(0x1000000000)) - -#define WB_HIDE ((WinBits)SAL_CONST_INT64(0x80000000)) -#define WB_HSCROLL WB_HORZ -#define WB_VSCROLL WB_VERT -#define WB_TOPIMAGE WB_TOP - -// Window-Bits for PushButtons -#define WB_DEFBUTTON ((WinBits)0x10000000) -#define WB_NOLIGHTBORDER ((WinBits)0x20000000) -#define WB_RECTSTYLE ((WinBits)0x08000000) -#define WB_SMALLSTYLE ((WinBits)0x04000000) -#define WB_TOGGLE ((WinBits)SAL_CONST_INT64(0x1000000000)) -#define WB_BEVELBUTTON ((WinBits)SAL_CONST_INT64(0x2000000000)) - -// Window-Bits for FixedText -#define WB_PATHELLIPSIS ((WinBits)0x00100000) -#define WB_EXTRAOFFSET ((WinBits)0x02000000) -#define WB_NOMULTILINE ((WinBits)0x10000000) -#define WB_INFO ((WinBits)0x20000000) - -// Window-Bits for CheckBox -#define WB_CBLINESTYLE ((WinBits)SAL_CONST_INT64(0x2000000000)) - -// Window-Bits for Edit -#define WB_PASSWORD ((WinBits)0x01000000) -#define WB_READONLY ((WinBits)0x02000000) -#define WB_NOHIDESELECTION ((WinBits)SAL_CONST_INT64(0x1000000000)) -#define WB_FORCECTRLBACKGROUND ((WinBits)0x80000000) - -// Window-Bits for MultiLineEdit -#define WB_IGNORETAB ((WinBits)0x20000000) - -// Window-Bits for ListBox and MultiListBox -#define WB_SIMPLEMODE ((WinBits)0x20000000) - -// Window-Bits for FixedBitmap -#define WB_FAST ((WinBits)0x04000000) -#define WB_SCALE ((WinBits)0x08000000) -#define WB_TOPLEFTVISIBLE ((WinBits)0x10000000) - -// Window-Bits for ToolBox -#define WB_LINESPACING ((WinBits)0x01000000) -#define WB_SCROLL ((WinBits)0x02000000) -#define WB_FORCETABCYCLE ((WinBits)0x04000000) - -// Window-Bits for TabControl -#define WB_SINGLELINE ((WinBits)0x02000000) - -// Window-Bits for DockingWindows -#define WB_DOCKBORDER ((WinBits)0x00001000) - -// Window-Bits for SplitWindow -#define WB_NOSPLITDRAW ((WinBits)0x01000000) -#define WB_FLATSPLITDRAW ((WinBits)0x02000000) - -// Window-Bits for MessageBoxen -#define WB_OK ((WinBits)0x00100000) -#define WB_OK_CANCEL ((WinBits)0x00200000) -#define WB_YES_NO ((WinBits)0x00400000) -#define WB_YES_NO_CANCEL ((WinBits)0x00800000) -#define WB_RETRY_CANCEL ((WinBits)0x01000000) -#define WB_DEF_OK ((WinBits)0x02000000) -#define WB_DEF_CANCEL ((WinBits)0x04000000) -#define WB_DEF_RETRY ((WinBits)0x08000000) -#define WB_DEF_YES ((WinBits)SAL_CONST_INT64(0x10000000)) -#define WB_DEF_NO ((WinBits)SAL_CONST_INT64(0x20000000)) -#define WB_ABORT_RETRY_IGNORE ((WinBits)SAL_CONST_INT64(0x1000000000)) -#define WB_DEF_IGNORE ((WinBits)SAL_CONST_INT64(0x2000000000)) - -// Standard-WinBits -#define WB_STDWORK (WB_SIZEMOVE | WB_CLOSEABLE) -#define WB_STDDOCKWIN (WB_DOCKABLE | WB_MOVEABLE | WB_CLOSEABLE) -#define WB_STDFLOATWIN (WB_SIZEMOVE | WB_CLOSEABLE | WB_ROLLABLE) -#define WB_STDDIALOG (WB_MOVEABLE | WB_CLOSEABLE) -#define WB_STDMODELESS (WB_STDDIALOG) -#define WB_STDMODAL (WB_STDDIALOG) -#define WB_STDTABDIALOG (WB_STDDIALOG) -#define WB_STDTABCONTROL 0 - -// For TreeListBox -#define WB_HASBUTTONS ((WinBits)0x00800000) -#define WB_HASLINES ((WinBits)0x01000000) -#define WB_HASLINESATROOT ((WinBits)0x02000000) - -// For FileOpen Dialog -#define WB_PATH ((WinBits)0x00100000) -#define WB_OPEN ((WinBits)0x00200000) -#define WB_SAVEAS ((WinBits)0x00400000) - -// For Slider -// Window-Bits for TabControl -#define WB_SLIDERSET ((WinBits)0x02000000) - - -// -------------------- -// - extended WinBits - -// -------------------- -#define WB_EXT_DOCUMENT ((WinBits)0x00000001) -#define WB_EXT_DOCMODIFIED ((WinBits)0x00000002) - -// --------------- -// - WindowAlign - -// --------------- - -// By changes you must also change: rsc/vclrsc.hxx -enum WindowAlign { WINDOWALIGN_LEFT, WINDOWALIGN_TOP, WINDOWALIGN_RIGHT, WINDOWALIGN_BOTTOM }; -enum ImageAlign { IMAGEALIGN_LEFT, IMAGEALIGN_TOP, IMAGEALIGN_RIGHT, IMAGEALIGN_BOTTOM, - IMAGEALIGN_LEFT_TOP, IMAGEALIGN_LEFT_BOTTOM, IMAGEALIGN_TOP_LEFT, - IMAGEALIGN_TOP_RIGHT, IMAGEALIGN_RIGHT_TOP, IMAGEALIGN_RIGHT_BOTTOM, - IMAGEALIGN_BOTTOM_LEFT, IMAGEALIGN_BOTTOM_RIGHT, IMAGEALIGN_CENTER }; -enum SymbolAlign { SYMBOLALIGN_LEFT, SYMBOLALIGN_RIGHT }; - -// ------------ -// - TriState - -// ------------ - -// By changes you must also change: rsc/vclrsc.hxx -enum TriState { STATE_NOCHECK, STATE_CHECK, STATE_DONTKNOW }; - - -// ---------------------- -// - ButtonDialog-Types - -// ---------------------- - -typedef USHORT StandardButtonType; -#define BUTTON_OK ((StandardButtonType)0) -#define BUTTON_CANCEL ((StandardButtonType)1) -#define BUTTON_YES ((StandardButtonType)2) -#define BUTTON_NO ((StandardButtonType)3) -#define BUTTON_RETRY ((StandardButtonType)4) -#define BUTTON_HELP ((StandardButtonType)5) -#define BUTTON_CLOSE ((StandardButtonType)6) -#define BUTTON_MORE ((StandardButtonType)7) -#define BUTTON_IGNORE ((StandardButtonType)8) -#define BUTTON_ABORT ((StandardButtonType)9) -#define BUTTON_LESS ((StandardButtonType)10) -#define BUTTON_COUNT 11 +#include <tools/wintypes.hxx> #endif // _SV_WINTYPES_HXX diff --git a/vcl/inc/vcl/wrkwin.hxx b/vcl/inc/vcl/wrkwin.hxx index 8b2701420a2f..1dd46d8debe5 100644 --- a/vcl/inc/vcl/wrkwin.hxx +++ b/vcl/inc/vcl/wrkwin.hxx @@ -105,7 +105,7 @@ public: void Restore(); void Maximize( BOOL bMaximize = TRUE ); - BOOL IsMaximized(); + BOOL IsMaximized() const; }; #endif // _SV_WRKWIN_HXX diff --git a/vcl/os2/source/app/salinst.cxx b/vcl/os2/source/app/salinst.cxx index d4d324ad469c..633ad4137aff 100644 --- a/vcl/os2/source/app/salinst.cxx +++ b/vcl/os2/source/app/salinst.cxx @@ -55,6 +55,7 @@ #include <salbmp.h> #include <vcl/salimestatus.hxx> #include <vcl/timer.hxx> +#include <tools/solarmutex.hxx> // ======================================================================= @@ -501,12 +502,14 @@ Os2SalInstance::Os2SalInstance() mpSalWaitMutex = new vos::OMutex; mnYieldWaitCount = 0; mpSalYieldMutex->acquire(); + ::tools::SolarMutex::SetSolarMutex( mpSalYieldMutex ); } // ----------------------------------------------------------------------- Os2SalInstance::~Os2SalInstance() { + ::tools::SolarMutex::SetSolarMutex( 0 ); mpSalYieldMutex->release(); delete mpSalYieldMutex; delete mpSalWaitMutex; diff --git a/vcl/os2/source/gdi/salgdi.cxx b/vcl/os2/source/gdi/salgdi.cxx index b6616eb3a24b..082e690c09e7 100644 --- a/vcl/os2/source/gdi/salgdi.cxx +++ b/vcl/os2/source/gdi/salgdi.cxx @@ -1016,7 +1016,7 @@ BOOL Os2SalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* } } - delete pBuf; + delete [] pBuf; return bRet; } diff --git a/vcl/os2/source/window/salframe.cxx b/vcl/os2/source/window/salframe.cxx index 345573b268c3..5e4b843c7cff 100644 --- a/vcl/os2/source/window/salframe.cxx +++ b/vcl/os2/source/window/salframe.cxx @@ -3320,7 +3320,7 @@ static long ImplHandleIMEConversion( Os2SalFrame* pFrame, MPARAM nMP2Param ) if ( pBuf ) { aEvt.maText = XubString( pBuf, (USHORT)nBufLen ); - delete pBuf; + delete [] pBuf; if ( pAttrBuf ) { USHORT nTextLen = aEvt.maText.Len(); @@ -3346,7 +3346,7 @@ static long ImplHandleIMEConversion( Os2SalFrame* pFrame, MPARAM nMP2Param ) } aEvt.mpTextAttr = pSalAttrAry; } - delete pAttrBuf; + delete [] pAttrBuf; } if ( bLastCursor ) aEvt.mnCursorPos = aEvt.maText.Len(); @@ -3358,7 +3358,7 @@ static long ImplHandleIMEConversion( Os2SalFrame* pFrame, MPARAM nMP2Param ) // wieder zerstoeren pFrame->CallCallback( SALEVENT_EXTTEXTINPUT, (void*)&aEvt ); if ( pSalAttrAry ) - delete pSalAttrAry; + delete [] pSalAttrAry; } else pIMEData->mpReleaseIME( hWnd, hIMI ); diff --git a/vcl/prj/build.lst b/vcl/prj/build.lst index 908dd1eafd72..5d2aaf90c6f7 100644 --- a/vcl/prj/build.lst +++ b/vcl/prj/build.lst @@ -1,4 +1,4 @@ -vc vcl : l10n apple_remote BOOST:boost rsc sot ucbhelper unotools ICU:icu GRAPHITE:graphite i18npool i18nutil unoil ridljar X11_EXTENSIONS:x11_extensions offuh basegfx basebmp tools transex3 icc SO:print_header cpputools NULL +vc vcl : l10n apple_remote BOOST:boost rsc sot ucbhelper unotools ICU:icu GRAPHITE:graphite i18npool i18nutil unoil ridljar X11_EXTENSIONS:x11_extensions offuh basegfx basebmp tools transex3 icc SO:print_header cpputools shell NULL vc vcl usr1 - all vc_mkout NULL vc vcl\inc nmake - all vc_inc NULL vc vcl\source\glyphs nmake - all vc_glyphs vc_inc NULL diff --git a/vcl/prj/d.lst b/vcl/prj/d.lst index 983628184177..54af0d2e289d 100644 --- a/vcl/prj/d.lst +++ b/vcl/prj/d.lst @@ -58,6 +58,7 @@ mkdir: %_DEST%\inc%_EXT%\vcl ..\inc\vcl\imagerepository.hxx %_DEST%\inc%_EXT%\vcl\imagerepository.hxx ..\inc\vcl\imgcons.hxx %_DEST%\inc%_EXT%\vcl\imgcons.hxx ..\inc\vcl\imgctrl.hxx %_DEST%\inc%_EXT%\vcl\imgctrl.hxx +..\inc\vcl\impdel.hxx %_DEST%\inc%_EXT%\vcl\impdel.hxx ..\inc\vcl\inputctx.hxx %_DEST%\inc%_EXT%\vcl\inputctx.hxx ..\inc\vcl\javachild.hxx %_DEST%\inc%_EXT%\vcl\javachild.hxx ..\inc\vcl\jobset.hxx %_DEST%\inc%_EXT%\vcl\jobset.hxx diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 9d398aef10cd..516b23dd76be 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -61,6 +61,13 @@ void SalFrame::Flush( const Rectangle& ) // ----------------------------------------------------------------------- +void SalFrame::SetRepresentedURL( const rtl::OUString& ) +{ + // currently this is Mac only functionality +} + +// ----------------------------------------------------------------------- + SalInstance::~SalInstance() { } diff --git a/vcl/source/app/session.cxx b/vcl/source/app/session.cxx index ed8e355c2071..e82e93a9ccca 100644 --- a/vcl/source/app/session.cxx +++ b/vcl/source/app/session.cxx @@ -38,6 +38,7 @@ #include <tools/debug.hxx> #include <com/sun/star/frame/XSessionManagerClient.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XSessionManagerListener2.hpp> #include <list> @@ -81,6 +82,7 @@ class VCLSession : public cppu::WeakComponentImplHelper1 < XSessionManagerClient void callSaveRequested( bool bShutdown, bool bCancelable ); void callShutdownCancelled(); void callInteractionGranted( bool bGranted ); + void callQuit(); public: VCLSession(); virtual ~VCLSession(); @@ -199,6 +201,27 @@ void VCLSession::callShutdownCancelled() Application::AcquireSolarMutex( nAcquireCount ); } +void VCLSession::callQuit() +{ + std::list< Listener > aListeners; + { + osl::MutexGuard aGuard( m_aMutex ); + // copy listener list since calling a listener may remove it. + aListeners = m_aListeners; + // set back interaction state + m_bInteractionRequested = m_bInteractionDone = m_bInteractionGranted = false; + } + + ULONG nAcquireCount = Application::ReleaseSolarMutex(); + for( std::list< Listener >::const_iterator it = aListeners.begin(); it != aListeners.end(); ++it ) + { + Reference< XSessionManagerListener2 > xListener2( it->m_xListener, UNO_QUERY ); + if( xListener2.is() ) + xListener2->doQuit(); + } + Application::AcquireSolarMutex( nAcquireCount ); +} + void VCLSession::SalSessionEventProc( SalSessionEvent* pEvent ) { switch( pEvent->m_eType ) @@ -218,6 +241,9 @@ void VCLSession::SalSessionEventProc( SalSessionEvent* pEvent ) case ShutdownCancel: pOneInstance->callShutdownCancelled(); break; + case Quit: + pOneInstance->callQuit(); + break; } } diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 6aa453563596..bd90d8824d91 100644..100755 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -37,14 +37,17 @@ #include "vcl/event.hxx" #include "vcl/settings.hxx" #include "vcl/i18nhelp.hxx" -#include "vcl/fontcfg.hxx" +#include "unotools/fontcfg.hxx" #include "vcl/configsettings.hxx" #include "vcl/gradient.hxx" #include "vcl/unohelp.hxx" +#include "vcl/bitmapex.hxx" +#include "vcl/impimagetree.hxx" #include "unotools/localedatawrapper.hxx" #include "unotools/collatorwrapper.hxx" #include "unotools/configmgr.hxx" #include "unotools/confignode.hxx" +#include <unotools/syslocaleoptions.hxx> #ifdef WNT #include "tools/prewin.h" @@ -66,7 +69,6 @@ DBG_NAME( AllSettings ) STYLE_OPTION_NOMNEMONICS) // ======================================================================= - ImplMachineData::ImplMachineData() { mnRefCount = 1; @@ -549,7 +551,7 @@ void ImplStyleData::SetStandardStyles() Font aStdFont( FAMILY_SWISS, Size( 0, 8 ) ); aStdFont.SetCharSet( gsl_getSystemTextEncoding() ); aStdFont.SetWeight( WEIGHT_NORMAL ); - aStdFont.SetName( vcl::DefaultFontConfiguration::get()->getUserInterfaceFont(com::sun::star::lang::Locale( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), rtl::OUString(), rtl::OUString() ) ) ); + aStdFont.SetName( utl::DefaultFontConfiguration::get()->getUserInterfaceFont(com::sun::star::lang::Locale( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), rtl::OUString(), rtl::OUString() ) ) ); maAppFont = aStdFont; maHelpFont = aStdFont; maMenuFont = aStdFont; @@ -706,6 +708,7 @@ void StyleSettings::Set3DColors( const Color& rColor ) case STYLE_SYMBOLS_INDUSTRIAL: return ::rtl::OUString::createFromAscii( "industrial" ); case STYLE_SYMBOLS_CRYSTAL: return ::rtl::OUString::createFromAscii( "crystal" ); case STYLE_SYMBOLS_TANGO: return ::rtl::OUString::createFromAscii( "tango" ); + case STYLE_SYMBOLS_OXYGEN: return ::rtl::OUString::createFromAscii( "oxygen" ); case STYLE_SYMBOLS_CLASSIC: return ::rtl::OUString::createFromAscii( "classic" ); } @@ -726,6 +729,8 @@ ULONG StyleSettings::ImplNameToSymbolsStyle( const ::rtl::OUString &rName ) cons return STYLE_SYMBOLS_CRYSTAL; else if ( rName == ::rtl::OUString::createFromAscii( "tango" ) ) return STYLE_SYMBOLS_TANGO; + else if ( rName == ::rtl::OUString::createFromAscii( "oxygen" ) ) + return STYLE_SYMBOLS_OXYGEN; else if ( rName == ::rtl::OUString::createFromAscii( "classic" ) ) return STYLE_SYMBOLS_CLASSIC; @@ -759,12 +764,12 @@ ULONG StyleSettings::GetCurrentSymbolsStyle() const // style selected in Tools -> Options... -> OpenOffice.org -> View ULONG nStyle = GetSymbolsStyle(); - if ( nStyle == STYLE_SYMBOLS_AUTO ) + if ( nStyle == STYLE_SYMBOLS_AUTO || ( !CheckSymbolStyle (nStyle) ) ) { // the preferred style can be read from the desktop setting by the desktop native widgets modules ULONG nPreferredStyle = GetPreferredSymbolsStyle(); - if ( nPreferredStyle == STYLE_SYMBOLS_AUTO ) + if ( nPreferredStyle == STYLE_SYMBOLS_AUTO || ( !CheckSymbolStyle (nPreferredStyle) ) ) { // use a hardcoded desktop-specific fallback if no preferred style has been detected @@ -780,7 +785,10 @@ ULONG StyleSettings::GetCurrentSymbolsStyle() const nPreferredStyle = snFallbackDesktopStyle; } - nStyle = GetHighContrastMode()? STYLE_SYMBOLS_HICONTRAST: nPreferredStyle; + if (GetHighContrastMode() && CheckSymbolStyle (STYLE_SYMBOLS_HICONTRAST) ) + nStyle = STYLE_SYMBOLS_HICONTRAST; + else + nStyle = nPreferredStyle; } return nStyle; @@ -814,6 +822,33 @@ ULONG StyleSettings::GetAutoSymbolsStyle() const nRet = STYLE_SYMBOLS_TANGO; else if( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde" ) ) nRet = STYLE_SYMBOLS_CRYSTAL; + else if( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde4" ) ) + nRet = STYLE_SYMBOLS_OXYGEN; + } + + // falback to any existing style + if ( ! CheckSymbolStyle (nRet) ) + { + for ( ULONG n = 0 ; n <= STYLE_SYMBOLS_THEMES_MAX ; n++ ) + { + ULONG nStyleToCheck = n; + + // auto is not a real theme => can't be fallback + if ( nStyleToCheck == STYLE_SYMBOLS_AUTO ) + continue; + + // will check hicontrast in the end + if ( nStyleToCheck == STYLE_SYMBOLS_HICONTRAST ) + continue; + if ( nStyleToCheck == STYLE_SYMBOLS_THEMES_MAX ) + nStyleToCheck = STYLE_SYMBOLS_HICONTRAST; + + if ( CheckSymbolStyle ( nStyleToCheck ) ) + { + nRet = nStyleToCheck; + n = STYLE_SYMBOLS_THEMES_MAX; + } + } } return nRet; @@ -821,6 +856,14 @@ ULONG StyleSettings::GetAutoSymbolsStyle() const // ----------------------------------------------------------------------- +bool StyleSettings::CheckSymbolStyle( ULONG nStyle ) const +{ + static ImplImageTreeSingletonRef aImageTree; + return aImageTree->checkStyle( ImplSymbolsStyleToName( nStyle ) ); +} + +// ----------------------------------------------------------------------- + void StyleSettings::SetStandardStyles() { CopyData(); @@ -1069,7 +1112,6 @@ BOOL StyleSettings::operator ==( const StyleSettings& rSet ) const ImplMiscData::ImplMiscData() { mnRefCount = 1; - mnTwoDigitYearStart = 1930; mnEnableATT = sal::static_int_cast<USHORT>(~0U); mnDisablePrinting = sal::static_int_cast<USHORT>(~0U); static const char* pEnv = getenv("SAL_DECIMALSEP_ENABLED" ); // set default without UI @@ -1081,7 +1123,6 @@ ImplMiscData::ImplMiscData() ImplMiscData::ImplMiscData( const ImplMiscData& rData ) { mnRefCount = 1; - mnTwoDigitYearStart = rData.mnTwoDigitYearStart; mnEnableATT = rData.mnEnableATT; mnDisablePrinting = rData.mnDisablePrinting; mbEnableLocalizedDecimalSep = rData.mbEnableLocalizedDecimalSep; @@ -1155,8 +1196,7 @@ BOOL MiscSettings::operator ==( const MiscSettings& rSet ) const if ( mpData == rSet.mpData ) return TRUE; - if ( (mpData->mnTwoDigitYearStart == rSet.mpData->mnTwoDigitYearStart ) && - (mpData->mnEnableATT == rSet.mpData->mnEnableATT ) && + if ( (mpData->mnEnableATT == rSet.mpData->mnEnableATT ) && (mpData->mnDisablePrinting == rSet.mpData->mnDisablePrinting ) && (mpData->mbEnableLocalizedDecimalSep == rSet.mpData->mbEnableLocalizedDecimalSep ) ) return TRUE; @@ -1513,28 +1553,20 @@ BOOL HelpSettings::operator ==( const HelpSettings& rSet ) const // ======================================================================= -static BOOL ImplCompareLocales( const ::com::sun::star::lang::Locale& L1, const ::com::sun::star::lang::Locale& L2 ) -{ - return ( ( L1.Language == L2.Language ) && - ( L1.Country == L2.Country ) && - ( L1.Variant == L2.Variant ) ); -} - -// ======================================================================= - ImplAllSettingsData::ImplAllSettingsData() { mnRefCount = 1; mnSystemUpdate = SETTINGS_ALLSETTINGS; mnWindowUpdate = SETTINGS_ALLSETTINGS; meLanguage = LANGUAGE_SYSTEM; - meUILanguage = LANGUAGE_SYSTEM; + meUILanguage = LANGUAGE_SYSTEM; mpLocaleDataWrapper = NULL; mpUILocaleDataWrapper = NULL; mpCollatorWrapper = NULL; mpUICollatorWrapper = NULL; mpI18nHelper = NULL; mpUII18nHelper = NULL; + maMiscSettings.SetEnableLocalizedDecimalSep( maSysLocale.GetOptions().IsDecimalSeparatorAsLocale() ); } // ----------------------------------------------------------------------- @@ -1546,15 +1578,12 @@ ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData& rData ) : maMiscSettings( rData.maMiscSettings ), maNotificationSettings( rData.maNotificationSettings ), maHelpSettings( rData.maHelpSettings ), - maLocale( rData.maLocale ), - maUILocale( rData.maUILocale ) - + maLocale( rData.maLocale ) { mnRefCount = 1; mnSystemUpdate = rData.mnSystemUpdate; mnWindowUpdate = rData.mnWindowUpdate; meLanguage = rData.meLanguage; - meUILanguage = rData.meUILanguage; // Pointer couldn't shared and objects haven't a copy ctor // So we create the cache objects new, if the GetFunction is // called @@ -1750,11 +1779,7 @@ ULONG AllSettings::Update( ULONG nFlags, const AllSettings& rSet ) if ( nFlags & SETTINGS_UILOCALE ) { - if ( mpData->meUILanguage || rSet.mpData->meUILanguage ) - { - SetUILanguage( rSet.mpData->meUILanguage ); - nChangeFlags |= SETTINGS_UILOCALE; - } + // UILocale can't be changed } return nChangeFlags; @@ -1793,9 +1818,6 @@ ULONG AllSettings::GetChangeFlags( const AllSettings& rSet ) const if ( mpData->meLanguage || rSet.mpData->meLanguage ) nChangeFlags |= SETTINGS_LOCALE; - if ( mpData->meUILanguage || rSet.mpData->meUILanguage ) - nChangeFlags |= SETTINGS_UILOCALE; - return nChangeFlags; } @@ -1817,18 +1839,13 @@ BOOL AllSettings::operator ==( const AllSettings& rSet ) const (mpData->maNotificationSettings == rSet.mpData->maNotificationSettings) && (mpData->maHelpSettings == rSet.mpData->maHelpSettings) && (mpData->mnSystemUpdate == rSet.mpData->mnSystemUpdate) && + (mpData->maLocale == rSet.mpData->maLocale) && (mpData->mnWindowUpdate == rSet.mpData->mnWindowUpdate) ) { - // special treatment for Locale, because maLocale is only - // initialized after first call of GetLocale(). - ::com::sun::star::lang::Locale aEmptyLocale; - if ( ( ImplCompareLocales( mpData->maLocale, aEmptyLocale ) && ImplCompareLocales( rSet.mpData->maLocale, aEmptyLocale ) ) - || ImplCompareLocales( GetLocale(), rSet.GetLocale() ) ) - { - return TRUE; - } + return TRUE; } - return FALSE; + else + return FALSE; } // ----------------------------------------------------------------------- @@ -1857,70 +1874,39 @@ void AllSettings::SetLocale( const ::com::sun::star::lang::Locale& rLocale ) // ----------------------------------------------------------------------- -void AllSettings::SetUILocale( const ::com::sun::star::lang::Locale& rLocale ) +void AllSettings::SetUILocale( const ::com::sun::star::lang::Locale& ) { - CopyData(); - - mpData->maUILocale = rLocale; - - if ( !rLocale.Language.getLength() ) - mpData->meUILanguage = LANGUAGE_SYSTEM; - else - mpData->meUILanguage = MsLangId::convertLocaleToLanguage( rLocale ); - if ( mpData->mpUILocaleDataWrapper ) - { - delete mpData->mpUILocaleDataWrapper; - mpData->mpUILocaleDataWrapper = NULL; - } - if ( mpData->mpUII18nHelper ) - { - delete mpData->mpUII18nHelper; - mpData->mpUII18nHelper = NULL; - } + // there is only one UILocale per process } // ----------------------------------------------------------------------- void AllSettings::SetLanguage( LanguageType eLang ) { - CopyData(); - - mpData->meLanguage = eLang; - - // Will be calculated in GetLocale() - mpData->maLocale = ::com::sun::star::lang::Locale(); - if ( mpData->mpLocaleDataWrapper ) - { - delete mpData->mpLocaleDataWrapper; - mpData->mpLocaleDataWrapper = NULL; - } - if ( mpData->mpI18nHelper ) + if ( eLang != mpData->meLanguage ) { - delete mpData->mpI18nHelper; - mpData->mpI18nHelper = NULL; + CopyData(); + + mpData->meLanguage = eLang; + MsLangId::convertLanguageToLocale( GetLanguage(), ((AllSettings*)this)->mpData->maLocale ); + if ( mpData->mpLocaleDataWrapper ) + { + delete mpData->mpLocaleDataWrapper; + mpData->mpLocaleDataWrapper = NULL; + } + if ( mpData->mpI18nHelper ) + { + delete mpData->mpI18nHelper; + mpData->mpI18nHelper = NULL; + } } } // ----------------------------------------------------------------------- -void AllSettings::SetUILanguage( LanguageType eLang ) +void AllSettings::SetUILanguage( LanguageType ) { - CopyData(); - - mpData->meUILanguage = eLang; - - // Will be calculated in GetUILocale() - mpData->maUILocale = ::com::sun::star::lang::Locale(); - if ( mpData->mpUILocaleDataWrapper ) - { - delete mpData->mpUILocaleDataWrapper; - mpData->mpUILocaleDataWrapper = NULL; - } - if ( mpData->mpUII18nHelper ) - { - delete mpData->mpUII18nHelper; - mpData->mpUII18nHelper = NULL; - } + // there is only one UILanguage per process } // ----------------------------------------------------------------------- @@ -1973,8 +1959,7 @@ BOOL AllSettings::GetLayoutRTL() const const ::com::sun::star::lang::Locale& AllSettings::GetLocale() const { if ( !mpData->maLocale.Language.getLength() ) - MsLangId::convertLanguageToLocale( GetLanguage(), - ((AllSettings*)this)->mpData->maLocale ); + mpData->maLocale = mpData->maSysLocale.GetLocale(); return mpData->maLocale; } @@ -1983,9 +1968,9 @@ const ::com::sun::star::lang::Locale& AllSettings::GetLocale() const const ::com::sun::star::lang::Locale& AllSettings::GetUILocale() const { + // the UILocale is never changed if ( !mpData->maUILocale.Language.getLength() ) - MsLangId::convertLanguageToLocale( GetUILanguage(), - ((AllSettings*)this)->mpData->maUILocale ); + mpData->maUILocale = mpData->maSysLocale.GetUILocale(); return mpData->maUILocale; } @@ -1994,8 +1979,9 @@ const ::com::sun::star::lang::Locale& AllSettings::GetUILocale() const LanguageType AllSettings::GetLanguage() const { + // meLanguage == LANGUAGE_SYSTEM means: use settings from SvtSysLocale if ( mpData->meLanguage == LANGUAGE_SYSTEM ) - return MsLangId::getSystemLanguage(); + return mpData->maSysLocale.GetLanguage(); return mpData->meLanguage; } @@ -2004,10 +1990,8 @@ LanguageType AllSettings::GetLanguage() const LanguageType AllSettings::GetUILanguage() const { - if ( mpData->meUILanguage == LANGUAGE_SYSTEM ) - return MsLangId::getSystemUILanguage(); - - return mpData->meUILanguage; + // the UILanguage is never changed + return mpData->maSysLocale.GetUILanguage(); } // ----------------------------------------------------------------------- @@ -2076,3 +2060,22 @@ const CollatorWrapper& AllSettings::GetUICollatorWrapper() const } */ +void AllSettings::LocaleSettingsChanged( sal_uInt32 nHint ) +{ + AllSettings aAllSettings( Application::GetSettings() ); + if ( nHint & SYSLOCALEOPTIONS_HINT_DECSEP ) + { + MiscSettings aMiscSettings = aAllSettings.GetMiscSettings(); + BOOL bIsDecSepAsLocale = aAllSettings.mpData->maSysLocale.GetOptions().IsDecimalSeparatorAsLocale(); + if ( aMiscSettings.GetEnableLocalizedDecimalSep() != bIsDecSepAsLocale ) + { + aMiscSettings.SetEnableLocalizedDecimalSep( bIsDecSepAsLocale ); + aAllSettings.SetMiscSettings( aMiscSettings ); + } + } + + if ( (nHint & SYSLOCALEOPTIONS_HINT_LOCALE) ) + aAllSettings.SetLocale( aAllSettings.mpData->maSysLocale.GetOptions().GetLocale() ); + + Application::SetSettings( aAllSettings ); +} diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 6057409baa14..7f329f2d24d5 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -31,63 +31,53 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#ifndef _SV_SVSYS_HXX -#include <svsys.h> -#endif -#include <vcl/salinst.hxx> -#include <vcl/salframe.hxx> -#include <vcl/salsys.hxx> -#ifndef _VOS_PROCESS_HXX -#include <vos/process.hxx> -#endif -#ifndef _VOS_MUTEX_HXX -#include <vos/mutex.hxx> -#endif -#include <tools/tools.h> -#include <tools/debug.hxx> -#include <tools/time.hxx> -#include <i18npool/mslangid.hxx> -#include <vcl/svdata.hxx> -#include <vcl/settings.hxx> -#ifndef _ACCMGR_HXX -#include <vcl/accmgr.hxx> -#endif -#ifndef _SV_KEYCOD_HXX -#include <vcl/keycod.hxx> -#endif -#include <vcl/event.hxx> -#include <vcl/virdev.hxx> -#include <vcl/windata.hxx> -#include <vcl/window.h> -#include <vcl/wrkwin.hxx> -#include <vcl/idlemgr.hxx> -#include <vcl/svapp.hxx> -#include <vcl/cvtgrf.hxx> -#include <vcl/unowrap.hxx> -#include <vcl/xconnection.hxx> -#ifndef _SV_SVIDS_HRC -#include <vcl/svids.hrc> -#endif -#include <vcl/timer.hxx> - -#include <vcl/unohelp.hxx> - -#include <com/sun/star/uno/Reference.h> -#include <com/sun/star/awt/XToolkit.hpp> -#include <com/sun/star/uno/XNamingService.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <comphelper/processfactory.hxx> - -#include <osl/module.h> -#include <osl/file.hxx> +#include "svsys.h" +#include "vcl/salinst.hxx" +#include "vcl/salframe.hxx" +#include "vcl/salsys.hxx" +#include "vos/process.hxx" +#include "vos/mutex.hxx" +#include "tools/tools.h" +#include "tools/debug.hxx" +#include "tools/time.hxx" +#include "i18npool/mslangid.hxx" +#include "vcl/svdata.hxx" +#include "vcl/settings.hxx" +#include "vcl/accmgr.hxx" +#include "vcl/keycod.hxx" +#include "vcl/event.hxx" +#include "vcl/vclevent.hxx" +#include "vcl/virdev.hxx" +#include "vcl/windata.hxx" +#include "vcl/window.h" +#include "vcl/wrkwin.hxx" +#include "vcl/idlemgr.hxx" +#include "vcl/svapp.hxx" +#include "vcl/cvtgrf.hxx" +#include "vcl/unowrap.hxx" +#include "vcl/xconnection.hxx" +#include "vcl/svids.hrc" +#include "vcl/timer.hxx" + +#include "vcl/unohelp.hxx" + +#include "com/sun/star/uno/Reference.h" +#include "com/sun/star/awt/XToolkit.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "comphelper/processfactory.hxx" + +#include "osl/module.h" +#include "osl/file.hxx" #include "osl/thread.h" #include "rtl/tencinfo.h" -#include <rtl/instance.hxx> -#include <vcl/salimestatus.hxx> +#include "rtl/instance.hxx" +#include "vcl/salimestatus.hxx" #include <utility> #include <vcl/lazydelete.hxx> +#include <unotools/syslocaleoptions.hxx> using namespace ::com::sun::star::uno; @@ -467,7 +457,7 @@ void Application::Execute() // ----------------------------------------------------------------------- -void Application::Reschedule( bool bAllEvents ) +inline void ImplYield( bool i_bWait, bool i_bAllEvents ) { ImplSVData* pSVData = ImplGetSVData(); @@ -477,34 +467,45 @@ void Application::Reschedule( bool bAllEvents ) Timer::ImplTimerCallbackProc(); pSVData->maAppData.mnDispatchLevel++; - pSVData->mpDefInst->Yield( false, bAllEvents ); + // do not wait for events if application was already quit; in that + // case only dispatch events already available + // do not wait for events either if the app decided that it is too busy for timers + // (feature added for the slideshow) + pSVData->mpDefInst->Yield( i_bWait && !pSVData->maAppData.mbAppQuit && !pSVData->maAppData.mbNoYield, i_bAllEvents ); pSVData->maAppData.mnDispatchLevel--; // flush lazy deleted objects if( pSVData->maAppData.mnDispatchLevel == 0 ) vcl::LazyDelete::flush(); + + // the system timer events will not necesseraly come in in non waiting mode + // e.g. on aqua; need to trigger timer checks manually + if( pSVData->maAppData.mbNoYield && !pSVData->mbNoCallTimer ) + { + do + { + Timer::ImplTimerCallbackProc(); + } + while( pSVData->mbNotAllTimerCalled ); + } + + // call post yield listeners + if( pSVData->maAppData.mpPostYieldListeners ) + pSVData->maAppData.mpPostYieldListeners->callListeners( NULL ); } // ----------------------------------------------------------------------- -void Application::Yield( bool bAllEvents ) +void Application::Reschedule( bool i_bAllEvents ) { - ImplSVData* pSVData = ImplGetSVData(); - - // run timers that have timed out - if ( !pSVData->mbNoCallTimer ) - while ( pSVData->mbNotAllTimerCalled ) - Timer::ImplTimerCallbackProc(); + ImplYield( false, i_bAllEvents ); +} - // do not wait for events if application was already quit; in that - // case only dispatch events already available - pSVData->maAppData.mnDispatchLevel++; - pSVData->mpDefInst->Yield( !pSVData->maAppData.mbAppQuit, bAllEvents ); - pSVData->maAppData.mnDispatchLevel--; +// ----------------------------------------------------------------------- - // flush lazy deleted objects - if( pSVData->maAppData.mnDispatchLevel == 0 ) - vcl::LazyDelete::flush(); +void Application::Yield( bool i_bAllEvents ) +{ + ImplYield( true, i_bAllEvents ); } // ----------------------------------------------------------------------- @@ -704,12 +705,10 @@ bool Application::ValidateSystemFont() void Application::SetSettings( const AllSettings& rSettings ) { - MsLangId::setConfiguredSystemLanguage( rSettings.GetLanguage()); - MsLangId::setConfiguredSystemUILanguage( rSettings.GetUILanguage()); ImplSVData* pSVData = ImplGetSVData(); if ( !pSVData->maAppData.mpSettings ) { - pSVData->maAppData.mpSettings = new AllSettings(); + GetSettings(); *pSVData->maAppData.mpSettings = rSettings; ResMgr::SetDefaultLocale( rSettings.GetUILocale() ); } @@ -811,7 +810,12 @@ const AllSettings& Application::GetSettings() { ImplSVData* pSVData = ImplGetSVData(); if ( !pSVData->maAppData.mpSettings ) + { + pSVData->maAppData.mpCfgListener = new LocaleConfigurationListener; pSVData->maAppData.mpSettings = new AllSettings(); + pSVData->maAppData.mpSettings->GetSysLocale().GetOptions().AddListener( pSVData->maAppData.mpCfgListener ); + } + return *(pSVData->maAppData.mpSettings); } @@ -1193,6 +1197,33 @@ void Application::RemoveIdleHdl( const Link& rLink ) // ----------------------------------------------------------------------- +void Application::EnableNoYieldMode( bool i_bNoYield ) +{ + ImplSVData* pSVData = ImplGetSVData(); + pSVData->maAppData.mbNoYield = i_bNoYield; +} + +// ----------------------------------------------------------------------- + +void Application::AddPostYieldListener( const Link& i_rListener ) +{ + ImplSVData* pSVData = ImplGetSVData(); + if( ! pSVData->maAppData.mpPostYieldListeners ) + pSVData->maAppData.mpPostYieldListeners = new VclEventListeners2(); + pSVData->maAppData.mpPostYieldListeners->addListener( i_rListener ); +} + +// ----------------------------------------------------------------------- + +void Application::RemovePostYieldListener( const Link& i_rListener ) +{ + ImplSVData* pSVData = ImplGetSVData(); + if( pSVData->maAppData.mpPostYieldListeners ) + pSVData->maAppData.mpPostYieldListeners->removeListener( i_rListener ); +} + +// ----------------------------------------------------------------------- + WorkWindow* Application::GetAppWindow() { return ImplGetSVData()->maWinData.mpAppWin; diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index 21e1f34c1ef5..6a61d15db4c0 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -47,7 +47,7 @@ #include <uno/current_context.hxx> #include <cppuhelper/implbase1.hxx> #include <tools/debug.hxx> -#include <vcl/fontcfg.hxx> +#include <unotools/fontcfg.hxx> #include <vcl/configsettings.hxx> #include <vcl/svdata.hxx> #include <vcl/window.h> @@ -523,3 +523,9 @@ Window* ImplFindWindow( const SalFrame* pFrame, Point& rSalFramePos ) return NULL; } + +void LocaleConfigurationListener::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 nHint ) +{ + AllSettings::LocaleSettingsChanged( nHint ); +} + diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index 6c09978e37b1..310c01a40673 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -79,8 +79,8 @@ #include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/lang/XComponent.hpp" #include "rtl/logfile.hxx" - -#include "vcl/fontcfg.hxx" +#include <unotools/syslocaleoptions.hxx> +#include "unotools/fontcfg.hxx" #include "vcl/configsettings.hxx" #include "vcl/lazydelete.hxx" @@ -467,6 +467,12 @@ void DeInitVCL() if ( pSVData->maAppData.mpSettings ) { + if ( pSVData->maAppData.mpCfgListener ) + { + pSVData->maAppData.mpSettings->GetSysLocale().GetOptions().RemoveListener( pSVData->maAppData.mpCfgListener ); + delete pSVData->maAppData.mpCfgListener; + } + delete pSVData->maAppData.mpSettings; pSVData->maAppData.mpSettings = NULL; } diff --git a/vcl/source/app/vclevent.cxx b/vcl/source/app/vclevent.cxx index 8ebc65c8a3f6..704d68c5bc7f 100644 --- a/vcl/source/app/vclevent.cxx +++ b/vcl/source/app/vclevent.cxx @@ -80,3 +80,56 @@ BOOL VclEventListeners::Process( VclSimpleEvent* pEvent ) const } return bProcessed; } + +VclEventListeners2::VclEventListeners2() +{ +} + +VclEventListeners2::~VclEventListeners2() +{ +} + +void VclEventListeners2::addListener( const Link& i_rLink ) +{ + // ensure uniqueness + for( std::list< Link >::const_iterator it = m_aListeners.begin(); it != m_aListeners.end(); ++it ) + { + if( *it == i_rLink ) + return; + } + m_aListeners.push_back( i_rLink ); +} + +void VclEventListeners2::removeListener( const Link& i_rLink ) +{ + size_t n = m_aIterators.size(); + for( size_t i = 0; i < n; i++ ) + { + if( m_aIterators[i].m_aIt != m_aListeners.end() && *m_aIterators[i].m_aIt == i_rLink ) + { + m_aIterators[i].m_bWasInvalidated = true; + ++m_aIterators[i].m_aIt; + } + } + m_aListeners.remove( i_rLink ); +} + +void VclEventListeners2::callListeners( VclSimpleEvent* i_pEvent ) +{ + vcl::DeletionListener aDel( this ); + + m_aIterators.push_back( ListenerIt() ); + size_t nIndex = m_aIterators.size() - 1; + m_aIterators[ nIndex ].m_aIt = m_aListeners.begin(); + while( ! aDel.isDeleted() && m_aIterators[ nIndex ].m_aIt != m_aListeners.end() ) + { + m_aIterators[ nIndex ].m_aIt->Call( i_pEvent ); + if( m_aIterators[ nIndex ].m_bWasInvalidated ) + // check if the current element was removed and the iterator increased in the meantime + m_aIterators[ nIndex ].m_bWasInvalidated = false; + else + ++m_aIterators[ nIndex ].m_aIt; + } + m_aIterators.pop_back(); +} + diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index e7a4aadb8694..53a060af6bd6 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -50,7 +50,7 @@ #include <tools/poly.hxx> #include <vcl/button.hxx> #include <vcl/window.h> -#include <vcl/controllayout.hxx> +#include <vcl/controldata.hxx> #ifndef _SV_NATIVEWIDGET_HXX #include <vcl/salnativewidgets.hxx> #endif @@ -383,8 +383,8 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, WinBits nWinStyle = GetStyle(); Rectangle aOutRect( rPos, rSize ); - MetricVector *pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL; - String *pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL; + MetricVector *pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; + String *pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; ImageAlign eImageAlign = mpButtonData->meImageAlign; Size aImageSize = mpButtonData->maImage.GetSizePixel(); @@ -406,13 +406,12 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, } else if ( bDrawText && !bDrawImage && !bHasSymbol ) { - aOutRect = pDev->GetTextRect( aOutRect, aText, nTextStyle ); - rSize = aOutRect.GetSize(); - rPos = aOutRect.TopLeft(); + DrawControlText( *pDev, aOutRect, aText, nTextStyle, pVector, pDisplayText ); ImplSetFocusRect( aOutRect ); + rSize = aOutRect.GetSize(); + rPos = aOutRect.TopLeft(); - pDev->DrawText( aOutRect, aText, nTextStyle, pVector, pDisplayText ); return; } @@ -853,31 +852,25 @@ WinBits PushButton::ImplInitStyle( const Window* pPrevWindow, WinBits nStyle ) return nStyle; } +// ----------------------------------------------------------------- + +const Font& PushButton::GetCanonicalFont( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetPushButtonFont(); +} + +// ----------------------------------------------------------------- +const Color& PushButton::GetCanonicalTextColor( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetButtonTextColor(); +} + // ----------------------------------------------------------------------- void PushButton::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if ( bFont ) - { - Font aFont = rStyleSettings.GetPushButtonFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); - } - - if ( bForeground || bFont ) - { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetButtonTextColor(); - SetTextColor( aColor ); - SetTextFillColor(); - } + Button::ImplInitSettings( bFont, bForeground ); if ( bBackground ) { @@ -1659,7 +1652,7 @@ void PushButton::KeyUp( const KeyEvent& rKEvt ) void PushButton::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast<PushButton*>(this)->ImplDrawPushButton( true ); } @@ -2225,31 +2218,25 @@ WinBits RadioButton::ImplInitStyle( const Window* pPrevWindow, WinBits nStyle ) return nStyle; } +// ----------------------------------------------------------------- + +const Font& RadioButton::GetCanonicalFont( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetRadioCheckFont(); +} + +// ----------------------------------------------------------------- +const Color& RadioButton::GetCanonicalTextColor( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetRadioCheckTextColor(); +} + // ----------------------------------------------------------------------- void RadioButton::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if ( bFont ) - { - Font aFont = rStyleSettings.GetRadioCheckFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); - } - - if ( bForeground || bFont ) - { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetRadioCheckTextColor(); - SetTextColor( aColor ); - SetTextFillColor(); - } + Button::ImplInitSettings( bFont, bForeground ); if ( bBackground ) { @@ -2424,16 +2411,14 @@ if ( bNativeOK == FALSE ) void RadioButton::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, const Point& rPos, const Size& rSize, - const Size& rImageSize, long nImageSep, - Rectangle& rStateRect, - Rectangle& rMouseRect, - bool bLayout ) + const Size& rImageSize, Rectangle& rStateRect, + Rectangle& rMouseRect, bool bLayout ) { WinBits nWinStyle = GetStyle(); XubString aText( GetText() ); Rectangle aRect( rPos, rSize ); - MetricVector* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL; - String* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL; + MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; + String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; pDev->Push( PUSH_CLIPREGION ); pDev->IntersectClipRegion( Rectangle( rPos, rSize ) ); @@ -2446,9 +2431,9 @@ void RadioButton::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, { USHORT nTextStyle = Button::ImplGetTextStyle( aText, nWinStyle, nDrawFlags ); + const long nImageSep = GetDrawPixel( pDev, ImplGetImageToTextDistance() ); Size aSize( rSize ); Point aPos( rPos ); - aPos.X() += rImageSize.Width() + nImageSep; aSize.Width() -= rImageSize.Width() + nImageSep; @@ -2578,7 +2563,7 @@ void RadioButton::ImplDrawRadioButton( bool bLayout ) // Draw control text ImplDraw( this, 0, Point(), GetOutputSizePixel(), - aImageSize, IMPL_SEP_BUTTON_IMAGE, maStateRect, maMouseRect, bLayout ); + aImageSize, maStateRect, maMouseRect, bLayout ); if( !bLayout || (IsNativeControlSupported(CTRL_RADIOBUTTON, PART_ENTIRE_CONTROL)==TRUE) ) { @@ -2854,7 +2839,7 @@ void RadioButton::KeyUp( const KeyEvent& rKEvt ) void RadioButton::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast<RadioButton*>(this)->ImplDrawRadioButton( true ); } @@ -2909,8 +2894,7 @@ void RadioButton::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize pDev->SetTextFillColor(); ImplDraw( pDev, nFlags, aPos, aSize, - aImageSize, GetDrawPixel( pDev, IMPL_SEP_BUTTON_IMAGE ), - aStateRect, aMouseRect ); + aImageSize, aStateRect, aMouseRect ); Point aCenterPos = aStateRect.Center(); long nRadX = aImageSize.Width()/2; @@ -3158,6 +3142,15 @@ void RadioButton::Check( BOOL bCheck ) // ----------------------------------------------------------------------- +long RadioButton::ImplGetImageToTextDistance() const +{ + // 4 pixels, but take zoom into account, so the text doesn't "jump" relative to surrounding elements, + // which might have been aligned with the text of the check box + return CalcZoom( 4 ); +} + +// ----------------------------------------------------------------------- + Size RadioButton::ImplGetRadioImageSize() const { Size aSize; @@ -3331,12 +3324,12 @@ Size RadioButton::CalcMinimumSize( long nMaxWidth ) const { // subtract what will be added later nMaxWidth-=2; - nMaxWidth -= IMPL_SEP_BUTTON_IMAGE; + nMaxWidth -= ImplGetImageToTextDistance(); Size aTextSize = GetTextRect( Rectangle( Point(), Size( nMaxWidth > 0 ? nMaxWidth : 0x7fffffff, 0x7fffffff ) ), aText, FixedText::ImplGetTextStyle( GetStyle() ) ).GetSize(); aSize.Width()+=2; // for focus rect - aSize.Width() += IMPL_SEP_BUTTON_IMAGE; + aSize.Width() += ImplGetImageToTextDistance(); aSize.Width() += aTextSize.Width(); if ( aSize.Height() < aTextSize.Height() ) aSize.Height() = aTextSize.Height(); @@ -3395,31 +3388,25 @@ WinBits CheckBox::ImplInitStyle( const Window* pPrevWindow, WinBits nStyle ) return nStyle; } +// ----------------------------------------------------------------- + +const Font& CheckBox::GetCanonicalFont( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetRadioCheckFont(); +} + +// ----------------------------------------------------------------- +const Color& CheckBox::GetCanonicalTextColor( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetRadioCheckTextColor(); +} + // ----------------------------------------------------------------------- void CheckBox::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if ( bFont ) - { - Font aFont = rStyleSettings.GetRadioCheckFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); - } - - if ( bForeground || bFont ) - { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetRadioCheckTextColor(); - SetTextColor( aColor ); - SetTextFillColor(); - } + Button::ImplInitSettings( bFont, bForeground ); if ( bBackground ) { @@ -3527,9 +3514,8 @@ void CheckBox::ImplDrawCheckBoxState() void CheckBox::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, const Point& rPos, const Size& rSize, - const Size& rImageSize, long nImageSep, - Rectangle& rStateRect, Rectangle& rMouseRect, - bool bLayout ) + const Size& rImageSize, Rectangle& rStateRect, + Rectangle& rMouseRect, bool bLayout ) { WinBits nWinStyle = GetStyle(); XubString aText( GetText() ); @@ -3543,6 +3529,7 @@ void CheckBox::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, { USHORT nTextStyle = Button::ImplGetTextStyle( aText, nWinStyle, nDrawFlags ); + const long nImageSep = GetDrawPixel( pDev, ImplGetImageToTextDistance() ); Size aSize( rSize ); Point aPos( rPos ); aPos.X() += rImageSize.Width() + nImageSep; @@ -3640,7 +3627,7 @@ void CheckBox::ImplDrawCheckBox( bool bLayout ) HideFocus(); ImplDraw( this, 0, Point(), GetOutputSizePixel(), aImageSize, - IMPL_SEP_BUTTON_IMAGE, maStateRect, maMouseRect, bLayout ); + maStateRect, maMouseRect, bLayout ); if( !bLayout ) { @@ -3797,7 +3784,7 @@ void CheckBox::KeyUp( const KeyEvent& rKEvt ) void CheckBox::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast<CheckBox*>(this)->ImplDrawCheckBox( true ); } @@ -3852,8 +3839,7 @@ void CheckBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, pDev->SetTextFillColor(); ImplDraw( pDev, nFlags, aPos, aSize, - aImageSize, GetDrawPixel( pDev, IMPL_SEP_BUTTON_IMAGE ), - aStateRect, aMouseRect, false ); + aImageSize, aStateRect, aMouseRect, false ); pDev->SetLineColor(); pDev->SetFillColor( Color( COL_BLACK ) ); @@ -4099,6 +4085,15 @@ void CheckBox::EnableTriState( BOOL bTriState ) // ----------------------------------------------------------------------- +long CheckBox::ImplGetImageToTextDistance() const +{ + // 4 pixels, but take zoom into account, so the text doesn't "jump" relative to surrounding elements, + // which might have been aligned with the text of the check box + return CalcZoom( 4 ); +} + +// ----------------------------------------------------------------------- + Size CheckBox::ImplGetCheckImageSize() const { Size aSize; @@ -4232,12 +4227,12 @@ Size CheckBox::CalcMinimumSize( long nMaxWidth ) const { // subtract what will be added later nMaxWidth-=2; - nMaxWidth -= IMPL_SEP_BUTTON_IMAGE; + nMaxWidth -= ImplGetImageToTextDistance(); Size aTextSize = GetTextRect( Rectangle( Point(), Size( nMaxWidth > 0 ? nMaxWidth : 0x7fffffff, 0x7fffffff ) ), aText, FixedText::ImplGetTextStyle( GetStyle() ) ).GetSize(); aSize.Width()+=2; // for focus rect - aSize.Width() += IMPL_SEP_BUTTON_IMAGE; + aSize.Width() += ImplGetImageToTextDistance(); aSize.Width() += aTextSize.Width(); if ( aSize.Height() < aTextSize.Height() ) aSize.Height() = aTextSize.Height(); diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index f83e46e38302..21707d0182f5 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -44,7 +44,7 @@ #include <vcl/subedit.hxx> #include <vcl/event.hxx> #include <vcl/combobox.hxx> -#include <vcl/controllayout.hxx> +#include <vcl/controldata.hxx> @@ -689,7 +689,7 @@ void ComboBox::Resize() void ComboBox::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); AppendLayoutData( *mpSubEdit ); mpSubEdit->SetLayoutDataParent( this ); Control* pMainWindow = mpImplLB->GetMainWindow(); @@ -1534,7 +1534,7 @@ void ComboBox::SetBorderStyle( USHORT nBorderStyle ) long ComboBox::GetIndexForPoint( const Point& rPoint, USHORT& rPos ) const { - if( ! mpLayoutData ) + if( !HasLayoutData() ) FillLayoutData(); // check whether rPoint fits at all diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index 55c979fbd69f..1800327df33c 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -39,10 +39,12 @@ #include <vcl/event.hxx> #include <vcl/ctrl.hxx> #include <vcl/decoview.hxx> -#include <vcl/controllayout.hxx> +#include <vcl/controldata.hxx> #include <vcl/salnativewidgets.hxx> +#include <vcl/textlayout.hxx> - +#include <comphelper/processfactory.hxx> +#include <tools/diagnose_ex.h> using namespace vcl; @@ -51,7 +53,7 @@ using namespace vcl; void Control::ImplInitControlData() { mbHasFocus = FALSE; - mpLayoutData = NULL; + mpControlData = new ImplControlData; } // ----------------------------------------------------------------------- @@ -90,7 +92,7 @@ Control::Control( Window* pParent, const ResId& rResId ) : Control::~Control() { - delete mpLayoutData, mpLayoutData = NULL; + delete mpControlData, mpControlData = NULL; } // ----------------------------------------------------------------------- @@ -111,7 +113,7 @@ void Control::LoseFocus() void Control::Resize() { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); Window::Resize(); } @@ -123,10 +125,31 @@ void Control::FillLayoutData() const // ----------------------------------------------------------------------- +void Control::CreateLayoutData() const +{ + DBG_ASSERT( !mpControlData->mpLayoutData, "Control::CreateLayoutData: should be called with non-existent layout data only!" ); + mpControlData->mpLayoutData = new ::vcl::ControlLayoutData(); +} + +// ----------------------------------------------------------------------- + +bool Control::HasLayoutData() const +{ + return mpControlData->mpLayoutData != NULL; +} + +// ----------------------------------------------------------------------- + +::vcl::ControlLayoutData* Control::GetLayoutData() const +{ + return mpControlData->mpLayoutData; +} + +// ----------------------------------------------------------------------- + void Control::SetText( const String& rStr ) { - delete mpLayoutData; - mpLayoutData = NULL; + ImplClearLayoutData(); Window::SetText( rStr ); } @@ -142,9 +165,9 @@ Rectangle ControlLayoutData::GetCharacterBounds( long nIndex ) const Rectangle Control::GetCharacterBounds( long nIndex ) const { - if( ! mpLayoutData ) + if( !HasLayoutData() ) FillLayoutData(); - return mpLayoutData ? mpLayoutData->GetCharacterBounds( nIndex ) : Rectangle(); + return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->GetCharacterBounds( nIndex ) : Rectangle(); } // ----------------------------------------------------------------------- @@ -167,9 +190,9 @@ long ControlLayoutData::GetIndexForPoint( const Point& rPoint ) const long Control::GetIndexForPoint( const Point& rPoint ) const { - if( ! mpLayoutData ) + if( ! HasLayoutData() ) FillLayoutData(); - return mpLayoutData ? mpLayoutData->GetIndexForPoint( rPoint ) : -1; + return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->GetIndexForPoint( rPoint ) : -1; } // ----------------------------------------------------------------------- @@ -186,9 +209,9 @@ long ControlLayoutData::GetLineCount() const long Control::GetLineCount() const { - if( ! mpLayoutData ) + if( !HasLayoutData() ) FillLayoutData(); - return mpLayoutData ? mpLayoutData->GetLineCount() : 0; + return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->GetLineCount() : 0; } // ----------------------------------------------------------------------- @@ -220,9 +243,9 @@ Pair ControlLayoutData::GetLineStartEnd( long nLine ) const Pair Control::GetLineStartEnd( long nLine ) const { - if( ! mpLayoutData ) + if( !HasLayoutData() ) FillLayoutData(); - return mpLayoutData ? mpLayoutData->GetLineStartEnd( nLine ) : Pair( -1, -1 ); + return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->GetLineStartEnd( nLine ) : Pair( -1, -1 ); } // ----------------------------------------------------------------------- @@ -263,18 +286,18 @@ long ControlLayoutData::ToRelativeLineIndex( long nIndex ) const long Control::ToRelativeLineIndex( long nIndex ) const { - if( ! mpLayoutData ) + if( !HasLayoutData() ) FillLayoutData(); - return mpLayoutData ? mpLayoutData->ToRelativeLineIndex( nIndex ) : -1; + return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->ToRelativeLineIndex( nIndex ) : -1; } // ----------------------------------------------------------------------- String Control::GetDisplayText() const { - if( ! mpLayoutData ) + if( !HasLayoutData() ) FillLayoutData(); - return mpLayoutData ? mpLayoutData->m_aDisplayText : GetText(); + return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->m_aDisplayText : GetText(); } // ----------------------------------------------------------------------- @@ -321,8 +344,7 @@ void Control::StateChanged( StateChangedType nStateChange ) nStateChange == STATE_CHANGE_CONTROLFONT ) { - delete mpLayoutData; - mpLayoutData = NULL; + ImplClearLayoutData(); } Window::StateChanged( nStateChange ); } @@ -331,25 +353,25 @@ void Control::StateChanged( StateChangedType nStateChange ) void Control::AppendLayoutData( const Control& rSubControl ) const { - if( ! rSubControl.mpLayoutData ) + if( !rSubControl.HasLayoutData() ) rSubControl.FillLayoutData(); - if( ! rSubControl.mpLayoutData || ! rSubControl.mpLayoutData->m_aDisplayText.Len() ) + if( !rSubControl.HasLayoutData() || !rSubControl.mpControlData->mpLayoutData->m_aDisplayText.Len() ) return; - long nCurrentIndex = mpLayoutData->m_aDisplayText.Len(); - mpLayoutData->m_aDisplayText.Append( rSubControl.mpLayoutData->m_aDisplayText ); - int nLines = rSubControl.mpLayoutData->m_aLineIndices.size(); + long nCurrentIndex = mpControlData->mpLayoutData->m_aDisplayText.Len(); + mpControlData->mpLayoutData->m_aDisplayText.Append( rSubControl.mpControlData->mpLayoutData->m_aDisplayText ); + int nLines = rSubControl.mpControlData->mpLayoutData->m_aLineIndices.size(); int n; - mpLayoutData->m_aLineIndices.push_back( nCurrentIndex ); + mpControlData->mpLayoutData->m_aLineIndices.push_back( nCurrentIndex ); for( n = 1; n < nLines; n++ ) - mpLayoutData->m_aLineIndices.push_back( rSubControl.mpLayoutData->m_aLineIndices[n] + nCurrentIndex ); - int nRectangles = rSubControl.mpLayoutData->m_aUnicodeBoundRects.size(); + mpControlData->mpLayoutData->m_aLineIndices.push_back( rSubControl.mpControlData->mpLayoutData->m_aLineIndices[n] + nCurrentIndex ); + int nRectangles = rSubControl.mpControlData->mpLayoutData->m_aUnicodeBoundRects.size(); Rectangle aRel = const_cast<Control&>(rSubControl).GetWindowExtentsRelative( const_cast<Control*>(this) ); for( n = 0; n < nRectangles; n++ ) { - Rectangle aRect = rSubControl.mpLayoutData->m_aUnicodeBoundRects[n]; + Rectangle aRect = rSubControl.mpControlData->mpLayoutData->m_aUnicodeBoundRects[n]; aRect.Move( aRel.Left(), aRel.Top() ); - mpLayoutData->m_aUnicodeBoundRects.push_back( aRect ); + mpControlData->mpLayoutData->m_aUnicodeBoundRects.push_back( aRect ); } } @@ -378,15 +400,15 @@ BOOL Control::ImplCallEventListenersAndHandler( ULONG nEvent, const Link& rHand void Control::SetLayoutDataParent( const Control* pParent ) const { - if( mpLayoutData ) - mpLayoutData->m_pParent = pParent; + if( HasLayoutData() ) + mpControlData->mpLayoutData->m_pParent = pParent; } // ----------------------------------------------------------------- void Control::ImplClearLayoutData() const { - delete mpLayoutData, mpLayoutData = NULL; + delete mpControlData->mpLayoutData, mpControlData->mpLayoutData = NULL; } // ----------------------------------------------------------------------- @@ -467,3 +489,102 @@ Size Control::GetOptimalSize(WindowSizeType eType) const return Size( LONG_MAX, LONG_MAX ); } } + +// ----------------------------------------------------------------- + +void Control::SetReferenceDevice( OutputDevice* _referenceDevice ) +{ + if ( mpControlData->mpReferenceDevice == _referenceDevice ) + return; + + mpControlData->mpReferenceDevice = _referenceDevice; + Invalidate(); +} + +// ----------------------------------------------------------------- + +OutputDevice* Control::GetReferenceDevice() const +{ + return mpControlData->mpReferenceDevice; +} + +// ----------------------------------------------------------------- + +const Font& Control::GetCanonicalFont( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetLabelFont(); +} + +// ----------------------------------------------------------------- +const Color& Control::GetCanonicalTextColor( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetLabelTextColor(); +} + +// ----------------------------------------------------------------- +void Control::ImplInitSettings( const BOOL _bFont, const BOOL _bForeground ) +{ + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + + if ( _bFont ) + { + Font aFont( GetCanonicalFont( rStyleSettings ) ); + if ( IsControlFont() ) + aFont.Merge( GetControlFont() ); + SetZoomedPointFont( aFont ); + } + + if ( _bForeground || _bFont ) + { + Color aColor; + if ( IsControlForeground() ) + aColor = GetControlForeground(); + else + aColor = GetCanonicalTextColor( rStyleSettings ); + SetTextColor( aColor ); + SetTextFillColor(); + } +} + +// ----------------------------------------------------------------- + +void Control::DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRect, const XubString& _rStr, + USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText ) const +{ +#ifdef FS_DEBUG + if ( !_pVector ) + { + static MetricVector aCharRects; + static String sDisplayText; + aCharRects.clear(); + sDisplayText = String(); + _pVector = &aCharRects; + _pDisplayText = &sDisplayText; + } +#endif + + if ( !mpControlData->mpReferenceDevice || ( mpControlData->mpReferenceDevice == &_rTargetDevice ) ) + { + _io_rRect = _rTargetDevice.GetTextRect( _io_rRect, _rStr, _nStyle ); + _rTargetDevice.DrawText( _io_rRect, _rStr, _nStyle, _pVector, _pDisplayText ); + } + else + { + ControlTextRenderer aRenderer( *this, _rTargetDevice, *mpControlData->mpReferenceDevice ); + _io_rRect = aRenderer.DrawText( _io_rRect, _rStr, _nStyle, _pVector, _pDisplayText ); + } + +#ifdef FS_DEBUG + _rTargetDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); + _rTargetDevice.SetLineColor( COL_LIGHTRED ); + _rTargetDevice.SetFillColor(); + for ( MetricVector::const_iterator cr = _pVector->begin(); + cr != _pVector->end(); + ++cr + ) + { + _rTargetDevice.DrawRect( *cr ); + } + _rTargetDevice.Pop(); +#endif +} diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 5f41a441c6a1..b654e034470f 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -47,7 +47,7 @@ #include <vcl/subedit.hxx> #include <vcl/edit.hxx> #include <vcl/svapp.hxx> -#include <vcl/controllayout.hxx> +#include <vcl/controldata.hxx> #include <vcl/msgbox.hxx> #include <vcl/window.h> @@ -409,7 +409,7 @@ void Edit::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) if ( IsControlFont() ) aFont.Merge( GetControlFont() ); SetZoomedPointFont( aFont ); - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); } if ( bFont || bForeground ) @@ -526,8 +526,8 @@ void Edit::ImplRepaint( xub_StrLen nStart, xub_StrLen nEnd, bool bLayout ) long nPos = nStart ? pDX[2*nStart] : 0; aPos.X() = nPos + mnXOffset + ImplGetExtraOffset(); - MetricVector* pVector = &mpLayoutData->m_aUnicodeBoundRects; - String* pDisplayText = &mpLayoutData->m_aDisplayText; + MetricVector* pVector = &mpControlData->mpLayoutData->m_aUnicodeBoundRects; + String* pDisplayText = &mpControlData->mpLayoutData->m_aDisplayText; DrawText( aPos, aText, nStart, nEnd - nStart, pVector, pDisplayText ); @@ -722,7 +722,7 @@ void Edit::ImplDelete( const Selection& rSelection, BYTE nDirection, BYTE nMode ((rSelection.Max() == aText.Len()) && (nDirection == EDIT_DEL_RIGHT))) ) return; - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); Selection aSelection( rSelection ); aSelection.Justify(); @@ -864,7 +864,7 @@ void Edit::ImplInsertText( const XubString& rStr, const Selection* pNewSel, sal_ rtl::OUString aNewText( ImplGetValidString( rStr ) ); ImplTruncateToMaxLen( aNewText, aSelection.Len() ); - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); if ( aSelection.Len() ) maText.Erase( (xub_StrLen)aSelection.Min(), (xub_StrLen)aSelection.Len() ); @@ -1006,7 +1006,7 @@ void Edit::ImplSetText( const XubString& rText, const Selection* pNewSelection ) // wird, dann InsertText, damit flackerfrei. if ( ( rText.Len() <= mnMaxTextLen ) && ( (rText != maText) || (pNewSelection && (*pNewSelection != maSelection)) ) ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); maSelection.Min() = 0; maSelection.Max() = maText.Len(); if ( mnXOffset || HasPaintEvent() ) @@ -1637,7 +1637,7 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) { if ( !rKEvt.GetKeyCode().IsMod2() ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); uno::Reference < i18n::XBreakIterator > xBI = ImplGetBreakIterator(); Selection aSel( maSelection ); @@ -1858,7 +1858,7 @@ void Edit::KeyInput( const KeyEvent& rKEvt ) void Edit::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast<Edit*>(this)->ImplRepaint( 0, STRING_LEN, true ); } @@ -2648,7 +2648,7 @@ void Edit::ImplSetSelection( const Selection& rSelection, BOOL bPaint ) if ( aNew != maSelection ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); maSelection = aNew; if ( bPaint && ( aOld.Len() || aNew.Len() || IsPaintTransparent() ) ) diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index b417774142d3..a7729f4ace24 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -55,6 +55,7 @@ #include <unotools/localedatawrapper.hxx> #include <unotools/calendarwrapper.hxx> #include <unotools/charclass.hxx> +#include <unotools/misccfg.hxx> using namespace ::com::sun::star; @@ -1214,7 +1215,7 @@ static BOOL ImplDateProcessKeyInput( Edit*, const KeyEvent& rKEvt, ExtDateFieldF static BOOL ImplDateGetValue( const XubString& rStr, Date& rDate, ExtDateFieldFormat eDateFormat, const LocaleDataWrapper& rLocaleDataWrapper, const CalendarWrapper& rCalendarWrapper, - const AllSettings& rSettings ) + const AllSettings& ) { USHORT nDay = 0; USHORT nMonth = 0; @@ -1312,7 +1313,7 @@ static BOOL ImplDateGetValue( const XubString& rStr, Date& rDate, ExtDateFieldFo return FALSE; Date aNewDate( nDay, nMonth, nYear ); - DateFormatter::ExpandCentury( aNewDate, rSettings.GetMiscSettings().GetTwoDigitYearStart() ); + DateFormatter::ExpandCentury( aNewDate, utl::MiscCfg().GetYear2000() ); if ( aNewDate.IsValid() ) { rDate = aNewDate; @@ -1355,7 +1356,7 @@ BOOL DateFormatter::ImplDateReformat( const XubString& rStr, XubString& rOutStr, // ----------------------------------------------------------------------- XubString DateFormatter::ImplGetDateAsText( const Date& rDate, - const AllSettings& rSettings ) const + const AllSettings& ) const { BOOL bShowCentury = FALSE; switch ( GetExtDateFormat() ) @@ -1379,7 +1380,7 @@ XubString DateFormatter::ImplGetDateAsText( const Date& rDate, if ( !bShowCentury ) { // Check if I have to use force showing the century - USHORT nTwoDigitYearStart = rSettings.GetMiscSettings().GetTwoDigitYearStart(); + USHORT nTwoDigitYearStart = utl::MiscCfg().GetYear2000(); USHORT nYear = rDate.GetYear(); // Wenn Jahr nicht im 2stelligen Grenzbereich liegt, @@ -2033,7 +2034,7 @@ void DateFormatter::Reformat() void DateFormatter::ExpandCentury( Date& rDate ) { - ExpandCentury( rDate, Application::GetSettings().GetMiscSettings().GetTwoDigitYearStart() ); + ExpandCentury( rDate, utl::MiscCfg().GetYear2000() ); } // ----------------------------------------------------------------------- diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index ecb066d107ce..3d19e288a1ce 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -33,7 +33,7 @@ #include <vcl/decoview.hxx> #include <vcl/event.hxx> #include <vcl/fixed.hxx> -#include <vcl/controllayout.hxx> +#include <vcl/controldata.hxx> #include <vcl/window.h> #include <tools/rc.h> @@ -109,40 +109,25 @@ WinBits FixedText::ImplInitStyle( WinBits nStyle ) return nStyle; } +// ----------------------------------------------------------------- + +const Font& FixedText::GetCanonicalFont( const StyleSettings& _rStyle ) const +{ + return ( GetStyle() & WB_INFO ) ? _rStyle.GetInfoFont() : _rStyle.GetLabelFont(); +} + +// ----------------------------------------------------------------- +const Color& FixedText::GetCanonicalTextColor( const StyleSettings& _rStyle ) const +{ + return ( GetStyle() & WB_INFO ) ? _rStyle.GetInfoTextColor() : _rStyle.GetLabelTextColor(); +} + // ----------------------------------------------------------------------- void FixedText::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if ( bFont ) - { - Font aFont; - if ( GetStyle() & WB_INFO ) - aFont = rStyleSettings.GetInfoFont(); - else - aFont = rStyleSettings.GetLabelFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); - } - - if ( bForeground || bFont ) - { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - { - if ( GetStyle() & WB_INFO ) - aColor = rStyleSettings.GetInfoTextColor(); - else - aColor = rStyleSettings.GetLabelTextColor(); - } - SetTextColor( aColor ); - SetTextFillColor(); - } + Control::ImplInitSettings( bFont, bForeground ); if ( bBackground ) { @@ -278,17 +263,13 @@ void FixedText::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, nTextStyle |= TEXT_DRAW_MONO; if( bFillLayout ) - { - mpLayoutData->m_aDisplayText = String(); - pDev->DrawText( Rectangle( aPos, rSize ), - aText, - nTextStyle, - &mpLayoutData->m_aUnicodeBoundRects, - &mpLayoutData->m_aDisplayText - ); - } - else - pDev->DrawText( Rectangle( aPos, rSize ), aText, nTextStyle ); + mpControlData->mpLayoutData->m_aDisplayText = String(); + + Rectangle aRect( Rectangle( aPos, rSize ) ); + DrawControlText( *pDev, aRect, aText, nTextStyle, + bFillLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL, + bFillLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL + ); } // ----------------------------------------------------------------------- @@ -446,7 +427,7 @@ Size FixedText::GetOptimalSize(WindowSizeType eType) const void FixedText::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); ImplDraw( const_cast<FixedText*>(this), 0, Point(), GetOutputSizePixel(), true ); } @@ -468,31 +449,25 @@ WinBits FixedLine::ImplInitStyle( WinBits nStyle ) return nStyle; } +// ----------------------------------------------------------------- + +const Font& FixedLine::GetCanonicalFont( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetGroupFont(); +} + +// ----------------------------------------------------------------- +const Color& FixedLine::GetCanonicalTextColor( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetGroupTextColor(); +} + // ----------------------------------------------------------------------- void FixedLine::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if ( bFont ) - { - Font aFont = rStyleSettings.GetGroupFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); - } - - if ( bForeground || bFont ) - { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetGroupTextColor(); - SetTextColor( aColor ); - SetTextFillColor(); - } + Control::ImplInitSettings( bFont, bForeground ); if ( bBackground ) { @@ -526,8 +501,8 @@ void FixedLine::ImplDraw( bool bLayout ) String aText = GetText(); const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); WinBits nWinStyle = GetStyle(); - MetricVector* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL; - String* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL; + MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; + String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO ) SetLineColor( Color( COL_BLACK ) ); @@ -574,8 +549,7 @@ void FixedLine::ImplDraw( bool bLayout ) if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO ) nStyle |= TEXT_DRAW_MONO; - aRect = GetTextRect( aRect, aText, nStyle ); - DrawText( aRect, aText, nStyle, pVector, pDisplayText ); + DrawControlText( *this, aRect, aText, nStyle, pVector, pDisplayText ); if( !pVector ) { @@ -617,7 +591,7 @@ FixedLine::FixedLine( Window* pParent, const ResId& rResId ) : void FixedLine::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast<FixedLine*>(this)->ImplDraw( true ); } diff --git a/vcl/source/control/group.cxx b/vcl/source/control/group.cxx index a844c2f2eb93..4adc91f88d84 100644 --- a/vcl/source/control/group.cxx +++ b/vcl/source/control/group.cxx @@ -32,7 +32,7 @@ #include "precompiled_vcl.hxx" #include <vcl/event.hxx> #include <vcl/group.hxx> -#include <vcl/controllayout.hxx> +#include <vcl/controldata.hxx> #ifndef _SV_RC_H #include <tools/rc.h> @@ -66,31 +66,25 @@ WinBits GroupBox::ImplInitStyle( WinBits nStyle ) return nStyle; } +// ----------------------------------------------------------------- + +const Font& GroupBox::GetCanonicalFont( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetGroupFont(); +} + +// ----------------------------------------------------------------- +const Color& GroupBox::GetCanonicalTextColor( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetGroupTextColor(); +} + // ----------------------------------------------------------------------- void GroupBox::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if ( bFont ) - { - Font aFont = rStyleSettings.GetGroupFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); - } - - if ( bForeground || bFont ) - { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetGroupTextColor(); - SetTextColor( aColor ); - SetTextFillColor(); - } + Control::ImplInitSettings( bFont, bForeground ); if ( bBackground ) { @@ -227,16 +221,16 @@ void GroupBox::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, } } - MetricVector* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL; - String* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL; - pDev->DrawText( aRect, aText, nTextStyle, pVector, pDisplayText ); + MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; + String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; + DrawControlText( *pDev, aRect, aText, nTextStyle, pVector, pDisplayText ); } // ----------------------------------------------------------------------- void GroupBox::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast<GroupBox*>(this)-> ImplDraw( const_cast<GroupBox*>(this), 0, Point(), GetOutputSizePixel(), true ); } diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index c0a28c8b03fd..a915d8e6b9e8 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -40,7 +40,7 @@ #include <vcl/lstbox.h> #include <vcl/ilstbox.hxx> #include <vcl/i18nhelp.hxx> -#include <vcl/controllayout.hxx> +#include <vcl/controldata.hxx> #include <vcl/unohelp.hxx> #ifndef _COM_SUN_STAR_UTIL_XCOLLATOR_HPP_ #include <com/sun/star/i18n/XCollator.hpp> @@ -647,7 +647,7 @@ void ImplListBoxWindow::Clear() mnTop = 0; mnLeft = 0; mbImgsDiffSz = FALSE; - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; @@ -656,7 +656,7 @@ void ImplListBoxWindow::Clear() void ImplListBoxWindow::SetUserItemSize( const Size& rSz ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); maUserItemSize = rSz; ImplCalcMetrics(); } @@ -778,7 +778,7 @@ void ImplListBoxWindow::ImplCallSelect() nMRUCount--; } - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); ImplEntryType* pNewEntry = new ImplEntryType( aSelected ); pNewEntry->mbIsSelected = bSelectNewEntry; @@ -798,7 +798,7 @@ void ImplListBoxWindow::ImplCallSelect() USHORT ImplListBoxWindow::InsertEntry( USHORT nPos, ImplEntryType* pNewEntry ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); USHORT nNewPos = mpEntryList->InsertEntry( nPos, pNewEntry, mbSort ); if( (GetStyle() & WB_WORDBREAK) ) @@ -812,7 +812,7 @@ USHORT ImplListBoxWindow::InsertEntry( USHORT nPos, ImplEntryType* pNewEntry ) void ImplListBoxWindow::RemoveEntry( USHORT nPos ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); mpEntryList->RemoveEntry( nPos ); if( mnCurrentPos >= mpEntryList->GetEntryCount() ) mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; @@ -1062,7 +1062,7 @@ void ImplListBoxWindow::SelectEntry( USHORT nPos, BOOL bSelect ) ImplPaint( nPos ); if ( !IsVisible( nPos ) ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); USHORT nVisibleEntries = GetLastVisibleEntry()-mnTop; if ( !nVisibleEntries || !IsReallyVisible() || ( nPos < GetTopEntry() ) ) { @@ -1233,7 +1233,7 @@ BOOL ImplListBoxWindow::SelectEntries( USHORT nSelect, LB_EVENT_TYPE eLET, BOOL if( HasFocus() ) ImplShowFocusRect(); } - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); } return bSelectionChanged; } @@ -1838,8 +1838,8 @@ void ImplListBoxWindow::DrawEntry( USHORT nPos, BOOL bDrawImage, BOOL bDrawText, if( bDrawText ) { - MetricVector* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL; - String* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL; + MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; + String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; XubString aStr( mpEntryList->GetEntryText( nPos ) ); if ( aStr.Len() ) { @@ -1859,7 +1859,7 @@ void ImplListBoxWindow::DrawEntry( USHORT nPos, BOOL bDrawImage, BOOL bDrawText, } if( bLayout ) - mpLayoutData->m_aLineIndices.push_back( mpLayoutData->m_aDisplayText.Len() ); + mpControlData->mpLayoutData->m_aLineIndices.push_back( mpControlData->mpLayoutData->m_aDisplayText.Len() ); // pb: #106948# explicit mirroring for calc if ( mbMirroring ) @@ -1900,7 +1900,7 @@ void ImplListBoxWindow::DrawEntry( USHORT nPos, BOOL bDrawImage, BOOL bDrawText, void ImplListBoxWindow::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast<ImplListBoxWindow*>(this)-> ImplDoPaint( Rectangle( Point( 0, 0 ), GetOutputSize() ), true ); } @@ -1978,7 +1978,7 @@ void ImplListBoxWindow::Resize() if ( bShowFocusRect ) ImplShowFocusRect(); - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); } // ----------------------------------------------------------------------- @@ -2034,7 +2034,7 @@ void ImplListBoxWindow::SetTopEntry( USHORT nTop ) if ( nTop != mnTop ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); long nDiff = mpEntryList->GetAddedHeight( mnTop, nTop, 0 ); Update(); ImplHideFocusRect(); @@ -2078,7 +2078,7 @@ void ImplListBoxWindow::ScrollHorz( long n ) if ( nDiff ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); mnLeft = sal::static_int_cast<USHORT>(mnLeft + nDiff); Update(); ImplHideFocusRect(); @@ -2148,7 +2148,7 @@ void ImplListBoxWindow::StateChanged( StateChangedType nType ) ImplInitSettings( FALSE, FALSE, TRUE ); Invalidate(); } - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); } // ----------------------------------------------------------------------- @@ -2162,7 +2162,7 @@ void ImplListBoxWindow::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); ImplInitSettings( TRUE, TRUE, TRUE ); ImplCalcMetrics(); Invalidate(); @@ -2743,7 +2743,7 @@ void ImplWin::MouseButtonDown( const MouseEvent& ) void ImplWin::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast<ImplWin*>(this)->ImplDraw( true ); } @@ -2936,8 +2936,8 @@ void ImplWin::DrawEntry( BOOL bDrawImage, BOOL bDrawText, BOOL bDrawTextAtImageP aTextRect.Left() += nMaxWidth + IMG_TXT_DISTANCE; } - MetricVector* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL; - String* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL; + MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; + String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; DrawText( aTextRect, maString, nTextStyle, pVector, pDisplayText ); } diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx index a4d3cbc22544..ceabbe4ab166 100644 --- a/vcl/source/control/lstbox.cxx +++ b/vcl/source/control/lstbox.cxx @@ -43,7 +43,7 @@ #include "vcl/ilstbox.hxx" #include "vcl/lstbox.hxx" #include "vcl/combobox.hxx" -#include "vcl/controllayout.hxx" +#include "vcl/controldata.hxx" #include "tools/debug.hxx" @@ -719,7 +719,7 @@ void ListBox::Resize() void ListBox::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const Control* pMainWin = mpImplLB->GetMainWindow(); if( mpFloatWin ) { @@ -743,7 +743,7 @@ void ListBox::FillLayoutData() const long ListBox::GetIndexForPoint( const Point& rPoint, USHORT& rPos ) const { - if( ! mpLayoutData ) + if( !HasLayoutData() ) FillLayoutData(); // check whether rPoint fits at all diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index 0d656da40ba7..1cdaa39298df 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -36,7 +36,7 @@ #include "vcl/decoview.hxx" #include "vcl/spin.h" #include "vcl/spinfld.hxx" -#include "vcl/controllayout.hxx" +#include "vcl/controldata.hxx" #include "vcl/svdata.hxx" // ======================================================================= @@ -637,7 +637,7 @@ void SpinField::FillLayoutData() const { if( mbSpin ) { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); AppendLayoutData( *GetSubEdit() ); GetSubEdit()->SetLayoutDataParent( this ); } diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 561d550b1168..9a34629ddf8e 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -45,7 +45,7 @@ #include <vcl/button.hxx> #include <vcl/tabpage.hxx> #include <vcl/tabctrl.hxx> -#include <vcl/controllayout.hxx> +#include <vcl/controldata.hxx> #include <vcl/sound.hxx> #include <vcl/window.h> @@ -169,31 +169,25 @@ void TabControl::ImplInit( Window* pParent, WinBits nStyle ) EnableChildTransparentMode( TRUE ); } +// ----------------------------------------------------------------- + +const Font& TabControl::GetCanonicalFont( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetAppFont(); +} + +// ----------------------------------------------------------------- +const Color& TabControl::GetCanonicalTextColor( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetButtonTextColor(); +} + // ----------------------------------------------------------------------- void TabControl::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if ( bFont ) - { - Font aFont = rStyleSettings.GetAppFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); - } - - if ( bForeground || bFont ) - { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetButtonTextColor(); - SetTextColor( aColor ); - SetTextFillColor(); - } + Control::ImplInitSettings( bFont, bForeground ); if ( bBackground ) { @@ -232,9 +226,9 @@ void TabControl::ImplInitSettings( BOOL bFont, void TabControl::ImplFreeLayoutData() { - if( mpLayoutData ) + if( HasLayoutData() ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); mpTabCtrlData->maLayoutPageIdToLine.clear(); mpTabCtrlData->maLayoutLineToPageId.clear(); } @@ -864,9 +858,9 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bo if( bLayout ) { - if( ! mpLayoutData ) + if( !HasLayoutData() ) { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); mpTabCtrlData->maLayoutLineToPageId.clear(); mpTabCtrlData->maLayoutPageIdToLine.clear(); mpTabCtrlData->maTabRectangles.clear(); @@ -1010,8 +1004,8 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bo if( bLayout ) { - int nLine = mpLayoutData->m_aLineIndices.size(); - mpLayoutData->m_aLineIndices.push_back( mpLayoutData->m_aDisplayText.Len() ); + int nLine = mpControlData->mpLayoutData->m_aLineIndices.size(); + mpControlData->mpLayoutData->m_aLineIndices.push_back( mpControlData->mpLayoutData->m_aDisplayText.Len() ); mpTabCtrlData->maLayoutPageIdToLine[ (int)pItem->mnId ] = nLine; mpTabCtrlData->maLayoutLineToPageId[ nLine ] = (int)pItem->mnId; mpTabCtrlData->maTabRectangles.push_back( aRect ); @@ -1044,8 +1038,8 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bo DrawCtrlText( Point( nXPos + aImageSize.Width(), nYPos ), pItem->maFormatText, 0, STRING_LEN, nStyle, - bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL, - bLayout ? &mpLayoutData->m_aDisplayText : NULL + bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL, + bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL ); } @@ -2108,17 +2102,17 @@ Rectangle TabControl::GetCharacterBounds( USHORT nPageId, long nIndex ) const { Rectangle aRet; - if( ! mpLayoutData || ! mpTabCtrlData->maLayoutPageIdToLine.size() ) + if( !HasLayoutData() || ! mpTabCtrlData->maLayoutPageIdToLine.size() ) FillLayoutData(); - if( mpLayoutData ) + if( HasLayoutData() ) { std::hash_map< int, int >::const_iterator it = mpTabCtrlData->maLayoutPageIdToLine.find( (int)nPageId ); if( it != mpTabCtrlData->maLayoutPageIdToLine.end() ) { - Pair aPair = mpLayoutData->GetLineStartEnd( it->second ); + Pair aPair = mpControlData->mpLayoutData->GetLineStartEnd( it->second ); if( (aPair.B() - aPair.A()) >= nIndex ) - aRet = mpLayoutData->GetCharacterBounds( aPair.A() + nIndex ); + aRet = mpControlData->mpLayoutData->GetCharacterBounds( aPair.A() + nIndex ); } } @@ -2131,20 +2125,20 @@ long TabControl::GetIndexForPoint( const Point& rPoint, USHORT& rPageId ) const { long nRet = -1; - if( ! mpLayoutData || ! mpTabCtrlData->maLayoutPageIdToLine.size() ) + if( !HasLayoutData() || ! mpTabCtrlData->maLayoutPageIdToLine.size() ) FillLayoutData(); - if( mpLayoutData ) + if( HasLayoutData() ) { - int nIndex = mpLayoutData->GetIndexForPoint( rPoint ); + int nIndex = mpControlData->mpLayoutData->GetIndexForPoint( rPoint ); if( nIndex != -1 ) { // what line (->pageid) is this index in ? - int nLines = mpLayoutData->GetLineCount(); + int nLines = mpControlData->mpLayoutData->GetLineCount(); int nLine = -1; while( ++nLine < nLines ) { - Pair aPair = mpLayoutData->GetLineStartEnd( nLine ); + Pair aPair = mpControlData->mpLayoutData->GetLineStartEnd( nLine ); if( aPair.A() <= nIndex && aPair.B() >= nIndex ) { nRet = nIndex - aPair.A(); @@ -2173,10 +2167,10 @@ Rectangle TabControl::GetTabPageBounds( USHORT nPage ) const { Rectangle aRet; - if( ! mpLayoutData || ! mpTabCtrlData->maLayoutPageIdToLine.size() ) + if( !HasLayoutData() || ! mpTabCtrlData->maLayoutPageIdToLine.size() ) FillLayoutData(); - if( mpLayoutData ) + if( HasLayoutData() ) { std::hash_map< int, int >::const_iterator it = mpTabCtrlData->maLayoutPageIdToLine.find( (int)nPage ); if( it != mpTabCtrlData->maLayoutPageIdToLine.end() ) diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx index e5d83dc0733a..dd198ff521db 100644 --- a/vcl/source/fontsubset/cff.cxx +++ b/vcl/source/fontsubset/cff.cxx @@ -332,12 +332,13 @@ struct CffLocal int mnLocalSubrBase; int mnLocalSubrCount; int mnLocalSubrBias; - int mnNominalWidth; - int mnDefaultWidth; + + ValType maNominalWidth; + ValType maDefaultWidth; // ATM hinting related values - int mnStemStdHW; - int mnStemStdVW; + ValType maStemStdHW; + ValType maStemStdVW; ValVector maStemSnapH; ValVector maStemSnapV; ValVector maBlueValues; @@ -461,10 +462,10 @@ public: // TODO: is public really needed? void getHintPair( int nIndex, ValType* nMin, ValType* nEnd) const; // accessing other charstring specifics - bool hasCharWidth( void) const { return (mnCharWidth != -1);} - int getCharWidth( void) const { return mnCharWidth;} - void setNominalWidth( int nWidth) { mpCffLocal->mnNominalWidth = nWidth;} - void setDefaultWidth( int nWidth) { mpCffLocal->mnDefaultWidth = nWidth;} + bool hasCharWidth( void) const { return (maCharWidth > 0);} + ValType getCharWidth( void) const { return maCharWidth;} + void setNominalWidth( ValType aWidth) { mpCffLocal->maNominalWidth = aWidth;} + void setDefaultWidth( ValType aWidth) { mpCffLocal->maDefaultWidth = aWidth;} void updateWidth( bool bUseFirstVal); private: @@ -477,7 +478,7 @@ private: int mnHorzHintSize; ValType mnHintStack[ NMAXHINTS]; - int mnCharWidth; + ValType maCharWidth; }; // -------------------------------------------------------------------- @@ -488,7 +489,7 @@ CffSubsetterContext::CffSubsetterContext( const U8* pBasePtr, int nBaseLen) , mnStackIdx(0) , mnHintSize(0) , mnHorzHintSize(0) -, mnCharWidth(-1) +, maCharWidth(-1) { // setCharStringType( 1); // TODO: new CffLocal[ mnFDAryCount]; @@ -542,13 +543,13 @@ inline void CffSubsetterContext::updateWidth( bool bUseFirstVal) return; #endif if( bUseFirstVal) { - mnCharWidth = static_cast<int>(mpCffLocal->mnNominalWidth + mnValStack[0]); + maCharWidth = mpCffLocal->maNominalWidth + mnValStack[0]; // remove bottom stack entry --mnStackIdx; for( int i = 0; i < mnStackIdx; ++i) mnValStack[ i] = mnValStack[ i+1]; } else { - mnCharWidth = mpCffLocal->mnDefaultWidth; + maCharWidth = mpCffLocal->maDefaultWidth; } } @@ -615,7 +616,7 @@ void CffSubsetterContext::readCharString( const U8* pTypeOps, int nTypeLen) mnStackIdx = 0; mnHintSize = 0; mnHorzHintSize = 0; - mnCharWidth = -1; + maCharWidth = -1; assert( nTypeLen >= 0); // assert( nEnd <= getLength()); @@ -659,14 +660,14 @@ void CffSubsetterContext::readDictOp( void) nVal = popVal(); nInt = static_cast<int>(nVal); switch( nOpId) { - case 10: mpCffLocal->mnStemStdHW = nInt; break; // "StdHW" - case 11: mpCffLocal->mnStemStdVW = nInt; break; // "StdVW" + case 10: mpCffLocal->maStemStdHW = nVal; break; // "StdHW" + case 11: mpCffLocal->maStemStdVW = nVal; break; // "StdVW" case 15: mnCharsetBase = nInt; break; // "charset" case 16: mnEncodingBase = nInt; break; // "nEncoding" case 17: mnCharStrBase = nInt; break; // "nCharStrings" case 19: mpCffLocal->mnLocalSubrOffs = nInt; break;// "nSubrs" - case 20: setDefaultWidth( nInt ); break; // "defaultWidthX" - case 21: setNominalWidth( nInt ); break; // "nominalWidthX" + case 20: setDefaultWidth( nVal ); break; // "defaultWidthX" + case 21: setNominalWidth( nVal ); break; // "nominalWidthX" case 909: mpCffLocal->mfBlueScale = nVal; break; // "BlueScale" case 910: mpCffLocal->mfBlueShift = nVal; break; // "BlueShift" case 911: mpCffLocal->mfBlueFuzz = nVal; break; // "BlueFuzz" @@ -1477,7 +1478,7 @@ int CffSubsetterContext::convert2Type1Ops( CffLocal* pCffLocal, const U8* const mbSawError = false; mbNeedClose = false; mbIgnoreHints = false; -mnHintSize=mnHorzHintSize=mnStackIdx=0; mnCharWidth=-1;//####### +mnHintSize=mnHorzHintSize=mnStackIdx=0; maCharWidth=-1;//####### mnCntrMask = 0; while( mpReadPtr < mpReadEnd) convertOneTypeOp(); @@ -1673,10 +1674,10 @@ CffLocal::CffLocal( void) , mnLocalSubrBase( 0) , mnLocalSubrCount( 0) , mnLocalSubrBias( 0) -, mnNominalWidth( 0) -, mnDefaultWidth( 0) -, mnStemStdHW( 0) -, mnStemStdVW( 0) +, maNominalWidth( 0) +, maDefaultWidth( 0) +, maStemStdHW( 0) +, maStemStdVW( 0) , mfBlueScale( 0.0) , mfBlueShift( 0.0) , mfBlueFuzz( 0.0) @@ -2296,8 +2297,8 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, nPrivEntryCount += (mpCffLocal->mfBlueShift != 0.0); nPrivEntryCount += (mpCffLocal->mfBlueFuzz != 0.0); // emit stem hints only if non-default values - nPrivEntryCount += (mpCffLocal->mnStemStdHW != 0); - nPrivEntryCount += (mpCffLocal->mnStemStdVW != 0); + nPrivEntryCount += (mpCffLocal->maStemStdHW != 0); + nPrivEntryCount += (mpCffLocal->maStemStdVW != 0); nPrivEntryCount += !mpCffLocal->maStemSnapH.empty(); nPrivEntryCount += !mpCffLocal->maStemSnapV.empty(); // emit other hints only if non-default values @@ -2337,10 +2338,10 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, pOut += sprintf( pOut, "/BlueFuzz %.1f def\n", mpCffLocal->mfBlueFuzz); // emit stem hint related privdict entries - if( mpCffLocal->mnStemStdHW) - pOut += sprintf( pOut, "/StdHW [%d] def\n", mpCffLocal->mnStemStdHW); - if( mpCffLocal->mnStemStdVW) - pOut += sprintf( pOut, "/StdVW [%d] def\n", mpCffLocal->mnStemStdVW); + if( mpCffLocal->maStemStdHW) + pOut += sprintf( pOut, "/StdHW [%g] def\n", mpCffLocal->maStemStdHW); + if( mpCffLocal->maStemStdVW) + pOut += sprintf( pOut, "/StdVW [%g] def\n", mpCffLocal->maStemStdVW); rEmitter.emitValVector( "/StemSnapH [", "]ND\n", mpCffLocal->maStemSnapH); rEmitter.emitValVector( "/StemSnapV [", "]ND\n", mpCffLocal->maStemSnapV); @@ -2413,8 +2414,12 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, pOut += sprintf( pOut, " ND\n"); rEmitter.emitAllCrypted(); // provide individual glyphwidths if requested - if( pGlyphWidths ) - pGlyphWidths[i] = getCharWidth(); + if( pGlyphWidths ) { + ValType aCharWidth = getCharWidth(); + if( maFontMatrix.size() >= 4) + aCharWidth *= 1000.0F * maFontMatrix[0]; + pGlyphWidths[i] = static_cast<GlyphWidth>(aCharWidth); + } } pOut += sprintf( pOut, "end end\nreadonly put\nput\n"); pOut += sprintf( pOut, "dup/FontName get exch definefont pop\n"); @@ -2446,8 +2451,17 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, // provide details to the subset requesters, TODO: move into own method? // note: Top and Bottom are flipped between Type1 and VCL - rFSInfo.m_aFontBBox = Rectangle( Point( static_cast<long>(maFontBBox[0]), static_cast<long>(maFontBBox[1]) ), - Point( static_cast<long>(maFontBBox[2]), static_cast<long>(maFontBBox[3]) ) ); + // note: the rest of VCL expects the details below to be scaled like for an emUnits==1000 font + ValType fXFactor = 1.0; + ValType fYFactor = 1.0; + if( maFontMatrix.size() >= 4) { + fXFactor = 1000.0F * maFontMatrix[0]; + fYFactor = 1000.0F * maFontMatrix[3]; + } + rFSInfo.m_aFontBBox = Rectangle( Point( static_cast<long>(maFontBBox[0] * fXFactor), + static_cast<long>(maFontBBox[1] * fYFactor) ), + Point( static_cast<long>(maFontBBox[2] * fXFactor), + static_cast<long>(maFontBBox[3] * fYFactor) ) ); // PDF-Spec says the values below mean the ink bounds! // TODO: use better approximations for these ink bounds rFSInfo.m_nAscent = +rFSInfo.m_aFontBBox.Bottom(); // for capital letters diff --git a/vcl/source/fontsubset/gsub.cxx b/vcl/source/fontsubset/gsub.cxx index 9715e7fc8585..600c03194210 100644 --- a/vcl/source/fontsubset/gsub.cxx +++ b/vcl/source/fontsubset/gsub.cxx @@ -32,6 +32,8 @@ #include "gsub.h" +#include <osl/diagnose.h> + #include <vector> #include <map> #include <algorithm> @@ -280,9 +282,11 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, { const USHORT nGlyph0 = NEXT_UShort( pCoverage ); const USHORT nGlyph1 = NEXT_UShort( pCoverage ); - const USHORT nCovIdx = NEXT_UShort( pCoverage ); + const USHORT nStartCoverageIndex = NEXT_UShort( pCoverage ); + OSL_ENSURE( aSubstVector.size() == nStartCoverageIndex, "coverage index mismatch"); + (void)nStartCoverageIndex; for( USHORT j = nGlyph0; j <= nGlyph1; ++j ) - aSubstVector.push_back( GlyphSubst( j + nCovIdx, 0 ) ); + aSubstVector.push_back( GlyphSubst( j, 0 ) ); } } break; diff --git a/vcl/source/gdi/base14.cxx b/vcl/source/gdi/base14.cxx index 17e616d196b4..56d1c3ff5eba 100644 --- a/vcl/source/gdi/base14.cxx +++ b/vcl/source/gdi/base14.cxx @@ -601,7 +601,7 @@ const PDFWriterImpl::BuiltinFont PDFWriterImpl::m_aBuiltinFonts[ 14 ] = { "Symbol", // PSName 1010, -293, // ascend, descend FAMILY_DONTKNOW, // family style - RTL_TEXTENCODING_SYMBOL, // charset + RTL_TEXTENCODING_ADOBE_SYMBOL, // charset PITCH_VARIABLE, // pitch WIDTH_NORMAL, // width type WEIGHT_NORMAL, // weight type diff --git a/vcl/source/gdi/configsettings.cxx b/vcl/source/gdi/configsettings.cxx new file mode 100644 index 000000000000..b601caef301a --- /dev/null +++ b/vcl/source/gdi/configsettings.cxx @@ -0,0 +1,205 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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/configsettings.hxx> +#include <vcl/svdata.hxx> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/beans/PropertyValue.hpp> + +using namespace rtl; +using namespace utl; +using namespace vcl; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::container; + +#define SETTINGS_CONFIGNODE "VCL/Settings" + +/* + * SettingsConfigItem::get + */ + +SettingsConfigItem* SettingsConfigItem::get() +{ + ImplSVData* pSVData = ImplGetSVData(); + if( ! pSVData->mpSettingsConfigItem ) + pSVData->mpSettingsConfigItem = new SettingsConfigItem(); + return pSVData->mpSettingsConfigItem; +} + +/* + * SettignsConfigItem constructor + */ + +SettingsConfigItem::SettingsConfigItem() + : + ConfigItem( OUString( RTL_CONSTASCII_USTRINGPARAM( SETTINGS_CONFIGNODE ) ), + CONFIG_MODE_DELAYED_UPDATE ), + m_aSettings( 0 ) +{ + getValues(); +} + +/* + * SettingsConfigItem destructor + */ + +SettingsConfigItem::~SettingsConfigItem() +{ + if( IsModified() ) + Commit(); +} + +/* + * SettingsConfigItem::Commit + */ + +void SettingsConfigItem::Commit() +{ + if( ! IsValidConfigMgr() ) + return; + + std::hash_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group; + + for( group = m_aSettings.begin(); group != m_aSettings.end(); ++group ) + { + String aKeyName( group->first ); + /*sal_Bool bAdded =*/ AddNode( OUString(), aKeyName ); + Sequence< PropertyValue > aValues( group->second.size() ); + PropertyValue* pValues = aValues.getArray(); + int nIndex = 0; + SmallOUStrMap::const_iterator it; + for( it = group->second.begin(); it != group->second.end(); ++it ) + { + String aName( aKeyName ); + aName.Append( '/' ); + aName.Append( String( it->first ) ); + pValues[nIndex].Name = aName; + pValues[nIndex].Handle = 0; + pValues[nIndex].Value <<= it->second; + pValues[nIndex].State = PropertyState_DIRECT_VALUE; + nIndex++; + } + ReplaceSetProperties( aKeyName, aValues ); + } +} + +/* + * SettingsConfigItem::Notify + */ + +void SettingsConfigItem::Notify( const Sequence< OUString >& ) +{ + getValues(); +} + +/* + * SettingsConfigItem::getValues + */ +void SettingsConfigItem::getValues() +{ + if( ! IsValidConfigMgr() ) + return; + + m_aSettings.clear(); + + Sequence< OUString > aNames( GetNodeNames( OUString() ) ); + m_aSettings.resize( aNames.getLength() ); + + for( int j = 0; j < aNames.getLength(); j++ ) + { +#if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, "found settings data for \"%s\"\n", + OUStringToOString( aNames.getConstArray()[j], RTL_TEXTENCODING_ASCII_US ).getStr() + ); +#endif + String aKeyName( aNames.getConstArray()[j] ); + Sequence< OUString > aKeys( GetNodeNames( aKeyName ) ); + Sequence< OUString > aSettingsKeys( aKeys.getLength() ); + const OUString* pFrom = aKeys.getConstArray(); + OUString* pTo = aSettingsKeys.getArray(); + for( int m = 0; m < aKeys.getLength(); m++ ) + { + String aName( aKeyName ); + aName.Append( '/' ); + aName.Append( String( pFrom[m] ) ); + pTo[m] = aName; + } + Sequence< Any > aValues( GetProperties( aSettingsKeys ) ); + const Any* pValue = aValues.getConstArray(); + for( int i = 0; i < aValues.getLength(); i++, pValue++ ) + { + if( pValue->getValueTypeClass() == TypeClass_STRING ) + { + const OUString* pLine = (const OUString*)pValue->getValue(); + if( pLine->getLength() ) + m_aSettings[ aKeyName ][ pFrom[i] ] = *pLine; +#if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, " \"%s\"=\"%.30s\"\n", + OUStringToOString( aKeys.getConstArray()[i], RTL_TEXTENCODING_ASCII_US ).getStr(), + OUStringToOString( *pLine, RTL_TEXTENCODING_ASCII_US ).getStr() + ); +#endif + } + } + } +} + +/* + * SettingsConfigItem::getDefaultFont + */ + +const OUString& SettingsConfigItem::getValue( const OUString& rGroup, const OUString& rKey ) const +{ + ::std::hash_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group = m_aSettings.find( rGroup ); + if( group == m_aSettings.end() || group->second.find( rKey ) == group->second.end() ) + { + static OUString aEmpty; + return aEmpty; + } + return group->second.find(rKey)->second; +} + +/* + * SettingsConfigItem::setDefaultFont + */ + +void SettingsConfigItem::setValue( const OUString& rGroup, const OUString& rKey, const OUString& rValue ) +{ + bool bModified = m_aSettings[ rGroup ][ rKey ] != rValue; + if( bModified ) + { + m_aSettings[ rGroup ][ rKey ] = rValue; + SetModified(); + } +} + diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx index 07b1a391adf4..8c4b6f1a2cb2 100644 --- a/vcl/source/gdi/cvtsvm.cxx +++ b/vcl/source/gdi/cvtsvm.cxx @@ -119,7 +119,9 @@ void ImplWritePolyPolyAction( SvStream& rOStm, const PolyPolygon& rPolyPoly ) for( n = 0; n < nPoly; n++ ) { - // #i102224# + // #i102224# Here the evtl. curved nature of Polygon was + // ignored (for all those Years). Adapted to at least write + // a polygon representing the curve as good as possible Polygon aSimplePoly; rPolyPoly[n].AdaptiveSubdivide(aSimplePoly); const USHORT nSize(aSimplePoly.GetSize()); @@ -1596,6 +1598,9 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { // #i102224# MetaPolyLineAction* pAct = (MetaPolyLineAction*) pAction; + // #i102224# Here the evtl. curved nature of Polygon was + // ignored (for all those Years). Adapted to at least write + // a polygon representing the curve as good as possible Polygon aSimplePoly; pAct->GetPolygon().AdaptiveSubdivide(aSimplePoly); const LineInfo& rInfo = pAct->GetLineInfo(); @@ -1665,8 +1670,10 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, case( META_POLYGON_ACTION ): { - // #i102224# MetaPolygonAction* pAct = (MetaPolygonAction*)pAction; + // #i102224# Here the evtl. curved nature of Polygon was + // ignored (for all those Years). Adapted to at least write + // a polygon representing the curve as good as possible Polygon aSimplePoly; pAct->GetPolygon().AdaptiveSubdivide(aSimplePoly); const USHORT nPoints(aSimplePoly.GetSize()); @@ -1677,6 +1684,7 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, for( USHORT n = 0; n < nPoints; n++ ) rOStm << aSimplePoly[ n ]; + nCount++; const PolyPolygon aPolyPolygon(pAct->GetPolygon()); diff --git a/vcl/source/gdi/font.cxx b/vcl/source/gdi/font.cxx index 3bbdba5dad5f..afd6181351b4 100644 --- a/vcl/source/gdi/font.cxx +++ b/vcl/source/gdi/font.cxx @@ -38,8 +38,8 @@ #include "tools/debug.hxx" #include "vcl/font.hxx" #include "vcl/impfont.hxx" -#include "vcl/fontcfg.hxx" -#include "vcl/outdev.h" // just for ImplGetEnglishSearchFontName! TODO: move it +#include "vcl/outfont.hxx" +#include "unotools/fontcfg.hxx" #include <algorithm> @@ -169,7 +169,7 @@ void Impl_Font::AskConfig() mbConfigLookup = true; // prepare the FontSubst configuration lookup - const vcl::FontSubstConfiguration* pFontSubst = vcl::FontSubstConfiguration::get(); + const utl::FontSubstConfiguration* pFontSubst = utl::FontSubstConfiguration::get(); String aShortName; String aFamilyName; @@ -177,12 +177,12 @@ void Impl_Font::AskConfig() FontWeight eWeight = WEIGHT_DONTKNOW; FontWidth eWidthType = WIDTH_DONTKNOW; String aMapName = maFamilyName; - ImplGetEnglishSearchFontName( aMapName ); - vcl::FontSubstConfiguration::getMapName( aMapName, + GetEnglishSearchFontName( aMapName ); + utl::FontSubstConfiguration::getMapName( aMapName, aShortName, aFamilyName, eWeight, eWidthType, nType ); // lookup the font name in the configuration - const vcl::FontNameAttr* pFontAttr = pFontSubst->getSubstInfo( aMapName ); + const utl::FontNameAttr* pFontAttr = pFontSubst->getSubstInfo( aMapName ); // if the direct lookup failed try again with an alias name if ( !pFontAttr && (aShortName != aMapName) ) diff --git a/vcl/source/gdi/fontcfg.cxx b/vcl/source/gdi/fontcfg.cxx deleted file mode 100644 index 68d3b499341d..000000000000 --- a/vcl/source/gdi/fontcfg.cxx +++ /dev/null @@ -1,1381 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: fontcfg.cxx,v $ - * $Revision: 1.49.114.1 $ - * - * 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/fontcfg.hxx> -#include <vcl/configsettings.hxx> -#include <vcl/outdev.hxx> -#include <vcl/svdata.hxx> -#include <vcl/svapp.hxx> -#include <vcl/unohelp.hxx> -#include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/uno/Sequence.hxx> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <unotools/configpathes.hxx> -#include <rtl/ustrbuf.hxx> - -#if OSL_DEBUG_LEVEL > 1 -#include <stdio.h> -#endif - -#include <string.h> -#include <list> -#include <algorithm> - -#define DEFAULTFONT_CONFIGNODE "VCL/DefaultFonts" -#define SUBSTFONT_CONFIGNODE "VCL/FontSubstitutions" -#define SETTINGS_CONFIGNODE "VCL/Settings" - -using namespace vcl; -using namespace rtl; -using namespace utl; -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::beans; -using namespace com::sun::star::container; - - -/* - * DefaultFontConfiguration - */ - -static const char* getKeyType( int nKeyType ) -{ - switch( nKeyType ) - { - case DEFAULTFONT_CJK_DISPLAY: return "CJK_DISPLAY"; - case DEFAULTFONT_CJK_HEADING: return "CJK_HEADING"; - case DEFAULTFONT_CJK_PRESENTATION: return "CJK_PRESENTATION"; - case DEFAULTFONT_CJK_SPREADSHEET: return "CJK_SPREADSHEET"; - case DEFAULTFONT_CJK_TEXT: return "CJK_TEXT"; - case DEFAULTFONT_CTL_DISPLAY: return "CTL_DISPLAY"; - case DEFAULTFONT_CTL_HEADING: return "CTL_HEADING"; - case DEFAULTFONT_CTL_PRESENTATION: return "CTL_PRESENTATION"; - case DEFAULTFONT_CTL_SPREADSHEET: return "CTL_SPREADSHEET"; - case DEFAULTFONT_CTL_TEXT: return "CTL_TEXT"; - case DEFAULTFONT_FIXED: return "FIXED"; - case DEFAULTFONT_LATIN_DISPLAY: return "LATIN_DISPLAY"; - case DEFAULTFONT_LATIN_FIXED: return "LATIN_FIXED"; - case DEFAULTFONT_LATIN_HEADING: return "LATIN_HEADING"; - case DEFAULTFONT_LATIN_PRESENTATION: return "LATIN_PRESENTATION"; - case DEFAULTFONT_LATIN_SPREADSHEET: return "LATIN_SPREADSHEET"; - case DEFAULTFONT_LATIN_TEXT: return "LATIN_TEXT"; - case DEFAULTFONT_SANS: return "SANS"; - case DEFAULTFONT_SANS_UNICODE: return "SANS_UNICODE"; - case DEFAULTFONT_SERIF: return "SERIF"; - case DEFAULTFONT_SYMBOL: return "SYMBOL"; - case DEFAULTFONT_UI_FIXED: return "UI_FIXED"; - case DEFAULTFONT_UI_SANS: return "UI_SANS"; - default: - DBG_ERROR( "unmatched type" ); - return ""; - } -} - -DefaultFontConfiguration* DefaultFontConfiguration::get() -{ - ImplSVData* pSVData = ImplGetSVData(); - if( ! pSVData->maGDIData.mpDefaultFontConfiguration ) - pSVData->maGDIData.mpDefaultFontConfiguration = new DefaultFontConfiguration(); - return pSVData->maGDIData.mpDefaultFontConfiguration; -} - -DefaultFontConfiguration::DefaultFontConfiguration() -{ - try - { - // get service provider - Reference< XMultiServiceFactory > xSMgr( unohelper::GetMultiServiceFactory() ); - // create configuration hierachical access name - if( xSMgr.is() ) - { - try - { - m_xConfigProvider = - Reference< XMultiServiceFactory >( - xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.ConfigurationProvider" ))), - UNO_QUERY ); - if( m_xConfigProvider.is() ) - { - Sequence< Any > aArgs(1); - PropertyValue aVal; - aVal.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ); - aVal.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.VCL/DefaultFonts" ) ); - aArgs.getArray()[0] <<= aVal; - m_xConfigAccess = - Reference< XNameAccess >( - m_xConfigProvider->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.ConfigurationAccess" )), - aArgs ), - UNO_QUERY ); - if( m_xConfigAccess.is() ) - { - Sequence< OUString > aLocales = m_xConfigAccess->getElementNames(); - // fill config hash with empty interfaces - int nLocales = aLocales.getLength(); - const OUString* pLocaleStrings = aLocales.getConstArray(); - Locale aLoc; - for( int i = 0; i < nLocales; i++ ) - { - sal_Int32 nIndex = 0; - aLoc.Language = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiLowerCase(); - if( nIndex != -1 ) - aLoc.Country = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase(); - else - aLoc.Country = OUString(); - if( nIndex != -1 ) - aLoc.Variant = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase(); - else - aLoc.Variant = OUString(); - m_aConfig[ aLoc ] = LocaleAccess(); - m_aConfig[ aLoc ].aConfigLocaleString = pLocaleStrings[i]; - } - } - } - } - catch( Exception& ) - { - // configuration is awry - m_xConfigProvider.clear(); - m_xConfigAccess.clear(); - } - } - } - catch( WrappedTargetException& ) - { - } - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "config provider: %s, config access: %s\n", - m_xConfigProvider.is() ? "true" : "false", - m_xConfigAccess.is() ? "true" : "false" - ); - #endif -} - -DefaultFontConfiguration::~DefaultFontConfiguration() -{ - // release all nodes - m_aConfig.clear(); - // release top node - m_xConfigAccess.clear(); - // release config provider - m_xConfigProvider.clear(); -} - -OUString DefaultFontConfiguration::tryLocale( const Locale& rLocale, const OUString& rType ) const -{ - OUString aRet; - - std::hash_map< Locale, LocaleAccess, LocaleHash >::const_iterator it = - m_aConfig.find( rLocale ); - if( it != m_aConfig.end() ) - { - if( !it->second.xAccess.is() ) - { - try - { - Reference< XNameAccess > xNode; - if ( m_xConfigAccess->hasByName( it->second.aConfigLocaleString ) ) - { - Any aAny = m_xConfigAccess->getByName( it->second.aConfigLocaleString ); - if( aAny >>= xNode ) - it->second.xAccess = xNode; - } - } - catch( NoSuchElementException ) - { - } - catch( WrappedTargetException ) - { - } - } - if( it->second.xAccess.is() ) - { - try - { - if ( it->second.xAccess->hasByName( rType ) ) - { - Any aAny = it->second.xAccess->getByName( rType ); - aAny >>= aRet; - } - } - catch( NoSuchElementException& ) - { - } - catch( WrappedTargetException& ) - { - } - } - } - - return aRet; -} - -OUString DefaultFontConfiguration::getDefaultFont( const Locale& rLocale, int nType ) const -{ - Locale aLocale; - aLocale.Language = rLocale.Language.toAsciiLowerCase(); - aLocale.Country = rLocale.Country.toAsciiUpperCase(); - aLocale.Variant = rLocale.Variant.toAsciiUpperCase(); - - OUString aType = OUString::createFromAscii( getKeyType( nType ) ); - OUString aRet = tryLocale( aLocale, aType ); - if( ! aRet.getLength() && aLocale.Variant.getLength() ) - { - aLocale.Variant = OUString(); - aRet = tryLocale( aLocale, aType ); - } - if( ! aRet.getLength() && aLocale.Country.getLength() ) - { - aLocale.Country = OUString(); - aRet = tryLocale( aLocale, aType ); - } - if( ! aRet.getLength() ) - { - aLocale.Language = OUString( RTL_CONSTASCII_USTRINGPARAM( "en" ) ); - aRet = tryLocale( aLocale, aType ); - } - return aRet; -} - -OUString DefaultFontConfiguration::getUserInterfaceFont( const Locale& rLocale ) const -{ - Locale aLocale = rLocale; - if( ! aLocale.Language.getLength() ) - aLocale = Application::GetSettings().GetUILocale(); - - OUString aUIFont = getDefaultFont( aLocale, DEFAULTFONT_UI_SANS ); - - if( aUIFont.getLength() ) - return aUIFont; - - // fallback mechanism (either no configuration or no entry in configuration - - #define FALLBACKFONT_UI_SANS "Andale Sans UI;Albany;Albany AMT;Tahoma;Arial Unicode MS;Arial;Nimbus Sans L;Bitstream Vera Sans;gnu-unifont;Interface User;Geneva;WarpSans;Dialog;Swiss;Lucida;Helvetica;Charcoal;Chicago;MS Sans Serif;Helv;Times;Times New Roman;Interface System" - #define FALLBACKFONT_UI_SANS_LATIN2 "Andale Sans UI;Albany;Albany AMT;Tahoma;Arial Unicode MS;Arial;Nimbus Sans L;Luxi Sans;Bitstream Vera Sans;Interface User;Geneva;WarpSans;Dialog;Swiss;Lucida;Helvetica;Charcoal;Chicago;MS Sans Serif;Helv;Times;Times New Roman;Interface System" - #define FALLBACKFONT_UI_SANS_ARABIC "Tahoma;Traditional Arabic;Simplified Arabic;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;clearlyU;Interface User;Arial Unicode MS;Lucida Sans Unicode;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany;Lucida;Helvetica;Charcoal;Chicago;Arial;Helmet;Interface System;Sans Serif" - #define FALLBACKFONT_UI_SANS_THAI "OONaksit;Tahoma;Lucidasans;Arial Unicode MS" - #define FALLBACKFONT_UI_SANS_KOREAN "SunGulim;BaekmukGulim;Gulim;Roundgothic;Arial Unicode MS;Lucida Sans Unicode;gnu-unifont;Andale Sans UI" - #define FALLBACKFONT_UI_SANS_JAPANESE1 "HG-GothicB-Sun;Andale Sans UI;HG MhinchoLightJ" - #define FALLBACKFONT_UI_SANS_JAPANESE2 "Kochi Gothic;Gothic" - #define FALLBACKFONT_UI_SANS_CHINSIM "Andale Sans UI;Arial Unicode MS;ZYSong18030;AR PL SungtiL GB;AR PL KaitiM GB;SimSun;Lucida Sans Unicode;Fangsong;Hei;Song;Kai;Ming;gnu-unifont;Interface User;" - #define FALLBACKFONT_UI_SANS_CHINTRD "Andale Sans UI;Arial Unicode MS;AR PL Mingti2L Big5;AR PL KaitiM Big5;Kai;PMingLiU;MingLiU;Ming;Lucida Sans Unicode;gnu-unifont;Interface User;" - - // we need localized names for japanese fonts - static sal_Unicode const aMSGothic[] = { 0xFF2D, 0xFF33, ' ', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; - static sal_Unicode const aMSPGothic[] = { 0xFF2D, 0xFF33, ' ', 0xFF30, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; - static sal_Unicode const aTLPGothic[] = { 0x0054, 0x004C, 0x0050, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; - static sal_Unicode const aLXGothic[] = { 0x004C, 0x0058, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; - static sal_Unicode const aKochiGothic[] = { 0x6771, 0x98A8, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; - - String aFallBackJapaneseLocalized( RTL_CONSTASCII_USTRINGPARAM( "MS UI Gothic;" ) ); - aFallBackJapaneseLocalized += String( RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_JAPANESE1 ) ); - aFallBackJapaneseLocalized += String( aMSPGothic ); - aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) ); - aFallBackJapaneseLocalized += String( aMSGothic ); - aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) ); - aFallBackJapaneseLocalized += String( aTLPGothic ); - aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) ); - aFallBackJapaneseLocalized += String( aLXGothic ); - aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) ); - aFallBackJapaneseLocalized += String( aKochiGothic ); - aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) ); - aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_JAPANESE2 ) ); - static const OUString aFallBackJapanese( aFallBackJapaneseLocalized ); - static const OUString aFallback (RTL_CONSTASCII_USTRINGPARAM(FALLBACKFONT_UI_SANS)); - static const OUString aFallbackLatin2 (RTL_CONSTASCII_USTRINGPARAM(FALLBACKFONT_UI_SANS_LATIN2)); - static const OUString aFallBackArabic (RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_ARABIC ) ); - static const OUString aFallBackThai (RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_THAI ) ); - static const OUString aFallBackChineseSIM (RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_CHINSIM ) ); - static const OUString aFallBackChineseTRD (RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_CHINTRD ) ); - - // we need localized names for korean fonts - static sal_Unicode const aSunGulim[] = { 0xC36C, 0xAD74, 0xB9BC, 0 }; - static sal_Unicode const aBaekmukGulim[] = { 0xBC31, 0xBC35, 0xAD74, 0xB9BC, 0 }; - String aFallBackKoreanLocalized( aSunGulim ); - aFallBackKoreanLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) ); - aFallBackKoreanLocalized += String( aBaekmukGulim ); - aFallBackKoreanLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) ); - aFallBackKoreanLocalized += String(RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_KOREAN ) ); - static const OUString aFallBackKorean( aFallBackKoreanLocalized ); - - // optimize font list for some locales, as long as Andale Sans UI does not support them - if( aLocale.Language.equalsAscii( "ar" ) || - aLocale.Language.equalsAscii( "he" ) || - aLocale.Language.equalsAscii( "iw" ) ) - { - return aFallBackArabic; - } - else if( aLocale.Language.equalsAscii( "th" ) ) - { - return aFallBackThai; - } - else if( aLocale.Language.equalsAscii( "ko" ) ) - { - return aFallBackKorean; - } - else if( aLocale.Language.equalsAscii( "cs" ) || - aLocale.Language.equalsAscii( "hu" ) || - aLocale.Language.equalsAscii( "pl" ) || - aLocale.Language.equalsAscii( "ro" ) || - aLocale.Language.equalsAscii( "rm" ) || - aLocale.Language.equalsAscii( "hr" ) || - aLocale.Language.equalsAscii( "sk" ) || - aLocale.Language.equalsAscii( "sl" ) || - aLocale.Language.equalsAscii( "sb" ) ) - { - return aFallbackLatin2; - } - else if( aLocale.Language.equalsAscii( "zh" ) ) - { - if( ! aLocale.Country.equalsAscii( "cn" ) ) - return aFallBackChineseTRD; - else - return aFallBackChineseSIM; - } - else if( aLocale.Language.equalsAscii( "ja" ) ) - { - return aFallBackJapanese; - } - - return aFallback; -} - -// ------------------------------------------------------------------------------------ - -/* - * FontSubstConfigItem::get - */ - -FontSubstConfiguration* FontSubstConfiguration::get() -{ - ImplSVData* pSVData = ImplGetSVData(); - if( ! pSVData->maGDIData.mpFontSubstConfiguration ) - pSVData->maGDIData.mpFontSubstConfiguration = new FontSubstConfiguration(); - return pSVData->maGDIData.mpFontSubstConfiguration; -} - -/* - * FontSubstConfigItem::FontSubstConfigItem - */ - -FontSubstConfiguration::FontSubstConfiguration() : - maSubstHash( 300 ) -{ - try - { - // get service provider - Reference< XMultiServiceFactory > xSMgr( unohelper::GetMultiServiceFactory() ); - // create configuration hierachical access name - if( xSMgr.is() ) - { - try - { - m_xConfigProvider = - Reference< XMultiServiceFactory >( - xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.ConfigurationProvider" ))), - UNO_QUERY ); - if( m_xConfigProvider.is() ) - { - Sequence< Any > aArgs(1); - PropertyValue aVal; - aVal.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ); - aVal.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.VCL/FontSubstitutions" ) ); - aArgs.getArray()[0] <<= aVal; - m_xConfigAccess = - Reference< XNameAccess >( - m_xConfigProvider->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.ConfigurationAccess" )), - aArgs ), - UNO_QUERY ); - if( m_xConfigAccess.is() ) - { - Sequence< OUString > aLocales = m_xConfigAccess->getElementNames(); - // fill config hash with empty interfaces - int nLocales = aLocales.getLength(); - const OUString* pLocaleStrings = aLocales.getConstArray(); - Locale aLoc; - for( int i = 0; i < nLocales; i++ ) - { - sal_Int32 nIndex = 0; - aLoc.Language = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiLowerCase(); - if( nIndex != -1 ) - aLoc.Country = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase(); - else - aLoc.Country = OUString(); - if( nIndex != -1 ) - aLoc.Variant = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase(); - else - aLoc.Variant = OUString(); - m_aSubst[ aLoc ] = LocaleSubst(); - m_aSubst[ aLoc ].aConfigLocaleString = pLocaleStrings[i]; - } - } - } - } - catch( Exception& ) - { - // configuration is awry - m_xConfigProvider.clear(); - m_xConfigAccess.clear(); - } - } - } - catch( WrappedTargetException& ) - { - } - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "config provider: %s, config access: %s\n", - m_xConfigProvider.is() ? "true" : "false", - m_xConfigAccess.is() ? "true" : "false" - ); - #endif -} - -/* - * FontSubstConfigItem::~FontSubstConfigItem - */ - -FontSubstConfiguration::~FontSubstConfiguration() -{ - // release config access - m_xConfigAccess.clear(); - // release config provider - m_xConfigProvider.clear(); -} - -/* - * FontSubstConfigItem::getMapName - */ -// ======================================================================= - -static const char* const aImplKillLeadingList[] = -{ - "microsoft", - "monotype", - "linotype", - "baekmuk", - "adobe", - "nimbus", - "zycjk", - "itc", - "sun", - "amt", - "ms", - "mt", - "cg", - "hg", - "fz", - "ipa", - "sazanami", - "kochi", - NULL -}; - -// ----------------------------------------------------------------------- - -static const char* const aImplKillTrailingList[] = -{ - "microsoft", - "monotype", - "linotype", - "adobe", - "nimbus", - "itc", - "sun", - "amt", - "ms", - "mt", - "clm", - // Scripts, for compatibility with older versions - "we", - "cyr", - "tur", - "wt", - "greek", - "wl", - // CJK extensions - "gb", - "big5", - "pro", - "z01", - "z02", - "z03", - "z13", - "b01", - "w3x12", - // Old Printer Fontnames - "5cpi", - "6cpi", - "7cpi", - "8cpi", - "9cpi", - "10cpi", - "11cpi", - "12cpi", - "13cpi", - "14cpi", - "15cpi", - "16cpi", - "18cpi", - "24cpi", - "scale", - "pc", - NULL -}; - -// ----------------------------------------------------------------------- - -static const char* const aImplKillTrailingWithExceptionsList[] = -{ - "ce", "monospace", "oldface", NULL, - "ps", "caps", NULL, - NULL -}; - -// ----------------------------------------------------------------------- - -struct ImplFontAttrWeightSearchData -{ - const char* mpStr; - FontWeight meWeight; -}; - -static ImplFontAttrWeightSearchData const aImplWeightAttrSearchList[] = -{ -// the attribute names are ordered by "first match wins" -// e.g. "semilight" should wins over "semi" -{ "extrablack", WEIGHT_BLACK }, -{ "ultrablack", WEIGHT_BLACK }, -{ "ultrabold", WEIGHT_ULTRABOLD }, -{ "semibold", WEIGHT_SEMIBOLD }, -{ "semilight", WEIGHT_SEMILIGHT }, -{ "semi", WEIGHT_SEMIBOLD }, -{ "demi", WEIGHT_SEMIBOLD }, -{ "black", WEIGHT_BLACK }, -{ "bold", WEIGHT_BOLD }, -{ "heavy", WEIGHT_BLACK }, -{ "ultralight", WEIGHT_ULTRALIGHT }, -{ "light", WEIGHT_LIGHT }, -{ "medium", WEIGHT_MEDIUM }, -{ NULL, WEIGHT_DONTKNOW }, -}; - -// ----------------------------------------------------------------------- - -struct ImplFontAttrWidthSearchData -{ - const char* mpStr; - FontWidth meWidth; -}; - -static ImplFontAttrWidthSearchData const aImplWidthAttrSearchList[] = -{ -{ "narrow", WIDTH_CONDENSED }, -{ "semicondensed", WIDTH_SEMI_CONDENSED }, -{ "ultracondensed", WIDTH_ULTRA_CONDENSED }, -{ "semiexpanded", WIDTH_SEMI_EXPANDED }, -{ "ultraexpanded", WIDTH_ULTRA_EXPANDED }, -{ "expanded", WIDTH_EXPANDED }, -{ "wide", WIDTH_ULTRA_EXPANDED }, -{ "condensed", WIDTH_CONDENSED }, -{ "cond", WIDTH_CONDENSED }, -{ "cn", WIDTH_CONDENSED }, -{ NULL, WIDTH_DONTKNOW }, -}; - -struct ImplFontAttrTypeSearchData -{ - const char* mpStr; - ULONG mnType; -}; - -static ImplFontAttrTypeSearchData const aImplTypeAttrSearchList[] = -{ -{ "monotype", 0 }, -{ "linotype", 0 }, -{ "titling", IMPL_FONT_ATTR_TITLING }, -{ "captitals", IMPL_FONT_ATTR_CAPITALS }, -{ "captital", IMPL_FONT_ATTR_CAPITALS }, -{ "caps", IMPL_FONT_ATTR_CAPITALS }, -{ "italic", IMPL_FONT_ATTR_ITALIC }, -{ "oblique", IMPL_FONT_ATTR_ITALIC }, -{ "rounded", IMPL_FONT_ATTR_ROUNDED }, -{ "outline", IMPL_FONT_ATTR_OUTLINE }, -{ "shadow", IMPL_FONT_ATTR_SHADOW }, -{ "handwriting", IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_SCRIPT }, -{ "hand", IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_SCRIPT }, -{ "signet", IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_SCRIPT }, -{ "script", IMPL_FONT_ATTR_BRUSHSCRIPT | IMPL_FONT_ATTR_SCRIPT }, -{ "calligraphy", IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_SCRIPT }, -{ "chancery", IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_SCRIPT }, -{ "corsiva", IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_SCRIPT }, -{ "gothic", IMPL_FONT_ATTR_SANSSERIF | IMPL_FONT_ATTR_GOTHIC }, -{ "schoolbook", IMPL_FONT_ATTR_SERIF | IMPL_FONT_ATTR_SCHOOLBOOK }, -{ "schlbk", IMPL_FONT_ATTR_SERIF | IMPL_FONT_ATTR_SCHOOLBOOK }, -{ "typewriter", IMPL_FONT_ATTR_TYPEWRITER | IMPL_FONT_ATTR_FIXED }, -{ "lineprinter", IMPL_FONT_ATTR_TYPEWRITER | IMPL_FONT_ATTR_FIXED }, -{ "monospaced", IMPL_FONT_ATTR_FIXED }, -{ "monospace", IMPL_FONT_ATTR_FIXED }, -{ "mono", IMPL_FONT_ATTR_FIXED }, -{ "fixed", IMPL_FONT_ATTR_FIXED }, -{ "sansserif", IMPL_FONT_ATTR_SANSSERIF }, -{ "sans", IMPL_FONT_ATTR_SANSSERIF }, -{ "swiss", IMPL_FONT_ATTR_SANSSERIF }, -{ "serif", IMPL_FONT_ATTR_SERIF }, -{ "bright", IMPL_FONT_ATTR_SERIF }, -{ "symbols", IMPL_FONT_ATTR_SYMBOL }, -{ "symbol", IMPL_FONT_ATTR_SYMBOL }, -{ "dingbats", IMPL_FONT_ATTR_SYMBOL }, -{ "dings", IMPL_FONT_ATTR_SYMBOL }, -{ "ding", IMPL_FONT_ATTR_SYMBOL }, -{ "bats", IMPL_FONT_ATTR_SYMBOL }, -{ "math", IMPL_FONT_ATTR_SYMBOL }, -{ "oldstyle", IMPL_FONT_ATTR_OTHERSTYLE }, -{ "oldface", IMPL_FONT_ATTR_OTHERSTYLE }, -{ "old", IMPL_FONT_ATTR_OTHERSTYLE }, -{ "new", 0 }, -{ "modern", 0 }, -{ "lucida", 0 }, -{ "regular", 0 }, -{ "extended", 0 }, -{ "extra", IMPL_FONT_ATTR_OTHERSTYLE }, -{ "ext", 0 }, -{ "scalable", 0 }, -{ "scale", 0 }, -{ "nimbus", 0 }, -{ "adobe", 0 }, -{ "itc", 0 }, -{ "amt", 0 }, -{ "mt", 0 }, -{ "ms", 0 }, -{ "cpi", 0 }, -{ "no", 0 }, -{ NULL, 0 }, -}; - -// ----------------------------------------------------------------------- - -static bool ImplKillLeading( String& rName, const char* const* ppStr ) -{ - for(; *ppStr; ++ppStr ) - { - const char* pStr = *ppStr; - const xub_Unicode* pNameStr = rName.GetBuffer(); - while ( (*pNameStr == (xub_Unicode)(unsigned char)*pStr) && *pStr ) - { - pNameStr++; - pStr++; - } - if ( !*pStr ) - { - xub_StrLen nLen = sal::static_int_cast<xub_StrLen>(pNameStr - rName.GetBuffer()); - rName.Erase( 0, nLen ); - return true; - } - } - - // special case for Baekmuk - // TODO: allow non-ASCII KillLeading list - const xub_Unicode* pNameStr = rName.GetBuffer(); - if( (pNameStr[0]==0xBC31) && (pNameStr[1]==0xBC35) ) - { - xub_StrLen nLen = (pNameStr[2]==0x0020) ? 3 : 2; - rName.Erase( 0, nLen ); - return true; - } - - return false; -} - -// ----------------------------------------------------------------------- - -static xub_StrLen ImplIsTrailing( const String& rName, const char* pStr ) -{ - xub_StrLen nStrLen = static_cast<xub_StrLen>( strlen( pStr ) ); - if( nStrLen >= rName.Len() ) - return 0; - - const xub_Unicode* pEndName = rName.GetBuffer() + rName.Len(); - const sal_Unicode* pNameStr = pEndName - nStrLen; - do if( *(pNameStr++) != *(pStr++) ) - return 0; - while( *pStr ); - - return nStrLen; -} - -// ----------------------------------------------------------------------- - -static bool ImplKillTrailing( String& rName, const char* const* ppStr ) -{ - for(; *ppStr; ++ppStr ) - { - xub_StrLen nTrailLen = ImplIsTrailing( rName, *ppStr ); - if( nTrailLen ) - { - rName.Erase( rName.Len()-nTrailLen ); - return true; - } - } - - return false; -} - -// ----------------------------------------------------------------------- - -static bool ImplKillTrailingWithExceptions( String& rName, const char* const* ppStr ) -{ - for(; *ppStr; ++ppStr ) - { - xub_StrLen nTrailLen = ImplIsTrailing( rName, *ppStr ); - if( nTrailLen ) - { - // check string match against string exceptions - while( *++ppStr ) - if( ImplIsTrailing( rName, *ppStr ) ) - return false; - - rName.Erase( rName.Len()-nTrailLen ); - return true; - } - else - { - // skip exception strings - while( *++ppStr ) ; - } - } - - return false; -} - -// ----------------------------------------------------------------------- - -static BOOL ImplFindAndErase( String& rName, const char* pStr ) -{ - xub_StrLen nPos = rName.SearchAscii( pStr ); - if ( nPos == STRING_NOTFOUND ) - return FALSE; - - const char* pTempStr = pStr; - while ( *pTempStr ) - pTempStr++; - rName.Erase( nPos, (xub_StrLen)(pTempStr-pStr) ); - return TRUE; -} - -// ======================================================================= - -void FontSubstConfiguration::getMapName( const String& rOrgName, String& rShortName, - String& rFamilyName, FontWeight& rWeight, FontWidth& rWidth, ULONG& rType ) -{ - rShortName = rOrgName; - - // TODO: get rid of the crazy O(N*strlen) searches below - // they should be possible in O(strlen) - - // Kill leading vendor names and other unimportant data - ImplKillLeading( rShortName, aImplKillLeadingList ); - - // Kill trailing vendor names and other unimportant data - ImplKillTrailing( rShortName, aImplKillTrailingList ); - ImplKillTrailingWithExceptions( rShortName, aImplKillTrailingWithExceptionsList ); - - rFamilyName = rShortName; - - // Kill attributes from the name and update the data - // Weight - const ImplFontAttrWeightSearchData* pWeightList = aImplWeightAttrSearchList; - while ( pWeightList->mpStr ) - { - if ( ImplFindAndErase( rFamilyName, pWeightList->mpStr ) ) - { - if ( (rWeight == WEIGHT_DONTKNOW) || (rWeight == WEIGHT_NORMAL) ) - rWeight = pWeightList->meWeight; - break; - } - pWeightList++; - } - - // Width - const ImplFontAttrWidthSearchData* pWidthList = aImplWidthAttrSearchList; - while ( pWidthList->mpStr ) - { - if ( ImplFindAndErase( rFamilyName, pWidthList->mpStr ) ) - { - if ( (rWidth == WIDTH_DONTKNOW) || (rWidth == WIDTH_NORMAL) ) - rWidth = pWidthList->meWidth; - break; - } - pWidthList++; - } - - // Type - rType = 0; - const ImplFontAttrTypeSearchData* pTypeList = aImplTypeAttrSearchList; - while ( pTypeList->mpStr ) - { - if ( ImplFindAndErase( rFamilyName, pTypeList->mpStr ) ) - rType |= pTypeList->mnType; - pTypeList++; - } - - // Remove numbers - // TODO: also remove localized and fullwidth digits - xub_StrLen i = 0; - while ( i < rFamilyName.Len() ) - { - sal_Unicode c = rFamilyName.GetChar( i ); - if ( (c >= 0x0030) && (c <= 0x0039) ) - rFamilyName.Erase( i, 1 ); - else - i++; - } -} - - -struct StrictStringSort : public ::std::binary_function< const FontNameAttr&, const FontNameAttr&, bool > -{ - bool operator()( const FontNameAttr& rLeft, const FontNameAttr& rRight ) - { return rLeft.Name.CompareTo( rRight.Name ) == COMPARE_LESS ; } -}; - -static const char* const pAttribNames[] = -{ - "default", - "standard", - "normal", - "symbol", - "fixed", - "sansserif", - "serif", - "decorative", - "special", - "italic", - "title", - "capitals", - "cjk", - "cjk_jp", - "cjk_sc", - "cjk_tc", - "cjk_kr", - "ctl", - "nonelatin", - "full", - "outline", - "shadow", - "rounded", - "typewriter", - "script", - "handwriting", - "chancery", - "comic", - "brushscript", - "gothic", - "schoolbook", - "other" -}; - -struct enum_convert -{ - const char* pName; - int nEnum; -}; - - -static const enum_convert pWeightNames[] = -{ - { "normal", WEIGHT_NORMAL }, - { "medium", WEIGHT_MEDIUM }, - { "bold", WEIGHT_BOLD }, - { "black", WEIGHT_BLACK }, - { "semibold", WEIGHT_SEMIBOLD }, - { "light", WEIGHT_LIGHT }, - { "semilight", WEIGHT_SEMILIGHT }, - { "ultrabold", WEIGHT_ULTRABOLD }, - { "semi", WEIGHT_SEMIBOLD }, - { "demi", WEIGHT_SEMIBOLD }, - { "heavy", WEIGHT_BLACK }, - { "unknown", WEIGHT_DONTKNOW }, - { "thin", WEIGHT_THIN }, - { "ultralight", WEIGHT_ULTRALIGHT } -}; - -static const enum_convert pWidthNames[] = -{ - { "normal", WIDTH_NORMAL }, - { "condensed", WIDTH_CONDENSED }, - { "expanded", WIDTH_EXPANDED }, - { "unknown", WIDTH_DONTKNOW }, - { "ultracondensed", WIDTH_ULTRA_CONDENSED }, - { "extracondensed", WIDTH_EXTRA_CONDENSED }, - { "semicondensed", WIDTH_SEMI_CONDENSED }, - { "semiexpanded", WIDTH_SEMI_EXPANDED }, - { "extraexpanded", WIDTH_EXTRA_EXPANDED }, - { "ultraexpanded", WIDTH_ULTRA_EXPANDED } -}; - -void FontSubstConfiguration::fillSubstVector( const com::sun::star::uno::Reference< XNameAccess > xFont, - const rtl::OUString& rType, - std::vector< String >& rSubstVector ) const -{ - try - { - Any aAny = xFont->getByName( rType ); - if( aAny.getValueTypeClass() == TypeClass_STRING ) - { - const OUString* pLine = (const OUString*)aAny.getValue(); - sal_Int32 nIndex = 0; - sal_Int32 nLength = pLine->getLength(); - if( nLength ) - { - const sal_Unicode* pStr = pLine->getStr(); - sal_Int32 nTokens = 0; - // count tokens - while( nLength-- ) - { - if( *pStr++ == sal_Unicode(';') ) - nTokens++; - } - rSubstVector.clear(); - // optimize performance, heap fragmentation - rSubstVector.reserve( nTokens ); - while( nIndex != -1 ) - { - OUString aSubst( pLine->getToken( 0, ';', nIndex ) ); - if( aSubst.getLength() ) - { - UniqueSubstHash::iterator aEntry = maSubstHash.find( aSubst ); - if (aEntry != maSubstHash.end()) - aSubst = *aEntry; - else - maSubstHash.insert( aSubst ); - rSubstVector.push_back( aSubst ); - } - } - } - } - } - catch( NoSuchElementException ) - { - } - catch( WrappedTargetException ) - { - } -} - -FontWeight FontSubstConfiguration::getSubstWeight( const com::sun::star::uno::Reference< XNameAccess > xFont, - const rtl::OUString& rType ) const -{ - int weight = -1; - try - { - Any aAny = xFont->getByName( rType ); - if( aAny.getValueTypeClass() == TypeClass_STRING ) - { - const OUString* pLine = (const OUString*)aAny.getValue(); - if( pLine->getLength() ) - { - for( weight=sizeof(pWeightNames)/sizeof(pWeightNames[0])-1; weight >= 0; weight-- ) - if( pLine->equalsIgnoreAsciiCaseAscii( pWeightNames[weight].pName ) ) - break; - } -#if OSL_DEBUG_LEVEL > 1 - if( weight < 0 ) - fprintf( stderr, "Error: invalid weight %s\n", - OUStringToOString( *pLine, RTL_TEXTENCODING_ASCII_US ).getStr() ); -#endif - } - } - catch( NoSuchElementException ) - { - } - catch( WrappedTargetException ) - { - } - return (FontWeight)( weight >= 0 ? pWeightNames[weight].nEnum : WEIGHT_DONTKNOW ); -} - -FontWidth FontSubstConfiguration::getSubstWidth( const com::sun::star::uno::Reference< XNameAccess > xFont, - const rtl::OUString& rType ) const -{ - int width = -1; - try - { - Any aAny = xFont->getByName( rType ); - if( aAny.getValueTypeClass() == TypeClass_STRING ) - { - const OUString* pLine = (const OUString*)aAny.getValue(); - if( pLine->getLength() ) - { - for( width=sizeof(pWidthNames)/sizeof(pWidthNames[0])-1; width >= 0; width-- ) - if( pLine->equalsIgnoreAsciiCaseAscii( pWidthNames[width].pName ) ) - break; - } -#if OSL_DEBUG_LEVEL > 1 - if( width < 0 ) - fprintf( stderr, "Error: invalid width %s\n", - OUStringToOString( *pLine, RTL_TEXTENCODING_ASCII_US ).getStr() ); -#endif - } - } - catch( NoSuchElementException ) - { - } - catch( WrappedTargetException ) - { - } - return (FontWidth)( width >= 0 ? pWidthNames[width].nEnum : WIDTH_DONTKNOW ); -} - -unsigned long FontSubstConfiguration::getSubstType( const com::sun::star::uno::Reference< XNameAccess > xFont, - const rtl::OUString& rType ) const -{ - unsigned long type = 0; - try - { - Any aAny = xFont->getByName( rType ); - if( aAny.getValueTypeClass() == TypeClass_STRING ) - { - const OUString* pLine = (const OUString*)aAny.getValue(); - if( pLine->getLength() ) - { - sal_Int32 nIndex = 0; - while( nIndex != -1 ) - { - String aToken( pLine->getToken( 0, ',', nIndex ) ); - for( int k = 0; k < 32; k++ ) - if( aToken.EqualsIgnoreCaseAscii( pAttribNames[k] ) ) - { - type |= 1 << k; - break; - } - } - } - } - } - catch( NoSuchElementException ) - { - } - catch( WrappedTargetException ) - { - } - - return type; -} - -void FontSubstConfiguration::readLocaleSubst( const com::sun::star::lang::Locale& rLocale ) const -{ - std::hash_map< Locale, LocaleSubst, LocaleHash >::const_iterator it = - m_aSubst.find( rLocale ); - if( it != m_aSubst.end() ) - { - if( ! it->second.bConfigRead ) - { - it->second.bConfigRead = true; - Reference< XNameAccess > xNode; - try - { - Any aAny = m_xConfigAccess->getByName( it->second.aConfigLocaleString ); - aAny >>= xNode; - } - catch( NoSuchElementException ) - { - } - catch( WrappedTargetException ) - { - } - if( xNode.is() ) - { - Sequence< OUString > aFonts = xNode->getElementNames(); - int nFonts = aFonts.getLength(); - const OUString* pFontNames = aFonts.getConstArray(); - // improve performance, heap fragmentation - it->second.aSubstAttributes.reserve( nFonts ); - - // strings for subst retrieval, construct only once - OUString aSubstFontsStr ( RTL_CONSTASCII_USTRINGPARAM( "SubstFonts" ) ); - OUString aSubstFontsMSStr ( RTL_CONSTASCII_USTRINGPARAM( "SubstFontsMS" ) ); - OUString aSubstFontsPSStr ( RTL_CONSTASCII_USTRINGPARAM( "SubstFontsPS" ) ); - OUString aSubstFontsHTMLStr ( RTL_CONSTASCII_USTRINGPARAM( "SubstFontsHTML" ) ); - OUString aSubstWeightStr ( RTL_CONSTASCII_USTRINGPARAM( "FontWeight" ) ); - OUString aSubstWidthStr ( RTL_CONSTASCII_USTRINGPARAM( "FontWidth" ) ); - OUString aSubstTypeStr ( RTL_CONSTASCII_USTRINGPARAM( "FontType" ) ); - for( int i = 0; i < nFonts; i++ ) - { - Reference< XNameAccess > xFont; - try - { - Any aAny = xNode->getByName( pFontNames[i] ); - aAny >>= xFont; - } - catch( NoSuchElementException ) - { - } - catch( WrappedTargetException ) - { - } - if( ! xFont.is() ) - { - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "did not get font attributes for %s\n", - OUStringToOString( pFontNames[i], RTL_TEXTENCODING_UTF8 ).getStr() ); - #endif - continue; - } - - FontNameAttr aAttr; - // read subst attributes from config - aAttr.Name = pFontNames[i]; - fillSubstVector( xFont, aSubstFontsStr, aAttr.Substitutions ); - fillSubstVector( xFont, aSubstFontsMSStr, aAttr.MSSubstitutions ); - fillSubstVector( xFont, aSubstFontsPSStr, aAttr.PSSubstitutions ); - fillSubstVector( xFont, aSubstFontsHTMLStr, aAttr.HTMLSubstitutions ); - aAttr.Weight = getSubstWeight( xFont, aSubstWeightStr ); - aAttr.Width = getSubstWidth( xFont, aSubstWidthStr ); - aAttr.Type = getSubstType( xFont, aSubstTypeStr ); - - // finally insert this entry - it->second.aSubstAttributes.push_back( aAttr ); - } - std::sort( it->second.aSubstAttributes.begin(), it->second.aSubstAttributes.end(), StrictStringSort() ); - } - } - } -} - -const FontNameAttr* FontSubstConfiguration::getSubstInfo( const String& rFontName, const Locale& rLocale ) const -{ - if( !rFontName.Len() ) - return NULL; - - // search if a (language dep.) replacement table for the given font exists - // fallback is english - String aSearchFont( rFontName ); - aSearchFont.ToLowerAscii(); - FontNameAttr aSearchAttr; - aSearchAttr.Name = aSearchFont; - - Locale aLocale; - aLocale.Language = rLocale.Language.toAsciiLowerCase(); - aLocale.Country = rLocale.Country.toAsciiUpperCase(); - aLocale.Variant = rLocale.Variant.toAsciiUpperCase(); - - if( ! aLocale.Language.getLength() ) - aLocale = Application::GetSettings().GetUILocale(); - - while( aLocale.Language.getLength() ) - { - std::hash_map< Locale, LocaleSubst, LocaleHash >::const_iterator lang = m_aSubst.find( aLocale ); - if( lang != m_aSubst.end() ) - { - if( ! lang->second.bConfigRead ) - readLocaleSubst( aLocale ); - // try to find an exact match - // because the list is sorted this will also find fontnames of the form searchfontname* - std::vector< FontNameAttr >::const_iterator it = ::std::lower_bound( lang->second.aSubstAttributes.begin(), lang->second.aSubstAttributes.end(), aSearchAttr, StrictStringSort() ); - if( it != lang->second.aSubstAttributes.end() && aSearchFont.CompareTo( it->Name, aSearchFont.Len() ) == COMPARE_EQUAL ) - return &(*it); - } - // gradually become more unspecific - if( aLocale.Variant.getLength() ) - aLocale.Variant = OUString(); - else if( aLocale.Country.getLength() ) - aLocale.Country = OUString(); - else if( ! aLocale.Language.equalsAscii( "en" ) ) - aLocale.Language = OUString( RTL_CONSTASCII_USTRINGPARAM( "en" ) ); - else - aLocale.Language = OUString(); - } - return NULL; -} - -/* - * SettingsConfigItem::get - */ - -SettingsConfigItem* SettingsConfigItem::get() -{ - ImplSVData* pSVData = ImplGetSVData(); - if( ! pSVData->mpSettingsConfigItem ) - pSVData->mpSettingsConfigItem = new SettingsConfigItem(); - return pSVData->mpSettingsConfigItem; -} - -/* - * SettignsConfigItem constructor - */ - -SettingsConfigItem::SettingsConfigItem() - : - ConfigItem( OUString( RTL_CONSTASCII_USTRINGPARAM( SETTINGS_CONFIGNODE ) ), - CONFIG_MODE_DELAYED_UPDATE ), - m_aSettings( 0 ) -{ - getValues(); -} - -/* - * SettingsConfigItem destructor - */ - -SettingsConfigItem::~SettingsConfigItem() -{ - if( IsModified() ) - Commit(); -} - -/* - * SettingsConfigItem::Commit - */ - -void SettingsConfigItem::Commit() -{ - if( ! IsValidConfigMgr() ) - return; - - std::hash_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group; - - for( group = m_aSettings.begin(); group != m_aSettings.end(); ++group ) - { - String aKeyName( group->first ); - /*sal_Bool bAdded =*/ AddNode( OUString(), aKeyName ); - Sequence< PropertyValue > aValues( group->second.size() ); - PropertyValue* pValues = aValues.getArray(); - int nIndex = 0; - SmallOUStrMap::const_iterator it; - for( it = group->second.begin(); it != group->second.end(); ++it ) - { - String aName( aKeyName ); - aName.Append( '/' ); - aName.Append( String( it->first ) ); - pValues[nIndex].Name = aName; - pValues[nIndex].Handle = 0; - pValues[nIndex].Value <<= it->second; - pValues[nIndex].State = PropertyState_DIRECT_VALUE; - nIndex++; - } - ReplaceSetProperties( aKeyName, aValues ); - } -} - -/* - * SettingsConfigItem::Notify - */ - -void SettingsConfigItem::Notify( const Sequence< OUString >& ) -{ - getValues(); -} - -/* - * SettingsConfigItem::getValues - */ -void SettingsConfigItem::getValues() -{ - if( ! IsValidConfigMgr() ) - return; - - m_aSettings.clear(); - - Sequence< OUString > aNames( GetNodeNames( OUString() ) ); - m_aSettings.resize( aNames.getLength() ); - - for( int j = 0; j < aNames.getLength(); j++ ) - { -#if OSL_DEBUG_LEVEL > 2 - fprintf( stderr, "found settings data for \"%s\"\n", - OUStringToOString( aNames.getConstArray()[j], RTL_TEXTENCODING_ASCII_US ).getStr() - ); -#endif - String aKeyName( aNames.getConstArray()[j] ); - Sequence< OUString > aKeys( GetNodeNames( aKeyName ) ); - Sequence< OUString > aSettingsKeys( aKeys.getLength() ); - const OUString* pFrom = aKeys.getConstArray(); - OUString* pTo = aSettingsKeys.getArray(); - for( int m = 0; m < aKeys.getLength(); m++ ) - { - String aName( aKeyName ); - aName.Append( '/' ); - aName.Append( String( pFrom[m] ) ); - pTo[m] = aName; - } - Sequence< Any > aValues( GetProperties( aSettingsKeys ) ); - const Any* pValue = aValues.getConstArray(); - for( int i = 0; i < aValues.getLength(); i++, pValue++ ) - { - if( pValue->getValueTypeClass() == TypeClass_STRING ) - { - const OUString* pLine = (const OUString*)pValue->getValue(); - if( pLine->getLength() ) - m_aSettings[ aKeyName ][ pFrom[i] ] = *pLine; -#if OSL_DEBUG_LEVEL > 2 - fprintf( stderr, " \"%s\"=\"%.30s\"\n", - OUStringToOString( aKeys.getConstArray()[i], RTL_TEXTENCODING_ASCII_US ).getStr(), - OUStringToOString( *pLine, RTL_TEXTENCODING_ASCII_US ).getStr() - ); -#endif - } - } - } -} - -/* - * SettingsConfigItem::getDefaultFont - */ - -const OUString& SettingsConfigItem::getValue( const OUString& rGroup, const OUString& rKey ) const -{ - ::std::hash_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group = m_aSettings.find( rGroup ); - if( group == m_aSettings.end() || group->second.find( rKey ) == group->second.end() ) - { - static OUString aEmpty; - return aEmpty; - } - return group->second.find(rKey)->second; -} - -/* - * SettingsConfigItem::setDefaultFont - */ - -void SettingsConfigItem::setValue( const OUString& rGroup, const OUString& rKey, const OUString& rValue ) -{ - bool bModified = m_aSettings[ rGroup ][ rKey ] != rValue; - if( bModified ) - { - m_aSettings[ rGroup ][ rKey ] = rValue; - SetModified(); - } -} - diff --git a/vcl/source/gdi/fontcvt.cxx b/vcl/source/gdi/fontcvt.cxx deleted file mode 100644 index 565c92740dad..000000000000 --- a/vcl/source/gdi/fontcvt.cxx +++ /dev/null @@ -1,1528 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: fontcvt.cxx,v $ - * $Revision: 1.24 $ - * - * 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/fontcvt.hxx> -#include <vcl/outdev.h> - -#ifndef _STLP_MAP -#include <map> -#endif -#ifndef _STLP_VECTOR -#include <vector> -#endif -#ifndef _STLP_ALGORITHM -#include <algorithm> -#endif -#ifndef _STLP_FUNCTIONAL -#include <functional> -#endif - -//======================================================================= -// note: the character mappings that are only approximations -// are marked (with an empty comment) - -static const sal_Unicode aStarBatsTab[224] = -{ - // F020 - 0x0020, 0x263a, 0x25cf, 0x274d, - 0x25a0, 0x25a1, 0xE000, 0x2751, - 0x2752, 0xE001, 0xE002, 0xE003, - 0x2756, 0xE004, 0xE005, 0x27a2, - // F030 - 0xE006, 0x2794, 0x2713, 0x2612, - 0x2611, 0x27b2, 0x261b, 0x270d, - 0x270e, 0xE007, 0x2714, 0xE008, - 0xE009, 0xE00A, 0x274f, 0x2750, - // F040 - 0xE00B, 0xE00C, 0xE00D, 0xE00E, - 0x2722, 0x2723, 0x2724, 0x2725, - 0x2733, 0x2734, 0x2735, 0x2736, - 0x2737, 0x2738, 0x2739, 0x2717, - // F050 - 0x2718, 0x2719, 0x271a, 0x271b, - 0x271c, 0x272b, 0x272c, 0x272d, - 0x272e, 0x272f, 0x2730, 0, - 0xE00F, 0x278a, 0x278b, 0x278c, - // F060 - 0x278d, 0x278e, 0x278f, 0x2790, - 0x2791, 0x2792, 0x2793, 0xE010, - 0x2780, 0x2781, 0x2782, 0x2783, - 0x2784, 0x2785, 0x2786, 0x2787, - // F070 - 0x2788, 0x2789, 0xE011, 0xE012, - 0x260e, 0xE013, 0xE014, 0xE015, - 0xE016, 0xE017, 0xE018, 0xE019, - 0xE01A, 0x261e, 0xE01B, 0, - // F080 - 0x20ac, 0, 0x201a, 0x0192, - 0x201e, 0x2026, 0x2020, 0x2021, - 0xE01c, 0x2030, 0x0160, 0x2039, - 0x0152, 0, 0x017d, 0, - // F090 - 0, 0x2018, 0x2019, 0x201c, - 0x201d, 0x2022, 0x2013, 0x2014, - 0xE01d, 0x2122, 0x0161, 0x203a, - 0x0153, 0, 0x017e, 0x0178, - // F0A0 - 0, 0x21e7, 0x21e8, 0x21e9, - 0x21e6, 0xE01e, 0xE01f, 0x00a7, - 0xE020, 0xE021, 0xE022, 0x00ab, - 0xE023, 0x2639, 0xE024, 0xE025, - // F0B0 - 0xE026, 0xE027, 0xE028, 0x21e5, - 0x21e4, 0x2192, 0x2193, 0x2190, - 0x2191, 0xE029, 0xE02a, 0x00bb, - 0xE02b, 0xE02c, 0xE02d, 0xE02e, - // F0C0 - 0xE02f, 0xE030, 0xE031, 0xE032, - 0x25be, 0x25b4, 0x25bf, 0x25b5, - 0xE033, 0xE034, 0xE035, 0x2702, - 0x2708, 0x2721, 0x273f, 0x2744, - // F0D0 - 0x25d7, 0x2759, 0xE036, 0xE037, - 0x2762, 0x2663, 0x2665, 0x2660, - 0x2194, 0x2195, 0x2798, 0x279a, - 0x27b8, 0, 0x00b6, 0, - // F0E0 - 0x00a2, 0x00a4, 0x00a5, 0xE038, - 0x20a1, 0x20a2, 0x20a3, 0x20a4, - 0x20a9, 0x20ab, 0x20a8, 0xE039, - 0, 0, 0, 0, - // F0F0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0xE03a -}; - -// ----------------------------------------------------------------------- - -static const sal_Unicode aStarMathTab[224] = -{ - // F020 - 0x0020, 0x0021, 0x0022, 0x0023, - 0xE080, 0x0025, 0x0026, 0x221e, - 0x0028, 0x0029, 0x002a, 0x002b, - 0x002c, 0x002d, 0x002e, 0x002f, - // F030 - 0x2224, 0x21d2, 0x21d0, 0x21d4, - 0xE081, 0xE082, 0x00b0, 0, - 0, 0, 0x003a, 0x003b, - 0x003c, 0x003d, 0x003e, 0x00bf, - // F040 - 0x2260, 0xE083, 0x2212, 0x2217, - 0x00d7, 0x22c5, 0x00f7, 0x00b1, - 0x2213, 0x2295, 0x2296, 0x2297, - 0x2298, 0x2299, 0x222a, 0x2229, - // F050 - 0xE084, 0xE085, 0x2264, 0x2265, - 0xE086, 0xE087, 0x226a, 0x226b, - 0x007e, 0x2243, 0x2248, 0x225d, - 0x2261, 0x221d, 0x2202, 0x2282, - // F060 - 0x2283, 0x2286, 0x2287, 0x2284, - 0x2285, 0x2288, 0x2289, 0x2208, - 0x2209, 0xE089, 0x2203, 0x220d, - 0x2135, 0x2111, 0x211c, 0x2118, - // F070 - 0xE08a, 0x2221, 0x2222, 0x2223, - 0x2225, 0x22a5, 0xE08b, 0x22ef, - 0x22ee, 0x22f0, 0x22f1, 0x22b6, - 0x22b7, 0xE08c, 0x2216, 0x00ac, - // F080 - 0x222b, 0x222c, 0x222d, 0x222e, - 0x222f, 0x2230, 0x221a, 0xE08d, - 0xE08e, 0xE08f, 0x2210, 0x220f, - 0x2211, 0x2207, 0x2200, 0xE090, - // F090 - 0xE091, 0xE092, 0xE093, 0xE094, - 0xE095, 0xE096, 0xE097, 0xE098, - 0x02d9, 0x00a8, 0xE09b, 0x02da, - 0x2227, 0x2228, 0x220b, 0x2205, - // F0A0 - 0x007b, 0x007d, 0xe09e, 0xe09f, - 0x2329, 0x232a, 0x005b, 0x005d, - 0xE0a0, 0x22be, 0xE0a1, 0x2259, - 0x2254, 0x2255, 0x21b3, 0x2197, - // F0B0 - 0x2198, 0x2245, 0x301a, 0x301b, - 0x2373, 0xE0a5, 0xE0a6, 0x22a4, - 0x2112, 0x2130, 0x2131, 0, - 0xE0a7, 0xE0a8, 0xE0a9, 0xE0aa, - // F0C0 - 0x2308, 0x230a, 0x2309, 0x230b, - 0, 0xe0ab, 0xe0ac, 0xe0ad, - 0xe0ae, 0xe0af, 0xe0b0, 0xe0b1, - 0xe0b2, 0xe0b3, 0xe0b4, 0xe0b5, - // F0D0 - 0xe0b6, 0xe0b7, 0xe0b8, 0xe0b9, - 0xe0ba, 0xe0bb, 0xe0bc, 0xe0bd, - 0xe0be, 0xe0bf, 0xe0c0, 0xe0c1, - 0xe0c2, 0xe0c3, 0xe0c4, 0xe0c5, - // F0E0 - 0xe0c6, 0xe0c7, 0xe0c8, 0xe0c9, - 0xe0ca, 0xe0cb, 0xe0cc, 0xe0cd, - 0xe0ce, 0xe0cf, 0xe0d0, 0xe0d1, - 0x03f1, 0xe0d3, 0xe0d4, 0xe0d5, - // F0F0 - 0x2113, 0xe0d6, 0x2107, 0x2127, - 0x210a, 0xe0d9, 0x210f, 0x019b, - 0xe0db, 0xe0dc, 0xe0dd, 0x2115, - 0x2124, 0x211a, 0x211d, 0x2102 -}; - -// ----------------------------------------------------------------------- - -static const sal_Unicode aWingDingsTab[224] = -{ - // F020 - 0x0020, 0xe400, 0xe401, 0xe402, - 0xe403, 0xe404, 0xe405, 0xe406, - 0xe407, 0xe408, 0xe409, 0xe40a, - 0xe40b, 0xe40c, 0xe40d, 0xe40e, - // F030 - 0xe40f, 0xe410, 0xe411, 0xe412, - 0xe413, 0xe414, 0xe415, 0xe416, - 0xe417, 0xe418, 0xe419, 0xe41a, - 0xe41b, 0xe41c, 0x2707, 0xe41d, - // F040 - 0xe41e, 0xe41f, 0xe420, 0xe421, - 0x261c, 0xe423, 0x261d, 0x261f, - 0x261f, 0xe424, 0xe425, 0xe426, - 0xe427, 0xe428, 0xe429, 0xe42a, - // F050 - 0xe42b, 0xe42c, 0x263c, 0xe42d, - 0xe42e, 0xe42f, 0xe430, 0xe431, - 0xe432, 0xe433, 0x262a, 0x262f, - 0x0950, 0xe434, 0x2648, 0x2649, - // F060 - 0x264a, 0x264b, 0x264c, 0x264d, - 0x264e, 0x264f, 0x2650, 0x2651, - 0x2652, 0x2653, 0xe435, 0xe436, - 0xe437, 0xe438, 0xe439, 0xe43a, - // F070 - 0xe43b, 0xe43c, 0xe43d, 0xe43e, - 0xe43f, 0xe440, 0xe441, 0xe442, - 0xe443, 0x2353, 0x2318, 0xe444, - 0xe445, 0xe446, 0xe447, 0, - // F080 - 0xe448, 0xe449, 0xe44a, 0xe44b, - 0xe44c, 0xe44d, 0xe44e, 0xe44f, - 0xe450, 0xe451, 0xe452, 0xe453, - 0xe454, 0xe455, 0xe456, 0xe457, - // F090 - 0xe458, 0xe459, 0xe45a, 0xe45b, - 0xe45c, 0xe45d, 0xe45e, 0xe45f, - 0xe460, 0xe461, 0xe462, 0xe463, - 0xe464, 0xe465, 0xe466, 0xe467, - // F0a0 - 0xe468, 0xe469, 0xe46a, 0xe46b, - 0xe46c, 0xe46d, 0xe46e, 0xe46f, - 0xe470, 0xe471, 0xe472, 0xe473, - 0xe474, 0xe475, 0xe476, 0xe477, - // F0b0 - 0xe478, 0xe479, 0xe47a, 0xe47b, - 0xe47c, 0xe47d, 0xe47e, 0xe47f, - 0xe480, 0xe481, 0xe482, 0xe483, - 0xe484, 0xe485, 0xe486, 0xe487, - // F0c0 - 0xe488, 0xe489, 0xe48a, 0xe48b, - 0xe48c, 0xe48d, 0xe48e, 0xe48f, - 0xe490, 0xe491, 0xe492, 0xe493, - 0xe494, 0xe495, 0xe496, 0xe497, - // F0d0 - 0xe498, 0xe499, 0xe49a, 0xe49b, - 0xe49c, 0x232b, 0x2326, 0xe49d, - 0xe49e, 0xe49f, 0xe4a0, 0xe4a1, - 0xe4a2, 0xe4a3, 0xe4a4, 0xe4a5, - // F0e0 - 0xe4a6, 0xe4a7, 0xe4a8, 0xe4a9, - 0xe4aa, 0xe4ab, 0xe4ac, 0xe4ad, - 0xe4ae, 0xe4af, 0xe4b0, 0xe4b1, - 0xe4b2, 0xe4b3, 0xe4b4, 0xe4b5, - // F0f0 - 0xe4b6, 0xe4b7, 0xe4b8, 0xe4b9, - 0xe4ba, 0xe4bb, 0xe4bc, 0xe4bd, - 0xe4be, 0xe4bf, 0xe4c0, 0xe4c1, - 0xe4c2, 0xe4c3, 0xe4c4, 0xe4c5 -}; - -// ----------------------------------------------------------------------- - -static const sal_Unicode aWingDings2Tab[224] = -{ - // F020 - 0x0020, 0xe500, 0xe501, 0xe502, - 0xe503, 0xe504, 0xe505, 0xe506, - 0xe507, 0xe508, 0xe509, 0xe50a, - 0xe50b, 0xe50c, 0xe50d, 0xe50e, - // F030 - 0xe50f, 0xe510, 0xe511, 0xe512, - 0xe513, 0xe514, 0xe515, 0xe516, - 0xe517, 0xe518, 0xe519, 0xe51a, - 0xe51b, 0xe51c, 0xe51d, 0xe51e, - // F040 - 0xe51f, 0xe520, 0xe521, 0xe522, - 0xe523, 0xe524, 0xe525, 0xe526, - 0xe527, 0xe528, 0xe529, 0xe52a, - 0xe52b, 0xe52c, 0xe52d, 0xe52e, - // F050 - 0xe52f, 0xe530, 0xe531, 0xe532, - 0xe533, 0xe534, 0xe535, 0xe536, - 0xe537, 0xe538, 0xe539, 0xe53a, - 0xe53b, 0xe53c, 0xe53d, 0xe53e, - // F060 - 0xe53f, 0xe540, 0xe541, 0xe542, - 0xe543, 0xe544, 0xe545, 0xe546, - 0xe547, 0xe548, 0xe549, 0xe54a, - 0xe54b, 0xe54c, 0xe54d, 0xe54e, - // F070 - 0xe54e, 0xe54f, 0xe550, 0xe551, - 0xe552, 0xe553, 0xe554, 0xe555, - 0xe556, 0xe557, 0xe558, 0xe559, - 0xe55a, 0xe55b, 0xe55c, 0, - // F080 - 0x2609, 0x25cb, 0x263d, 0x263e, - 0xe55d, 0xe55e, 0xe55f, 0xe560, - 0xe561, 0xe562, 0xe563, 0xe564, - 0xe565, 0xe566, 0xe567, 0xe568, - // F090 - 0xe569, 0xe56a, 0xe56b, 0xe56c, - 0xe56d, 0xe56e, 0xe56f, 0xe570, - 0xe571, 0xe572, 0xe573, 0xe574, - 0xe575, 0xe576, 0xe577, 0xe578, - // F0a0 - 0xe579, 0xe57a, 0xe57b, 0xe57c, - 0xe57d, 0xe57e, 0xe57f, 0xe580, - 0xe581, 0xe582, 0xe583, 0xe584, - 0xe585, 0xe586, 0xe587, 0xe588, - // F0b0 - 0xe589, 0xe58a, 0xe58b, 0xe58c, - 0xe58d, 0xe58e, 0xe58f, 0xe590, - 0xe591, 0xe592, 0xe593, 0xe594, - 0xe595, 0xe596, 0xe597, 0xe598, - // F0c0 - 0xe599, 0xe59a, 0xe59b, 0xe59c, - 0xe59d, 0xe59e, 0xe59f, 0xe5a0, - 0xe5a1, 0xe5a2, 0xe5a3, 0xe5a4, - 0xe5a5, 0xe5a6, 0xe5a7, 0xe5a8, - // F0d0 - 0xe5a9, 0xe5aa, 0xe5ab, 0xe5ac, - 0xe5ad, 0xe5ae, 0xe5af, 0xe5b0, - 0xe5b1, 0xe5b2, 0xe5b3, 0xe5b4, - 0xe5b5, 0xe5b6, 0xe5b7, 0xe5b8, - // F0e0 - 0xe5b9, 0xe5ba, 0xe5bb, 0xe5bc, - 0xe5bd, 0xe5be, 0xe5bf, 0xe5c0, - 0xe5c1, 0xe5c2, 0xe5c3, 0xe5c4, - 0xe5c5, 0xe5c6, 0xe5c7, 0xe5c8, - // F0f0 - 0xe5c9, 0xe5ca, 0xe5cb, 0xe5cc, - 0xe5cd, 0xe5ce, 0xe5cf, 0xe5d0, - 0x203b, 0x2042, 0, 0, - 0, 0, 0, 0 -}; - -// ----------------------------------------------------------------------- - -static const sal_Unicode aWingDings3Tab[224] = -{ - // F020 - 0x0020, 0xe600, 0xe601, 0xe602, - 0xe603, 0x2196, 0xe604, 0x2199, - 0xe605, 0xe606, 0xe607, 0xe608, - 0xe609, 0xe60a, 0xe60b, 0x21de, - // F030 - 0x21df, 0xe60c, 0xe60d, 0xe60e, - 0x21e2, 0x21e1, 0x21e3, 0x21af, - 0x21b5, 0xe60f, 0xe610, 0xe611, - 0xe612, 0xe613, 0xe614, 0xe615, - // F040 - 0xe616, 0xe617, 0xe618, 0xe619, - 0x21c4, 0x21c5, 0xe61a, 0xe61b, - 0x21c7, 0x21c9, 0x21c8, 0x21ca, - 0x21b6, 0x21b7, 0xe61c, 0xe61d, - // F050 - 0x21bb, 0x21ba, 0xe61e, 0x2324, - 0x2303, 0x2325, 0x2334, 0xe61f, - 0x21ea, 0xe620, 0xe621, 0xe622, - 0xe623, 0xe624, 0xe625, 0xe626, - // F060 - 0xe627, 0xe628, 0xe629, 0xe62a, - 0xe62b, 0xe62c, 0xe62d, 0xe62e, - 0xe62f, 0xe630, 0xe631, 0xe632, - 0xe633, 0xe634, 0xe635, 0xe636, - // F070 - 0xe637, 0xe638, 0x25b3, 0x25bd, - 0x25c0, 0x25b6, 0x25c1, 0x25b7, - 0x25e3, 0xe639, 0x25e4, 0x25e5, - 0x25c2, 0x25b8, 0xe63a, 0, - // F080 - 0xe63b, 0xe63c, 0xe63d, 0xe63e, - 0xe63f, 0xe640, 0xe641, 0xe642, - 0xe643, 0xe644, 0xe645, 0xe646, - 0xe647, 0xe648, 0xe649, 0xe64a, - // F090 - 0xe64b, 0xe64c, 0xe64d, 0xe64e, - 0xe64f, 0xe650, 0xe651, 0xe652, - 0xe653, 0xe654, 0xe655, 0xe656, - 0xe657, 0xe658, 0xe659, 0xe65a, - // F0a0 - 0xe65b, 0xe65c, 0xe65d, 0xe65e, - 0xe65f, 0xe660, 0xe661, 0xe662, - 0xe663, 0xe664, 0xe665, 0xe666, - 0xe667, 0xe668, 0xe669, 0xe66a, - // F0b0 - 0xe66b, 0xe66c, 0xe66d, 0xe66e, - 0xe66f, 0xe670, 0xe671, 0xe672, - 0xe673, 0xe674, 0xe675, 0xe676, - 0xe677, 0xe678, 0xe679, 0xe67a, - // F0c0 - 0xe67b, 0xe67c, 0xe67d, 0xe67e, - 0xe67f, 0xe680, 0xe681, 0xe682, - 0xe683, 0xe684, 0xe685, 0xe686, - 0xe687, 0xe688, 0xe689, 0xe68a, - // F0d0 - 0xe68b, 0xe68c, 0xe68d, 0xe68e, - 0xe68f, 0xe690, 0xe691, 0xe692, - 0xe693, 0xe694, 0xe695, 0xe696, - 0xe697, 0xe698, 0xe699, 0xe69a, - // F0e0 - 0xe69b, 0xe69c, 0xe69d, 0xe69e, - 0xe69f, 0xe6a0, 0xe6a1, 0xe6a2, - 0xe6a3, 0xe6a4, 0xe6a5, 0xe6a6, - 0xe6a7, 0xe6a8, 0xe6a9, 0xe6aa, - // F0f0 - 0xe6ab, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0 -}; - -// ----------------------------------------------------------------------- - -static const sal_Unicode aWebDingsTab[224] = -{ - // F020 - 0x0020, 0xe300, 0xe301, 0xe302, - 0xe303, 0xe304, 0xe305, 0xe306, - 0xe307, 0xe308, 0xe309, 0xe30a, - 0xe30b, 0xe30c, 0xe30d, 0xe30e, - // F030 - 0xe30f, 0xe310, 0xe311, 0xe312, - 0xe313, 0xe314, 0xe315, 0xe316, - 0xe317, 0xe318, 0xe319, 0xe31a, - 0xe31b, 0xe31c, 0xe31d, 0xe31e, - // F040 - 0xe31f, 0xe320, 0xe321, 0xe322, - 0xe323, 0xe324, 0xe325, 0xe326, - 0xe327, 0xe328, 0xe329, 0xe32a, - 0xe32b, 0xe32c, 0xe32d, 0xe32e, - // F050 - 0xe32f, 0xe330, 0xe331, 0xe332, - 0xe333, 0xe334, 0xe335, 0xe336, - 0xe337, 0xe338, 0xe339, 0xe33a, - 0xe33b, 0xe33c, 0xe33d, 0xe33e, - // F060 - 0xe33f, 0xe340, 0xe341, 0xe342, - 0xe343, 0xe344, 0xe345, 0xe346, - 0xe347, 0xe348, 0xe349, 0xe34a, - 0xe34b, 0xe34c, 0xe34d, 0xe34e, - // F070 - 0xe34f, 0xe350, 0xe351, 0xe352, - 0xe353, 0xe354, 0xe355, 0xe356, - 0xe357, 0xe358, 0xe359, 0xe35a, - 0xe35b, 0xe35c, 0xe35d, 0, - // F080 - 0xe35e, 0xe35f, 0xe360, 0xe361, - 0xe362, 0xe363, 0xe364, 0xe365, - 0xe366, 0xe367, 0xe368, 0xe369, - 0xe36a, 0xe36b, 0xe36c, 0xe36d, - // F090 - 0xe36e, 0xe36f, 0xe370, 0xe371, - 0xe372, 0xe373, 0xe374, 0xe375, - 0xe376, 0xe377, 0xe378, 0xe379, - 0xe37a, 0xe37b, 0xe37c, 0xe37d, - // F0a0 - 0xe37e, 0xe37f, 0xe380, 0xe381, - 0xe382, 0xe383, 0xe384, 0xe385, - 0xe386, 0xe387, 0xe388, 0xe389, - 0xe38a, 0xe38b, 0xe38c, 0xe38d, - // F0b0 - 0xe38e, 0xe38f, 0xe390, 0xe391, - 0xe392, 0xe393, 0xe394, 0xe395, - 0xe396, 0xe397, 0xe398, 0xe399, - 0xe39a, 0xe39b, 0xe39c, 0xe39d, - // F0c0 - 0xe39e, 0xe39f, 0xe3a0, 0xe3a1, - 0xe3a2, 0xe3a3, 0xe3a4, 0xe3a5, - 0xe3a6, 0xe3a7, 0xe3a8, 0xe3a9, - 0xe3aa, 0xe3ab, 0xe3ac, 0xe3ad, - // F0d0 - 0xe3ae, 0xe3af, 0xe3b0, 0xe3b1, - 0xe3b2, 0xe3b3, 0xe3b4, 0xe3b5, - 0xe3b6, 0xe3b7, 0xe3b8, 0xe3b9, - 0xe3ba, 0xe3bb, 0xe3bc, 0xe3bd, - // F0e0 - 0xe3be, 0xe3bf, 0xe3c0, 0xe3c1, - 0xe3c2, 0xe3c3, 0xe3c4, 0xe3c5, - 0xe3c6, 0xe3c7, 0xe3c8, 0xe3c9, - 0xe3ca, 0xe3cb, 0xe3cd, 0xe3ce, - // F0f0 - 0xe3cf, 0xe3d0, 0xe3d1, 0xe3d2, - 0xe3d3, 0xe3d4, 0xe3d5, 0xe3d6, - 0xe3d7, 0xe3d8, 0xe3d9, 0xe3da, - 0xe3db, 0xe3dc, 0xe3dd, 0xe3de -}; - -// ----------------------------------------------------------------------- - -static const sal_Unicode aAdobeSymbolTab[224] = -{ -//TODO: - // F020 - 0x0020, 0xe100, 0xe101, 0xe102, - 0xe103, 0xe104, 0xe16a, 0xe105, - 0xe106, 0xe107, 0xe108, 0xe109, - 0xe10a, 0xe10b, 0xe10c, 0xe10d, - // F030 - 0x0030, 0x0031, 0x0032, 0x0033, - 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0xe10e, 0xe10f, - 0xe110, 0xe111, 0xe112, 0x003f, - // F040 - 0xe113, 0x0391, 0x0392, 0x03a7, - 0x0394, 0x0395, 0x03a6, 0x0393, - 0x0397, 0x0399, 0x03d1, 0x039a, - 0x039b, 0x039c, 0x039d, 0x039f, - // F050 - 0x03a0, 0x0398, 0x03a1, 0x03a3, - 0x03a4, 0x03a5, 0x03c2, 0x03a9, - 0x039e, 0x03a8, 0x0396, 0xe114, - 0x2234, 0xe115, 0xe116, 0x005f, - // F060 - 0x00af, 0x03b1, 0x03b2, 0x03c7, - 0x03b4, 0x03b5, 0x03d5, 0x03b3, - 0x03b7, 0x03b9, 0x03c6, 0x03ba, - 0x03bb, 0x03bc, 0x03bd, 0x03bf, - // F070 - 0x03c0, 0x03b8, 0x03c1, 0x03c3, - 0x03c4, 0x03c5, 0x03d6, 0x03c9, - 0x03be, 0x03c8, 0x03b6, 0xe117, - 0x007c, 0xe118, 0xe119, 0, - // F080 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F090 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0a0 - 0xe11a, 0x03d2, 0x0384, 0xe11b, - 0x2215, 0xe11c, 0xe11d, 0xe11e, - 0x2666, 0xe11f, 0xe120, 0xe121, - 0xe122, 0xe123, 0xe124, 0xe125, - // F0b0 - 0xe126, 0xe127, 0x2033, 0xe128, - 0xe129, 0xe12a, 0xe12b, 0xe12c, - 0xe12d, 0xe12e, 0xe12f, 0xe130, - 0xe131, 0x2502, 0x2500, 0x21b2, - // F0c0 - 0xe132, 0xe133, 0xe134, 0xe135, - 0xe136, 0xe137, 0xe138, 0xe139, - 0xe13a, 0xe13b, 0xe13c, 0xe13d, - 0xe13e, 0xe13f, 0xe140, 0xe141, - // F0d0 - 0x2220, 0xe142, 0x00ae, 0x00a9, - 0xe143, 0xe144, 0xe145, 0xe146, - 0xe147, 0xe148, 0xe149, 0xe14a, - 0xe14b, 0x21d1, 0xe14c, 0x21d3, - // F0e0 - 0x25ca, 0xe14d, 0xe14e, 0xe14f, - 0xe150, 0xe151, 0xe152, 0xe153, - 0xe154, 0xe155, 0xe156, 0xe157, - 0xe158, 0xe159, 0xe15a, 0xe15b, - // F0f0 - 0, 0xe15c, 0xe15d, 0xe15e, - 0xe15f, 0xe160, 0xe161, 0xe162, - 0xe163, 0xe164, 0xe165, 0xe166, - 0xe167, 0xe168, 0xe169, 0, -}; - -// ----------------------------------------------------------------------- - -static const sal_Unicode aMonotypeSortsTab[224] = -{ - // F020 - 0x0020, 0x2701, 0xe200, 0x2703, - 0x2704, 0xe201, 0x2706, 0xe202, - 0xe203, 0xe203, 0xe204, 0xe205, - 0x270c, 0xe206, 0xe207, 0xe208, - // F030 - 0x2710, 0x2711, 0x2712, 0xe209, - 0xe20a, 0x2715, 0x2716, 0xe20b, - 0xe20c, 0xe20d, 0xe20e, 0xe20f, - 0xe210, 0x271d, 0x271e, 0x271f, - // F040 - 0x2720, 0xe211, 0xe212, 0xe213, - 0xe214, 0xe215, 0x2726, 0x2727, - 0x2605, 0x2729, 0x272a, 0xe216, - 0xe217, 0xe218, 0xe219, 0xe21a, - // F050 - 0xe21b, 0xe21c, 0x2732, 0xe21d, - 0xe21e, 0xe21f, 0xe220, 0xe221, - 0xe222, 0xe223, 0x273a, 0x273b, - 0x273c, 0x273d, 0x273e, 0xe224, - // F060 - 0x2740, 0x2741, 0x2742, 0x2743, - 0xe225, 0x2745, 0x2746, 0x2747, - 0x2748, 0x2749, 0x274a, 0x274b, - 0xe226, 0xe227, 0xe228, 0xe229, - // F070 - 0xe22a, 0xe22b, 0xe22c, 0x25b2, - 0x25bc, 0xe22d, 0xe22e, 0xe22f, - 0x2758, 0xe230, 0x275a, 0x275b, - 0x275c, 0x275d, 0x275e, 0, - // F080 - 0xe231, 0xe232, 0xe233, 0xe234, - 0xe235, 0xe236, 0xe237, 0xe238, - 0xe239, 0xe23a, 0xe23b, 0xe23c, - 0xe23d, 0xe23e, 0, 0, - // F090 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0a0 - 0, 0xe23f, 0xe240, 0x2763, - 0x2764, 0x2765, 0x2766, 0x2767, - 0xe241, 0xe242, 0xe243, 0xe244, - 0x2460, 0x2461, 0x2462, 0x2463, - // F0b0 - 0x2464, 0x2465, 0x2466, 0x2467, - 0x2468, 0x2469, 0x2776, 0x2777, - 0x2778, 0x2779, 0x277a, 0x277b, - 0x277c, 0x277d, 0x277e, 0x277f, - // F0c0 - 0xe245, 0xe246, 0xe247, 0xe248, - 0xe249, 0xe24a, 0xe24b, 0xe24c, - 0xe24d, 0xe24e, 0xe24f, 0xe250, - 0xe251, 0xe252, 0xe253, 0xe254, - // F0d0 - 0xe255, 0xe256, 0xe257, 0xe258, - 0xe259, 0xe25a, 0xe25b, 0xe25c, - 0xe25d, 0x2799, 0xe25e, 0x279b, - 0x279c, 0x279d, 0x279e, 0x279f, - // F0e0 - 0x27a0, 0x27a1, 0xe25f, 0x27a3, - 0x27a4, 0x27a5, 0x27a6, 0x27a7, - 0x27a8, 0x27a9, 0x27aa, 0x27ab, - 0x27ac, 0x27ad, 0x27ae, 0x27af, - // F0f0 - 0, 0x27b1, 0xe260, 0x27b3, - 0x27b4, 0x27b5, 0x27b6, 0x27b7, - 0xe261, 0x27b9, 0x27ba, 0x27bb, - 0x27bc, 0x27bd, 0x27be, 0, -}; - -// ----------------------------------------------------------------------- - -/* -static const sal_Unicode aMonotypeSorts2Tab[224] = -{ -//TODO: - // F020 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F030 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F040 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F050 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F060 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F070 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F080 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F090 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0a0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0b0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0c0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0d0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0e0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0f0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, -}; -*/ - -static const sal_Unicode aMTExtraTab[224] = -{ - // F020 - 0x0020, 0, 0, 0xE095, - 0xE091, 0xE096, 0x02D9, 0, - 0xE093, 0, 0, 0, - 0, 0, 0, 0, - // F030 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0x25C1, 0, 0x25B7, 0, - // F040 - 0, 0, 0x2210, 0x019b, - 0, 0, 0, 0, - 0, 0x2229, 0, 0xE08B, - 0x22EF, 0x22EE, 0x22F0, 0x22F1, - // F050 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F060 - 0xE095, 0, 0xE25C, 0xE4BA, - 0, 0, 0x210F, 0, - 0, 0, 0, 0, - 0x2113, 0x2213, 0, 0x00B0, - // F070 - 0, 0, 0xE098, 0, - 0, 0xE097, 0, 0, - 0, 0, 0, 0xE081, - 0, 0xE082, 0, 0, - // F080 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F090 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0a0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0b0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0c0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0d0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0e0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0f0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0 -}; - - -//======================================================================= - -static sal_Unicode ImplStarSymbolToStarBats( sal_Unicode c ) -{ - switch ( c ) - { - case 0x00A2: c = 0xF0E0; break; - case 0x00A4: c = 0xF0E1; break; - case 0x00A5: c = 0xF0E2; break; - case 0x00A7: c = 0xF0A7; break; - case 0x00AB: c = 0xF0AB; break; - case 0x00B6: c = 0xF0DE; break; - case 0x00BB: c = 0xF0BB; break; - - case 0x0152: c = 0xF08C; break; - case 0x0153: c = 0xF09C; break; - case 0x0160: c = 0xF08A; break; - case 0x0161: c = 0xF09A; break; - case 0x0178: c = 0xF09F; break; - case 0x017D: c = 0xF08E; break; - case 0x017E: c = 0xF09E; break; - - case 0x0192: c = 0xF083; break; - case 0x02C6: c = 0xF088; break; - case 0x02DC: c = 0xF098; break; - case 0x2013: c = 0xF096; break; - case 0x2014: c = 0xF097; break; - case 0x2018: c = 0xF091; break; - - case 0x2019: c = 0xF092; break; - case 0x201A: c = 0xF082; break; - case 0x201C: c = 0xF093; break; - case 0x201D: c = 0xF094; break; - case 0x201E: c = 0xF084; break; - case 0x2020: c = 0xF086; break; - - case 0x2021: c = 0xF087; break; - case 0x2022: c = 0xF095; break; - case 0x2026: c = 0xF085; break; - case 0x2030: c = 0xF089; break; - case 0x2039: c = 0xF08B; break; - case 0x203A: c = 0xF09B; break; - - case 0x20A1: c = 0xF0E4; break; - case 0x20A2: c = 0xF0E5; break; - case 0x20A3: c = 0xF0E6; break; - case 0x20A4: c = 0xF0E7; break; - case 0x20A8: c = 0xF0EA; break; - case 0x20A9: c = 0xF0E8; break; - case 0x20AB: c = 0xF0E9; break; - case 0x20AC: c = 0xF080; break; - - case 0x2122: c = 0xF099; break; - case 0x2190: c = 0xF0B7; break; - case 0x2191: c = 0xF0B8; break; - case 0x2192: c = 0xF0B5; break; - case 0x2193: c = 0xF0B6; break; - case 0x2194: c = 0xF0D8; break; - case 0x2195: c = 0xF0D9; break; - - case 0x21E4: c = 0xF0B4; break; - case 0x21E5: c = 0xF0B3; break; - case 0x21E6: c = 0xF0A4; break; - case 0x21E7: c = 0xF0B2; break; - case 0x21E8: c = 0xF0AF; break; - case 0x21E9: c = 0xF0A3; break; - - case 0x25A0: c = 0xF024; break; - case 0x25A1: c = 0xF025; break; - case 0x25B4: c = 0xF0C5; break; - case 0x25B5: c = 0xF0C7; break; - case 0x25BE: c = 0xF0C4; break; - case 0x25BF: c = 0xF0C6; break; - case 0x25C6: c = 0xF043; break; - case 0x25CF: c = 0xF022; break; - case 0x25D7: c = 0xF0D0; break; - - case 0x260E: c = 0xF074; break; - case 0x2611: c = 0xF034; break; - case 0x2612: c = 0xF033; break; - case 0x261B: c = 0xF036; break; - case 0x261E: c = 0xF07D; break; - case 0x2639: c = 0xF0AD; break; - case 0x263A: c = 0xF021; break; - - case 0x2702: c = 0xF0CB; break; - case 0x2708: c = 0xF0CC; break; - case 0x270D: c = 0xF07E; break; - case 0x270E: c = 0xF038; break; - - case 0x2713: c = 0xF039; break; - case 0x2714: c = 0xF03A; break; - case 0x2717: c = 0xF04F; break; - case 0x2718: c = 0xF050; break; - case 0x2719: c = 0xF051; break; - case 0x271A: c = 0xF052; break; - case 0x271B: c = 0xF053; break; - case 0x271C: c = 0xF054; break; - - case 0x2721: c = 0xF0CD; break; - case 0x2722: c = 0xF044; break; - case 0x2723: c = 0xF045; break; - case 0x2724: c = 0xF046; break; - case 0x2725: c = 0xF047; break; - case 0x272B: c = 0xF055; break; - case 0x272C: c = 0xF056; break; - case 0x272D: c = 0xF057; break; - case 0x272E: c = 0xF058; break; - case 0x272F: c = 0xF059; break; - - case 0x2730: c = 0xF05A; break; - case 0x2733: c = 0xF048; break; - case 0x2734: c = 0xF049; break; - case 0x2735: c = 0xF04A; break; - case 0x2736: c = 0xF04B; break; - case 0x2737: c = 0xF04C; break; - case 0x2738: c = 0xF04D; break; - case 0x2739: c = 0xF04E; break; - case 0x273F: c = 0xF0CE; break; - - case 0x2744: c = 0xF0CF; break; - case 0x274D: c = 0xF023; break; - case 0x274F: c = 0xF03E; break; - case 0x2750: c = 0xF03F; break; - case 0x2751: c = 0xF027; break; - case 0x2752: c = 0xF028; break; - case 0x2756: c = 0xF02C; break; - case 0x2759: c = 0xF0D1; break; - case 0x2762: c = 0xF0D4; break; - - case 0x2780: c = 0xF068; break; - case 0x2781: c = 0xF069; break; - case 0x2782: c = 0xF06A; break; - case 0x2783: c = 0xF06B; break; - case 0x2784: c = 0xF06C; break; - case 0x2785: c = 0xF06D; break; - case 0x2786: c = 0xF06E; break; - case 0x2787: c = 0xF06F; break; - case 0x2788: c = 0xF070; break; - case 0x2789: c = 0xF071; break; - case 0x278A: c = 0xF05D; break; - case 0x278B: c = 0xF05E; break; - case 0x278C: c = 0xF05F; break; - case 0x278D: c = 0xF060; break; - case 0x278E: c = 0xF061; break; - case 0x278F: c = 0xF062; break; - - case 0x2790: c = 0xF063; break; - case 0x2791: c = 0xF064; break; - case 0x2792: c = 0xF065; break; - case 0x2793: c = 0xF066; break; - case 0x2794: c = 0xF031; break; - case 0x2798: c = 0xF0DA; break; - case 0x279A: c = 0xF0DB; break; - - case 0x27A2: c = 0xF02F; break; - case 0x27B2: c = 0xF035; break; - case 0x27B8: c = 0xF0DC; break; - - case 0xE000: c = 0xF000+38; break; - case 0xE001: c = 0xF000+41; break; - case 0xE002: c = 0xF000+42; break; - case 0xE003: c = 0xF000+43; break; - case 0xE004: c = 0xF000+45; break; - case 0xE005: c = 0xF000+46; break; - case 0xE006: c = 0xF000+48; break; - case 0xE007: c = 0xF000+57; break; - - case 0xE008: c = 0xF000+59; break; - case 0xE009: c = 0xF000+60; break; - case 0xE00a: c = 0xF000+61; break; - case 0xE00b: c = 0xF000+64; break; - case 0xE00c: c = 0xF000+65; break; - case 0xE00d: c = 0xF000+66; break; - case 0xE00e: c = 0xF000+67; break; - case 0xE00f: c = 0xF000+92; break; - - case 0xE010: c = 0xF000+103; break; - case 0xE011: c = 0xF000+114; break; - case 0xE012: c = 0xF000+115; break; - case 0xE013: c = 0xF000+117; break; - case 0xE014: c = 0xF000+118; break; - case 0xE015: c = 0xF000+119; break; - case 0xE016: c = 0xF000+120; break; - case 0xE017: c = 0xF000+121; break; - - case 0xE018: c = 0xF000+122; break; - case 0xE019: c = 0xF000+123; break; - case 0xE01a: c = 0xF000+124; break; - case 0xE01b: c = 0xF000+126; break; - case 0xE01c: c = 0xF000+136; break; - case 0xE01d: c = 0xF000+155; break; - case 0xE01e: c = 0xF000+165; break; - case 0xE01f: c = 0xF000+166; break; - - case 0xE020: c = 0xF000+168; break; - case 0xE021: c = 0xF000+169; break; - case 0xE022: c = 0xF000+170; break; - case 0xE023: c = 0xF000+172; break; - case 0xE024: c = 0xF000+174; break; - case 0xE025: c = 0xF000+175; break; - case 0xE026: c = 0xF000+176; break; - case 0xE027: c = 0xF000+177; break; - - case 0xE028: c = 0xF000+178; break; - case 0xE029: c = 0xF000+185; break; - case 0xE02a: c = 0xF000+186; break; - case 0xE02b: c = 0xF000+188; break; - case 0xE02c: c = 0xF000+189; break; - case 0xE02d: c = 0xF000+190; break; - case 0xE02e: c = 0xF000+191; break; - case 0xE02f: c = 0xF000+192; break; - - case 0xE030: c = 0xF000+193; break; - case 0xE031: c = 0xF000+194; break; - case 0xE032: c = 0xF000+195; break; - case 0xE033: c = 0xF000+200; break; - case 0xE034: c = 0xF000+201; break; - case 0xE035: c = 0xF000+202; break; - case 0xE036: c = 0xF000+210; break; - case 0xE037: c = 0xF000+211; break; - - case 0xE038: c = 0xF000+227; break; - case 0xE039: c = 0xF000+235; break; - case 0xE03a: c = 0xF000+255; break; - - default: c = 0; break; - } - - return c; -} - -enum SymbolFont -{ - Symbol=1, Wingdings=2, MonotypeSorts=4, Webdings=8, Wingdings2=16, - Wingdings3=32, MTExtra=64, TimesNewRoman=128 -}; - -const char *aSymbolNames[] = -{ - "Symbol", "Wingdings", "Monotype Sorts", "Webdings", "Wingdings 2", - "Wingdings 3", "MT Extra", "Times New Roman" -}; - -struct SymbolEntry -{ - sal_uInt8 cIndex; - enum SymbolFont eFont; -}; - -class StarSymbolToMSMultiFontImpl : public StarSymbolToMSMultiFont -{ -private: - ::std::multimap<sal_Unicode, SymbolEntry> maMagicMap; -public: - StarSymbolToMSMultiFontImpl(bool bPerfectOnly); - String ConvertChar(sal_Unicode &rChar); - String ConvertString(String &rString, xub_StrLen& rIndex); -}; - -struct ExtraTable { sal_Unicode cStar; sal_uInt8 cMS;}; - -ExtraTable aWingDingsExtraTab[] = -{ - {0x25cf, 0x6C}, {0x2714, 0xFC}, {0x2717, 0xFB}, {0x2794, 0xE8}, - {0x27a2, 0xD8}, {0xe000, 0x6F}, {0xe001, 0x73}, {0xe002, 0x74}, - {0xe003, 0x75}, {0xe004, 0x77}, {0xe005, 0xA6}, {0xe006, 0xE0}, - {0xe007, 0xFC}, {0xe008, 0x6C}, {0xe009, 0x6D}, {0xe00a, 0x6E}, - {0xe00b, 0x72}, {0xe00c, 0x75}, {0xe00d, 0x76}, {0xe00e, 0x74}, - {0xe00f, 0x8B}, {0xe010, 0x80}, {0xe011, 0x2B}, {0xe012, 0x3A}, - {0xe013, 0x5D}, {0xe014, 0x29}, {0xe015, 0x3A}, {0xe016, 0x3C}, - {0xe017, 0x38}, {0xe018, 0x3A}, {0xe019, 0x2A}, {0xe01a, 0x2B}, - {0xe01b, 0x3F}, {0xe01c, 0x9F}, {0xe01d, 0x80}, {0xe01e, 0x8B}, - {0xe023, 0x4A}, {0xe025, 0xF0}, {0xe026, 0xF2}, {0xe027, 0xEF}, - {0xe028, 0xF1}, {0xe029, 0x52}, {0xe02a, 0x29}, {0xe02b, 0xE0}, - {0xe02c, 0xE2}, {0xe02d, 0xDF}, {0xe02e, 0xE1}, {0xe02f, 0xAC}, - {0xe030, 0xAD}, {0xe031, 0xAE}, {0xe032, 0x7C}, {0xe033, 0x43}, - {0xe034, 0x4D}, {0xe0aa, 0x71}, {0xe422, 0x44} -}; - -ExtraTable aSymbolExtraTab2[] = -{ - {0x0020, 0x20}, {0x00A0, 0x20}, {0x0021, 0x21}, {0x2200, 0x22}, - {0x0023, 0x23}, {0x2203, 0x24}, {0x0025, 0x25}, {0x0026, 0x26}, - {0x220B, 0x27}, {0x0028, 0x28}, {0x0029, 0x29}, {0x2217, 0x2A}, - {0x002B, 0x2B}, {0x002C, 0x2C}, {0x2212, 0x2D}, {0x002E, 0x2E}, - {0x002F, 0x2F}, {0x003A, 0x3A}, {0x003B, 0x3B}, {0x003C, 0x3C}, - {0x003D, 0x3D}, {0x003E, 0x3E}, {0x2245, 0x40}, {0x2206, 0x44}, - {0x2126, 0x57}, {0x005B, 0x5B}, {0x005D, 0x5D}, {0x22A5, 0x5E}, - {0x03C6, 0x66}, {0x03D5, 0x6A}, {0x00B5, 0x6D}, {0x007B, 0x7B}, - {0x007C, 0x7C}, {0x007D, 0x7D}, {0x223C, 0x7E}, {0x20AC, 0xA0}, - {0x2032, 0xA2}, {0x2264, 0xA3}, {0x2044, 0xA4}, {0x221E, 0xA5}, - {0x0192, 0xA6}, {0x2663, 0xA7}, {0x2665, 0xA9}, {0x2660, 0xAA}, - {0x2194, 0xAB}, {0x2190, 0xAC}, {0x2191, 0xAD}, {0x2192, 0xAE}, - {0x2193, 0xAF}, {0x00B0, 0xB0}, {0x00B1, 0xB1}, {0x2265, 0xB3}, - {0x00D7, 0xB4}, {0x221D, 0xB5}, {0x2202, 0xB6}, {0x2022, 0xB7}, - {0x00F7, 0xB8}, {0x2260, 0xB9}, {0x2261, 0xBA}, {0x2248, 0xBB}, - {0x2026, 0xBC}, {0x21B5, 0xBF}, {0x2135, 0xC0}, {0x2111, 0xC1}, - {0x211C, 0xC2}, {0x2118, 0xC3}, {0x2297, 0xC4}, {0x2295, 0xC5}, - {0x2205, 0xC6}, {0x2229, 0xC7}, {0x222A, 0xC8}, {0x2283, 0xC9}, - {0x2287, 0xCA}, {0x2284, 0xCB}, {0x2282, 0xCC}, {0x2286, 0xCD}, - {0x2208, 0xCE}, {0x2209, 0xCF}, {0x2207, 0xD1}, {0x220F, 0xD5}, - {0x221A, 0xD6}, {0x22C5, 0xD7}, {0x00AC, 0xD8}, {0x2227, 0xD9}, - {0x2228, 0xDA}, {0x21D4, 0xDB}, {0x21D0, 0xDC}, {0x21D2, 0xDE}, - {0x2329, 0xE1}, {0x2211, 0xE5}, {0x232A, 0xF1}, {0x222B, 0xF2}, - {0x2320, 0xF3}, {0x2321, 0xF5}, {0x2013, 0x2D} -}; - -ExtraTable aSymbolExtraTab[] = -{ - {0xe021, 0xD3}, {0xe024, 0xD2}, {0xe035, 0x20}, {0xe036, 0x28}, - {0xe037, 0x29}, {0xe039, 0x20}, {0xe083, 0x2B}, {0xe084, 0x3C}, - {0xe085, 0x3E}, {0xe086, 0xA3}, {0xe087, 0xB3}, {0xe089, 0xCE}, - {0xe08a, 0xA6}, {0xe08c, 0xAE}, {0xe08d, 0xD6}, {0xe08e, 0xD6}, - {0xe08f, 0xD6}, {0xe094, 0xA2}, {0xe09e, 0x28}, {0xe09f, 0x29}, - {0xe0a0, 0xD0}, {0xe0a6, 0xA2}, {0xe0a7, 0x7C}, {0xe0a8, 0x2F}, - {0xe0ab, 0x7C}, {0xe0ac, 0x47}, {0xe0ad, 0x44}, {0xe0ae, 0x51}, - {0xe0af, 0x4C}, {0xe0b0, 0x58}, {0xe0b1, 0x50}, {0xe0b2, 0x53}, - {0xe0b3, 0x55}, {0xe0b4, 0x46}, {0xe0b5, 0x59}, {0xe0b6, 0x57}, - {0xe0b7, 0x61}, {0xe0b8, 0x62}, {0xe0b9, 0x67}, {0xe0ba, 0x64}, - {0xe0bb, 0x65}, {0xe0bc, 0x7A}, {0xe0bd, 0x68}, {0xe0be, 0x71}, - {0xe0bf, 0x69}, {0xe0c0, 0x6B}, {0xe0c1, 0x6C}, {0xe0c2, 0x6D}, - {0xe0c3, 0x6E}, {0xe0c4, 0x78}, {0xe0c5, 0x6F}, {0xe0c6, 0x70}, - {0xe0c7, 0x72}, {0xe0c8, 0x73}, {0xe0c9, 0x74}, {0xe0ca, 0x75}, - {0xe0cb, 0x66}, {0xe0cc, 0x63}, {0xe0cd, 0x79}, {0xe0ce, 0x77}, - {0xe0cf, 0x65}, {0xe0d0, 0x4A}, {0xe0d1, 0x76}, {0xe0d3, 0x56}, - {0xe0d4, 0x6A}, {0xe0d5, 0xB6}, {0xe0d6, 0x69}, {0xe0db, 0xAC}, - {0xe0dc, 0xAD}, {0xe0dd, 0xAF} -}; - -ExtraTable aTNRExtraTab[] = -{ - {0xe021, 0xA9}, - {0xe022, 0x40}, - {0xe024, 0xAE}, - {0xe035, 0x20}, - {0xe036, '('}, - {0xe037, ')'}, - {0xe039, 0x20}, - {0xe03a, 0x80}, - {0xe080, 0x89}, - {0xe083, '+'}, - {0xe084, '<'}, - {0xe085, '>'}, - {0xe0a9, '\\'} -}; - -StarSymbolToMSMultiFontImpl::StarSymbolToMSMultiFontImpl(bool bPerfectOnly) -{ - struct ConvertTable - { - enum SymbolFont meFont; - const sal_Unicode* pTab; - }; - - //In order of preference - const ConvertTable aConservativeTable[] = - { - {Symbol, aAdobeSymbolTab}, - {Wingdings, aWingDingsTab}, - {MonotypeSorts, aMonotypeSortsTab}, - {Webdings, aWebDingsTab}, - {Wingdings2, aWingDings2Tab}, - {Wingdings3, aWingDings3Tab}, - {MTExtra, aMTExtraTab} - }; - - struct ExtendedConvertTable - { - enum SymbolFont meFont; - const ExtraTable *mpTable; - size_t mnSize; - ExtendedConvertTable(SymbolFont eFont, const ExtraTable *pTable, - size_t nSize) - : meFont(eFont), mpTable(pTable), mnSize(nSize) {} - }; - - //Reverse map from a given starsymbol char to exact matches in ms symbol - //fonts. - int nEntries = sizeof(aConservativeTable) / sizeof(aConservativeTable[0]); - int i; - for (i = 0; i < nEntries; ++i) - { - const ConvertTable& r = aConservativeTable[i]; - SymbolEntry aEntry; - aEntry.eFont = r.meFont; - for (aEntry.cIndex = 0xFF; aEntry.cIndex >= 0x20; --aEntry.cIndex) - { - if (sal_Unicode cChar = r.pTab[aEntry.cIndex-0x20]) - maMagicMap.insert( - ::std::multimap<sal_Unicode, SymbolEntry>::value_type( - cChar, aEntry)); - } - } - - //In order of preference - const ExtendedConvertTable aAgressiveTable[] = - { - ExtendedConvertTable(Symbol, aSymbolExtraTab2, - sizeof(aSymbolExtraTab2)), - ExtendedConvertTable(Symbol, aSymbolExtraTab, - sizeof(aSymbolExtraTab)), - ExtendedConvertTable(Wingdings, aWingDingsExtraTab, - sizeof(aWingDingsExtraTab)), - ExtendedConvertTable(TimesNewRoman, aTNRExtraTab, - sizeof(aTNRExtraTab)) - }; - - //Allow extra conversions that are not perfect, but "good enough" - if (!bPerfectOnly) - nEntries = sizeof(aAgressiveTable) / sizeof(aAgressiveTable[0]); - else - nEntries = 1; - - for (i = 0; i < nEntries; ++i) - { - const ExtendedConvertTable& r = aAgressiveTable[i]; - SymbolEntry aEntry; - aEntry.eFont = r.meFont; - for (int j = r.mnSize / sizeof(r.mpTable[0]); j >=0; --j) - { - aEntry.cIndex = r.mpTable[j].cMS; - maMagicMap.insert( - ::std::multimap<sal_Unicode, SymbolEntry>::value_type( - r.mpTable[j].cStar, aEntry)); - } - } -} - -const char *SymbolFontToString(int nResult) -{ - const char **ppName = aSymbolNames; - int nI = Symbol; - while (nI <= nResult) - { - if (!(nI & nResult)) - nI = nI << 1; - else - break; - ppName++; - } - return *ppName; -} - -String StarSymbolToMSMultiFontImpl::ConvertChar(sal_Unicode &rChar) -{ - String sRet; - - ::std::multimap<sal_Unicode, SymbolEntry>::const_iterator aResult = - maMagicMap.find(rChar); - - if (aResult != maMagicMap.end()) - { - const SymbolEntry &rEntry = (*aResult).second; - sRet.AssignAscii(SymbolFontToString(rEntry.eFont)); - rChar = rEntry.cIndex; - } - - return sRet; -} - -String StarSymbolToMSMultiFontImpl::ConvertString(String &rString, - xub_StrLen& rIndex) -{ - typedef ::std::multimap<sal_Unicode, SymbolEntry>::iterator MI; - typedef ::std::pair<MI, MI> Result; - - String sRet; - - xub_StrLen nLen = rString.Len(); - if (rIndex >= nLen) - return sRet; - - int nTotal = 0, nResult = 0; - ::std::vector<Result> aPossibilities; - aPossibilities.reserve(nLen - rIndex); - xub_StrLen nStart = rIndex; - do - { - Result aResult = maMagicMap.equal_range(rString.GetChar(rIndex)); - int nBitfield = 0; - for (MI aIndex = aResult.first; aIndex != aResult.second; ++aIndex) - nBitfield |= aIndex->second.eFont; - - if (!nTotal) - nTotal = nBitfield; - else - { - if (nTotal != nBitfield) //Allow a series of failures - { - nTotal &= nBitfield; - if (!nTotal) - break; - } - } - nResult = nTotal; - if (nResult) //Don't bother storing a series of failures - aPossibilities.push_back(aResult); - ++rIndex; - }while(rIndex < nLen); - - if (nResult) - { - int nI = Symbol; - while (nI <= nResult) - { - if (!(nI & nResult)) - nI = nI << 1; - else - break; - } - sRet.AssignAscii(SymbolFontToString(nI)); - - xub_StrLen nSize = sal::static_int_cast<xub_StrLen>(aPossibilities.size()); - for(xub_StrLen nPos = 0; nPos < nSize; ++nPos) - { - const Result &rResult = aPossibilities[nPos]; - - for (MI aIndex = rResult.first; aIndex != rResult.second; ++aIndex) - { - if (aIndex->second.eFont == nI) - { - rString.SetChar(nPos+nStart, aIndex->second.cIndex); - break; - } - } - } - } - - return sRet; -} - -StarSymbolToMSMultiFont *CreateStarSymbolToMSMultiFont(bool bPerfectOnly) -{ - return new StarSymbolToMSMultiFontImpl(bPerfectOnly); -} - -//======================================================================= - -sal_Unicode ImplRecodeChar( const ImplCvtChar* pConversion, sal_Unicode cChar ) -{ - sal_Unicode cRetVal = 0; - if( pConversion->mpCvtFunc ) - { - // use a conversion function for recoding - cRetVal = pConversion->mpCvtFunc( cChar ); - } - else - { - // use a conversion table for recoding - sal_Unicode cIndex = cChar; - // allow symbol aliasing - if( cIndex & 0xFF00 ) - cIndex -= 0xF000; - // recode the symbol - if( cIndex>=0x0020 && cIndex<=0x00FF ) - cRetVal = pConversion->mpCvtTab[ cIndex - 0x0020 ]; - } - - return cRetVal ? cRetVal : cChar; -} - -// ----------------------------------------------------------------------- - -// recode the string assuming the character codes are symbol codes -// from an traditional symbol font (i.e. U+F020..U+F0FF) -void ImplRecodeString( const ImplCvtChar* pConversion, String& rStr, - xub_StrLen nIndex, xub_StrLen nLen ) -{ - ULONG nLastIndex = (ULONG)nIndex + nLen; - if( nLastIndex > rStr.Len() ) - nLastIndex = rStr.Len(); - - for(; nIndex < nLastIndex; ++nIndex ) - { - sal_Unicode cOrig = rStr.GetChar( nIndex ); - // only recode symbols and their U+00xx aliases - if( ((cOrig < 0x0020) || (cOrig > 0x00FF)) - && ((cOrig < 0xF020) || (cOrig > 0xF0FF)) ) - continue; - - // recode a symbol - sal_Unicode cNew = ImplRecodeChar( pConversion, cOrig ); - if( cOrig != cNew ) - rStr.SetChar( nIndex, cNew ); - } -} - -//======================================================================= - -struct RecodeTable { const char* pOrgName; ImplCvtChar aCvt;}; - -static RecodeTable aRecodeTable[] = -{ - // the first two entries must be StarMath and StarBats; do not reorder! - // reason: fgrep for FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS - {"starbats", {aStarBatsTab, "StarSymbol", NULL}}, - {"starmath", {aStarMathTab, "StarSymbol", NULL}}, - - {"symbol", {aAdobeSymbolTab, "StarSymbol", NULL}}, - {"standardsymbols", {aAdobeSymbolTab, "StarSymbol", NULL}}, - {"standardsymbolsl",{aAdobeSymbolTab, "StarSymbol", NULL}}, - - {"monotypesorts", {aMonotypeSortsTab, "StarSymbol", NULL}}, -// {"monotypesorts2", {aMonotypeSorts2Tab, "StarSymbol", NULL}} - {"zapfdingbats", {aMonotypeSortsTab, "StarSymbol", NULL}}, //ZapfDingbats=MonotypeSorts-X? - {"itczapfdingbats", {aMonotypeSortsTab, "StarSymbol", NULL}}, - {"dingbats", {aMonotypeSortsTab, "StarSymbol", NULL}}, - - {"webdings", {aWebDingsTab, "StarSymbol", NULL}}, - {"wingdings", {aWingDingsTab, "StarSymbol", NULL}}, - {"wingdings2", {aWingDings2Tab, "StarSymbol", NULL}}, - {"wingdings3", {aWingDings3Tab, "StarSymbol", NULL}}, - {"mtextra", {aMTExtraTab, "StarSymbol", NULL}} -}; - -static ImplCvtChar aImplStarSymbolCvt = { NULL, "StarBats", ImplStarSymbolToStarBats }; -#if 0 -// not used -static ImplCvtChar aImplDingBatsCvt = { aMonotypeSortsTab, "StarSymbol", NULL }; -#endif - -// ----------------------------------------------------------------------- - -const ImplCvtChar* ImplGetRecodeData( const String& rOrgFontName, - const String& rMapFontName ) -{ - const ImplCvtChar* pCvt = NULL; - String aOrgName( rOrgFontName ); - ImplGetEnglishSearchFontName( aOrgName ); - String aMapName( rMapFontName ); - ImplGetEnglishSearchFontName( aMapName ); - - if( aMapName.EqualsAscii( "starsymbol" ) - || aMapName.EqualsAscii( "opensymbol" ) ) - { - int nEntries = sizeof(aRecodeTable) / sizeof(aRecodeTable[0]); - for( int i = 0; i < nEntries; ++i) - { - RecodeTable& r = aRecodeTable[i]; - if( aOrgName.EqualsAscii( r.pOrgName ) ) - { pCvt = &r.aCvt; break; } - } - } - else if( aMapName.EqualsAscii( "starbats" ) ) - { - if( aOrgName.EqualsAscii( "starsymbol" ) ) - pCvt = &aImplStarSymbolCvt; - else if( aOrgName.EqualsAscii( "opensymbol" ) ) - pCvt = &aImplStarSymbolCvt; - } - - return pCvt; -} - -//======================================================================= - -FontToSubsFontConverter CreateFontToSubsFontConverter( - const String& rOrgName, ULONG nFlags ) -{ - const ImplCvtChar* pCvt = NULL; - - String aName = rOrgName; - ImplGetEnglishSearchFontName( aName ); - - if ( nFlags & FONTTOSUBSFONT_IMPORT ) - { - int nEntries = sizeof(aRecodeTable) / sizeof(aRecodeTable[0]); - if ( nFlags & FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ) // only StarMath+StarBats - nEntries = 2; - for( int i = 0; i < nEntries; ++i ) - { - RecodeTable& r = aRecodeTable[i]; - if( aName.EqualsAscii( r.pOrgName ) ) - { pCvt = &r.aCvt; break; } - } - } - else - { - // TODO: FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS - if( aName.EqualsAscii( "starsymbol" ) ) pCvt = &aImplStarSymbolCvt; - else if( aName.EqualsAscii( "opensymbol" ) ) pCvt = &aImplStarSymbolCvt; - } - - return (FontToSubsFontConverter)pCvt; -} - -// ----------------------------------------------------------------------- - -void DestroyFontToSubsFontConverter( FontToSubsFontConverter ) -{ - // nothing to do for now, because we use static ImplCvtChars -} - -// ----------------------------------------------------------------------- - -sal_Unicode ConvertFontToSubsFontChar( - FontToSubsFontConverter hConverter, sal_Unicode cChar ) -{ - if ( hConverter ) - return ImplRecodeChar( (ImplCvtChar*)hConverter, cChar ); - else - return cChar; -} - -// ----------------------------------------------------------------------- - -String GetFontToSubsFontName( FontToSubsFontConverter hConverter ) -{ - if ( !hConverter ) - return String(); - - const char* pName = ((ImplCvtChar*)hConverter)->mpSubsFontName; - return String::CreateFromAscii( pName ); -} diff --git a/vcl/source/gdi/impimagetree.cxx b/vcl/source/gdi/impimagetree.cxx index 039041826124..8178204a4ffd 100644 --- a/vcl/source/gdi/impimagetree.cxx +++ b/vcl/source/gdi/impimagetree.cxx @@ -46,6 +46,7 @@ #include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/Sequence.hxx" #include "comphelper/processfactory.hxx" +#include "osl/file.hxx" #include "osl/diagnose.h" #include "rtl/bootstrap.hxx" #include "rtl/string.h" @@ -118,12 +119,43 @@ ImplImageTree::ImplImageTree() {} ImplImageTree::~ImplImageTree() {} +bool ImplImageTree::checkStyle(rtl::OUString const & style) +{ + bool exists; + + // using cache because setStyle is an expensive operation + // setStyle calls resetZips => closes any opened zip files with icons, cleans the icon cache, ... + if (checkStyleCacheLookup(style, exists)) { + return exists; + } + + setStyle(style); + + exists = false; + const rtl::OUString sBrandURLSuffix(RTL_CONSTASCII_USTRINGPARAM("_brand.zip")); + for (Zips::iterator i(m_zips.begin()); i != m_zips.end() && !exists;) { + ::rtl::OUString aZipURL = i->first; + sal_Int32 nFromIndex = aZipURL.getLength() - sBrandURLSuffix.getLength(); + // skip brand-specific icon themes; they are incomplete and thus not useful for this check + if (nFromIndex < 0 || !aZipURL.match(sBrandURLSuffix, nFromIndex)) { + osl::File aZip(aZipURL); + if (aZip.open(OpenFlag_Read) == ::osl::FileBase::E_None) { + aZip.close(); + exists = true; + } + } + ++i; + } + m_checkStyleCache[style] = exists; + return exists; +} + bool ImplImageTree::loadImage( rtl::OUString const & name, rtl::OUString const & style, BitmapEx & bitmap, bool localized) { setStyle(style); - if (cacheLookup(name, localized, bitmap)) { + if (iconCacheLookup(name, localized, bitmap)) { return true; } if (!bitmap.IsEmpty()) { @@ -164,7 +196,7 @@ bool ImplImageTree::loadImage( rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); } if (found) { - m_cache[name.intern()] = std::make_pair(localized, bitmap); + m_iconCache[name.intern()] = std::make_pair(localized, bitmap); } return found; } @@ -173,7 +205,8 @@ void ImplImageTree::shutDown() { m_style = rtl::OUString(); // for safety; empty m_style means "not initialized" m_zips.clear(); - m_cache.clear(); + m_iconCache.clear(); + m_checkStyleCache.clear(); } void ImplImageTree::setStyle(rtl::OUString const & style) { @@ -181,7 +214,7 @@ void ImplImageTree::setStyle(rtl::OUString const & style) { if (style != m_style) { m_style = style; resetZips(); - m_cache.clear(); + m_iconCache.clear(); } } @@ -241,6 +274,7 @@ void ImplImageTree::resetZips() { u.GetMainURL(INetURLObject::NO_DECODE), css::uno::Reference< css::container::XNameAccess >())); } + if ( m_style.equals(::rtl::OUString::createFromAscii("default")) ) { rtl::OUString url( RTL_CONSTASCII_USTRINGPARAM( @@ -252,11 +286,23 @@ void ImplImageTree::resetZips() { } } -bool ImplImageTree::cacheLookup( +bool ImplImageTree::checkStyleCacheLookup( + rtl::OUString const & style, bool &exists) +{ + CheckStyleCache::iterator i(m_checkStyleCache.find(style)); + if (i != m_checkStyleCache.end()) { + exists = i->second; + return true; + } else { + return false; + } +} + +bool ImplImageTree::iconCacheLookup( rtl::OUString const & name, bool localized, BitmapEx & bitmap) { - Cache::iterator i(m_cache.find(name)); - if (i != m_cache.end() && i->second.first == localized) { + IconCache::iterator i(m_iconCache.find(name)); + if (i != m_iconCache.end() && i->second.first == localized) { bitmap = i->second.second; return true; } else { diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk index bdc08118979a..ae90d5bd1461 100644..100755 --- a/vcl/source/gdi/makefile.mk +++ b/vcl/source/gdi/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2008 by Sun Microsystems, Inc. # # OpenOffice.org - a multi-platform office productivity suite @@ -51,7 +51,33 @@ CDEFS+=-DENABLE_GRAPHITE # --- Files -------------------------------------------------------- -SLOFILES= $(SLO)$/salmisc.obj \ +EXCEPTIONSFILES= $(SLO)$/salmisc.obj \ + $(SLO)$/outdev.obj \ + $(SLO)$/outdev3.obj \ + $(SLO)$/gfxlink.obj \ + $(SLO)$/print.obj \ + $(SLO)$/print2.obj \ + $(SLO)$/configsettings.obj \ + $(SLO)$/sallayout.obj \ + $(SLO)$/image.obj \ + $(SLO)$/impimage.obj \ + $(SLO)$/impgraph.obj \ + $(SLO)$/metric.obj \ + $(SLO)$/pdfwriter_impl.obj \ + $(SLO)$/pdffontcache.obj\ + $(SLO)$/bmpconv.obj \ + $(SLO)$/pdfextoutdevdata.obj \ + $(SLO)$/jobset.obj \ + $(SLO)$/impimagetree.obj \ + $(SLO)$/pngread.obj \ + $(SLO)$/pngwrite.obj \ + $(SLO)$/virdev.obj \ + $(SLO)$/impprn.obj \ + $(SLO)$/gdimtf.obj \ + $(SLO)$/graphictools.obj \ + $(SLO)$/textlayout.obj + +SLOFILES= $(EXCEPTIONSFILES) \ $(SLO)$/animate.obj \ $(SLO)$/impanmvw.obj \ $(SLO)$/bitmap.obj \ @@ -68,80 +94,30 @@ SLOFILES= $(SLO)$/salmisc.obj \ $(SLO)$/cvtsvm.obj \ $(SLO)$/cvtgrf.obj \ $(SLO)$/font.obj \ - $(SLO)$/gdimtf.obj \ - $(SLO)$/gfxlink.obj \ $(SLO)$/gradient.obj \ $(SLO)$/hatch.obj \ $(SLO)$/graph.obj \ - $(SLO)$/image.obj \ - $(SLO)$/impimage.obj \ $(SLO)$/impbmp.obj \ - $(SLO)$/impgraph.obj \ - $(SLO)$/impimagetree.obj \ $(SLO)$/imagerepository.obj \ - $(SLO)$/impprn.obj \ $(SLO)$/impvect.obj \ $(SLO)$/jobset.obj \ $(SLO)$/lineinfo.obj \ $(SLO)$/mapmod.obj \ $(SLO)$/metaact.obj \ - $(SLO)$/metric.obj \ $(SLO)$/octree.obj \ $(SLO)$/outmap.obj \ - $(SLO)$/outdev.obj \ $(SLO)$/outdev2.obj \ - $(SLO)$/outdev3.obj \ $(SLO)$/outdev4.obj \ $(SLO)$/outdev5.obj \ $(SLO)$/outdev6.obj \ - $(SLO)$/virdev.obj \ - $(SLO)$/fontcvt.obj \ - $(SLO)$/print.obj \ - $(SLO)$/print2.obj \ $(SLO)$/regband.obj \ $(SLO)$/region.obj \ $(SLO)$/wall.obj \ - $(SLO)$/fontcfg.obj \ $(SLO)$/base14.obj \ $(SLO)$/pdfwriter.obj \ - $(SLO)$/pdfwriter_impl.obj \ - $(SLO)$/pdffontcache.obj\ - $(SLO)$/sallayout.obj \ $(SLO)$/salgdilayout.obj \ $(SLO)$/extoutdevdata.obj \ - $(SLO)$/pdfextoutdevdata.obj \ - $(SLO)$/salnativewidgets-none.obj \ - $(SLO)$/bmpconv.obj \ - $(SLO)$/pngread.obj \ - $(SLO)$/pngwrite.obj \ - $(SLO)$/graphictools.obj - -EXCEPTIONSFILES= $(SLO)$/salmisc.obj \ - $(SLO)$/outdev.obj \ - $(SLO)$/outdev3.obj \ - $(SLO)$/gfxlink.obj \ - $(SLO)$/print.obj \ - $(SLO)$/print2.obj \ - $(SLO)$/sallayout.obj \ - $(SLO)$/image.obj \ - $(SLO)$/impimage.obj \ - $(SLO)$/impgraph.obj \ - $(SLO)$/metric.obj \ - $(SLO)$/pdfwriter_impl.obj \ - $(SLO)$/pdffontcache.obj\ - $(SLO)$/fontcfg.obj \ - $(SLO)$/bmpconv.obj \ - $(SLO)$/pdfextoutdevdata.obj \ - $(SLO)$/fontcvt.obj \ - $(SLO)$/jobset.obj \ - $(SLO)$/impimagetree.obj \ - $(SLO)$/pngread.obj \ - $(SLO)$/pngwrite.obj \ - $(SLO)$/virdev.obj \ - $(SLO)$/impprn.obj \ - $(SLO)$/gdimtf.obj \ - $(SLO)$/graphictools.obj - + $(SLO)$/salnativewidgets-none.obj # --- Targets ------------------------------------------------------ diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index 0587e661b7e8..1f27ad2afe7d 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -982,7 +982,7 @@ void MetaPolyLineAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) WRITE_BASE_COMPAT( rOStm, 3, pData ); Polygon aSimplePoly; - maPoly.GetSimple( aSimplePoly ); + maPoly.AdaptiveSubdivide( aSimplePoly ); rOStm << aSimplePoly; // Version 1 rOStm << maLineInfo; // Version 2 @@ -1070,7 +1070,7 @@ void MetaPolygonAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) WRITE_BASE_COMPAT( rOStm, 2, pData ); Polygon aSimplePoly; // Version 1 - maPoly.GetSimple( aSimplePoly ); + maPoly.AdaptiveSubdivide( aSimplePoly ); rOStm << aSimplePoly; sal_uInt8 bHasPolyFlags = maPoly.HasFlags(); // Version 2 @@ -1162,7 +1162,7 @@ void MetaPolyPolygonAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) const Polygon& rPoly = maPolyPoly.GetObject( i ); if ( rPoly.HasFlags() ) nNumberOfComplexPolygons++; - rPoly.GetSimple( aSimplePoly ); + rPoly.AdaptiveSubdivide( aSimplePoly ); rOStm << aSimplePoly; } @@ -2586,7 +2586,13 @@ sal_Bool MetaGradientExAction::Compare( const MetaAction& rMetaAction ) const void MetaGradientExAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { WRITE_BASE_COMPAT( rOStm, 1, pData ); - rOStm << maPolyPoly << maGradient; + + // #i105373# see comment at MetaTransparentAction::Write + PolyPolygon aNoCurvePolyPolygon; + maPolyPoly.AdaptiveSubdivide(aNoCurvePolyPolygon); + + rOStm << aNoCurvePolyPolygon; + rOStm << maGradient; } // ------------------------------------------------------------------------ @@ -2654,7 +2660,13 @@ sal_Bool MetaHatchAction::Compare( const MetaAction& rMetaAction ) const void MetaHatchAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { WRITE_BASE_COMPAT( rOStm, 1, pData ); - rOStm << maPolyPoly << maHatch; + + // #i105373# see comment at MetaTransparentAction::Write + PolyPolygon aNoCurvePolyPolygon; + maPolyPoly.AdaptiveSubdivide(aNoCurvePolyPolygon); + + rOStm << aNoCurvePolyPolygon; + rOStm << maHatch; } // ------------------------------------------------------------------------ @@ -3721,7 +3733,20 @@ sal_Bool MetaTransparentAction::Compare( const MetaAction& rMetaAction ) const void MetaTransparentAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { WRITE_BASE_COMPAT( rOStm, 1, pData ); - rOStm << maPolyPoly; + + // #i105373# The PolyPolygon in this action may be a curve; this + // was ignored until now what is an error. To make older office + // versions work with MetaFiles, i opt for applying AdaptiveSubdivide + // to the PolyPoylgon. + // The alternative would be to really write the curve information + // like in MetaPolyPolygonAction::Write (where someone extended it + // correctly, but not here :-( ). + // The golden solution would be to combine both, but i think it's + // not necessary; a good subdivision will be sufficient. + PolyPolygon aNoCurvePolyPolygon; + maPolyPoly.AdaptiveSubdivide(aNoCurvePolyPolygon); + + rOStm << aNoCurvePolyPolygon; rOStm << mnTransPercent; } diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx index 8b20c8e384f7..91ea8419cba9 100644 --- a/vcl/source/gdi/outdev.cxx +++ b/vcl/source/gdi/outdev.cxx @@ -1129,11 +1129,16 @@ namespace { inline int iround( float x ) { - sal_Int32 a = *reinterpret_cast<const sal_Int32 *>(&x); - sal_Int32 exponent = (127 + 31) - ((a >> 23) & 0xFF); - sal_Int32 r = ((sal_Int32(a) << 8) | (1U << 31)) >> exponent; + union + { + float f; + sal_Int32 i; + }; + f = x; + sal_Int32 exponent = (127 + 31) - ((i >> 23) & 0xFF); + sal_Int32 r = ((sal_Int32(i) << 8) | (1U << 31)) >> exponent; r &= ((exponent - 32) >> 31); - sal_Int32 sign = a >> 31; + sal_Int32 sign = i >> 31; return r = (r ^ sign) - sign; } diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 0a7a8b765b6b..51aad0790a26 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -56,11 +56,12 @@ #include <vcl/window.hxx> #include <vcl/svapp.hxx> #include <vcl/bmpacc.hxx> -#include <vcl/fontcvt.hxx> +#include <unotools/fontcvt.hxx> #include <vcl/outdev.hxx> #include <vcl/edit.hxx> -#include <vcl/fontcfg.hxx> +#include <unotools/fontcfg.hxx> #include <vcl/sysdata.hxx> +#include <vcl/textlayout.hxx> #ifndef _OSL_FILE_H #include <osl/file.h> #endif @@ -96,6 +97,7 @@ #include <memory> #include <algorithm> + // ======================================================================= DBG_NAMEEX( OutputDevice ) @@ -107,6 +109,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::rtl; using namespace ::vcl; +using namespace ::utl; // ======================================================================= @@ -304,451 +307,6 @@ void OutputDevice::ImplUpdateAllFontData( bool bNewFontLists ) // ======================================================================= -struct ImplLocalizedFontName -{ - const char* mpEnglishName; - const sal_Unicode* mpLocalizedNames; -}; - -static sal_Unicode const aBatang[] = { 0xBC14, 0xD0D5, 0, 0 }; -static sal_Unicode const aBatangChe[] = { 0xBC14, 0xD0D5, 0xCCB4, 0, 0 }; -static sal_Unicode const aGungsuh[] = { 0xAD81, 0xC11C, 0, 0 }; -static sal_Unicode const aGungsuhChe[] = { 0xAD81, 0xC11C, 0xCCB4, 0, 0 }; -static sal_Unicode const aGulim[] = { 0xAD74, 0xB9BC, 0, 0 }; -static sal_Unicode const aGulimChe[] = { 0xAD74, 0xB9BC, 0xCCB4, 0, 0 }; -static sal_Unicode const aDotum[] = { 0xB3CB, 0xC6C0, 0, 0 }; -static sal_Unicode const aDotumChe[] = { 0xB3CB, 0xC6C0, 0xCCB4, 0, 0 }; -static sal_Unicode const aSimSun[] = { 0x5B8B, 0x4F53, 0, 0 }; -static sal_Unicode const aNSimSun[] = { 0x65B0, 0x5B8B, 0x4F53, 0, 0 }; -static sal_Unicode const aSimHei[] = { 0x9ED1, 0x4F53, 0, 0 }; -static sal_Unicode const aSimKai[] = { 0x6977, 0x4F53, 0, 0 }; -static sal_Unicode const azycjkSun[] = { 0x4E2D, 0x6613, 0x5B8B, 0x4F53, 0, 0 }; -static sal_Unicode const azycjkHei[] = { 0x4E2D, 0x6613, 0x9ED1, 0x4F53, 0, 0 }; -static sal_Unicode const azycjkKai[] = { 0x4E2D, 0x6613, 0x6977, 0x4F53, 0, 0 }; -static sal_Unicode const aFZHei[] = { 0x65B9, 0x6B63, 0x9ED1, 0x4F53, 0, 0 }; -static sal_Unicode const aFZKai[] = { 0x65B9, 0x6B63, 0x6977, 0x4F53, 0, 0 }; -static sal_Unicode const aFZSongYI[] = { 0x65B9, 0x6B63, 0x5B8B, 0x4E00, 0, 0 }; -static sal_Unicode const aFZShuSong[] = { 0x65B9, 0x6B63, 0x4E66, 0x5B8B, 0, 0 }; -static sal_Unicode const aFZFangSong[] = { 0x65B9, 0x6B63, 0x4EFF, 0x5B8B, 0, 0 }; -// Attention: this fonts includes the wrong encoding vector - so we double the names with correct and wrong encoding -// First one is the GB-Encoding (we think the correct one), second is the big5 encoded name -static sal_Unicode const aMHei[] = { 'm', 0x7B80, 0x9ED1, 0, 'm', 0x6F60, 0x7AAA, 0, 0 }; -static sal_Unicode const aMKai[] = { 'm', 0x7B80, 0x6977, 0x566C, 0, 'm', 0x6F60, 0x7FF1, 0x628E, 0, 0 }; -static sal_Unicode const aMSong[] = { 'm', 0x7B80, 0x5B8B, 0, 'm', 0x6F60, 0x51BC, 0, 0 }; -static sal_Unicode const aCFangSong[] = { 'm', 0x7B80, 0x592B, 0x5B8B, 0, 'm', 0x6F60, 0x6E98, 0x51BC, 0, 0 }; -static sal_Unicode const aMingLiU[] = { 0x7D30, 0x660E, 0x9AD4, 0, 0 }; -static sal_Unicode const aPMingLiU[] = { 0x65B0, 0x7D30, 0x660E, 0x9AD4, 0, 0 }; -static sal_Unicode const aHei[] = { 0x6865, 0, 0 }; -static sal_Unicode const aKai[] = { 0x6B61, 0, 0 }; -static sal_Unicode const aMing[] = { 0x6D69, 0x6E67, 0, 0 }; -static sal_Unicode const aMSGothic[] = { 'm','s', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; -static sal_Unicode const aMSPGothic[] = { 'm','s','p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; -static sal_Unicode const aMSMincho[] = { 'm', 's', 0x660E, 0x671D, 0 }; -static sal_Unicode const aMSPMincho[] = { 'm','s','p', 0x660E, 0x671D, 0 }; -static sal_Unicode const aMeiryo[] = { 0x30e1, 0x30a4, 0x30ea, 0x30aa, 0 }; -static sal_Unicode const aHGMinchoL[] = { 'h','g', 0x660E, 0x671D, 'l', 0, 0 }; -static sal_Unicode const aHGGothicB[] = { 'h','g', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 0 }; -static sal_Unicode const aHGPMinchoL[] = { 'h','g','p', 0x660E, 0x671D, 'l', 0 }; -static sal_Unicode const aHGPGothicB[] = { 'h','g','p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 0 }; -static sal_Unicode const aHGMinchoLSun[] = { 'h','g', 0x660E, 0x671D, 'l', 's', 'u', 'n', 0 }; -static sal_Unicode const aHGPMinchoLSun[] = { 'h','g','p', 0x660E, 0x671D, 'l', 's', 'u', 'n', 0 }; -static sal_Unicode const aHGGothicBSun[] = { 'h', 'g', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 's', 'u', 'n', 0 }; -static sal_Unicode const aHGPGothicBSun[] = { 'h', 'g', 'p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 's', 'u', 'n', 0 }; -static sal_Unicode const aHGHeiseiMin[] = { 'h', 'g', 0x5E73, 0x6210, 0x660E, 0x671D, 0x4F53, 0, 'h', 'g', 0x5E73, 0x6210, 0x660E, 0x671D, 0x4F53, 'w', '3', 'x', '1', '2', 0, 0 }; -static sal_Unicode const aIPAMincho[] = { 'i', 'p', 'a', 0x660E, 0x671D, 0 }; -static sal_Unicode const aIPAPMincho[] = { 'i', 'p', 'a', 'p', 0x660E, 0x671D, 0 }; -static sal_Unicode const aIPAGothic[] = { 'i', 'p', 'a', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 }; -static sal_Unicode const aIPAPGothic[] = { 'i', 'p', 'a', 'p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 }; -static sal_Unicode const aIPAUIGothic[] = { 'i', 'p', 'a', 'u', 'i', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 }; -static sal_Unicode const aSazanamiMincho[] = { 0x3055, 0x3056, 0x306A, 0x307F, 0x660E, 0x671D, 0, 0 }; -static sal_Unicode const aSazanamiGothic[] = { 0x3055, 0x3056, 0x306A, 0x307F, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; -static sal_Unicode const aKochiMincho[] = { 0x6771, 0x98A8, 0x660E, 0x671D, 0, 0 }; -static sal_Unicode const aKochiGothic[] = { 0x6771, 0x98A8, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; -static sal_Unicode const aSunDotum[] = { 0xC36C, 0xB3CB, 0xC6C0, 0, 0 }; -static sal_Unicode const aSunGulim[] = { 0xC36C, 0xAD74, 0xB9BC, 0, 0 }; -static sal_Unicode const aSunBatang[] = { 0xC36C, 0xBC14, 0xD0D5, 0, 0 }; -static sal_Unicode const aBaekmukDotum[] = { 0xBC31, 0xBB35, 0xB3CB, 0xC6C0, 0, 0 }; -static sal_Unicode const aBaekmukGulim[] = { 0xBC31, 0xBB35, 0xAD74, 0xB9BC, 0, 0 }; -static sal_Unicode const aBaekmukBatang[] = { 0xBC31, 0xBB35, 0xBC14, 0xD0D5, 0, 0 }; -static sal_Unicode const aFzMingTi[] = { 0x65B9, 0x6B63, 0x660E, 0x9AD4, 0, 0 }; -static sal_Unicode const aFzHeiTiTW[]= { 0x65B9, 0x6B63, 0x9ED1, 0x9AD4, 0, 0 }; -static sal_Unicode const aFzKaiTiTW[]= { 0x65B9, 0x6B63, 0x6977, 0x9AD4, 0, 0 }; -static sal_Unicode const aFzHeiTiCN[]= { 0x65B9, 0x6B63, 0x9ED1, 0x4F53, 0, 0 }; -static sal_Unicode const aFzKaiTiCN[]= { 0x65B9, 0x6B63, 0x6977, 0x4F53, 0, 0 }; -static sal_Unicode const aFzSongTi[] = { 0x65B9, 0x6B63, 0x5B8B, 0x4F53, 0, 0 }; -static sal_Unicode const aHYMyeongJoExtra[] = { 'h', 'y', 0xACAC, 0xBA85, 0xC870, 0, 0 }; -static sal_Unicode const aHYSinMyeongJoMedium[] = { 'h', 'y', 0xC2E0, 0xBA85, 0xC870, 0, 0 }; -static sal_Unicode const aHYGothicMedium[] = { 'h', 'y', 0xC911, 0xACE0, 0xB515, 0, 0 }; -static sal_Unicode const aHYGraphicMedium[] = { 'h', 'y', 0xADF8, 0xB798, 0xD53D, 'm', 0, 0 }; -static sal_Unicode const aHYGraphic[] = { 'h', 'y', 0xADF8, 0xB798, 0xD53D, 0, 0 }; -static sal_Unicode const aNewGulim[] = { 0xC0C8, 0xAD74, 0xB9BC, 0, 0 }; -static sal_Unicode const aSunGungseo[] = { 0xC36C, 0xAD81, 0xC11C, 0, 0 }; -static sal_Unicode const aHYGungSoBold[] = { 'h','y', 0xAD81, 0xC11C, 'b', 0, 0 }; -static sal_Unicode const aHYGungSo[] = { 'h','y', 0xAD81, 0xC11C, 0, 0 }; -static sal_Unicode const aSunHeadLine[] = { 0xC36C, 0xD5E4, 0xB4DC, 0xB77C, 0xC778, 0, 0 }; -static sal_Unicode const aHYHeadLineMedium[] = { 'h', 'y', 0xD5E4, 0xB4DC, 0xB77C, 0xC778, 'm', 0, 0 }; -static sal_Unicode const aHYHeadLine[] = { 'h', 'y', 0xD5E4, 0xB4DC, 0xB77C, 0xC778, 0, 0 }; -static sal_Unicode const aYetR[] = { 0xD734, 0xBA3C, 0xC61B, 0xCCB4, 0, 0 }; -static sal_Unicode const aHYGothicExtra[] = { 'h', 'y', 0xACAC, 0xACE0, 0xB515, 0, 0 }; -static sal_Unicode const aSunMokPan[] = { 0xC36C, 0xBAA9, 0xD310, 0, 0 }; -static sal_Unicode const aSunYeopseo[] = { 0xC36C, 0xC5FD, 0xC11C, 0, 0 }; -static sal_Unicode const aSunBaekSong[] = { 0xC36C, 0xBC31, 0xC1A1, 0, 0 }; -static sal_Unicode const aHYPostLight[] = { 'h', 'y', 0xC5FD, 0xC11C, 'l', 0, 0 }; -static sal_Unicode const aHYPost[] = { 'h', 'y', 0xC5FD, 0xC11C, 0, 0 }; -static sal_Unicode const aMagicR[] = { 0xD734, 0xBA3C, 0xB9E4, 0xC9C1, 0xCCB4, 0, 0 }; -static sal_Unicode const aSunCrystal[] = { 0xC36C, 0xD06C, 0xB9AC, 0xC2A4, 0xD0C8, 0, 0 }; -static sal_Unicode const aSunSaemmul[] = { 0xC36C, 0xC0D8, 0xBB3C, 0, 0 }; -static sal_Unicode const aHaansoftBatang[] = { 0xD55C, 0xCEF4, 0xBC14, 0xD0D5, 0, 0 }; -static sal_Unicode const aHaansoftDotum[] = { 0xD55C, 0xCEF4, 0xB3CB, 0xC6C0, 0, 0 }; -static sal_Unicode const aHyhaeseo[] = { 0xD55C, 0xC591, 0xD574, 0xC11C, 0, 0 }; -static sal_Unicode const aMDSol[] = { 'm', 'd', 0xC194, 0xCCB4, 0, 0 }; -static sal_Unicode const aMDGaesung[] = { 'm', 'd', 0xAC1C, 0xC131, 0xCCB4, 0, 0 }; -static sal_Unicode const aMDArt[] = { 'm', 'd', 0xC544, 0xD2B8, 0xCCB4, 0, 0 }; -static sal_Unicode const aMDAlong[] = { 'm', 'd', 0xC544, 0xB871, 0xCCB4, 0, 0 }; -static sal_Unicode const aMDEasop[] = { 'm', 'd', 0xC774, 0xC19D, 0xCCB4, 0, 0 }; -static sal_Unicode const aHYShortSamulMedium[] = { 'h', 'y', 0xC595, 0xC740, 0xC0D8, 0xBB3C, 'm', 0 }; -static sal_Unicode const aHYShortSamul[] = { 'h', 'y', 0xC595, 0xC740, 0xC0D8, 0xBB3C, 0 }; -static sal_Unicode const aHGGothicE[] = { 'h','g', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'e', 0 }; -static sal_Unicode const aHGPGothicE[] = { 'h','g','p', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'e', 0 }; -static sal_Unicode const aHGSGothicE[] = { 'h','g','s', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'e', 0 }; -static sal_Unicode const aHGGothicM[] = { 'h','g', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'm', 0 }; -static sal_Unicode const aHGPGothicM[] = { 'h','g','p', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'm', 0 }; -static sal_Unicode const aHGSGothicM[] = { 'h','g','s', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'm', 0 }; -static sal_Unicode const aHGGyoshotai[] = { 'h','g', 0x884C, 0x66F8, 0x4F53, 0 }; -static sal_Unicode const aHGPGyoshotai[] = { 'h','g','p', 0x884C, 0x66F8, 0x4F53, 0 }; -static sal_Unicode const aHGSGyoshotai[] = { 'h','g','s', 0x884C, 0x66F8, 0x4F53, 0 }; -static sal_Unicode const aHGKyokashotai[] = { 'h','g', 0x6559, 0x79D1, 0x66F8, 0x4F53, 0 }; -static sal_Unicode const aHGPKyokashotai[] = { 'h','g','p', 0x6559, 0x79D1, 0x66F8, 0x4F53, 0 }; -static sal_Unicode const aHGSKyokashotai[] = { 'h','g','s', 0x6559, 0x79D1, 0x66F8, 0x4F53, 0 }; -static sal_Unicode const aHGMinchoB[] = { 'h','g', 0x660E, 0x671D, 'b', 0 }; -static sal_Unicode const aHGPMinchoB[] = { 'h','g','p', 0x660E, 0x671D, 'b', 0 }; -static sal_Unicode const aHGSMinchoB[] = { 'h','g','s', 0x660E, 0x671D, 'b', 0 }; -static sal_Unicode const aHGMinchoE[] = { 'h','g', 0x660E, 0x671D, 'e', 0 }; -static sal_Unicode const aHGPMinchoE[] = { 'h','g','p', 0x660E, 0x671D, 'e', 0 }; -static sal_Unicode const aHGSMinchoE[] = { 'h','g','s', 0x660E, 0x671D, 'e', 0 }; -static sal_Unicode const aHGSoeiKakupoptai[] = { 'h','g', 0x5275,0x82F1,0x89D2,0xFF8E, - 0xFF9F,0xFF6F,0xFF8C,0xFF9F,0x4F53,0}; -static sal_Unicode const aHGPSoeiKakupoptai[] = { 'h','g', 'p', 0x5275,0x82F1,0x89D2,0xFF8E, - 0xFF9F,0xFF6F,0xFF8C,0xFF9F,0x4F53,0}; -static sal_Unicode const aHGSSoeiKakupoptai[] = { 'h','g', 's', 0x5275,0x82F1,0x89D2,0xFF8E, - 0xFF9F,0xFF6F,0xFF8C,0xFF9F,0x4F53,0}; -static sal_Unicode const aHGSoeiPresenceEB[] = { 'h','g', 0x5275,0x82F1,0xFF8C,0xFF9F, - 0xFF9A,0xFF7E,0xFF9E,0xFF9D,0xFF7D, 'e','b',0}; -static sal_Unicode const aHGPSoeiPresenceEB[] = { 'h','g','p', 0x5275,0x82F1,0xFF8C,0xFF9F, - 0xFF9A,0xFF7E,0xFF9E,0xFF9D,0xFF7D, 'e','b',0}; -static sal_Unicode const aHGSSoeiPresenceEB[] = { 'h','g','s', 0x5275,0x82F1,0xFF8C,0xFF9F, - 0xFF9A,0xFF7E,0xFF9E,0xFF9D,0xFF7D, 'e','b',0}; -static sal_Unicode const aHGSoeiKakugothicUB[] = { 'h','g', 0x5275,0x82F1,0x89D2,0xFF7A, - 0xFF9E,0xFF7C,0xFF6F,0xFF78,'u','b',0}; -static sal_Unicode const aHGPSoeiKakugothicUB[] = { 'h','g','p', 0x5275,0x82F1,0x89D2,0xFF7A, - 0xFF9E,0xFF7C,0xFF6F,0xFF78,'u','b',0}; -static sal_Unicode const aHGSSoeiKakugothicUB[] = { 'h','g','s', 0x5275,0x82F1,0x89D2,0xFF7A, - 0xFF9E,0xFF7C,0xFF6F,0xFF78,'u','b',0}; -static sal_Unicode const aHGSeikaishotaiPRO[] = { 'h','g', 0x6B63,0x6977,0x66F8,0x4F53, '-','p','r','o',0}; -static sal_Unicode const aHGMaruGothicMPRO[] = { 'h','g', 0x4E38,0xFF7A,0xFF9E,0xFF7C,0xFF6F,0xFF78, '-','p','r','o',0}; -static sal_Unicode const aHiraginoMinchoPro[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x660E, 0x671D, 'p','r','o',0}; -static sal_Unicode const aHiraginoMinchoProN[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x660E, 0x671D, 'p','r','o','n',0}; -static sal_Unicode const aHiraginoKakuGothicPro[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x89D2, 0x30B4, 'p','r','o',0}; -static sal_Unicode const aHiraginoKakuGothicProN[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x89D2, 0x30B4, 'p','r','o','n',0}; -static sal_Unicode const aHiraginoMaruGothicPro[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o',0}; -static sal_Unicode const aHiraginoMaruGothicProN[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o','n',0}; - - -static ImplLocalizedFontName aImplLocalizedNamesList[] = -{ -{ "batang", aBatang }, -{ "batangche", aBatangChe }, -{ "gungshu", aGungsuh }, -{ "gungshuche", aGungsuhChe }, -{ "gulim", aGulim }, -{ "gulimche", aGulimChe }, -{ "dotum", aDotum }, -{ "dotumche", aDotumChe }, -{ "simsun", aSimSun }, -{ "nsimsun", aNSimSun }, -{ "simhei", aSimHei }, -{ "simkai", aSimKai }, -{ "zycjksun", azycjkSun }, -{ "zycjkhei", azycjkHei }, -{ "zycjkkai", azycjkKai }, -{ "fzhei", aFZHei }, -{ "fzkai", aFZKai }, -{ "fzsong", aFZSongYI }, -{ "fzshusong", aFZShuSong }, -{ "fzfangsong", aFZFangSong }, -{ "mhei", aMHei }, -{ "mkai", aMKai }, -{ "msong", aMSong }, -{ "cfangsong", aCFangSong }, -{ "mingliu", aMingLiU }, -{ "pmingliu", aPMingLiU }, -{ "hei", aHei }, -{ "kai", aKai }, -{ "ming", aMing }, -{ "msgothic", aMSGothic }, -{ "mspgothic", aMSPGothic }, -{ "msmincho", aMSMincho }, -{ "mspmincho", aMSPMincho }, -{ "meiryo", aMeiryo }, -{ "hgminchol", aHGMinchoL }, -{ "hggothicb", aHGGothicB }, -{ "hgpminchol", aHGPMinchoL }, -{ "hgpgothicb", aHGPGothicB }, -{ "hgmincholsun", aHGMinchoLSun }, -{ "hggothicbsun", aHGGothicBSun }, -{ "hgpmincholsun", aHGPMinchoLSun }, -{ "hgpgothicbsun", aHGPGothicBSun }, -{ "hgheiseimin", aHGHeiseiMin }, -{ "ipamincho", aIPAMincho }, -{ "ipapmincho", aIPAPMincho }, -{ "ipagothic", aIPAGothic }, -{ "ipapgothic", aIPAPGothic }, -{ "ipauigothic", aIPAUIGothic }, -{ "sazanamimincho", aSazanamiMincho }, -{ "sazanamigothic", aSazanamiGothic }, -{ "kochimincho", aKochiMincho }, -{ "kochigothic", aKochiGothic }, -{ "sundotum", aSunDotum }, -{ "sungulim", aSunGulim }, -{ "sunbatang", aSunBatang }, -{ "baekmukdotum", aBaekmukDotum }, -{ "baekmukgulim", aBaekmukGulim }, -{ "baekmukbatang", aBaekmukBatang }, -{ "fzheiti", aFzHeiTiCN }, -{ "fzheiti", aFzHeiTiTW }, -{ "fzkaiti", aFzKaiTiCN }, -{ "fzkaitib", aFzKaiTiTW }, -{ "fzmingtib", aFzMingTi }, -{ "fzsongti", aFzSongTi }, -{ "hymyeongjoextra", aHYMyeongJoExtra }, -{ "hysinmyeongjomedium", aHYSinMyeongJoMedium }, -{ "hygothicmedium", aHYGothicMedium }, -{ "hygraphicmedium", aHYGraphicMedium }, -{ "hygraphic", aHYGraphic }, -{ "newgulim", aNewGulim }, -{ "sungungseo", aSunGungseo }, -{ "hygungsobold", aHYGungSoBold }, -{ "hygungso", aHYGungSo }, -{ "sunheadline", aSunHeadLine }, -{ "hyheadlinemedium", aHYHeadLineMedium }, -{ "hyheadline", aHYHeadLine }, -{ "yetr", aYetR }, -{ "hygothicextra", aHYGothicExtra }, -{ "sunmokpan", aSunMokPan }, -{ "sunyeopseo", aSunYeopseo }, -{ "sunbaeksong", aSunBaekSong }, -{ "hypostlight", aHYPostLight }, -{ "hypost", aHYPost }, -{ "magicr", aMagicR }, -{ "suncrystal", aSunCrystal }, -{ "sunsaemmul", aSunSaemmul }, -{ "hyshortsamulmedium", aHYShortSamulMedium }, -{ "hyshortsamul", aHYShortSamul }, -{ "haansoftbatang", aHaansoftBatang }, -{ "haansoftdotum", aHaansoftDotum }, -{ "hyhaeseo", aHyhaeseo }, -{ "mdsol", aMDSol }, -{ "mdgaesung", aMDGaesung }, -{ "mdart", aMDArt }, -{ "mdalong", aMDAlong }, -{ "mdeasop", aMDEasop }, -{ "hggothice", aHGGothicE }, -{ "hgpgothice", aHGPGothicE }, -{ "hgpothice", aHGSGothicE }, -{ "hggothicm", aHGGothicM }, -{ "hgpgothicm", aHGPGothicM }, -{ "hgpgothicm", aHGSGothicM }, -{ "hggyoshotai", aHGGyoshotai }, -{ "hgpgyoshotai", aHGPGyoshotai }, -{ "hgsgyoshotai", aHGSGyoshotai }, -{ "hgkyokashotai", aHGKyokashotai }, -{ "hgpkyokashotai", aHGPKyokashotai }, -{ "hgskyokashotai", aHGSKyokashotai }, -{ "hgminchob", aHGMinchoB }, -{ "hgpminchob", aHGPMinchoB }, -{ "hgsminchob", aHGSMinchoB }, -{ "hgminchoe", aHGMinchoE }, -{ "hgpminchoe", aHGPMinchoE }, -{ "hgsminchoe", aHGSMinchoE }, -{ "hgsoeikakupoptai", aHGSoeiKakupoptai }, -{ "hgpsoeikakupopta", aHGPSoeiKakupoptai }, -{ "hgssoeikakupopta", aHGSSoeiKakupoptai }, -{ "hgsoeipresenceeb", aHGSoeiPresenceEB }, -{ "hgpsoeipresenceeb", aHGPSoeiPresenceEB }, -{ "hgssoeipresenceeb", aHGSSoeiPresenceEB }, -{ "hgsoeikakugothicub", aHGSoeiKakugothicUB }, -{ "hgpsoeikakugothicub", aHGPSoeiKakugothicUB }, -{ "hgssoeikakugothicub", aHGSSoeiKakugothicUB }, -{ "hgseikaishotaipro", aHGSeikaishotaiPRO }, -{ "hgmarugothicmpro", aHGMaruGothicMPRO }, -{ "hiraginominchopro", aHiraginoMinchoPro }, -{ "hiraginominchopron", aHiraginoMinchoProN }, -{ "hiraginokakugothicpro", aHiraginoKakuGothicPro }, -{ "hiraginokakugothicpron", aHiraginoKakuGothicProN }, -{ "hiraginomarugothicpro", aHiraginoMaruGothicPro }, -{ "hiraginomarugothicpron", aHiraginoMaruGothicProN }, -{ NULL, NULL }, -}; - -// ----------------------------------------------------------------------- - -void ImplGetEnglishSearchFontName( String& rName ) -{ - bool bNeedTranslation = false; - xub_StrLen nLen = rName.Len(); - - // Remove trailing whitespaces - xub_StrLen i = nLen; - while ( i && (rName.GetChar( i-1 ) < 32) ) - i--; - if ( i != nLen ) - rName.Erase( i ); - - // Remove Script at the end - // Scriptname must be the last part of the fontname and - // looks like "fontname (scriptname)". So there can only be a - // script name at the and of the fontname, when the last char is ')' - if ( (nLen >= 3) && rName.GetChar( nLen-1 ) == ')' ) - { - int nOpen = 1; - xub_StrLen nTempLen = nLen-2; - while ( nTempLen ) - { - if ( rName.GetChar( nTempLen ) == '(' ) - { - nOpen--; - if ( !nOpen ) - { - // Remove Space at the end - if ( nTempLen && (rName.GetChar( nTempLen-1 ) == ' ') ) - nTempLen--; - rName.Erase( nTempLen ); - nLen = nTempLen; - break; - } - } - if ( rName.GetChar( nTempLen ) == ')' ) - nOpen++; - nTempLen--; - } - } - - // remove all whitespaces and converts to lower case ASCII - // TODO: better transliteration to ASCII e.g. all digits - i = 0; - while ( i < nLen ) - { - sal_Unicode c = rName.GetChar( i ); - if ( c > 127 ) - { - // Translate to Lowercase-ASCII - // FullWidth-ASCII to half ASCII - if ( (c >= 0xFF00) && (c <= 0xFF5E) ) - { - c -= 0xFF00-0x0020; - // Upper to Lower - if ( (c >= 'A') && (c <= 'Z') ) - c += 'a' - 'A'; - rName.SetChar( i, c ); - } - else - { - // Only Fontnames with None-Ascii-Characters must be translated - bNeedTranslation = true; - } - } - // not lowercase Ascii - else if ( !((c >= 'a') && (c <= 'z')) ) - { - // To Lowercase-Ascii - if ( (c >= 'A') && (c <= 'Z') ) - { - c += 'a' - 'A'; - rName.SetChar( i, c ); - } - else if( ((c < '0') || (c > '9')) && (c != ';') ) // not 0-9 or semicolon - { - // Remove white spaces and special characters - rName.Erase( i, 1 ); - nLen--; - continue; - } - } - - i++; - } - - // translate normalized localized name to its normalized English ASCII name - if( bNeedTranslation ) - { - typedef std::hash_map<const String, const char*,FontNameHash> FontNameDictionary; - static FontNameDictionary aDictionary( sizeof(aImplLocalizedNamesList) / sizeof(*aImplLocalizedNamesList) ); - // the font name dictionary needs to be intialized once - if( aDictionary.empty() ) - { - // TODO: check if all dictionary entries are already normalized? - const ImplLocalizedFontName* pList = aImplLocalizedNamesList; - for(; pList->mpEnglishName; ++pList ) - aDictionary[ pList->mpLocalizedNames ] = pList->mpEnglishName; - } - - FontNameDictionary::const_iterator it = aDictionary.find( rName ); - if( it != aDictionary.end() ) - rName.AssignAscii( it->second ); - } -} - -// ----------------------------------------------------------------------- - -static String GetNextFontToken( const String& rTokenStr, xub_StrLen& rIndex ) -{ - // check for valid start index - int nStringLen = rTokenStr.Len(); - if( rIndex >= nStringLen ) - { - rIndex = STRING_NOTFOUND; - return String(); - } - - // find the next token delimiter and return the token substring - const sal_Unicode* pStr = rTokenStr.GetBuffer() + rIndex; - const sal_Unicode* pEnd = rTokenStr.GetBuffer() + nStringLen; - for(; pStr < pEnd; ++pStr ) - if( (*pStr == ';') || (*pStr == ',') ) - break; - - xub_StrLen nTokenStart = rIndex; - xub_StrLen nTokenLen; - if( pStr < pEnd ) - { - rIndex = sal::static_int_cast<xub_StrLen>(pStr - rTokenStr.GetBuffer()); - nTokenLen = rIndex - nTokenStart; - ++rIndex; // skip over token separator - } - else - { - // no token delimiter found => handle last token - rIndex = STRING_NOTFOUND; - nTokenLen = STRING_LEN; - - // optimize if the token string consists of just one token - if( !nTokenStart ) - return rTokenStr; - } - - return String( rTokenStr, nTokenStart, nTokenLen ); -} - -// TODO: get rid of this in another incompatible build with SW project. -// SW's WW8 and RTF filters still use this (from fontcvt.hxx) -String GetFontToken( const String& rTokenStr, xub_StrLen nToken, xub_StrLen& rIndex ) -{ - // skip nToken Tokens - for( xub_StrLen i = 0; (i < nToken) && (rIndex != STRING_NOTFOUND); ++i ) - GetNextFontToken( rTokenStr, rIndex ); - - return GetNextFontToken( rTokenStr, rIndex ); -} // ======================================================================= @@ -812,8 +370,8 @@ ImplFontSubstEntry::ImplFontSubstEntry( const String& rFontName, { maSearchName = rFontName; maSearchReplaceName = rSubstFontName; - ImplGetEnglishSearchFontName( maSearchName ); - ImplGetEnglishSearchFontName( maSearchReplaceName ); + GetEnglishSearchFontName( maSearchName ); + GetEnglishSearchFontName( maSearchReplaceName ); } // ----------------------------------------------------------------------- @@ -913,7 +471,7 @@ static void ImplFontSubstitute( String& rFontName, { #ifdef DBG_UTIL String aTempName = rFontName; - ImplGetEnglishSearchFontName( aTempName ); + GetEnglishSearchFontName( aTempName ); DBG_ASSERT( aTempName == rFontName, "ImplFontSubstitute() called without a searchname" ); #endif @@ -938,44 +496,6 @@ static void ImplFontSubstitute( String& rFontName, } } -// ======================================================================= - -static bool ImplIsFontToken( const String& rName, const String& rToken ) -{ - String aTempName; - xub_StrLen nIndex = 0; - do - { - aTempName = GetNextFontToken( rName, nIndex ); - if ( rToken == aTempName ) - return true; - } - while ( nIndex != STRING_NOTFOUND ); - - return false; -} - -// ----------------------------------------------------------------------- - -static void ImplAppendFontToken( String& rName, const String& rNewToken ) -{ - if ( rName.Len() ) - { - rName.Append( ';' ); - rName.Append( rNewToken ); - } - else - rName = rNewToken; -} - -// ----------------------------------------------------------------------- - -static void ImplAddTokenFontName( String& rName, const String& rNewToken ) -{ - if ( !ImplIsFontToken( rName, rNewToken ) ) - ImplAppendFontToken( rName, rNewToken ); -} - // ----------------------------------------------------------------------- Font OutputDevice::GetDefaultFont( USHORT nType, LanguageType eLang, @@ -993,7 +513,7 @@ Font OutputDevice::GetDefaultFont( USHORT nType, LanguageType eLang, MsLangId::convertLanguageToLocale( eLang, aLocale ); } - DefaultFontConfiguration& rDefaults = *DefaultFontConfiguration::get(); + utl::DefaultFontConfiguration& rDefaults = *utl::DefaultFontConfiguration::get(); String aSearch = rDefaults.getUserInterfaceFont( aLocale ); // ensure a fallback String aDefault = rDefaults.getDefaultFont( aLocale, nType ); if( aDefault.Len() ) @@ -1072,11 +592,11 @@ Font OutputDevice::GetDefaultFont( USHORT nType, LanguageType eLang, do { aSearchName = GetNextFontToken( aSearch, nIndex ); - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); ImplDevFontListData* pFontFamily = pOutDev->mpFontList->ImplFindBySearchName( aSearchName ); if( pFontFamily ) { - ImplAddTokenFontName( aName, pFontFamily->GetFamilyName() ); + AddTokenFontName( aName, pFontFamily->GetFamilyName() ); if( nFlags & DEFAULTFONT_FLAGS_ONLYONE ) break; } @@ -1176,61 +696,6 @@ Font OutputDevice::GetDefaultFont( USHORT nType, LanguageType eLang, // ======================================================================= -String GetSubsFontName( const String& rName, ULONG nFlags ) -{ - String aName; - - xub_StrLen nIndex = 0; - String aOrgName = GetNextFontToken( rName, nIndex ); - ImplGetEnglishSearchFontName( aOrgName ); - - // #93662# do not try to replace StarSymbol with MS only font - if( nFlags == (SUBSFONT_MS|SUBSFONT_ONLYONE) - && ( aOrgName.EqualsAscii( "starsymbol" ) - || aOrgName.EqualsAscii( "opensymbol" ) ) ) - return aName; - - const FontNameAttr* pAttr = FontSubstConfiguration::get()->getSubstInfo( aOrgName ); - if ( pAttr ) - { - for( int i = 0; i < 3; i++ ) - { - const ::std::vector< String >* pVector = NULL; - switch( i ) - { - case 0: - if( nFlags & SUBSFONT_MS && pAttr->MSSubstitutions.size() ) - pVector = &pAttr->MSSubstitutions; - break; - case 1: - if( nFlags & SUBSFONT_PS && pAttr->PSSubstitutions.size() ) - pVector = &pAttr->PSSubstitutions; - break; - case 2: - if( nFlags & SUBSFONT_HTML && pAttr->HTMLSubstitutions.size() ) - pVector = &pAttr->HTMLSubstitutions; - break; - } - if( ! pVector ) - continue; - for( ::std::vector< String >::const_iterator it = pVector->begin(); it != pVector->end(); ++it ) - if( ! ImplIsFontToken( rName, *it ) ) - { - ImplAppendFontToken( aName, *it ); - if( nFlags & SUBSFONT_ONLYONE ) - { - i = 4; - break; - } - } - } - } - - return aName; -} - -// ======================================================================= - static unsigned ImplIsCJKFont( const String& rFontName ) { // Test, if Fontname includes CJK characters --> In this case we @@ -1695,7 +1160,7 @@ bool ImplDevFontListData::AddFontFace( ImplFontData* pNewData ) // ----------------------------------------------------------------------- // get font attributes using the normalized font family name -void ImplDevFontListData::InitMatchData( const vcl::FontSubstConfiguration& rFontSubst, +void ImplDevFontListData::InitMatchData( const utl::FontSubstConfiguration& rFontSubst, const String& rSearchName ) { String aShortName; @@ -1834,29 +1299,6 @@ void ImplDevFontList::Clear() mbMatchData = false; } -// ----------------------------------------------------------------------- - -// TODO: use a more generic String hash -int FontNameHash::operator()( const String& rStr ) const -{ - // this simple hash just has to be good enough for font names - int nHash = 0; - const int nLen = rStr.Len(); - const sal_Unicode* p = rStr.GetBuffer(); - switch( nLen ) - { - default: nHash = (p[0]<<16) - (p[1]<<8) + p[2]; - nHash += nLen; - p += nLen - 3; - // fall through - case 3: nHash += (p[2]<<16); // fall through - case 2: nHash += (p[1]<<8); // fall through - case 1: nHash += p[0]; // fall through - case 0: break; - }; - - return nHash; -} // ----------------------------------------------------------------------- @@ -2003,7 +1445,7 @@ ImplDevFontListData* ImplDevFontList::GetGlyphFallbackFont( ImplFontSelectData& // call the hook to query the best matching glyph fallback font if( mpFallbackHook->FindFontSubstitute( rFontSelData, rMissingCodes ) ) // apply outdev3.cxx specific fontname normalization - ImplGetEnglishSearchFontName( rFontSelData.maSearchName ); + GetEnglishSearchFontName( rFontSelData.maSearchName ); else rFontSelData.maSearchName = String(); @@ -2058,7 +1500,7 @@ void ImplDevFontList::Add( ImplFontData* pNewData ) for( xub_StrLen nMapNameIndex = 0; nMapNameIndex != STRING_NOTFOUND; ) { String aSearchName = pNewData->maName; - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); DevFontList::const_iterator it = maDevFontList.find( aSearchName ); ImplDevFontListData* pFoundData = NULL; @@ -2095,7 +1537,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindBySearchName( const String& rSearc { #ifdef DEBUG String aTempName = rSearchName; - ImplGetEnglishSearchFontName( aTempName ); + GetEnglishSearchFontName( aTempName ); DBG_ASSERT( aTempName == rSearchName, "ImplDevFontList::ImplFindBySearchName() called with non-normalized name" ); #endif @@ -2150,7 +1592,7 @@ ImplDevFontListData* ImplDevFontList::FindFontFamily( const String& rFontName ) { // normalize the font fomily name and String aName = rFontName; - ImplGetEnglishSearchFontName( aName ); + GetEnglishSearchFontName( aName ); ImplDevFontListData* pFound = ImplFindBySearchName( aName ); return pFound; } @@ -2167,7 +1609,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByTokenNames( const String& rToken String aSearchName = GetNextFontToken( rTokenStr, nTokenPos ); if( !aSearchName.Len() ) continue; - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); pFoundData = ImplFindBySearchName( aSearchName ); if( pFoundData ) break; @@ -2178,7 +1620,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByTokenNames( const String& rToken // ----------------------------------------------------------------------- -ImplDevFontListData* ImplDevFontList::ImplFindBySubstFontAttr( const vcl::FontNameAttr& rFontAttr ) const +ImplDevFontListData* ImplDevFontList::ImplFindBySubstFontAttr( const utl::FontNameAttr& rFontAttr ) const { ImplDevFontListData* pFoundData = NULL; @@ -2187,7 +1629,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindBySubstFontAttr( const vcl::FontNa for(; it != rFontAttr.Substitutions.end(); ++it ) { String aSearchName( *it ); - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); pFoundData = ImplFindBySearchName( aSearchName ); if( pFoundData ) @@ -2933,7 +2375,7 @@ ImplFontEntry* ImplFontCache::GetFontEntry( ImplDevFontList* pFontList, // if we found a different symbol font we need a symbol conversion table if( pFontData->IsSymbolFont() ) if( aFontSelData.maTargetName != aFontSelData.maSearchName ) - pEntry->mpConversion = ImplGetRecodeData( aFontSelData.maTargetName, aFontSelData.maSearchName ); + pEntry->mpConversion = ConvertChar::GetRecodeData( aFontSelData.maTargetName, aFontSelData.maSearchName ); // add the new entry to the cache maFontInstanceList[ aFontSelData ] = pEntry; @@ -2981,7 +2423,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD, #endif - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); ImplFontSubstitute( aSearchName, nSubstFlags, pDevSpecific ); // #114999# special emboldening for Ricoh fonts // TODO: smarter check for special cases by using PreMatch infrastructure? @@ -3029,7 +2471,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD, #endif if( mpPreMatchHook ) if( mpPreMatchHook->FindFontSubstitute( rFSD ) ) - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); #ifdef ENABLE_GRAPHITE // the prematch hook uses the target name to search, but we now need // to restore the features to make the font selection data unique @@ -3056,13 +2498,13 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD, { rFSD.maTargetName = GetNextFontToken( rFSD.maName, nTokenPos ); aSearchName = rFSD.maTargetName; - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); } else nTokenPos = STRING_NOTFOUND; if( mpPreMatchHook ) if( mpPreMatchHook->FindFontSubstitute( rFSD ) ) - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); ImplFontSubstitute( aSearchName, nSubstFlags, pDevSpecific ); ImplDevFontListData* pFoundData = ImplFindBySearchName( aSearchName ); if( pFoundData ) @@ -3076,7 +2518,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD, nTokenPos = 0; rFSD.maTargetName = GetNextFontToken( rFSD.maName, nTokenPos ); aSearchName = rFSD.maTargetName; - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); } String aSearchShortName; @@ -3151,7 +2593,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD, continue; aSearchName = rFSD.maTargetName; - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); String aTempShortName; String aTempFamilyName; @@ -4835,7 +4277,7 @@ void OutputDevice::ImplGetEmphasisMark( PolyPolygon& rPolyPoly, BOOL& rPolyLine, double dScale = ((double)nDotSize)/1000.0; aPoly.Scale( dScale, dScale ); Polygon aTemp; - aPoly.GetSimple( aTemp ); + aPoly.AdaptiveSubdivide( aTemp ); Rectangle aBoundRect = aTemp.GetBoundRect(); rWidth = aBoundRect.GetWidth(); nDotSize = aBoundRect.GetHeight(); @@ -5257,7 +4699,7 @@ void OutputDevice::ImplDrawText( SalLayout& rSalLayout ) long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const XubString& rStr, - USHORT nStyle ) const + USHORT nStyle, const ::vcl::ITextLayout& _rLayout ) { DBG_ASSERTWARNING( nWidth >= 0, "ImplGetTextLines: nWidth <= 0!" ); @@ -5295,7 +4737,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, while ( ( nBreakPos < nLen ) && ( rStr.GetChar( nBreakPos ) != _CR ) && ( rStr.GetChar( nBreakPos ) != _LF ) ) nBreakPos++; - long nLineWidth = GetTextWidth( rStr, nPos, nBreakPos-nPos ); + long nLineWidth = _rLayout.GetTextWidth( rStr, nPos, nBreakPos-nPos ); if ( ( nLineWidth > nWidth ) && ( nStyle & TEXT_DRAW_WORDBREAK ) ) { if ( !xBI.is() ) @@ -5304,7 +4746,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, if ( xBI.is() ) { const com::sun::star::lang::Locale& rDefLocale(Application::GetSettings().GetUILocale()); - xub_StrLen nSoftBreak = GetTextBreak( rStr, nWidth, nPos, nBreakPos - nPos ); + xub_StrLen nSoftBreak = _rLayout.GetTextBreak( rStr, nWidth, nPos, nBreakPos - nPos ); DBG_ASSERT( nSoftBreak < nBreakPos, "Break?!" ); //aHyphOptions.hyphenIndex = nSoftBreak; i18n::LineBreakResults aLBR = xBI->getLineBreak( aText, nSoftBreak, rDefLocale, nPos, aHyphOptions, aUserOptions ); @@ -5408,7 +4850,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, } // if ( xHyph.is() ) } // if ( (nStyle & TEXT_DRAW_WORDBREAK_HYPHENATION) == TEXT_DRAW_WORDBREAK_HYPHENATION ) } - nLineWidth = GetTextWidth( rStr, nPos, nBreakPos-nPos ); + nLineWidth = _rLayout.GetTextWidth( rStr, nPos, nBreakPos-nPos ); } else { @@ -5422,14 +4864,14 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, { if( nSpacePos > nPos ) nSpacePos--; - nW = GetTextWidth( rStr, nPos, nSpacePos-nPos ); + nW = _rLayout.GetTextWidth( rStr, nPos, nSpacePos-nPos ); } } while( nW > nWidth ); if( nSpacePos != STRING_NOTFOUND ) { nBreakPos = nSpacePos; - nLineWidth = GetTextWidth( rStr, nPos, nBreakPos-nPos ); + nLineWidth = _rLayout.GetTextWidth( rStr, nPos, nBreakPos-nPos ); if( nBreakPos < rStr.Len()-1 ) nBreakPos++; } @@ -6159,6 +5601,10 @@ void OutputDevice::DrawTextArray( const Point& rStartPt, const String& rStr, if ( !IsDeviceOutputNecessary() ) return; + if( mbInitClipRegion ) + ImplInitClipRegion(); + if( mbOutputClipped ) + return; SalLayout* pSalLayout = ImplLayout( rStr, nIndex, nLen, rStartPt, 0, pDXAry, true ); if( pSalLayout ) @@ -6483,7 +5929,7 @@ SalLayout* OutputDevice::ImplLayout( const String& rOrigStr, // convert from logical units to physical units // recode string if needed if( mpFontEntry->mpConversion ) - ImplRecodeString( mpFontEntry->mpConversion, aStr, 0, aStr.Len() ); + mpFontEntry->mpConversion->RecodeString( aStr, 0, aStr.Len() ); long nPixelWidth = nLogicalWidth; if( nLogicalWidth && mbMap ) @@ -6771,9 +6217,10 @@ xub_StrLen OutputDevice::GetTextBreak( const String& rStr, long nTextWidth, // ----------------------------------------------------------------------- -void OutputDevice::ImplDrawText( const Rectangle& rRect, +void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& rRect, const String& rOrigStr, USHORT nStyle, - MetricVector* pVector, String* pDisplayText ) + MetricVector* pVector, String* pDisplayText, + ::vcl::ITextLayout& _rLayout ) { Color aOldTextColor; Color aOldTextFillColor; @@ -6782,12 +6229,12 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, { BOOL bHighContrastBlack = FALSE; BOOL bHighContrastWhite = FALSE; - const StyleSettings& rStyleSettings( GetSettings().GetStyleSettings() ); + const StyleSettings& rStyleSettings( rTargetDevice.GetSettings().GetStyleSettings() ); if( rStyleSettings.GetHighContrastMode() ) { Color aCol; - if( IsBackground() ) - aCol = GetBackground().GetColor(); + if( rTargetDevice.IsBackground() ) + aCol = rTargetDevice.GetBackground().GetColor(); else // best guess is the face color here // but it may be totally wrong. the background color @@ -6798,16 +6245,16 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, bHighContrastWhite = aCol.IsBright(); } - aOldTextColor = GetTextColor(); - if ( IsTextFillColor() ) + aOldTextColor = rTargetDevice.GetTextColor(); + if ( rTargetDevice.IsTextFillColor() ) { bRestoreFillColor = TRUE; - aOldTextFillColor = GetTextFillColor(); + aOldTextFillColor = rTargetDevice.GetTextFillColor(); } if( bHighContrastBlack ) - SetTextColor( COL_GREEN ); + rTargetDevice.SetTextColor( COL_GREEN ); else if( bHighContrastWhite ) - SetTextColor( COL_LIGHTGREEN ); + rTargetDevice.SetTextColor( COL_LIGHTGREEN ); else { // draw disabled text always without shadow @@ -6818,7 +6265,7 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, aRect.Move( 1, 1 ); DrawText( aRect, rOrigStr, nStyle & ~TEXT_DRAW_DISABLE ); */ - SetTextColor( GetSettings().GetStyleSettings().GetDisableColor() ); + rTargetDevice.SetTextColor( rTargetDevice.GetSettings().GetStyleSettings().GetDisableColor() ); } } @@ -6830,14 +6277,16 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, Point aPos = rRect.TopLeft(); - long nTextHeight = GetTextHeight(); - TextAlign eAlign = GetTextAlign(); + long nTextHeight = rTargetDevice.GetTextHeight(); + TextAlign eAlign = rTargetDevice.GetTextAlign(); xub_StrLen nMnemonicPos = STRING_NOTFOUND; String aStr = rOrigStr; if ( nStyle & TEXT_DRAW_MNEMONIC ) aStr = GetNonMnemonicString( aStr, nMnemonicPos ); + const bool bDrawMnemonics = !(rTargetDevice.GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) && !pVector; + // Mehrzeiligen Text behandeln wir anders if ( nStyle & TEXT_DRAW_MULTILINE ) { @@ -6852,7 +6301,7 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, if ( nTextHeight ) { - nMaxTextWidth = ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle ); + nMaxTextWidth = ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, _rLayout ); nLines = (xub_StrLen)(nHeight/nTextHeight); nFormatLines = aMultiLineInfo.Count(); if ( !nLines ) @@ -6874,7 +6323,7 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, if ( aLastLine.GetChar( i ) == _LF ) aLastLine.SetChar( i, ' ' ); } - aLastLine = GetEllipsisString( aLastLine, nWidth, nStyle ); + aLastLine = ImplGetEllipsisString( rTargetDevice, aLastLine, nWidth, nStyle, _rLayout ); nStyle &= ~(TEXT_DRAW_VCENTER | TEXT_DRAW_BOTTOM); nStyle |= TEXT_DRAW_TOP; } @@ -6892,8 +6341,8 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, // Clipping setzen if ( nStyle & TEXT_DRAW_CLIP ) { - Push( PUSH_CLIPREGION ); - IntersectClipRegion( rRect ); + rTargetDevice.Push( PUSH_CLIPREGION ); + rTargetDevice.IntersectClipRegion( rRect ); } // Vertikales Alignment @@ -6906,7 +6355,7 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, if ( eAlign == ALIGN_BOTTOM ) aPos.Y() += nTextHeight; else if ( eAlign == ALIGN_BASELINE ) - aPos.Y() += GetFontMetric().GetAscent(); + aPos.Y() += rTargetDevice.GetFontMetric().GetAscent(); // Alle Zeilen ausgeben, bis auf die letzte for ( i = 0; i < nFormatLines; i++ ) @@ -6918,8 +6367,8 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, aPos.X() += (nWidth-pLineInfo->GetWidth())/2; xub_StrLen nIndex = pLineInfo->GetIndex(); xub_StrLen nLineLen = pLineInfo->GetLen(); - DrawText( aPos, aStr, nIndex, nLineLen, pVector, pDisplayText ); - if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) && !pVector ) + _rLayout.DrawText( aPos, aStr, nIndex, nLineLen, pVector, pDisplayText ); + if ( bDrawMnemonics ) { if ( (nMnemonicPos >= nIndex) && (nMnemonicPos < nIndex+nLineLen) ) { @@ -6928,16 +6377,16 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, long nMnemonicWidth; sal_Int32* pCaretXArray = (sal_Int32*) alloca( 2 * sizeof(sal_Int32) * nLineLen ); - /*BOOL bRet =*/ GetCaretPositions( aStr, pCaretXArray, - nIndex, nLineLen); + /*BOOL bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray, + nIndex, nLineLen ); long lc_x1 = pCaretXArray[2*(nMnemonicPos - nIndex)]; long lc_x2 = pCaretXArray[2*(nMnemonicPos - nIndex)+1]; - nMnemonicWidth = ::abs((int)(lc_x1 - lc_x2)); + nMnemonicWidth = rTargetDevice.ImplLogicWidthToDevicePixel( ::abs((int)(lc_x1 - lc_x2)) ); - Point aTempPos = LogicToPixel( aPos ); - nMnemonicX = mnOutOffX + aTempPos.X() + ImplLogicWidthToDevicePixel( Min( lc_x1, lc_x2 ) ); - nMnemonicY = mnOutOffY + aTempPos.Y() + ImplLogicWidthToDevicePixel( GetFontMetric().GetAscent() ); - ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth ); + Point aTempPos = rTargetDevice.LogicToPixel( aPos ); + nMnemonicX = rTargetDevice.GetOutOffXPixel() + aTempPos.X() + rTargetDevice.ImplLogicWidthToDevicePixel( Min( lc_x1, lc_x2 ) ); + nMnemonicY = rTargetDevice.GetOutOffYPixel() + aTempPos.Y() + rTargetDevice.ImplLogicWidthToDevicePixel( rTargetDevice.GetFontMetric().GetAscent() ); + rTargetDevice.ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth ); } } aPos.Y() += nTextHeight; @@ -6948,26 +6397,26 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, // Gibt es noch eine letzte Zeile, dann diese linksbuendig ausgeben, // da die Zeile gekuerzt wurde if ( aLastLine.Len() ) - DrawText( aPos, aLastLine, 0, STRING_LEN, pVector, pDisplayText ); + _rLayout.DrawText( aPos, aLastLine, 0, STRING_LEN, pVector, pDisplayText ); // Clipping zuruecksetzen if ( nStyle & TEXT_DRAW_CLIP ) - Pop(); + rTargetDevice.Pop(); } } else { - long nTextWidth = GetTextWidth( aStr ); + long nTextWidth = _rLayout.GetTextWidth( aStr, 0, STRING_LEN ); // Evt. Text kuerzen if ( nTextWidth > nWidth ) { if ( nStyle & TEXT_DRAW_ELLIPSIS ) { - aStr = GetEllipsisString( aStr, nWidth, nStyle ); + aStr = ImplGetEllipsisString( rTargetDevice, aStr, nWidth, nStyle, _rLayout ); nStyle &= ~(TEXT_DRAW_CENTER | TEXT_DRAW_RIGHT); nStyle |= TEXT_DRAW_LEFT; - nTextWidth = GetTextWidth( aStr ); + nTextWidth = _rLayout.GetTextWidth( aStr, 0, aStr.Len() ); } } else @@ -6986,7 +6435,7 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, if ( eAlign == ALIGN_BOTTOM ) aPos.Y() += nTextHeight; else if ( eAlign == ALIGN_BASELINE ) - aPos.Y() += GetFontMetric().GetAscent(); + aPos.Y() += rTargetDevice.GetFontMetric().GetAscent(); if ( nStyle & TEXT_DRAW_BOTTOM ) aPos.Y() += nHeight-nTextHeight; @@ -6999,44 +6448,44 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, if ( nMnemonicPos != STRING_NOTFOUND ) { sal_Int32* pCaretXArray = (sal_Int32*) alloca( 2 * sizeof(sal_Int32) * aStr.Len() ); - /*BOOL bRet =*/ GetCaretPositions( aStr, pCaretXArray, 0, aStr.Len() ); + /*BOOL bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray, 0, aStr.Len() ); long lc_x1 = pCaretXArray[2*(nMnemonicPos)]; long lc_x2 = pCaretXArray[2*(nMnemonicPos)+1]; - nMnemonicWidth = ::abs((int)(lc_x1 - lc_x2)); + nMnemonicWidth = rTargetDevice.ImplLogicWidthToDevicePixel( ::abs((int)(lc_x1 - lc_x2)) ); - Point aTempPos = LogicToPixel( aPos ); - nMnemonicX = mnOutOffX + aTempPos.X() + ImplLogicWidthToDevicePixel( Min(lc_x1, lc_x2) ); - nMnemonicY = mnOutOffY + aTempPos.Y() + ImplLogicWidthToDevicePixel( GetFontMetric().GetAscent() ); + Point aTempPos = rTargetDevice.LogicToPixel( aPos ); + nMnemonicX = rTargetDevice.GetOutOffXPixel() + aTempPos.X() + rTargetDevice.ImplLogicWidthToDevicePixel( Min(lc_x1, lc_x2) ); + nMnemonicY = rTargetDevice.GetOutOffYPixel() + aTempPos.Y() + rTargetDevice.ImplLogicWidthToDevicePixel( rTargetDevice.GetFontMetric().GetAscent() ); } if ( nStyle & TEXT_DRAW_CLIP ) { - Push( PUSH_CLIPREGION ); - IntersectClipRegion( rRect ); - DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText ); - if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) && !pVector ) + rTargetDevice.Push( PUSH_CLIPREGION ); + rTargetDevice.IntersectClipRegion( rRect ); + _rLayout.DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText ); + if ( bDrawMnemonics ) { if ( nMnemonicPos != STRING_NOTFOUND ) - ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth ); + rTargetDevice.ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth ); } - Pop(); + rTargetDevice.Pop(); } else { - DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText ); - if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) && !pVector ) + _rLayout.DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText ); + if ( bDrawMnemonics ) { if ( nMnemonicPos != STRING_NOTFOUND ) - ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth ); + rTargetDevice.ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth ); } } } if ( nStyle & TEXT_DRAW_DISABLE && !pVector ) { - SetTextColor( aOldTextColor ); + rTargetDevice.SetTextColor( aOldTextColor ); if ( bRestoreFillColor ) - SetTextFillColor( aOldTextFillColor ); + rTargetDevice.SetTextFillColor( aOldTextFillColor ); } } @@ -7069,7 +6518,8 @@ void OutputDevice::AddTextRectActions( const Rectangle& rRect, // #i47157# Factored out to ImplDrawTextRect(), to be shared // between us and DrawText() - ImplDrawText( rRect, rOrigStr, nStyle, NULL, NULL ); + DefaultTextLayout aLayout( *this ); + ImplDrawText( *this, rRect, rOrigStr, nStyle, NULL, NULL, aLayout ); // and restore again EnableOutput( bOutputEnabled ); @@ -7078,10 +6528,9 @@ void OutputDevice::AddTextRectActions( const Rectangle& rRect, // ----------------------------------------------------------------------- -void OutputDevice::DrawText( const Rectangle& rRect, - const String& rOrigStr, USHORT nStyle, - MetricVector* pVector, String* pDisplayText ) - +void OutputDevice::DrawText( const Rectangle& rRect, const String& rOrigStr, USHORT nStyle, + MetricVector* pVector, String* pDisplayText, + ::vcl::ITextLayout* _pTextLayout ) { if( mpOutDevData && mpOutDevData->mpRecordLayout ) { @@ -7092,10 +6541,11 @@ void OutputDevice::DrawText( const Rectangle& rRect, DBG_TRACE( "OutputDevice::DrawText( const Rectangle& )" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); - if ( mpMetaFile ) + bool bDecomposeTextRectAction = ( _pTextLayout != NULL ) && _pTextLayout->DecomposeTextRectAction(); + if ( mpMetaFile && !bDecomposeTextRectAction ) mpMetaFile->AddAction( new MetaTextRectAction( rRect, rOrigStr, nStyle ) ); - if ( ( !IsDeviceOutputNecessary() && ! pVector ) || !rOrigStr.Len() || rRect.IsEmpty() ) + if ( ( !IsDeviceOutputNecessary() && !pVector && !bDecomposeTextRectAction ) || !rOrigStr.Len() || rRect.IsEmpty() ) return; // we need a graphics @@ -7103,17 +6553,19 @@ void OutputDevice::DrawText( const Rectangle& rRect, return; if( mbInitClipRegion ) ImplInitClipRegion(); - if( mbOutputClipped ) + if( mbOutputClipped && !bDecomposeTextRectAction ) return; // temporarily disable mtf action generation (ImplDrawText _does_ // create META_TEXT_ACTIONs otherwise) GDIMetaFile* pMtf = mpMetaFile; - mpMetaFile = NULL; + if ( !bDecomposeTextRectAction ) + mpMetaFile = NULL; - // #i47157# Factored out to ImplDrawTextRect(), to be used also + // #i47157# Factored out to ImplDrawText(), to be used also // from AddTextRectActions() - ImplDrawText( rRect, rOrigStr, nStyle, pVector, pDisplayText ); + DefaultTextLayout aDefaultLayout( *this ); + ImplDrawText( *this, rRect, rOrigStr, nStyle, pVector, pDisplayText, _pTextLayout ? *_pTextLayout : aDefaultLayout ); // and enable again mpMetaFile = pMtf; @@ -7125,8 +6577,9 @@ void OutputDevice::DrawText( const Rectangle& rRect, // ----------------------------------------------------------------------- Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, - const String& rOrigStr, USHORT nStyle, - TextRectInfo* pInfo ) const + const XubString& rStr, USHORT nStyle, + TextRectInfo* pInfo, + const ::vcl::ITextLayout* _pTextLayout ) const { DBG_TRACE( "OutputDevice::GetTextRect()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -7137,7 +6590,7 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, long nMaxWidth; long nTextHeight = GetTextHeight(); - String aStr = rOrigStr; + String aStr = rStr; if ( nStyle & TEXT_DRAW_MNEMONIC ) aStr = GetNonMnemonicString( aStr ); @@ -7149,7 +6602,8 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, xub_StrLen i; nMaxWidth = 0; - ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle ); + DefaultTextLayout aDefaultLayout( *const_cast< OutputDevice* >( this ) ); + ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, _pTextLayout ? *_pTextLayout : aDefaultLayout ); nFormatLines = aMultiLineInfo.Count(); if ( !nTextHeight ) nTextHeight = 1; @@ -7197,7 +6651,7 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, else { nLines = 1; - nMaxWidth = GetTextWidth( aStr ); + nMaxWidth = _pTextLayout ? _pTextLayout->GetTextWidth( aStr, 0, aStr.Len() ) : GetTextWidth( aStr ); if ( pInfo ) { @@ -7256,11 +6710,20 @@ static BOOL ImplIsCharIn( xub_Unicode c, const sal_Char* pStr ) String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth, USHORT nStyle ) const { - DBG_TRACE( "OutputDevice::GetEllipsisString()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); + DefaultTextLayout aTextLayout( *const_cast< OutputDevice* >( this ) ); + return ImplGetEllipsisString( *this, rOrigStr, nMaxWidth, nStyle, aTextLayout ); +} + +// ----------------------------------------------------------------------- + +String OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, const XubString& rOrigStr, long nMaxWidth, + USHORT nStyle, const ::vcl::ITextLayout& _rLayout ) +{ + DBG_TRACE( "OutputDevice::ImplGetEllipsisString()" ); String aStr = rOrigStr; - xub_StrLen nIndex = GetTextBreak( aStr, nMaxWidth ); + xub_StrLen nIndex = _rLayout.GetTextBreak( aStr, nMaxWidth, 0, aStr.Len() ); if ( nIndex != STRING_LEN ) @@ -7271,7 +6734,7 @@ String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth, if ( nIndex > 1 ) { aStr.AppendAscii( "..." ); - while ( aStr.Len() && (GetTextWidth( aStr ) > nMaxWidth) ) + while ( aStr.Len() && (_rLayout.GetTextWidth( aStr, 0, aStr.Len() ) > nMaxWidth) ) { if ( (nIndex > 1) || (nIndex == aStr.Len()) ) nIndex--; @@ -7307,8 +6770,8 @@ String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth, XubString aLastStr( aStr, nLastContent, aStr.Len() ); XubString aTempLastStr1( RTL_CONSTASCII_USTRINGPARAM( "..." ) ); aTempLastStr1 += aLastStr; - if ( GetTextWidth( aTempLastStr1 ) > nMaxWidth ) - aStr = GetEllipsisString( aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS ); + if ( _rLayout.GetTextWidth( aTempLastStr1, 0, aTempLastStr1.Len() ) > nMaxWidth ) + aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS, _rLayout ); else { USHORT nFirstContent = 0; @@ -7323,7 +6786,7 @@ String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth, nFirstContent++; if ( nFirstContent >= nLastContent ) - aStr = GetEllipsisString( aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS ); + aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS, _rLayout ); else { if ( nFirstContent > 4 ) @@ -7332,8 +6795,8 @@ String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth, aFirstStr.AppendAscii( "..." ); XubString aTempStr = aFirstStr; aTempStr += aLastStr; - if ( GetTextWidth( aTempStr ) > nMaxWidth ) - aStr = GetEllipsisString( aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS ); + if ( _rLayout.GetTextWidth( aTempStr, 0, aTempStr.Len() ) > nMaxWidth ) + aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS, _rLayout ); else { do @@ -7357,7 +6820,7 @@ String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth, XubString aTempLastStr( aStr, nLastContent, aStr.Len() ); aTempStr = aFirstStr; aTempStr += aTempLastStr; - if ( GetTextWidth( aTempStr ) > nMaxWidth ) + if ( _rLayout.GetTextWidth( aTempStr, 0, aTempStr.Len() ) > nMaxWidth ) break; } } diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index a7d91abcbd5f..9c8c1ec1bf5e 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -283,8 +283,6 @@ struct PageSyncData std::deque< Graphic > mGraphics; std::deque< ::boost::shared_ptr< PDFWriter::AnyWidget > > mControls; - std::set< ::rtl::OUString > mControlNames; - GlobalSyncData* mpGlobalData; sal_Bool mbGroupIgnoreGDIMtfActions; @@ -375,7 +373,6 @@ sal_Bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIM if ( pControl.get() ) rWriter.CreateControl( *pControl ); mControls.pop_front(); - mControlNames.erase( pControl->Name ); } break; case PDFExtOutDevDataSync::BeginGroup : @@ -772,16 +769,6 @@ void PDFExtOutDevData::CreateControl( const PDFWriter::AnyWidget& rControlType, mpPageSyncData->PushAction( mrOutDev, PDFExtOutDevDataSync::CreateControl ); ::boost::shared_ptr< PDFWriter::AnyWidget > pClone( rControlType.Clone() ); - // ensure a unique name - ::rtl::OUString sUniqueName( pClone->Name ); - sal_Int32 nUniqueNumber( 0 ); - while ( mpPageSyncData->mControlNames.find( sUniqueName ) != mpPageSyncData->mControlNames.end() ) - { - sUniqueName = pClone->Name + ::rtl::OUString::valueOf( ++nUniqueNumber ); - } - pClone->Name = sUniqueName; - mpPageSyncData->mControlNames.insert( pClone->Name ); - mpPageSyncData->mControls.push_back( pClone ); } diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index dfbb83b7954b..c0205f1f325d 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -41,7 +41,6 @@ #include <tools/debug.hxx> #include <tools/zcodec.hxx> #include <tools/stream.hxx> -#include <tools/urlobj.hxx> //for relative url #include <i18npool/mslangid.hxx> #include <vcl/virdev.hxx> #include <vcl/bmpacc.hxx> @@ -51,6 +50,7 @@ #include <vcl/sallayout.hxx> #include <vcl/metric.hxx> #include <vcl/fontsubset.hxx> +#include <vcl/textlayout.hxx> #include <svsys.h> #include <vcl/salgdi.hxx> #include <vcl/svapp.hxx> @@ -665,26 +665,29 @@ OString PDFWriterImpl::convertWidgetFieldName( const rtl::OUString& rString ) } OString aRet = aBuffer.makeStringAndClear(); - std::hash_map<OString, sal_Int32, OStringHash>::iterator it = m_aFieldNameMap.find( aRet ); - - if( it != m_aFieldNameMap.end() ) // not unique + if( ! m_aContext.AllowDuplicateFieldNames ) { - std::hash_map< OString, sal_Int32, OStringHash >::const_iterator check_it; - OString aTry; - do + std::hash_map<OString, sal_Int32, OStringHash>::iterator it = m_aFieldNameMap.find( aRet ); + + if( it != m_aFieldNameMap.end() ) // not unique { - OStringBuffer aUnique( aRet.getLength() + 16 ); - aUnique.append( aRet ); - aUnique.append( '_' ); - aUnique.append( it->second ); - it->second++; - aTry = aUnique.makeStringAndClear(); - check_it = m_aFieldNameMap.find( aTry ); - } while( check_it != m_aFieldNameMap.end() ); - aRet = aTry; + std::hash_map< OString, sal_Int32, OStringHash >::const_iterator check_it; + OString aTry; + do + { + OStringBuffer aUnique( aRet.getLength() + 16 ); + aUnique.append( aRet ); + aUnique.append( '_' ); + aUnique.append( it->second ); + it->second++; + aTry = aUnique.makeStringAndClear(); + check_it = m_aFieldNameMap.find( aTry ); + } while( check_it != m_aFieldNameMap.end() ); + aRet = aTry; + } + else + m_aFieldNameMap[ aRet ] = 2; } - else - m_aFieldNameMap[ aRet ] = 2; return aRet; } @@ -2842,6 +2845,121 @@ static bool getPfbSegmentLengths( const unsigned char* pFontBytes, int nByteLen, return true; } +std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const ImplFontData* pFont, EmbedFont& rEmbed ) +{ + std::map< sal_Int32, sal_Int32 > aRet; + if( isBuiltinFont( pFont ) ) + { + aRet[ rEmbed.m_nNormalFontID ] = emitBuiltinFont( pFont ); + return aRet; + } + + sal_Int32 nFontObject = 0; + sal_Int32 nFontDescriptor = 0; + rtl::OString aSubType( "/Type1" ); + FontSubsetInfo aInfo; + // fill in dummy values + aInfo.m_nAscent = 1000; + aInfo.m_nDescent = 200; + aInfo.m_nCapHeight = 1000; + aInfo.m_aFontBBox = Rectangle( Point( -200, -200 ), Size( 1700, 1700 ) ); + aInfo.m_aPSName = pFont->maName; + sal_Int32 pWidths[256]; + rtl_zeroMemory( pWidths, sizeof(pWidths) ); + if( pFont->IsEmbeddable() ) + { + const unsigned char* pFontData = NULL; + long nFontLen = 0; + sal_Ucs nEncodedCodes[256]; + sal_Int32 pEncWidths[256]; + if( (pFontData = (const unsigned char*)m_pReferenceDevice->mpGraphics->GetEmbedFontData( pFont, nEncodedCodes, pEncWidths, aInfo, &nFontLen )) != NULL ) + { + m_pReferenceDevice->mpGraphics->FreeEmbedFontData( pFontData, nFontLen ); + for( int i = 0; i < 256; i++ ) + { + if( nEncodedCodes[i] >= 32 && nEncodedCodes[i] < 256 ) + { + pWidths[i] = pEncWidths[ i ]; + } + } + } + } + else if( pFont->mbSubsettable ) + { + aSubType = rtl::OString( "/TrueType" ); + Int32Vector aGlyphWidths; + Ucs2UIntMap aUnicodeMap; + m_pReferenceDevice->mpGraphics->GetGlyphWidths( pFont, false, aGlyphWidths, aUnicodeMap ); + + OUString aTmpName; + osl_createTempFile( NULL, NULL, &aTmpName.pData ); + sal_Int32 pGlyphIDs[ 256 ]; + sal_uInt8 pEncoding[ 256 ]; + sal_Ucs pUnicodes[ 256 ]; + sal_Int32 pDuWidths[ 256 ]; + + memset( pGlyphIDs, 0, sizeof( pGlyphIDs ) ); + memset( pEncoding, 0, sizeof( pEncoding ) ); + memset( pUnicodes, 0, sizeof( pUnicodes ) ); + memset( pDuWidths, 0, sizeof( pDuWidths ) ); + + for( sal_Ucs c = 32; c < 256; c++ ) + { + pUnicodes[c] = c; + pEncoding[c] = c; + pGlyphIDs[c] = 0; + if( aUnicodeMap.find( c ) != aUnicodeMap.end() ) + pWidths[ c ] = aGlyphWidths[ aUnicodeMap[ c ] ]; + } + + m_pReferenceDevice->mpGraphics->CreateFontSubset( aTmpName, pFont, pGlyphIDs, pEncoding, pDuWidths, 256, aInfo ); + osl_removeFile( aTmpName.pData ); + } + else + { + DBG_ERROR( "system font neither embeddable nor subsettable" ); + } + + // write font descriptor + nFontDescriptor = emitFontDescriptor( pFont, aInfo, 0, 0 ); + if( nFontDescriptor ) + { + // write font object + sal_Int32 nObject = createObject(); + if( updateObject( nObject ) ) + { + OStringBuffer aLine( 1024 ); + aLine.append( nObject ); + aLine.append( " 0 obj\n" + "<</Type/Font/Subtype" ); + aLine.append( aSubType ); + aLine.append( "/BaseFont/" ); + appendName( aInfo.m_aPSName, aLine ); + aLine.append( "\n" ); + if( !pFont->mbSymbolFlag ) + aLine.append( "/Encoding/WinAnsiEncoding\n" ); + aLine.append( "/FirstChar 32 /LastChar 255\n" + "/Widths[" ); + for( int i = 32; i < 256; i++ ) + { + aLine.append( pWidths[i] ); + aLine.append( ((i&15) == 15) ? "\n" : " " ); + } + aLine.append( "]\n" + "/FontDescriptor " ); + aLine.append( nFontDescriptor ); + aLine.append( " 0 R>>\n" + "endobj\n\n" ); + writeBuffer( aLine.getStr(), aLine.getLength() ); + + nFontObject = nObject; + aRet[ rEmbed.m_nNormalFontID ] = nObject; + } + } + + return aRet; +} + // TODO: always subset instead of embedding the full font => this method becomes obsolete then std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFontData* pFont, EmbedFont& rEmbed ) { @@ -3601,23 +3719,28 @@ sal_Int32 PDFWriterImpl::emitFontDescriptor( const ImplFontData* pFont, FontSubs // According to PDF reference 1.4 StemV is required // seems a tad strange to me, but well ... aLine.append( "\n" - "/StemV 80\n" - "/FontFile" ); - switch( rInfo.m_nFontType ) + "/StemV 80\n" ); + if( nFontStream ) { - case FontSubsetInfo::SFNT_TTF: - aLine.append( '2' ); - break; - case FontSubsetInfo::TYPE1_PFA: - case FontSubsetInfo::TYPE1_PFB: - break; - default: - DBG_ERROR( "unknown fonttype in PDF font descriptor" ); - return 0; + aLine.append( "/FontFile" ); + switch( rInfo.m_nFontType ) + { + case FontSubsetInfo::SFNT_TTF: + aLine.append( '2' ); + break; + case FontSubsetInfo::TYPE1_PFA: + case FontSubsetInfo::TYPE1_PFB: + case FontSubsetInfo::ANY_TYPE1: + break; + default: + DBG_ERROR( "unknown fonttype in PDF font descriptor" ); + return 0; + } + aLine.append( ' ' ); + aLine.append( nFontStream ); + aLine.append( " 0 R\n" ); } - aLine.append( ' ' ); - aLine.append( nFontStream ); - aLine.append( " 0 R>>\n" + aLine.append( ">>\n" "endobj\n\n" ); CHECK_RETURN( writeBuffer( aLine.getStr(), aLine.getLength() ) ); @@ -3874,6 +3997,17 @@ bool PDFWriterImpl::emitFonts() } } + // emit system fonts + for( FontEmbedData::iterator sit = m_aSystemFonts.begin(); sit != m_aSystemFonts.end(); ++sit ) + { + std::map< sal_Int32, sal_Int32 > aObjects = emitSystemFont( sit->first, sit->second ); + for( std::map< sal_Int32, sal_Int32 >::iterator fit = aObjects.begin(); fit != aObjects.end(); ++fit ) + { + CHECK_RETURN( fit->second ); + aFontIDToObject[ fit->first ] = fit->second; + } + } + OStringBuffer aFontDict( 1024 ); aFontDict.append( getFontDictObject() ); aFontDict.append( " 0 obj\n" @@ -4574,13 +4708,25 @@ void PDFWriterImpl::createDefaultEditAppearance( PDFWidget& rEdit, const PDFWrit // prepare font to use, draw field border Font aFont = drawFieldBorder( rEdit, rWidget, rSettings ); - sal_Int32 nBest = getBestBuiltinFont( aFont ); + sal_Int32 nBest = m_aContext.FieldsUseSystemFonts ? getSystemFont( aFont ): getBestBuiltinFont( aFont ); // prepare DA string OStringBuffer aDA( 32 ); appendNonStrokingColor( replaceColor( rWidget.TextColor, rSettings.GetFieldTextColor() ), aDA ); aDA.append( ' ' ); - aDA.append( m_aBuiltinFonts[nBest].getNameObject() ); + if( m_aContext.FieldsUseSystemFonts ) + { + aDA.append( "/F" ); + aDA.append( nBest ); + + OStringBuffer aDR( 32 ); + aDR.append( "/Font " ); + aDR.append( getFontDictObject() ); + aDR.append( " 0 R" ); + rEdit.m_aDRDict = aDR.makeStringAndClear(); + } + else + aDA.append( m_aBuiltinFonts[nBest].getNameObject() ); aDA.append( ' ' ); m_aPages[ m_nCurrentPage ].appendMappedLength( sal_Int32( aFont.GetHeight() ), aDA ); aDA.append( " Tf" ); @@ -4614,7 +4760,7 @@ void PDFWriterImpl::createDefaultListBoxAppearance( PDFWidget& rBox, const PDFWr // prepare font to use, draw field border Font aFont = drawFieldBorder( rBox, rWidget, rSettings ); - sal_Int32 nBest = getBestBuiltinFont( aFont ); + sal_Int32 nBest = m_aContext.FieldsUseSystemFonts ? getSystemFont( aFont ): getBestBuiltinFont( aFont ); beginRedirect( pListBoxStream, rBox.m_aRect ); OStringBuffer aAppearance( 64 ); @@ -4662,9 +4808,22 @@ void PDFWriterImpl::createDefaultListBoxAppearance( PDFWidget& rBox, const PDFWr aDA.append( " 2 Tr " ); } #endif + // prepare DA string appendNonStrokingColor( replaceColor( rWidget.TextColor, rSettings.GetFieldTextColor() ), aDA ); aDA.append( ' ' ); - aDA.append( m_aBuiltinFonts[nBest].getNameObject() ); + if( m_aContext.FieldsUseSystemFonts ) + { + aDA.append( "/F" ); + aDA.append( nBest ); + + OStringBuffer aDR( 32 ); + aDR.append( "/Font " ); + aDR.append( getFontDictObject() ); + aDR.append( " 0 R" ); + rBox.m_aDRDict = aDR.makeStringAndClear(); + } + else + aDA.append( m_aBuiltinFonts[nBest].getNameObject() ); aDA.append( ' ' ); m_aPages[ m_nCurrentPage ].appendMappedLength( sal_Int32( aFont.GetHeight() ), aDA ); aDA.append( " Tf" ); @@ -5241,9 +5400,18 @@ bool PDFWriterImpl::emitWidgetAnnotations() } if( rWidget.m_aDAString.getLength() ) { - aLine.append( "/DR<</Font<<" ); - appendBuiltinFontsToDict( aLine ); - aLine.append( ">>>>\n" ); + if( rWidget.m_aDRDict.getLength() ) + { + aLine.append( "/DR<<" ); + aLine.append( rWidget.m_aDRDict ); + aLine.append( ">>\n" ); + } + else + { + aLine.append( "/DR<</Font<<" ); + appendBuiltinFontsToDict( aLine ); + aLine.append( ">>>>\n" ); + } aLine.append( "/DA" ); appendLiteralStringEncrypt( rWidget.m_aDAString, rWidget.m_nObject, aLine ); aLine.append( "\n" ); @@ -6384,6 +6552,29 @@ std::set< PDFWriter::ErrorCode > PDFWriterImpl::getErrors() return m_aErrors; } +sal_Int32 PDFWriterImpl::getSystemFont( const Font& i_rFont ) +{ + getReferenceDevice()->Push(); + getReferenceDevice()->SetFont( i_rFont ); + getReferenceDevice()->ImplNewFont(); + + const ImplFontData* pDevFont = m_pReferenceDevice->mpFontEntry->maFontSelData.mpFontData; + sal_Int32 nFontID = 0; + FontEmbedData::iterator it = m_aSystemFonts.find( pDevFont ); + if( it != m_aSystemFonts.end() ) + nFontID = it->second.m_nNormalFontID; + else + { + nFontID = m_nNextFID++; + m_aSystemFonts[ pDevFont ] = EmbedFont(); + m_aSystemFonts[ pDevFont ].m_nNormalFontID = nFontID; + } + + getReferenceDevice()->Pop(); + getReferenceDevice()->ImplNewFont(); + + return nFontID; +} void PDFWriterImpl::registerGlyphs( int nGlyphs, sal_GlyphId* pGlyphs, @@ -7305,7 +7496,8 @@ void PDFWriterImpl::drawText( const Rectangle& rRect, const String& rOrigStr, US if ( nTextHeight ) { - nMaxTextWidth = m_pReferenceDevice->ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle ); + ::vcl::DefaultTextLayout aLayout( *m_pReferenceDevice ); + nMaxTextWidth = OutputDevice::ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, aLayout ); nLines = (xub_StrLen)(nHeight/nTextHeight); nFormatLines = aMultiLineInfo.Count(); if ( !nLines ) @@ -8790,6 +8982,13 @@ bool PDFWriterImpl::writeTransparentObject( TransparencyEmit& rObject ) aLine.append( ' ' ); appendFixedInt( rObject.m_aBoundRect.Bottom()+1, aLine ); aLine.append( " ]\n" ); + if( ! rObject.m_pSoftMaskStream ) + { + if( ! m_bIsPDF_A1 ) + { + aLine.append( "/Group<</S/Transparency/CS/DeviceRGB/K true>>\n" ); + } + } /* #i42884# the PDF reference recommends that each Form XObject * should have a resource dict; alas if that is the same object * as the one of the page it triggers an endless recursion in @@ -10131,12 +10330,17 @@ void PDFWriterImpl::setFont( const Font& rFont ) void PDFWriterImpl::push( sal_uInt16 nFlags ) { + OSL_ENSURE( m_aGraphicsStack.size() > 0, "invalid graphics stack" ); m_aGraphicsStack.push_front( m_aGraphicsStack.front() ); m_aGraphicsStack.front().m_nFlags = nFlags; } void PDFWriterImpl::pop() { + OSL_ENSURE( m_aGraphicsStack.size() > 1, "pop without push" ); + if( m_aGraphicsStack.size() < 2 ) + return; + GraphicsState aState = m_aGraphicsStack.front(); m_aGraphicsStack.pop_front(); GraphicsState& rOld = m_aGraphicsStack.front(); diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index 7d5ec2bf4f61..e058cfa487db 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -311,6 +311,8 @@ public: { sal_Int32 m_nNormalFontID; std::list< EmbedEncoding > m_aExtendedEncodings; + + EmbedFont() : m_nNormalFontID( 0 ) {} }; typedef std::map< const ImplFontData*, EmbedFont > FontEmbedData; @@ -396,6 +398,7 @@ public: USHORT m_nTextStyle; rtl::OUString m_aValue; rtl::OString m_aDAString; + rtl::OString m_aDRDict; rtl::OString m_aMKDict; rtl::OString m_aMKDictCAString; // i12626, added to be able to encrypt the /CA text string // since the object number is not known at the moment @@ -612,6 +615,7 @@ private: FontSubsetData m_aSubsets; bool m_bEmbedStandardFonts; FontEmbedData m_aEmbeddedFonts; + FontEmbedData m_aSystemFonts; sal_Int32 m_nNextFID; PDFFontCache m_aFontCache; @@ -679,6 +683,7 @@ private: m_aOverlineColor( COL_TRANSPARENT ), m_nAntiAlias( 1 ), m_nLayoutMode( 0 ), + m_aDigitLanguage( 0 ), m_nTransparentPercent( 0 ), m_nFlags( 0xffff ), m_nUpdateFlags( 0xffff ) @@ -693,6 +698,7 @@ private: m_aClipRegion( rState.m_aClipRegion ), m_nAntiAlias( rState.m_nAntiAlias ), m_nLayoutMode( rState.m_nLayoutMode ), + m_aDigitLanguage( rState.m_aDigitLanguage ), m_nTransparentPercent( rState.m_nTransparentPercent ), m_nFlags( rState.m_nFlags ), m_nUpdateFlags( rState.m_nUpdateFlags ) @@ -710,6 +716,7 @@ private: m_aClipRegion = rState.m_aClipRegion; m_nAntiAlias = rState.m_nAntiAlias; m_nLayoutMode = rState.m_nLayoutMode; + m_aDigitLanguage = rState.m_aDigitLanguage; m_nTransparentPercent = rState.m_nTransparentPercent; m_nFlags = rState.m_nFlags; m_nUpdateFlags = rState.m_nUpdateFlags; @@ -897,6 +904,8 @@ i12626 sal_Int32 emitBuiltinFont( const ImplFontData*, sal_Int32 nObject = -1 ); /* writes a type1 embedded font object and returns its mapping from font ids to object ids (or 0 in case of failure ) */ std::map< sal_Int32, sal_Int32 > emitEmbeddedFont( const ImplFontData*, EmbedFont& ); + /* writes a type1 system font object and returns its mapping from font ids to object ids (or 0 in case of failure ) */ + std::map< sal_Int32, sal_Int32 > emitSystemFont( const ImplFontData*, EmbedFont& ); /* writes a font descriptor and returns its object id (or 0) */ sal_Int32 emitFontDescriptor( const ImplFontData*, FontSubsetInfo&, sal_Int32 nSubsetID, sal_Int32 nStream ); /* writes a ToUnicode cmap, returns the corresponding stream object */ @@ -983,6 +992,7 @@ i12626 sal_Int32 findRadioGroupWidget( const PDFWriter::RadioButtonWidget& rRadio ); Font replaceFont( const Font& rControlFont, const Font& rAppSetFont ); sal_Int32 getBestBuiltinFont( const Font& rFont ); + sal_Int32 getSystemFont( const Font& i_rFont ); // used for edit and listbox Font drawFieldBorder( PDFWidget&, const PDFWriter::AnyWidget&, const StyleSettings& ); diff --git a/vcl/source/gdi/regband.cxx b/vcl/source/gdi/regband.cxx index 938a30351f9a..09c97ef7cd2b 100644 --- a/vcl/source/gdi/regband.cxx +++ b/vcl/source/gdi/regband.cxx @@ -110,7 +110,7 @@ ImplRegionBand::ImplRegionBand( if ( ! bIgnorePoints) { // Copy points. - ImplRegionBandPoint* pPoint = mpFirstBandPoint; + ImplRegionBandPoint* pPoint = rRegionBand.mpFirstBandPoint; ImplRegionBandPoint* pPrevPointCopy = NULL; while (pPoint != NULL) { diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx index db44bec521fe..fefbf8cdcb08 100644 --- a/vcl/source/gdi/region.cxx +++ b/vcl/source/gdi/region.cxx @@ -2456,6 +2456,14 @@ SvStream& operator>>( SvStream& rIStrm, Region& rRegion ) } } + if( rIStrm.IsEof() ) + { + DBG_ERROR( "premature end of region stream" ); + delete rRegion.mpImplRegion; + rRegion.mpImplRegion = (ImplRegion*)&aImplEmptyRegion; + return rIStrm; + } + // get next header rIStrm >> nTmp16; } @@ -2534,7 +2542,13 @@ SvStream& operator<<( SvStream& rOStrm, const Region& rRegion ) rOStrm << bHasPolyPolygon; if( bHasPolyPolygon ) - rOStrm << rRegion.GetPolyPolygon(); + { + // #i105373# + PolyPolygon aNoCurvePolyPolygon; + rRegion.GetPolyPolygon().AdaptiveSubdivide(aNoCurvePolyPolygon); + + rOStrm << aNoCurvePolyPolygon; + } } return rOStrm; diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index b69a9c365f08..c8748c65e2d3 100755 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -96,11 +96,12 @@ bool IsDiacritic( sal_UCS4 nChar ) if( nChar >= 0x2100 ) return false; + // TODO: #i105058# use icu uchar.h's character classification instead of the handcrafted table struct DiaRange { sal_UCS4 mnMin, mnEnd;}; static const DiaRange aRanges[] = { {0x0300, 0x0370}, - {0x0590, 0x05C0}, {0x05C1, 0x05C3}, {0x05C3, 0x05C6}, {0x05C7, 0x05C8}, - {0x0610, 0x061B}, {0x064B, 0x0660}, {0x0670, 0x0671}, {0x06D6, 0x06DC}, {0x06DF, 0x06EE}, + {0x0590, 0x05BE}, {0x05BF, 0x05C0}, {0x05C1, 0x05C3}, {0x05C4, 0x05C6}, {0x05C7, 0x05C8}, + {0x0610, 0x061B}, {0x064B, 0x0660}, {0x0670, 0x0671}, {0x06D6, 0x06DD}, {0x06DF, 0x06E5}, {0x06E7, 0x06E9}, {0x06EA,0x06EF}, {0x0730, 0x074D}, {0x07A6, 0x07B1}, {0x07EB, 0x07F4}, #if 0 // all known fonts have zero-width diacritics already, so no need to query it {0x0900, 0x0904}, {0x093C, 0x093D}, {0x0941, 0x0948}, {0x094D, 0x0950}, {0x0951, 0x0958}, @@ -108,7 +109,8 @@ bool IsDiacritic( sal_UCS4 nChar ) {0x0A00, 0x0A05}, {0x0A3C, 0x0A59}, //... #endif {0x1DC0, 0x1E00}, - {0x205F, 0x2070}, {0x20D0, 0x2100} + {0x205F, 0x2070}, {0x20D0, 0x2100}, + {0xFB1E, 0xFB1F} }; // TODO: almost anything is faster than an O(n) search diff --git a/vcl/source/gdi/salmisc.cxx b/vcl/source/gdi/salmisc.cxx index fc24c0289b50..8b442086eabf 100644 --- a/vcl/source/gdi/salmisc.cxx +++ b/vcl/source/gdi/salmisc.cxx @@ -426,10 +426,10 @@ BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRec // memory exception, clean up // remark: the buffer ptr causing the exception // is still NULL here - delete pSrcScan; - delete pDstScan; - delete pMapX; - delete pMapY; + delete[] pSrcScan; + delete[] pDstScan; + delete[] pMapX; + delete[] pMapY; delete pDstBuffer; return NULL; } diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx new file mode 100755 index 000000000000..67a30c351b7a --- /dev/null +++ b/vcl/source/gdi/textlayout.cxx @@ -0,0 +1,384 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* 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/ctrl.hxx" +#include "vcl/outdev.hxx" +#include "vcl/outfont.hxx" +#include "vcl/textlayout.hxx" + +#include <com/sun/star/i18n/ScriptDirection.hpp> + +#include <tools/diagnose_ex.h> + +#if OSL_DEBUG_LEVEL > 1 +#include <rtl/strbuf.hxx> +#endif + +//........................................................................ +namespace vcl +{ +//........................................................................ + + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::Exception; + namespace ScriptDirection = ::com::sun::star::i18n::ScriptDirection; + + //==================================================================== + //= DefaultTextLayout + //==================================================================== + //-------------------------------------------------------------------- + DefaultTextLayout::~DefaultTextLayout() + { + } + + //-------------------------------------------------------------------- + long DefaultTextLayout::GetTextWidth( const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const + { + return m_rTargetDevice.GetTextWidth( _rText, _nStartIndex, _nLength ); + } + + //-------------------------------------------------------------------- + void DefaultTextLayout::DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex, + xub_StrLen _nLength, MetricVector* _pVector, String* _pDisplayText ) + { + m_rTargetDevice.DrawText( _rStartPoint, _rText, _nStartIndex, _nLength, _pVector, _pDisplayText ); + } + + //-------------------------------------------------------------------- + bool DefaultTextLayout::GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, + xub_StrLen _nStartIndex, xub_StrLen _nLength ) const + { + return m_rTargetDevice.GetCaretPositions( _rText, _pCaretXArray, _nStartIndex, _nLength ); + } + + //-------------------------------------------------------------------- + xub_StrLen DefaultTextLayout::GetTextBreak( const XubString& _rText, long _nMaxTextWidth, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const + { + return m_rTargetDevice.GetTextBreak( _rText, _nMaxTextWidth, _nStartIndex, _nLength ); + } + + //-------------------------------------------------------------------- + bool DefaultTextLayout::DecomposeTextRectAction() const + { + return false; + } + + //==================================================================== + //= ReferenceDeviceTextLayout + //==================================================================== + class ReferenceDeviceTextLayout : public ITextLayout + { + public: + ReferenceDeviceTextLayout( const Control& _rControl, OutputDevice& _rTargetDevice, OutputDevice& _rReferenceDevice ); + virtual ~ReferenceDeviceTextLayout(); + + // ITextLayout + virtual long GetTextWidth( const XubString& rStr, xub_StrLen nIndex, xub_StrLen nLen ) const; + virtual void DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength, MetricVector* _pVector, String* _pDisplayText ); + virtual bool GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const; + virtual xub_StrLen GetTextBreak( const XubString& _rText, long _nMaxTextWidth, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const; + virtual bool DecomposeTextRectAction() const; + + public: + // equivalents to the respective OutputDevice methods, which take the reference device into account + long GetTextArray( const XubString& _rText, sal_Int32* _pDXAry, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const; + Rectangle DrawText( const Rectangle& _rRect, const XubString& _rText, USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText ); + + protected: + void onBeginDrawText() + { + m_aCompleteTextRect.SetEmpty(); + } + Rectangle onEndDrawText() + { + return m_aCompleteTextRect; + } + + private: + OutputDevice& m_rTargetDevice; + OutputDevice& m_rReferenceDevice; + Font m_aUnzoomedPointFont; + const Fraction m_aZoom; + const bool m_bRTLEnabled; + + Rectangle m_aCompleteTextRect; + }; + + //==================================================================== + //= ControlTextRenderer + //==================================================================== + ReferenceDeviceTextLayout::ReferenceDeviceTextLayout( const Control& _rControl, OutputDevice& _rTargetDevice, + OutputDevice& _rReferenceDevice ) + :m_rTargetDevice( _rTargetDevice ) + ,m_rReferenceDevice( _rReferenceDevice ) + ,m_aUnzoomedPointFont( _rControl.GetUnzoomedControlPointFont() ) + ,m_aZoom( _rControl.GetZoom() ) + ,m_bRTLEnabled( _rControl.IsRTLEnabled() ) + { + m_rTargetDevice.Push( PUSH_MAPMODE | PUSH_FONT | PUSH_TEXTLAYOUTMODE ); + + MapMode aTargetMapMode( m_rTargetDevice.GetMapMode() ); + OSL_ENSURE( aTargetMapMode.GetOrigin() == Point(), "ReferenceDeviceTextLayout::ReferenceDeviceTextLayout: uhm, the code below won't work here ..." ); + + // normally, controls simulate "zoom" by "zooming" the font. This is responsible for (part of) the discrepancies + // between text in Writer and text in controls in Writer, though both have the same font. + // So, if we have a zoom set at the control, then we do not scale the font, but instead modify the map mode + // to accomodate for the zoom. + aTargetMapMode.SetScaleX( m_aZoom ); // TODO: shouldn't this be "current_scale * zoom"? + aTargetMapMode.SetScaleY( m_aZoom ); + + // also, use a higher-resolution map unit than "pixels", which should save us some rounding errors when + // translating coordinates between the reference device and the target device. + OSL_ENSURE( aTargetMapMode.GetMapUnit() == MAP_PIXEL, + "ReferenceDeviceTextLayout::ReferenceDeviceTextLayout: this class is not expected to work with such target devices!" ); + // we *could* adjust all the code in this class to handle this case, but at the moment, it's not necessary + const MapUnit eTargetMapUnit = m_rReferenceDevice.GetMapMode().GetMapUnit(); + aTargetMapMode.SetMapUnit( eTargetMapUnit ); + OSL_ENSURE( aTargetMapMode.GetMapUnit() != MAP_PIXEL, + "ReferenceDeviceTextLayout::ReferenceDeviceTextLayout: a reference device which has map mode PIXEL?!" ); + + m_rTargetDevice.SetMapMode( aTargetMapMode ); + + // now that the Zoom is part of the map mode, reset the target device's font to the "unzoomed" version + Font aDrawFont( m_aUnzoomedPointFont ); + aDrawFont.SetSize( m_rTargetDevice.LogicToLogic( aDrawFont.GetSize(), MAP_POINT, eTargetMapUnit ) ); + _rTargetDevice.SetFont( aDrawFont ); + + // transfer font to the reference device + m_rReferenceDevice.Push( PUSH_FONT | PUSH_TEXTLAYOUTMODE ); + Font aRefFont( m_aUnzoomedPointFont ); + aRefFont.SetSize( OutputDevice::LogicToLogic( + aRefFont.GetSize(), MAP_POINT, m_rReferenceDevice.GetMapMode().GetMapUnit() ) ); + m_rReferenceDevice.SetFont( aRefFont ); + } + + //-------------------------------------------------------------------- + ReferenceDeviceTextLayout::~ReferenceDeviceTextLayout() + { + m_rReferenceDevice.Pop(); + m_rTargetDevice.Pop(); + } + + //-------------------------------------------------------------------- + namespace + { + //................................................................ + bool lcl_normalizeLength( const XubString& _rText, const xub_StrLen _nStartIndex, xub_StrLen& _io_nLength ) + { + xub_StrLen nTextLength = _rText.Len(); + if ( _nStartIndex > nTextLength ) + return false; + if ( _nStartIndex + _io_nLength > nTextLength ) + _io_nLength = nTextLength - _nStartIndex; + return true; + } + } + + //-------------------------------------------------------------------- + long ReferenceDeviceTextLayout::GetTextArray( const XubString& _rText, sal_Int32* _pDXAry, xub_StrLen _nStartIndex, + xub_StrLen _nLength ) const + { + if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) ) + return 0; + + // retrieve the character widths from the reference device + long nTextWidth = m_rReferenceDevice.GetTextArray( _rText, _pDXAry, _nStartIndex, _nLength ); +#if OSL_DEBUG_LEVEL > 1 + if ( _pDXAry ) + { + ::rtl::OStringBuffer aTrace; + aTrace.append( "ReferenceDeviceTextLayout::GetTextArray( " ); + aTrace.append( ::rtl::OUStringToOString( _rText, RTL_TEXTENCODING_UTF8 ) ); + aTrace.append( " ): " ); + aTrace.append( nTextWidth ); + aTrace.append( " = ( " ); + for ( size_t i=0; i<_nLength; ) + { + aTrace.append( _pDXAry[i] ); + if ( ++i < _nLength ) + aTrace.append( ", " ); + } + aTrace.append( ")" ); + OSL_TRACE( aTrace.makeStringAndClear().getStr() ); + } +#endif + return nTextWidth; + } + + //-------------------------------------------------------------------- + long ReferenceDeviceTextLayout::GetTextWidth( const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const + { + return GetTextArray( _rText, NULL, _nStartIndex, _nLength ); + } + + //-------------------------------------------------------------------- + void ReferenceDeviceTextLayout::DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength, MetricVector* _pVector, String* _pDisplayText ) + { + if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) ) + return; + + if ( _pVector && _pDisplayText ) + { + MetricVector aGlyphBounds; + m_rReferenceDevice.GetGlyphBoundRects( _rStartPoint, _rText, _nStartIndex, _nLength, _nStartIndex, aGlyphBounds ); + ::std::copy( + aGlyphBounds.begin(), aGlyphBounds.end(), + ::std::insert_iterator< MetricVector > ( *_pVector, _pVector->end() ) ); + _pDisplayText->Append( _rText.Copy( _nStartIndex, _nLength ) ); + return; + } + + sal_Int32* pCharWidths = new sal_Int32[ _nLength ]; + long nTextWidth = GetTextArray( _rText, pCharWidths, _nStartIndex, _nLength ); + m_rTargetDevice.DrawTextArray( _rStartPoint, _rText, pCharWidths, _nStartIndex, _nLength ); + delete[] pCharWidths; + + m_aCompleteTextRect.Union( Rectangle( _rStartPoint, Size( nTextWidth, m_rTargetDevice.GetTextHeight() ) ) ); + } + + //-------------------------------------------------------------------- + bool ReferenceDeviceTextLayout::GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, + xub_StrLen _nStartIndex, xub_StrLen _nLength ) const + { + if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) ) + return false; + + // retrieve the caret positions from the reference device + if ( !m_rReferenceDevice.GetCaretPositions( _rText, _pCaretXArray, _nStartIndex, _nLength ) ) + return false; + + return true; + } + + //-------------------------------------------------------------------- + xub_StrLen ReferenceDeviceTextLayout::GetTextBreak( const XubString& _rText, long _nMaxTextWidth, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const + { + if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) ) + return 0; + + return m_rReferenceDevice.GetTextBreak( _rText, _nMaxTextWidth, _nStartIndex, _nLength ); + } + + //-------------------------------------------------------------------- + bool ReferenceDeviceTextLayout::DecomposeTextRectAction() const + { + return true; + } + + //-------------------------------------------------------------------- + namespace + { + long zoomBy( long _value, const Fraction& _zoom ) + { + double n = (double)_value; + n *= (double)_zoom.GetNumerator(); + n /= (double)_zoom.GetDenominator(); + return (long)::rtl::math::round( n ); + } + long unzoomBy( long _value, const Fraction& _zoom ) + { + return zoomBy( _value, Fraction( _zoom.GetDenominator(), _zoom.GetNumerator() ) ); + } + } + + //-------------------------------------------------------------------- + Rectangle ReferenceDeviceTextLayout::DrawText( const Rectangle& _rRect, const XubString& _rText, USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText ) + { + if ( !_rText.Len() ) + return Rectangle(); + + // determine text layout mode from the RTL-ness of the control whose text we render + ULONG nTextLayoutMode = m_bRTLEnabled ? TEXT_LAYOUT_BIDI_RTL : TEXT_LAYOUT_BIDI_LTR; + m_rReferenceDevice.SetLayoutMode( nTextLayoutMode ); + m_rTargetDevice.SetLayoutMode( nTextLayoutMode | TEXT_LAYOUT_TEXTORIGIN_LEFT ); + // TEXT_LAYOUT_TEXTORIGIN_LEFT is because when we do actually draw the text (in DrawText( Point, ... )), then + // our caller gives us the left border of the draw position, regardless of script type, text layout, + // and the like + + // in our ctor, we set the map mode of the target device from pixel to twip, but our caller doesn't know this, + // but passed pixel coordinates. So, adjust the rect. + Rectangle aRect( m_rTargetDevice.PixelToLogic( _rRect ) ); + + onBeginDrawText(); + m_rTargetDevice.DrawText( aRect, _rText, _nStyle, _pVector, _pDisplayText, this ); + Rectangle aTextRect = onEndDrawText(); + + if ( aTextRect.IsEmpty() && !aRect.IsEmpty() ) + { + // this happens for instance if we're in a PaintToDevice call, where only a MetaFile is recorded, + // but no actual painting happens, so our "DrawText( Point, ... )" is never called + // In this case, calculate the rect from what OutputDevice::GetTextRect would give us. This has + // the disadvantage of less accuracy, compared with the approach to calculate the rect from the + // single "DrawText( Point, ... )" calls, since more intermediate arithmetics will translate + // from ref- to target-units. + aTextRect = m_rTargetDevice.GetTextRect( aRect, _rText, _nStyle, NULL, this ); + } + + // similar to above, the text rect now contains TWIPs (or whatever unit the ref device has), but the caller + // expects pixel coordinates + aTextRect = m_rTargetDevice.LogicToPixel( aTextRect ); + + // convert the metric vector + if ( _pVector ) + { + for ( MetricVector::iterator charRect = _pVector->begin(); + charRect != _pVector->end(); + ++charRect + ) + { + *charRect = m_rTargetDevice.LogicToPixel( *charRect ); + } + } + + return aTextRect; + } + + //==================================================================== + //= ControlTextRenderer + //==================================================================== + //-------------------------------------------------------------------- + ControlTextRenderer::ControlTextRenderer( const Control& _rControl, OutputDevice& _rTargetDevice, OutputDevice& _rReferenceDevice ) + :m_pImpl( new ReferenceDeviceTextLayout( _rControl, _rTargetDevice, _rReferenceDevice ) ) + { + } + + //-------------------------------------------------------------------- + ControlTextRenderer::~ControlTextRenderer() + { + } + + //-------------------------------------------------------------------- + Rectangle ControlTextRenderer::DrawText( const Rectangle& _rRect, const XubString& _rText, USHORT _nStyle, + MetricVector* _pVector, String* _pDisplayText ) + { + return m_pImpl->DrawText( _rRect, _rText, _nStyle, _pVector, _pDisplayText ); + } + +//........................................................................ +} // namespace vcl +//........................................................................ diff --git a/vcl/source/glyphs/gcach_ftyp.cxx b/vcl/source/glyphs/gcach_ftyp.cxx index c782366928db..b92bea929c51 100644 --- a/vcl/source/glyphs/gcach_ftyp.cxx +++ b/vcl/source/glyphs/gcach_ftyp.cxx @@ -136,7 +136,8 @@ static int nFTVERSION = 0; static FT_Error (*pFTNewSize)(FT_Face,FT_Size*); static FT_Error (*pFTActivateSize)(FT_Size); static FT_Error (*pFTDoneSize)(FT_Size); -static FT_Error (*pFTEmbolden)(FT_GlyphSlot); +FT_Error (*pFTEmbolden)(FT_GlyphSlot); +FT_Error (*pFTOblique)(FT_GlyphSlot); static bool bEnableSizeFT = false; struct EqStr{ bool operator()(const char* a, const char* b) const { return !strcmp(a,b); } }; @@ -473,6 +474,7 @@ FreetypeManager::FreetypeManager() pFTActivateSize = (FT_Error(*)(FT_Size))(sal_IntPtr)dlsym( RTLD_DEFAULT, "FT_Activate_Size" ); pFTDoneSize = (FT_Error(*)(FT_Size))(sal_IntPtr)dlsym( RTLD_DEFAULT, "FT_Done_Size" ); pFTEmbolden = (FT_Error(*)(FT_GlyphSlot))(sal_IntPtr)dlsym( RTLD_DEFAULT, "FT_GlyphSlot_Embolden" ); + pFTOblique = (FT_Error(*)(FT_GlyphSlot))(sal_IntPtr)dlsym( RTLD_DEFAULT, "FT_GlyphSlot_Oblique" ); bEnableSizeFT = (pFTNewSize!=NULL) && (pFTActivateSize!=NULL) && (pFTDoneSize!=NULL); @@ -2486,10 +2488,12 @@ bool FreetypeServerFont::ApplyGSUB( const ImplFontSelectData& rFSD ) { const USHORT nGlyph0 = GetUShort( pCoverage+0 ); const USHORT nGlyph1 = GetUShort( pCoverage+2 ); - const USHORT nCovIdx = GetUShort( pCoverage+4 ); + const USHORT nStartCoverageIndex = GetUShort( pCoverage+4 ); + DBG_ASSERT( aSubstVector.size() == nStartCoverageIndex, "coverage index mismatch"); + (void)nStartCoverageIndex; pCoverage += 6; for( USHORT j = nGlyph0; j <= nGlyph1; ++j ) - aSubstVector.push_back( GlyphSubst( j + nCovIdx, 0 ) ); + aSubstVector.push_back( GlyphSubst( j, 0 ) ); } } break; diff --git a/vcl/source/glyphs/graphite_adaptors.cxx b/vcl/source/glyphs/graphite_adaptors.cxx index 9b16318fdc40..34e2f5f5bbe3 100644 --- a/vcl/source/glyphs/graphite_adaptors.cxx +++ b/vcl/source/glyphs/graphite_adaptors.cxx @@ -71,6 +71,8 @@ namespace typedef std::hash_map<long,bool> SilfMap; SilfMap sSilfMap; } +extern FT_Error (*pFTEmbolden)(FT_GlyphSlot); +extern FT_Error (*pFTOblique)(FT_GlyphSlot); // class CharacterRenderProperties implentation. // @@ -303,11 +305,11 @@ void GraphiteFontAdaptor::getGlyphMetrics(gr::gid16 nGlyphId, gr::Rect & aBoundi return; } // check whether we need synthetic bold/italic otherwise metric is wrong - if (mrFont.NeedsArtificialBold()) - FT_GlyphSlot_Embolden(aFace->glyph); + if (mrFont.NeedsArtificialBold() && pFTEmbolden) + (*pFTEmbolden)(aFace->glyph); - if (mrFont.NeedsArtificialItalic()) - FT_GlyphSlot_Oblique(aFace->glyph); + if (mrFont.NeedsArtificialItalic() && pFTOblique) + (*pFTOblique)(aFace->glyph); const FT_Glyph_Metrics &gm = aFace->glyph->metrics; diff --git a/vcl/source/glyphs/makefile.mk b/vcl/source/glyphs/makefile.mk index 3e79cdc63da2..e43daaeac2ee 100644 --- a/vcl/source/glyphs/makefile.mk +++ b/vcl/source/glyphs/makefile.mk @@ -42,9 +42,6 @@ ENABLE_EXCEPTIONS=true .INCLUDE : $(PRJ)$/util$/makefile2.pmk CFLAGS+= $(FREETYPE_CFLAGS) -.IF "$(USE_FT_EMBOLDEN)" == "YES" -CFLAGS+=-DUSE_FT_EMBOLDEN -.ENDIF # --- Files -------------------------------------------------------- diff --git a/vcl/source/window/accmgr.cxx b/vcl/source/window/accmgr.cxx index 71373bbabee5..36064fc8bc6b 100644 --- a/vcl/source/window/accmgr.cxx +++ b/vcl/source/window/accmgr.cxx @@ -83,6 +83,23 @@ void ImplAccelManager::RemoveAccel( Accelerator* pAccel ) if ( !mpAccelList ) return; + //e.g. #i90599#. Someone starts typing a sequence in a dialog, but doesn't + //end it, and then closes the dialog, deleting the accelerators. So if + //we're removing an accelerator that a sub-accelerator which is in the + //sequence list, throw away the entire sequence + if ( mpSequenceList ) + { + for (USHORT i = 0; i < pAccel->GetItemCount(); ++i) + { + Accelerator* pSubAccel = pAccel->GetAccel(pAccel->GetItemId(i)); + if ( mpSequenceList->GetPos( pSubAccel ) != LIST_ENTRY_NOTFOUND ) + { + EndSequence( true ); + break; + } + } + } + // Raus damit mpAccelList->Remove( pAccel ); } diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 1fc2b9be703a..997e63d8b22e 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -453,6 +453,14 @@ Dialog::~Dialog() // ----------------------------------------------------------------------- +IMPL_LINK( Dialog, ImplAsyncCloseHdl, void*, EMPTYARG ) +{ + Close(); + return 0; +} + +// ----------------------------------------------------------------------- + long Dialog::Notify( NotifyEvent& rNEvt ) { // Zuerst Basisklasse rufen wegen TabSteuerung @@ -468,7 +476,11 @@ long Dialog::Notify( NotifyEvent& rNEvt ) if ( (nKeyCode == KEY_ESCAPE) && ((GetStyle() & WB_CLOSEABLE) || ImplGetCancelButton( this ) || ImplGetOKButton( this )) ) { - Close(); + // #i89505# for the benefit of slightly mentally challenged implementations + // like e.g. SfxModelessDialog which destroy themselves inside Close() + // post this Close asynchronous so we can leave our key handler before + // we get destroyed + PostUserEvent( LINK( this, Dialog, ImplAsyncCloseHdl ), this ); return TRUE; } } diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index ebd4475a80fc..c9e0c23e7f16 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -5136,15 +5136,23 @@ IMPL_LINK( MenuBarWindow, CloserHdl, PushButton*, EMPTYARG ) return 0; if( aCloser.GetCurItemId() == IID_DOCUMENTCLOSE ) - return ((MenuBar*)pMenu)->GetCloserHdl().Call( pMenu ); - std::map<USHORT,AddButtonEntry>::iterator it = m_aAddButtons.find( aCloser.GetCurItemId() ); - if( it != m_aAddButtons.end() ) { - MenuBar::MenuBarButtonCallbackArg aArg; - aArg.nId = it->first; - aArg.bHighlight = (aCloser.GetHighlightItemId() == it->first); - aArg.pMenuBar = dynamic_cast<MenuBar*>(pMenu); - return it->second.m_aSelectLink.Call( &aArg ); + // #i106052# call close hdl asynchronously to ease handler implementation + // this avoids still being in the handler while the DecoToolBox already + // gets destroyed + Application::PostUserEvent( ((MenuBar*)pMenu)->GetCloserHdl(), pMenu ); + } + else + { + std::map<USHORT,AddButtonEntry>::iterator it = m_aAddButtons.find( aCloser.GetCurItemId() ); + if( it != m_aAddButtons.end() ) + { + MenuBar::MenuBarButtonCallbackArg aArg; + aArg.nId = it->first; + aArg.bHighlight = (aCloser.GetHighlightItemId() == it->first); + aArg.pMenuBar = dynamic_cast<MenuBar*>(pMenu); + return it->second.m_aSelectLink.Call( &aArg ); + } } return 0; } diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index 4aaef6a707b1..ede3bcc107aa 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -1320,8 +1320,13 @@ void StatusBar::SetItemText( USHORT nItemId, const XubString& rText ) // adjust item width - see also DataChanged() long nFudge = GetTextHeight()/4; long nWidth = GetTextWidth( pItem->maText ) + nFudge; - if( nWidth > pItem->mnWidth + STATUSBAR_OFFSET ) + if( (nWidth > pItem->mnWidth + STATUSBAR_OFFSET) || + ((nWidth < pItem->mnWidth) && (mnDX - STATUSBAR_OFFSET) < mnItemsWidth )) + { pItem->mnWidth = nWidth + STATUSBAR_OFFSET; + ImplFormat(); + Invalidate(); + } // Item neu Zeichen, wenn StatusBar sichtbar und // UpdateMode gesetzt ist diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index f3ce8b2d05ea..2d99fbb20b65 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -62,6 +62,7 @@ public: TaskPaneList* mpTaskPaneList; Size maMaxOutSize; + rtl::OUString maRepresentedURL; }; SystemWindow::ImplData::ImplData() @@ -277,6 +278,29 @@ void SystemWindow::SetZLevel( BYTE nLevel ) // ----------------------------------------------------------------------- +void SystemWindow::SetRepresentedURL( const rtl::OUString& i_rURL ) +{ + bool bChanged = (i_rURL != mpImplData->maRepresentedURL); + mpImplData->maRepresentedURL = i_rURL; + if ( !mbSysChild && bChanged ) + { + const Window* pWindow = this; + while ( pWindow->mpWindowImpl->mpBorderWindow ) + pWindow = pWindow->mpWindowImpl->mpBorderWindow; + + if ( pWindow->mpWindowImpl->mbFrame ) + pWindow->mpWindowImpl->mpFrame->SetRepresentedURL( i_rURL ); + } +} +// ----------------------------------------------------------------------- + +const rtl::OUString& SystemWindow::GetRepresentedURL() const +{ + return mpImplData->maRepresentedURL; +} + +// ----------------------------------------------------------------------- + void SystemWindow::SetIcon( USHORT nIcon ) { if ( mnIcon == nIcon ) diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 9ec86fab20de..ecc335420f18 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -1002,6 +1002,9 @@ const Size& ToolBox::GetDefaultImageSize() const case STYLE_SYMBOLS_CRYSTAL: aLargeButtonSize = Size( TB_LARGEIMAGESIZE_CRYSTAL, TB_LARGEIMAGESIZE_CRYSTAL ); break; + case STYLE_SYMBOLS_OXYGEN: + aLargeButtonSize = Size( TB_LARGEIMAGESIZE_OXYGEN, TB_LARGEIMAGESIZE_OXYGEN ); + break; default: aLargeButtonSize = Size( TB_LARGEIMAGESIZE, TB_LARGEIMAGESIZE ); } diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 63bf407ce49f..bcf86c749673 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -68,7 +68,7 @@ #include "vcl/wall.hxx" #include "vcl/gradient.hxx" #include "vcl/toolbox.h" -#include "vcl/fontcfg.hxx" +#include "unotools/fontcfg.hxx" #include "vcl/sysdata.hxx" #include "vcl/sallayout.hxx" #include "vcl/button.hxx" // Button::GetStandardText @@ -310,7 +310,7 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, BOOL bCallHdl ) if ( !bUseSystemFont ) { ImplInitFontList(); - String aConfigFont = vcl::DefaultFontConfiguration::get()->getUserInterfaceFont( rSettings.GetUILocale() ); + String aConfigFont = utl::DefaultFontConfiguration::get()->getUserInterfaceFont( rSettings.GetUILocale() ); xub_StrLen nIndex = 0; while( nIndex != STRING_NOTFOUND ) { @@ -9752,6 +9752,8 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP EnableOutput(); DBG_ASSERT( GetMapMode().GetMapUnit() == MAP_PIXEL, "MapMode must be PIXEL based" ); + if ( GetMapMode().GetMapUnit() != MAP_PIXEL ) + return; // preserve graphicsstate Push(); diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx index 0c19c5c5ee4f..c1f80bb061e5 100644 --- a/vcl/source/window/wrkwin.cxx +++ b/vcl/source/window/wrkwin.cxx @@ -310,7 +310,7 @@ void WorkWindow::Maximize( BOOL bMaximize ) ImplSetFrameState( bMaximize ? SAL_FRAMESTATE_MAXIMIZED : SAL_FRAMESTATE_NORMAL ); } -BOOL WorkWindow::IsMaximized() +BOOL WorkWindow::IsMaximized() const { BOOL bRet = FALSE; diff --git a/vcl/unx/gtk/a11y/atktext.cxx b/vcl/unx/gtk/a11y/atktext.cxx index 8d83ca008e4a..0a97e5ba1ca6 100644 --- a/vcl/unx/gtk/a11y/atktext.cxx +++ b/vcl/unx/gtk/a11y/atktext.cxx @@ -187,8 +187,16 @@ static accessibility::XAccessibleTextMarkup* if( !pWrap->mpTextMarkup && pWrap->mpContext ) { uno::Any any = pWrap->mpContext->queryInterface( accessibility::XAccessibleTextMarkup::static_type(NULL) ); - pWrap->mpTextMarkup = reinterpret_cast< accessibility::XAccessibleTextMarkup * > (any.pReserved); - pWrap->mpTextMarkup->acquire(); + /* Since this not a dedicated interface in Atk and thus has not + * been queried during wrapper initialization, we need to check + * the return value here. + */ + if( typelib_TypeClass_INTERFACE == any.pType->eTypeClass ) + { + pWrap->mpTextMarkup = reinterpret_cast< accessibility::XAccessibleTextMarkup * > (any.pReserved); + if( pWrap->mpTextMarkup ) + pWrap->mpTextMarkup->acquire(); + } } return pWrap->mpTextMarkup; diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx index 5206c8ce87ca..c92a69d3fb49 100644 --- a/vcl/unx/gtk/a11y/atkutil.cxx +++ b/vcl/unx/gtk/a11y/atkutil.cxx @@ -221,7 +221,7 @@ void DocumentFocusListener::notifyEvent( const accessibility::AccessibleEventObj if( accessibility::AccessibleStateType::FOCUSED == nState ) atk_wrapper_focus_tracker_notify_when_idle( getAccessible(aEvent) ); } - catch(lang::IndexOutOfBoundsException e) + catch(const lang::IndexOutOfBoundsException &e) { g_warning("Focused object has invalid index in parent"); } @@ -577,7 +577,14 @@ static void handle_get_focus(::VclWindowEvent const * pEvent) if( g_aWindowList.find(pWindow) == g_aWindowList.end() ) { g_aWindowList.insert(pWindow); - aDocumentFocusListener->attachRecursive(xAccessible, xContext, xStateSet); + try + { + aDocumentFocusListener->attachRecursive(xAccessible, xContext, xStateSet); + } + catch( const uno::Exception &e ) + { + g_warning( "Exception caught processing focus events" ); + } } #ifdef ENABLE_TRACING else @@ -608,7 +615,7 @@ static void handle_menu_highlighted(::VclMenuEvent const * pEvent) } } } - catch( uno::Exception e ) + catch( const uno::Exception& e ) { g_warning( "Exception caught processing menu highlight events" ); } diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index eff7319d6efc..92ff2d3b8d8e 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -772,7 +772,10 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) m_aForeignTopLevelWindow = None; m_nStyle = nStyle; - GtkWindowType eWinType = ((nStyle & SAL_FRAME_STYLE_FLOAT) && ! (nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION)) + GtkWindowType eWinType = ( (nStyle & SAL_FRAME_STYLE_FLOAT) && + ! (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION| + SAL_FRAME_STYLE_FLOAT_FOCUSABLE)) + ) ? GTK_WINDOW_POPUP : GTK_WINDOW_TOPLEVEL; if( nStyle & SAL_FRAME_STYLE_SYSTEMCHILD ) @@ -801,7 +804,7 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) bool bDecoHandling = ! isChild() && ( ! (nStyle & SAL_FRAME_STYLE_FLOAT) || - (nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) ); + (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 @@ -832,6 +835,11 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, true ); bNoDecor = true; } + else if( (nStyle & SAL_FRAME_STYLE_FLOAT_FOCUSABLE) ) + { + eType = GDK_WINDOW_TYPE_HINT_UTILITY; + } + if( (nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ) ) { eType = GDK_WINDOW_TYPE_HINT_TOOLBAR; @@ -869,7 +877,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)) ) || bMetaCityToolWindowHack ) lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, false ); } @@ -2075,7 +2083,7 @@ void GtkSalFrame::ToTop( USHORT nFlags ) * to our window - which it of course won't since our input hint * is set to false. */ - if( (m_nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) ) + if( (m_nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION|SAL_FRAME_STYLE_FLOAT_FOCUSABLE)) ) XSetInputFocus( getDisplay()->GetDisplay(), GDK_WINDOW_XWINDOW( m_pWindow->window ), RevertToParent, CurrentTime ); } else @@ -2369,6 +2377,11 @@ void GtkSalFrame::createNewWindow( XLIB_Window aNewParent, bool bXEmbed, int nSc } } + // free xrender resources + for( unsigned int i = 0; i < sizeof(m_aGraphics)/sizeof(m_aGraphics[0]); i++ ) + if( m_aGraphics[i].bInUse ) + m_aGraphics[i].pGraphics->SetDrawable( None, m_nScreen ); + // first deinit frame if( m_pIMHandler ) { diff --git a/vcl/unx/headless/svppspgraphics.cxx b/vcl/unx/headless/svppspgraphics.cxx index 3e9d67bcbbe9..1311aaed4ee4 100644 --- a/vcl/unx/headless/svppspgraphics.cxx +++ b/vcl/unx/headless/svppspgraphics.cxx @@ -986,13 +986,6 @@ const void* PspGraphics::DoGetEmbedFontData( fontID aFont, const sal_Ucs* pUnico return NULL; // fill in font info - switch( aFontInfo.m_eType ) - { - case psp::fonttype::TrueType: rInfo.m_nFontType = FontSubsetInfo::SFNT_TTF; break; - case psp::fonttype::Type1: rInfo.m_nFontType = FontSubsetInfo::ANY_TYPE1; break; - default: - return NULL; - } rInfo.m_nAscent = aFontInfo.m_nAscend; rInfo.m_nDescent = aFontInfo.m_nDescend; rInfo.m_aPSName = rMgr.getPSName( aFont ); @@ -1029,9 +1022,22 @@ const void* PspGraphics::DoGetEmbedFontData( fontID aFont, const sal_Ucs* pUnico rInfo.m_nCapHeight = yMax; // Well ... for( int i = 0; i < 256; i++ ) - pWidths[i] = (aMetrics[i].width > 0 ? aMetrics[i].width : 0); + switch( aFontInfo.m_eType ) + { + case psp::fonttype::TrueType: + rInfo.m_nFontType = FontSubsetInfo::SFNT_TTF; + break; + case psp::fonttype::Type1: { + const bool bPFA = ((*(unsigned char*)pFile) < 0x80); + rInfo.m_nFontType = bPFA ? FontSubsetInfo::TYPE1_PFA : FontSubsetInfo::TYPE1_PFB; + } + break; + default: + return NULL; + } + return pFile; } diff --git a/vcl/unx/inc/kde_headers.h b/vcl/unx/inc/kde_headers.h deleted file mode 100644 index ccbffc99cb99..000000000000 --- a/vcl/unx/inc/kde_headers.h +++ /dev/null @@ -1,97 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: kde_headers.h,v $ - * $Revision: 1.6 $ - * - * 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. - * - ************************************************************************/ - -#ifndef INCLUDED_VCL_KDE_HEADERS_H -#define INCLUDED_VCL_KDE_HEADERS_H - -/* ********* Suppress warnings if needed */ -#include "sal/config.h" - -#if defined __GNUC__ -#pragma GCC system_header -#endif - - -/* ********* Hack, but needed because of conflicting types... */ -#define Region QtXRegion - - -/* ********* Qt headers */ -#include <qaccessible.h> -#include <qcheckbox.h> -#include <qcombobox.h> -#include <qfont.h> -#include <qframe.h> -#include <qlineedit.h> -#include <qlistview.h> -#include <qmainwindow.h> -#include <qmenudata.h> -#include <qpaintdevice.h> -#include <qpainter.h> -#include <qpushbutton.h> -#include <qradiobutton.h> -#include <qrangecontrol.h> -#include <qstring.h> -#include <qtabbar.h> -#include <qtabwidget.h> -#include <qtoolbar.h> -#include <qtoolbutton.h> -#include <qwidget.h> -#include <qprogressbar.h> - -/* ********* See hack on top of this file */ -#undef Region - - -/* ********* KDE base headers */ -#include <kaboutdata.h> -#include <kapplication.h> -#include <kcmdlineargs.h> -#include <kconfig.h> -#include <kdeversion.h> -#include <kemailsettings.h> -#include <kglobal.h> -#include <kglobalsettings.h> -#include <klocale.h> -#include <kmainwindow.h> -#include <kmenubar.h> -#include <kprotocolmanager.h> -#include <kstartupinfo.h> -#include <kstyle.h> - - -/* ********* KDE address book connectivity headers */ -#include <kabc/addressbook.h> -#include <kabc/addressee.h> -#include <kabc/field.h> -#include <kabc/stdaddressbook.h> - - -#endif diff --git a/vcl/unx/inc/plugins/gtk/gtkframe.hxx b/vcl/unx/inc/plugins/gtk/gtkframe.hxx index a8fc6f65d4ee..c2a147517ac8 100644 --- a/vcl/unx/inc/plugins/gtk/gtkframe.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkframe.hxx @@ -242,9 +242,10 @@ class GtkSalFrame : public SalFrame bool isFloatGrabWindow() const { return - (m_nStyle & SAL_FRAME_STYLE_FLOAT) && // only a float can be floatgrab - !(m_nStyle & SAL_FRAME_STYLE_TOOLTIP) && // tool tips are not - !(m_nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION); // toolbars are also not + (m_nStyle & SAL_FRAME_STYLE_FLOAT) && // only a float can be floatgrab + !(m_nStyle & SAL_FRAME_STYLE_TOOLTIP) && // tool tips are not + !(m_nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) && // toolbars are also not + !(m_nStyle & SAL_FRAME_STYLE_FLOAT_FOCUSABLE); // focusable floats are not } bool isChild( bool bPlug = true, bool bSysChild = true ) diff --git a/vcl/unx/inc/plugins/kde/kdedata.hxx b/vcl/unx/inc/plugins/kde/kdedata.hxx index 831621e38cc1..04730b39fad2 100644 --- a/vcl/unx/inc/plugins/kde/kdedata.hxx +++ b/vcl/unx/inc/plugins/kde/kdedata.hxx @@ -75,7 +75,7 @@ public: virtual SalGraphics* GetGraphics(); virtual void ReleaseGraphics( SalGraphics *pGraphics ); - virtual void updateGraphics(); + virtual void updateGraphics( bool bClear ); virtual void UpdateSettings( AllSettings& rSettings ); virtual void Show( BOOL bVisible, BOOL bNoActivate ); }; diff --git a/vcl/unx/inc/salframe.h b/vcl/unx/inc/salframe.h index 848f2250d31c..8dad0350a937 100644 --- a/vcl/unx/inc/salframe.h +++ b/vcl/unx/inc/salframe.h @@ -212,7 +212,9 @@ public: virtual SalGraphics* GetGraphics(); virtual void ReleaseGraphics( SalGraphics* pGraphics ); - virtual void updateGraphics(); + // call with true to clear graphics (setting None as drawable) + // call with false to setup graphics with window (GetWindow()) + virtual void updateGraphics( bool bClear ); virtual BOOL PostEvent( void* pData ); diff --git a/vcl/unx/inc/sm.hxx b/vcl/unx/inc/sm.hxx index 17bb40e2106a..09d2f5557e1d 100644 --- a/vcl/unx/inc/sm.hxx +++ b/vcl/unx/inc/sm.hxx @@ -69,7 +69,7 @@ public: static bool checkDocumentsSaved(); static bool queryInteraction(); static void saveDone(); - static void interactionDone(); + static void interactionDone( bool bCancelShutdown ); static String getExecName(); static VCL_DLLPUBLIC const ByteString& getSessionID(); diff --git a/vcl/unx/kde/kdedata.cxx b/vcl/unx/kde/kdedata.cxx index 1b5a2f86dcee..9da57b6e790d 100644 --- a/vcl/unx/kde/kdedata.cxx +++ b/vcl/unx/kde/kdedata.cxx @@ -29,7 +29,7 @@ #include "precompiled_vcl.hxx" #define _SV_SALDATA_CXX -#include "kde_headers.h" +#include <shell/kde_headers.h> #include <unistd.h> #include <fcntl.h> diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx index 8046d22d75d3..cd461fc36c8f 100644 --- a/vcl/unx/kde/salnativewidgets-kde.cxx +++ b/vcl/unx/kde/salnativewidgets-kde.cxx @@ -32,7 +32,7 @@ #include "precompiled_vcl.hxx" #define _SV_SALNATIVEWIDGETS_KDE_CXX -#include "kde_headers.h" +#include <shell/kde_headers.h> #include <salunx.h> #include <saldata.hxx> @@ -2073,12 +2073,13 @@ void KDESalFrame::ReleaseGraphics( SalGraphics *pGraphics ) } } -void KDESalFrame::updateGraphics() +void KDESalFrame::updateGraphics( bool bClear ) { + Drawable aDrawable = bClear ? None : GetWindow(); for( int i = 0; i < nMaxGraphics; i++ ) { if( m_aGraphics[i].bInUse ) - m_aGraphics[i].pGraphics->SetDrawable( GetWindow(), GetScreenNumber() ); + m_aGraphics[i].pGraphics->SetDrawable( aDrawable, GetScreenNumber() ); } } diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx index 796350a63d50..6177c4b2896a 100644 --- a/vcl/unx/kde4/KDESalFrame.cxx +++ b/vcl/unx/kde4/KDESalFrame.cxx @@ -181,7 +181,6 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) StyleSettings style( rSettings.GetStyleSettings() ); BOOL bSetTitleFont = false; - // General settings QPalette pal = kapp->palette(); @@ -214,6 +213,14 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) pKey = "Theme"; if ( aGroup.hasKey( pKey ) ) style.SetPreferredSymbolsStyleName( readEntryUntranslated( &aGroup, pKey ) ); + + //toolbar + pKey = "toolbarFont"; + if ( aGroup.hasKey( pKey ) ) + { + Font aFont = toFont( aGroup.readEntry( pKey, QFont() ), rSettings.GetUILocale() ); + style.SetToolFont( aFont ); + } } Color aFore = toColor( pal.color( QPalette::Active, QPalette::WindowText ) ); @@ -288,7 +295,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) style.SetFloatTitleFont( aFont ); style.SetMenuFont( aFont ); // will be changed according to pMenuBar - style.SetToolFont( aFont ); // will be changed according to pToolBar + //style.SetToolFont( aFont ); //already set above style.SetLabelFont( aFont ); style.SetInfoFont( aFont ); style.SetRadioCheckFont( aFont ); @@ -300,11 +307,9 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) int flash_time = QApplication::cursorFlashTime(); style.SetCursorBlinkTime( flash_time != 0 ? flash_time/2 : STYLE_CURSOR_NOBLINKTIME ); - KMainWindow qMainWindow; - // Menu style.SetSkipDisabledInMenus( TRUE ); - KMenuBar *pMenuBar = qMainWindow.menuBar(); + KMenuBar* pMenuBar = new KMenuBar(); if ( pMenuBar ) { // Color @@ -337,22 +342,11 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) style.SetMenuFont( aFont ); } - // Tool bar - KToolBar *pToolBar = qMainWindow.toolBar(); - if ( pToolBar ) - { - aFont = toFont( pToolBar->font(), rSettings.GetUILocale() ); - style.SetToolFont( aFont ); - } + delete pMenuBar; // Scroll bar size style.SetScrollBarSize( kapp->style()->pixelMetric( QStyle::PM_ScrollBarExtent ) ); - // #i59364# high contrast mode - BOOL bHC = ( style.GetFaceColor().IsDark() || - style.GetWindowColor().IsDark() ); - style.SetHighContrastMode( bHC ); - rSettings.SetStyleSettings( style ); } @@ -369,12 +363,13 @@ void KDESalFrame::ReleaseGraphics( SalGraphics *pGraphics ) } } -void KDESalFrame::updateGraphics() +void KDESalFrame::updateGraphics( bool bClear ) { + Drawable aDrawable = bClear ? None : GetWindow(); for( int i = 0; i < nMaxGraphics; i++ ) { if( m_aGraphics[i].bInUse ) - m_aGraphics[i].pGraphics->SetDrawable( GetWindow(), GetScreenNumber() ); + m_aGraphics[i].pGraphics->SetDrawable( aDrawable, GetScreenNumber() ); } } diff --git a/vcl/unx/kde4/KDESalFrame.hxx b/vcl/unx/kde4/KDESalFrame.hxx index 11a22bd93ba5..de3a5af189ee 100644 --- a/vcl/unx/kde4/KDESalFrame.hxx +++ b/vcl/unx/kde4/KDESalFrame.hxx @@ -52,7 +52,7 @@ class KDESalFrame : public X11SalFrame virtual SalGraphics* GetGraphics(); virtual void ReleaseGraphics( SalGraphics *pGraphics ); - virtual void updateGraphics(); + virtual void updateGraphics( bool bClear ); virtual void UpdateSettings( AllSettings& rSettings ); virtual void Show( BOOL bVisible, BOOL bNoActivate ); };
\ No newline at end of file diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index 2e8f0dcad96b..1c9882923b43 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -513,10 +513,12 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, } else if (type == CTRL_FRAME) { + pixmap.fill(KApplication::palette().color(QPalette::Window)); lcl_drawFrame( widgetRect, painter, QStyle::PE_Frame, nControlState, value ); } else if (type == CTRL_FIXEDBORDER) { + pixmap.fill(KApplication::palette().color(QPalette::Window)); lcl_drawFrame( widgetRect, painter, QStyle::PE_FrameWindow, nControlState, value ); } else if (type == CTRL_WINDOW_BACKGROUND) diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx index 70b1796df7f0..dedda64d157e 100644 --- a/vcl/unx/kde4/KDEXLib.cxx +++ b/vcl/unx/kde4/KDEXLib.cxx @@ -77,24 +77,30 @@ void KDEXLib::Init() pInputMethod->SetLocale(); XrmInitialize(); - KAboutData *kAboutData = new KAboutData( "OpenOffice.org", - "OpenOffice.org", + KAboutData *kAboutData = new KAboutData("OpenOffice.org", + "kdelibs4", ki18n( "OpenOffice.org" ), "3.0.0", ki18n( "OpenOffice.org with KDE Native Widget Support." ), KAboutData::License_LGPL, - ki18n( "Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008 Novell, Inc"), + ki18n( "Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Novell, Inc"), ki18n( "OpenOffice.org is an office suite.\n" ), "http://kde.openoffice.org/index.html", "dev@kde.openoffice.org" ); + kAboutData->addAuthor( ki18n( "Jan Holesovsky" ), ki18n( "Original author and maintainer of the KDE NWF." ), "kendy@artax.karlin.mff.cuni.cz", "http://artax.karlin.mff.cuni.cz/~kendy" ); + kAboutData->addAuthor( ki18n("Roman Shtylman"), + ki18n( "Porting to KDE 4." ), + "shtylman@gmail.com", "http://shtylman.com" ); kAboutData->addAuthor( ki18n("Eric Bischoff"), ki18n( "Accessibility fixes, porting to KDE 4." ), "bischoff@kde.org" ); + //kAboutData->setProgramIconName("OpenOffice"); + m_nFakeCmdLineArgs = 1; USHORT nIdx; vos::OExtCommandLine aCommandLine; @@ -135,6 +141,7 @@ void KDEXLib::Init() m_pApplication = new VCLKDEApplication(); kapp->disableSessionManagement(); + KApplication::setQuitOnLastWindowClosed(false); Display* pDisp = QX11Info::display(); SalKDEDisplay *pSalDisplay = new SalKDEDisplay(pDisp); diff --git a/vcl/unx/source/app/salinst.cxx b/vcl/unx/source/app/salinst.cxx index 1dc2d1404009..6b7753960290 100644 --- a/vcl/unx/source/app/salinst.cxx +++ b/vcl/unx/source/app/salinst.cxx @@ -50,7 +50,7 @@ #include "vcl/salwtype.hxx" #include "vcl/salatype.hxx" #include "vcl/helper.hxx" - +#include <tools/solarmutex.hxx> #include "vos/mutex.hxx" // ------------------------------------------------------------------------- @@ -63,6 +63,7 @@ SalYieldMutex::SalYieldMutex() { mnCount = 0; mnThreadId = 0; + ::tools::SolarMutex::SetSolarMutex( this ); } void SalYieldMutex::acquire() @@ -141,6 +142,7 @@ X11SalInstance::~X11SalInstance() delete pSalData; SetSalData( NULL ); + ::tools::SolarMutex::SetSolarMutex( 0 ); delete mpSalYieldMutex; } diff --git a/vcl/unx/source/app/sm.cxx b/vcl/unx/source/app/sm.cxx index ff981b04259b..c5605cec1dfb 100644 --- a/vcl/unx/source/app/sm.cxx +++ b/vcl/unx/source/app/sm.cxx @@ -114,7 +114,7 @@ void IceSalSession::queryInteraction() void IceSalSession::interactionDone() { - SessionManagerClient::interactionDone(); + SessionManagerClient::interactionDone( false ); } void IceSalSession::saveDone() @@ -129,6 +129,7 @@ void IceSalSession::saveDone() bool IceSalSession::cancelShutdown() { + SessionManagerClient::interactionDone( true ); return false; } @@ -368,6 +369,12 @@ void SessionManagerClient::SaveYourselfProc( IMPL_STATIC_LINK_NOINSTANCE( SessionManagerClient, ShutDownHdl, void*, EMPTYARG ) { + if( pOneInstance ) + { + SalSessionQuitEvent aEvent; + pOneInstance->CallCallback( &aEvent ); + } + const std::list< SalFrame* >& rFrames = GetX11SalData()->GetDisplay()->getFrames(); SMprintf( rFrames.begin() != rFrames.end() ? "shutdown on first frame\n" : "shutdown event but no frame\n" ); if( rFrames.begin() != rFrames.end() ) @@ -526,12 +533,12 @@ bool SessionManagerClient::queryInteraction() return bRet; } -void SessionManagerClient::interactionDone() +void SessionManagerClient::interactionDone( bool bCancelShutdown ) { if( aSmcConnection ) { ICEConnectionObserver::lock(); - SmcInteractDone( aSmcConnection, False ); + SmcInteractDone( aSmcConnection, bCancelShutdown ? True : False ); ICEConnectionObserver::unlock(); } } diff --git a/vcl/unx/source/dtrans/X11_selection.cxx b/vcl/unx/source/dtrans/X11_selection.cxx index 3f7dfc2df709..c6036ae4f78e 100644 --- a/vcl/unx/source/dtrans/X11_selection.cxx +++ b/vcl/unx/source/dtrans/X11_selection.cxx @@ -219,28 +219,64 @@ SelectionManager::SelectionManager() : m_aWindow( None ), m_nSelectionTimeout( 0 ), m_nSelectionTimestamp( CurrentTime ), + m_bDropEnterSent( true ), m_aCurrentDropWindow( None ), + m_nDropTime( None ), + m_nLastDropAction( 0 ), + m_nLastX( 0 ), + m_nLastY( 0 ), + m_nDropTimestamp( 0 ), m_bDropWaitingForCompletion( false ), m_aDropWindow( None ), m_aDropProxy( None ), m_aDragSourceWindow( None ), + m_nLastDragX( 0 ), + m_nLastDragY( 0 ), m_nNoPosX( 0 ), m_nNoPosY( 0 ), m_nNoPosWidth( 0 ), m_nNoPosHeight( 0 ), + m_nDragButton( 0 ), + m_nUserDragAction( 0 ), + m_nTargetAcceptAction( 0 ), + m_nSourceActions( 0 ), m_bLastDropAccepted( false ), m_bDropSuccess( false ), m_bDropSent( false ), m_bWaitingForPrimaryConversion( false ), + m_nDragTimestamp( None ), m_aMoveCursor( None ), m_aCopyCursor( None ), m_aLinkCursor( None ), m_aNoneCursor( None ), m_aCurrentCursor( None ), - m_nCurrentProtocolVersion( nXdndProtocolRevision ) + m_nCurrentProtocolVersion( nXdndProtocolRevision ), + m_nCLIPBOARDAtom( None ), + m_nTARGETSAtom( None ), + m_nTIMESTAMPAtom( None ), + m_nTEXTAtom( None ), + m_nINCRAtom( None ), + m_nCOMPOUNDAtom( None ), + m_nMULTIPLEAtom( None ), + m_nUTF16Atom( None ), + m_nImageBmpAtom( None ), + m_nXdndAware( None ), + m_nXdndEnter( None ), + m_nXdndLeave( None ), + m_nXdndPosition( None ), + m_nXdndStatus( None ), + m_nXdndDrop( None ), + m_nXdndFinished( None ), + m_nXdndSelection( None ), + m_nXdndTypeList( None ), + m_nXdndProxy( None ), + m_nXdndActionCopy( None ), + m_nXdndActionMove( None ), + m_nXdndActionLink( None ), + m_nXdndActionAsk( None ), + m_nXdndActionPrivate( None ) { m_aDropEnterEvent.data.l[0] = None; - m_bDropEnterSent = true; m_aDragRunning.reset(); } diff --git a/vcl/unx/source/gdi/pspgraphics.cxx b/vcl/unx/source/gdi/pspgraphics.cxx index 009b14c56062..227d6cd7e9b2 100644 --- a/vcl/unx/source/gdi/pspgraphics.cxx +++ b/vcl/unx/source/gdi/pspgraphics.cxx @@ -1094,13 +1094,6 @@ const void* PspGraphics::DoGetEmbedFontData( fontID aFont, const sal_Ucs* pUnico return NULL; // fill in font info - switch( aFontInfo.m_eType ) - { - case psp::fonttype::TrueType: rInfo.m_nFontType = FontSubsetInfo::SFNT_TTF; break; - case psp::fonttype::Type1: rInfo.m_nFontType = FontSubsetInfo::ANY_TYPE1; break; - default: - return NULL; - } rInfo.m_nAscent = aFontInfo.m_nAscend; rInfo.m_nDescent = aFontInfo.m_nDescend; rInfo.m_aPSName = rMgr.getPSName( aFont ); @@ -1137,9 +1130,22 @@ const void* PspGraphics::DoGetEmbedFontData( fontID aFont, const sal_Ucs* pUnico rInfo.m_nCapHeight = yMax; // Well ... for( int i = 0; i < 256; i++ ) - pWidths[i] = (aMetrics[i].width > 0 ? aMetrics[i].width : 0); + switch( aFontInfo.m_eType ) + { + case psp::fonttype::TrueType: + rInfo.m_nFontType = FontSubsetInfo::SFNT_TTF; + break; + case psp::fonttype::Type1: { + const bool bPFA = ((*(unsigned char*)pFile) < 0x80); + rInfo.m_nFontType = bPFA ? FontSubsetInfo::TYPE1_PFA : FontSubsetInfo::TYPE1_PFB; + } + break; + default: + return NULL; + } + return pFile; } diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index 5bf8b63dc6e2..5fe2295a8fed 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -1029,11 +1029,12 @@ BOOL X11SalGraphics::drawEPS( long,long,long,long,void*,ULONG ) XID X11SalGraphics::GetXRenderPicture() { + XRenderPeer& rRenderPeer = XRenderPeer::GetInstance(); + if( !m_aRenderPicture ) { // check xrender support for matching visual // find a XRenderPictFormat compatible with the Drawable - XRenderPeer& rRenderPeer = XRenderPeer::GetInstance(); XRenderPictFormat* pVisualFormat = static_cast<XRenderPictFormat*>(GetXRenderFormat()); if( !pVisualFormat ) { @@ -1054,7 +1055,15 @@ XID X11SalGraphics::GetXRenderPicture() // TODO: avoid clipping if already set correctly if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) ) rRenderPeer.SetPictureClipRegion( aDstPic, pClipRegion_ ); + else #endif + { + // reset clip region + // TODO: avoid clip reset if already done + XRenderPictureAttributes aAttr; + aAttr.clip_mask = None; + rRenderPeer.ChangePicture( m_aRenderPicture, CPClipMask, &aAttr ); + } return m_aRenderPicture; } @@ -1097,6 +1106,7 @@ bool IsLeftOf( const XLineFixed& rA, const XLineFixed& rB ) const XFixed aXDiff = rU.p2.x - rU.p1.x; const XFixed aYDiff = rU.p2.y - rU.p1.y; + // compare upper point of lower segment with line through upper segment if( (rU.p1.y != rL.p1.y) || (rU.p1.x != rL.p1.x) ) { const sal_Int64 n1 = (sal_Int64)aXDiff * (rL.p1.y - rU.p1.y); @@ -1105,6 +1115,7 @@ bool IsLeftOf( const XLineFixed& rA, const XLineFixed& rB ) return ((n1 < n2) == bAbove); } + // compare lower point of lower segment with line through upper segment if( (rU.p2.y != rL.p2.y) || (rU.p2.x != rL.p2.x) ) { const sal_Int64 n3 = (sal_Int64)aXDiff * (rL.p2.y - rU.p1.y); @@ -1123,10 +1134,14 @@ struct HalfTrapezoid // maLine.p1.y <= mnY < maLine.p2.y XLineFixed maLine; XFixed mnY; + + XFixed getXMin() const { return std::min( maLine.p1.x, maLine.p2.x); } + XFixed getXMax() const { return std::max( maLine.p1.x, maLine.p2.x); } }; -struct HalfTrapCompare +class HalfTrapCompare { +public: bool operator()( const HalfTrapezoid& rA, const HalfTrapezoid& rB ) const { bool bIsTopLeft = false; @@ -1139,14 +1154,15 @@ struct HalfTrapCompare } }; -typedef std::priority_queue< HalfTrapezoid, std::vector<HalfTrapezoid>, HalfTrapCompare > HTQueueBase; +typedef std::vector< HalfTrapezoid > HTVector; +typedef std::priority_queue< HalfTrapezoid, HTVector, HalfTrapCompare > HTQueueBase; // we need a priority queue with a reserve() to prevent countless reallocations class HTQueue : public HTQueueBase { public: void reserve( size_t n ) { c.reserve( n ); } - int capacity() { return c.capacity(); } + void swapvec( HTVector& v ) { c.swap( v ); } }; typedef std::vector<XTrapezoid> TrapezoidVector; @@ -1174,6 +1190,10 @@ public: }; typedef std::multiset< int, TrapezoidYCompare > VerticalTrapSet; + +#ifndef DISABLE_SOLVECROSSOVER_WORKAROUND +void splitIntersectingSegments( HTVector&); +#endif // DISABLE_SOLVECROSSOVER_WORKAROUND } // end of anonymous namespace // draw a poly-polygon @@ -1211,7 +1231,7 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly // don't bother with polygons outside of visible area const basegfx::B2DRange aViewRange( 0, 0, GetGraphicsWidth(), GetGraphicsHeight() ); const basegfx::B2DRange aPolyRange = basegfx::tools::getRange( rOrigPolyPoly ); - const bool bNeedViewClip = !aPolyRange.isInside( aViewRange ); + const bool bNeedViewClip = aPolyRange.isInside( aViewRange ); if( !aPolyRange.overlaps( aViewRange ) ) return true; @@ -1238,6 +1258,15 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly if( !nClippedPolyCount ) continue; +#ifndef DISABLE_SOLVECROSSOVER_WORKAROUND + for( int nClippedPolyIdx = 0; nClippedPolyIdx < nClippedPolyCount; ++nClippedPolyIdx ) + { + const ::basegfx::B2DPolygon aSolvedPolygon = aClippedPolygon.getB2DPolygon( nClippedPolyIdx ); + const int nPointCount = aSolvedPolygon.count(); + aGoodPolyPoly.append( aSolvedPolygon ); + nHTQueueReserve += aSolvedPolygon.areControlPointsUsed() ? 8 * nPointCount : nPointCount; + } +#else // DISABLE_SOLVECROSSOVER_WORKAROUND // #i103259# polypoly.solveCrossover() fails to remove self-intersections // but polygon.solveCrossover() works. Use it to build the intersection-free polypolygon // TODO: if the self-intersection prevention is too expensive make the trap-algorithm tolerate intersections @@ -1256,11 +1285,12 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly nHTQueueReserve += aSolvedPolygon.areControlPointsUsed() ? 8 * nPointCount : nPointCount; } } +#endif // DISABLE_SOLVECROSSOVER_WORKAROUND } // #i100922# try to prevent priority-queue reallocations by reservering enough nHTQueueReserve = ((4*nHTQueueReserve) | 0x1FFF) + 1; - HTQueue aHTQueue; - aHTQueue.reserve( nHTQueueReserve ); + HTVector aHTVector; + aHTVector.reserve( nHTQueueReserve ); // first convert the B2DPolyPolygon to HalfTrapezoids const int nGoodPolyCount = aGoodPolyPoly.count(); @@ -1300,9 +1330,6 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly // check if enough data is available for a new HalfTrapezoid if( nPointIdx == 0 ) continue; - // ignore vertical segments - if( aNewXPF.y == aOldXPF.y ) - continue; // construct HalfTrapezoid as topdown segment HalfTrapezoid aHT; @@ -1327,14 +1354,33 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly #endif // queue up the HalfTrapezoid - aHTQueue.push( aHT ); + aHTVector.push_back( aHT ); } } } - if( aHTQueue.empty() ) + if( aHTVector.empty() ) return TRUE; +#ifndef DISABLE_SOLVECROSSOVER_WORKAROUND + // find intersecting halftraps and split them up + // TODO: remove when solveCrossOvers gets fast enough so its use can be enabled above + // FAQ: why should segment intersection be handled before adaptiveSubdivide()? + // Answer: because it is conceptually much faster + // Example: consider two intersecting circles with a diameter of 1000 pixels + // before subdivision: eight bezier segments + // after subdivision: more than a thousand line segments + // since even the best generic intersection finders have a complexity of O((n+k)*log(n+k)) + // it shows that testing while the segment count is still low is a much better approach. + splitIntersectingSegments( aHTVector); +#endif // DISABLE_SOLVECROSSOVER_WORKAROUND + + // build queue from vector of intersection-free segments + // TODO: is replacing the priority-queue by a sorted vector worth it? + std::make_heap( aHTVector.begin(), aHTVector.end(), HalfTrapCompare()); + HTQueue aHTQueue; + aHTQueue.swapvec( aHTVector); + // then convert the HalfTrapezoids into full Trapezoids TrapezoidVector aTrapVector; aTrapVector.reserve( aHTQueue.size() * 2 ); // just a guess @@ -1350,24 +1396,28 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly XTrapezoid aTrapezoid; // convert a HalfTrapezoid pair + // get the left side of the trapezoid const HalfTrapezoid& rLeft = aHTQueue.top(); aTrapezoid.top = rLeft.mnY; - aTrapezoid.bottom = rLeft.maLine.p2.y; aTrapezoid.left = rLeft.maLine; + aHTQueue.pop(); -#if 0 - // ignore empty trapezoids - if( aTrapezoid.bottom <= aTrapezoid.top ) + // ignore left segment that would result in an empty trapezoid + if( aTrapezoid.left.p2.y <= aTrapezoid.top ) continue; -#endif - aHTQueue.pop(); - if( aHTQueue.empty() ) // TODO: assert - break; - const HalfTrapezoid& rRight = aHTQueue.top(); - aTrapezoid.right = rRight.maLine; - aHTQueue.pop(); + // get the right side of the trapezoid + aTrapezoid.right.p2.y = aTrapezoid.bottom; + while( !aHTQueue.empty() ) { + const HalfTrapezoid& rRight = aHTQueue.top(); + aTrapezoid.right = rRight.maLine; + aHTQueue.pop(); + // ignore right segment that would result in an empty trapezoid + if( aTrapezoid.right.p2.y > aTrapezoid.top ) + break; + } + // the topmost endpoint determines the trapezoid bottom aTrapezoid.bottom = aTrapezoid.left.p2.y; if( aTrapezoid.bottom > aTrapezoid.right.p2.y ) aTrapezoid.bottom = aTrapezoid.right.p2.y; @@ -1375,44 +1425,49 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly // keep the full Trapezoid candidate aTrapVector.push_back( aTrapezoid ); - // unless it splits an older trapezoid + // unless it splits another trapezoid that is still active bool bSplit = false; - for(;;) + ActiveTrapSet::iterator aActiveTrapsIt = aActiveTraps.begin(); + for(; aActiveTrapsIt != aActiveTraps.end(); ++aActiveTrapsIt ) { - // check if the new trapezoid overlaps with an old trapezoid - ActiveTrapSet::iterator aActiveTrapsIt - = aActiveTraps.upper_bound( aTrapVector.size()-1 ); - if( aActiveTrapsIt == aActiveTraps.begin() ) - break; - --aActiveTrapsIt; - XTrapezoid& rLeftTrap = aTrapVector[ *aActiveTrapsIt ]; + // skip until first overlap candidate + // TODO: use stl::*er_bound() instead + if( IsLeftOf( aTrapezoid.left, rLeftTrap.left) ) + continue; + // in the ActiveTrapSet there are still trapezoids where // a vertical overlap with new trapezoids is no longer possible // they could have been removed in the verticaltraps loop below - // but this would have been expensive and is not needed as we can - // simply ignore them now and remove them from the ActiveTrapSet - // so they won't bother us in the future + // but this would be expensive and is not needed as we can + // simply ignore them until we stumble upon them here. if( rLeftTrap.bottom <= aTrapezoid.top ) { - aActiveTraps.erase( aActiveTrapsIt ); + ActiveTrapSet::iterator it = aActiveTrapsIt; + if( aActiveTrapsIt != aActiveTraps.begin() ) + --aActiveTrapsIt; + aActiveTraps.erase( it ); continue; } // check if there is horizontal overlap // aTrapezoid.left==rLeftTrap.right is allowed though if( !IsLeftOf( aTrapezoid.left, rLeftTrap.right ) ) - break; + continue; - // split the old trapezoid and keep its upper part + // prepare to split the old trapezoid and keep its upper part // find the old trapezoids entry in the VerticalTrapSet and remove it typedef std::pair<VerticalTrapSet::iterator, VerticalTrapSet::iterator> VTSPair; VTSPair aVTSPair = aVerticalTraps.equal_range( *aActiveTrapsIt ); VerticalTrapSet::iterator aVTSit = aVTSPair.first; - for(; (aVTSit != aVTSPair.second) && (*aVTSit != *aActiveTrapsIt); ++aVTSit ) ; - if( aVTSit != aVTSPair.second ) + for(; aVTSit != aVTSPair.second; ++aVTSit ) + { + if( *aVTSit != *aActiveTrapsIt ) + continue; aVerticalTraps.erase( aVTSit ); + break; + } // then update the old trapezoid's bottom rLeftTrap.bottom = aTrapezoid.top; // enter the updated old trapzoid in VerticalTrapSet @@ -1445,24 +1500,26 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly // mark trapezoids that can no longer be split as inactive // and recycle their sides which were not fully resolved static const XFixed nMaxTop = +0x7FFFFFFF; - XFixed nNewTop = aHTQueue.empty() ? nMaxTop : aHTQueue.top().mnY; + const XFixed nNewTop = aHTQueue.empty() ? nMaxTop : aHTQueue.top().mnY; while( !aVerticalTraps.empty() ) { + // check the next trapezoid to be retired const XTrapezoid& rOldTrap = aTrapVector[ *aVerticalTraps.begin() ]; if( nNewTop < rOldTrap.bottom ) break; - // the reference Trapezoid can no longer be split + // this trapezoid can no longer be split aVerticalTraps.erase( aVerticalTraps.begin() ); // recycle its sides that were not fully resolved HalfTrapezoid aHT; aHT.mnY = rOldTrap.bottom; - if( rOldTrap.left.p2.y > rOldTrap.bottom ) + + if( rOldTrap.left.p2.y > aHT.mnY ) { aHT.maLine = rOldTrap.left; aHTQueue.push( aHT ); } - if( rOldTrap.right.p2.y > rOldTrap.bottom ) + if( rOldTrap.right.p2.y > aHT.mnY ) { aHT.maLine = rOldTrap.right; aHTQueue.push( aHT ); @@ -1529,13 +1586,20 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const : aPolygon.transform(basegfx::tools::createScaleB2DHomMatrix(1.0, rLineWidth.getX() / rLineWidth.getY())); } - // AW: reSegment no longer needed; new createAreaGeometry will remove exteme positions - // and create bezier polygons - //if( aPolygon.areControlPointsUsed() ) - // aPolygon = basegfx::tools::reSegmentPolygonEdges( aPolygon, 8, true, false ); - //const basegfx::B2DPolyPolygon aAreaPolyPoly = basegfx::tools::createAreaGeometryForSimplePolygon( - // aPolygon, 0.5*rLineWidth.getX(), eLineJoin ); - const basegfx::B2DPolyPolygon aAreaPolyPoly(basegfx::tools::createAreaGeometry(aPolygon, 0.5*rLineWidth.getX(), eLineJoin)); + // special handling for hairlines to improve the drawing performance + // TODO: revisit after basegfx performance related changes + const bool bIsHairline = (rLineWidth.getX() < 1.2) && (rLineWidth.getY() < 1.2); + if( bIsHairline ) + { + // for hairlines the linejoin style becomes irrelevant + eLineJoin = basegfx::B2DLINEJOIN_NONE; + // createAreaGeometry is still too expensive when beziers are involved + if( aPolygon.areControlPointsUsed() ) + aPolygon = ::basegfx::tools::adaptiveSubdivideByDistance( aPolygon, 0.125 ); + } + + // create the area-polygon for the line + const basegfx::B2DPolyPolygon aAreaPolyPoly( basegfx::tools::createAreaGeometry(aPolygon, 0.5*rLineWidth.getX(), eLineJoin) ); if( (rLineWidth.getX() != rLineWidth.getY()) && !basegfx::fTools::equalZero( rLineWidth.getX() ) ) @@ -1568,3 +1632,259 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const : // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +#ifndef DISABLE_SOLVECROSSOVER_WORKAROUND +// TODO: move the intersection solver into basegfx +// and then support bezier-intersection finding too + +namespace { // anonymous namespace to prevent export + +typedef HalfTrapezoid LineSeg; +typedef HTVector LSVector; + +inline bool operator==( const LineSeg& r1, const LineSeg& r2) +{ + if( r1.maLine.p2.y != r2.maLine.p2.y) return false; + if( r1.maLine.p2.x != r2.maLine.p2.x) return false; + if( r1.maLine.p1.y != r2.maLine.p1.y) return false; + if( r1.maLine.p1.x != r2.maLine.p1.x) return false; + return true; +} + +struct LSYMinCmp +{ + bool operator()( const LineSeg& r1, const LineSeg& r2) const + { return r2.maLine.p1.y < r1.maLine.p1.y; } +}; + +struct LSYMaxCmp +{ + bool operator()( const LineSeg& r1, const LineSeg& r2) const + { return r2.maLine.p2.y < r1.maLine.p2.y; } +}; + +struct LSXMinCmp +{ + bool operator()( const LineSeg& r1, const LineSeg& r2) const + { return( r1.getXMin() < r2.getXMin()); } +}; + +struct CutPoint +{ + XFixed mnSegmentId; + float mfCutParam; + XPointFixed maPoint; +}; + +struct CutPointCmp +{ + bool operator()( const CutPoint& r1, const CutPoint& r2) const + { + if( r1.mnSegmentId != r2.mnSegmentId) + return (r1.mnSegmentId < r2.mnSegmentId); + return (r1.mfCutParam < r2.mfCutParam); + } +}; + +bool findIntersection( const LineSeg& rLS1, const LineSeg& rLS2, CutPoint aCutPoints[2]) +{ + // segments intersect at r1.p1 + s*(r1.p2-r1.p1) == r2.p1 + t*(r2.p2-r2.p1) + // when both segment-parameters are ((0 <s<1) && (0<t<1)) + // (r1.p1 - r2.p1) == s * (r1.p1 - r1.p2) + t * (r2.p2 - r2.p1) + // => + // (r1.p1x - r2.p1x) == s * (r1.p1x - r1.p2x) + t * (r2.p2x - r2.p1x) + // (r1.p1y - r2.p1y) == s * (r1.p1y - r1.p2y) + t * (r2.p2y - r2.p1y) + // check if lines are identical or parallel => not intersecting + const XLineFixed& r1 = rLS1.maLine; + const XLineFixed& r2 = rLS2.maLine; + const double fDet = (double)(r1.p1.x - r1.p2.x) * (r2.p2.y - r2.p1.y) + - (double)(r2.p2.x - r2.p1.x) * (r1.p1.y - r1.p2.y); + static const double fEps = 1e-8; + if( fabs(fDet) < fEps) + return false; + // check if intersecting with first segment + const double fS1 = (double)(r2.p2.y - r2.p1.y) * (r1.p1.x - r2.p1.x); + const double fS2 = (double)(r2.p2.x - r2.p1.x) * (r2.p1.y - r1.p1.y); + const double fS = (fS1 + fS2) / fDet; + if( (fS <= +fEps) || (fS >= 1-fEps)) + return false; + // check if intersecting with second segment + const double fT1 = (double)(r1.p2.y - r1.p1.y) * (r1.p1.x - r2.p1.x); + const double fT2 = (double)(r1.p2.x - r1.p1.x) * (r2.p1.y - r1.p1.y); + const double fT = (fT1 + fT2) / fDet; + if( (fT <= +fEps) || (fT >= 1-fEps)) + return false; + // force the intersection point to be exactly identical on both segments + aCutPoints[0].maPoint.x = (XFixed)(r1.p1.x + fS * (r1.p2.x - r1.p1.x)); + aCutPoints[0].maPoint.y = (XFixed)(r1.p1.y + fS * (r1.p2.y - r1.p1.y)); + aCutPoints[1].maPoint.x = aCutPoints[0].maPoint.x; + aCutPoints[1].maPoint.y = aCutPoints[0].maPoint.y; + aCutPoints[0].mnSegmentId = rLS1.mnY; + aCutPoints[0].mfCutParam = (float)fS; + aCutPoints[1].mnSegmentId = rLS2.mnY; + aCutPoints[1].mfCutParam = (float)fT; + return true; +} + +typedef std::priority_queue< LineSeg, LSVector, LSYMinCmp> LSYMinQueueBase; +typedef std::priority_queue< LineSeg, LSVector, LSYMaxCmp> LSYMaxQueueBase; +typedef std::multiset< LineSeg, LSXMinCmp> LSXMinSet; +typedef std::set< CutPoint, CutPointCmp> CutPointSet; + +class LSYMinQueue : public LSYMinQueueBase +{ +public: + void reserve( size_t n) { c.reserve(n);} + void swapvec( LSVector& v) { c.swap(v);} +}; + +class LSYMaxQueue : public LSYMaxQueueBase +{ +public: + void reserve( size_t n) { c.reserve(n);} +}; + +void addAndCutSegment( LSVector& rLSVector, const LineSeg& rLS, CutPointSet& rCutPointSet) +{ + // short circuit when no segment was cut + if( rCutPointSet.empty()) { + rLSVector.push_back( rLS); + return; + } + + // find the first cut point for this segment + LineSeg aCS = rLS; + CutPoint aMinCutPoint; + aMinCutPoint.mnSegmentId = rLS.mnY; + aMinCutPoint.mfCutParam = 0.0; + CutPointSet::iterator itFirst = rCutPointSet.lower_bound( aMinCutPoint); + CutPointSet::iterator it = itFirst; + // iterate through all cut points of this segment + for(; it != rCutPointSet.end(); ++it) { + const CutPoint rCutPoint = (*it); + if( rCutPoint.mnSegmentId != rLS.mnY) + break; + // cut segment at the cutpoint + aCS.maLine.p2 = rCutPoint.maPoint; + rLSVector.push_back( aCS); + // prepare for next segment cut + aCS.maLine.p1 = aCS.maLine.p2; + } + // remove cutparams that will no longer be needed + // TODO: is it worth it or should we just keep the cutparams? + rCutPointSet.erase( itFirst, it); + + // add segment part remaining after last cut + aCS.maLine.p2 = rLS.maLine.p2; + rLSVector.push_back( aCS); +} + +void splitIntersectingSegments( LSVector& rLSVector) +{ + // get a unique id for each lineseg, temporarily abuse the mnY member + LSVector::iterator aLSit = rLSVector.begin(); + for( int i = 0; aLSit != rLSVector.end(); ++aLSit) { + LineSeg& rLS = *aLSit; + rLS.mnY = i++; + } + // get an y-sorted queue from the input vector + LSYMinQueue aYMinQueue; + std::make_heap( rLSVector.begin(), rLSVector.end(), LSYMinCmp()); + aYMinQueue.swapvec( rLSVector); + + // prepare the result vector + // try to avoid reallocations by guessing a reasonable result size + rLSVector.reserve( aYMinQueue.size() * 3/2 ); + + // find all intersections + CutPointSet aCutPointSet; + LSXMinSet aXMinSet; + LSYMaxQueue aYMaxQueue; + aYMaxQueue.reserve( aYMinQueue.size()); + // sweep-down and check all segment-pairs that overlap + while( !aYMinQueue.empty()) { + // get next input-segment + const LineSeg& rLS = aYMinQueue.top(); + // retire obsoleted segments + const XFixed fYCur = rLS.maLine.p1.y; + while( !aYMaxQueue.empty()) { + // check next segment to be retired + const LineSeg& rOS = aYMaxQueue.top(); + if( fYCur < rOS.maLine.p2.y) + break; + // emit resolved segment into result + addAndCutSegment( rLSVector, rOS, aCutPointSet); + // find segment to be retired in xmin-compare-set + LSXMinSet::iterator itR = aXMinSet.lower_bound( rOS); + while( !(*itR == rOS)) ++itR; + // retire segment from xmin-compare-set + aXMinSet.erase( itR); + // this segment is pining for the fjords + aYMaxQueue.pop(); + } + + // iterate over all segments that might overlap + // skip over the leftmost segments that cannot overlap + const XFixed fXMax = rLS.getXMax(); + LSXMinSet::const_iterator itC = aXMinSet.begin(); + for(; itC != aXMinSet.end(); ++itC) + if( (*itC).getXMin() <= fXMax) + break; + // TODO: if the linear search becomes too expensive + // then use an XMaxQueue based approach to replace it + const XFixed fXMin = rLS.getXMin(); + for(; itC != aXMinSet.end(); ++itC) { + const LineSeg& rOS = *itC; + if( fXMin >= rOS.getXMax()) + continue; + if( fXMax < rOS.getXMin()) + break; + CutPoint aCutPoints[2]; + if( !findIntersection( rLS, rOS, aCutPoints)) + continue; + // remember cut parameters + // TODO: std::set seems to use individual allocations + // which results in perf-problems for many entries + // => pre-allocate nodes by using a non-default allocator + aCutPointSet.insert( aCutPoints[0]); + aCutPointSet.insert( aCutPoints[1]); + } + // add segment to xmin-compare-set + // TODO: do we have a good insertion hint? + aXMinSet.insert( /*itC,*/ rLS); + // register segment for retirement + aYMaxQueue.push( rLS); + aYMinQueue.pop(); + } + + // retire the remaining segments + aXMinSet.clear(); + while( !aYMaxQueue.empty()) { + // emit segments and cut them up if needed + const LineSeg& rLS = aYMaxQueue.top(); + addAndCutSegment( rLSVector, rLS, aCutPointSet); + aYMaxQueue.pop(); + } + + // get the segments ready to be consumed by the drawPolygon() caller + aLSit = rLSVector.begin(); + LSVector::iterator aLSit2 = aLSit; + for(; aLSit != rLSVector.end(); ++aLSit) { + LineSeg& rLS = *aLSit; + // restore the segment top member + rLS.mnY = rLS.maLine.p1.y; + // remove horizontal segments for now + // TODO: until the trapezoid converter is adjusted to handle them + if( rLS.maLine.p1.y == rLS.maLine.p2.y ) + continue; + *(aLSit2++) = rLS; + } + if(aLSit2 != aLSit) + rLSVector.resize( aLSit2 - rLSVector.begin() ); +} + +} // end anonymous namespace + +#endif // DISABLE_SOLVECROSSOVER_WORKAROUND + +// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + diff --git a/vcl/unx/source/gdi/xrender_peer.cxx b/vcl/unx/source/gdi/xrender_peer.cxx index d8f2045c6fde..fc8de818fafd 100644 --- a/vcl/unx/source/gdi/xrender_peer.cxx +++ b/vcl/unx/source/gdi/xrender_peer.cxx @@ -142,6 +142,10 @@ void XRenderPeer::InitRenderLib() mpXRenderCreatePicture = (Picture(*)(Display*,Drawable,const XRenderPictFormat*, unsigned long,const XRenderPictureAttributes*))pFunc; + pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderChangePicture" ); + if( !pFunc ) return; + mpXRenderChangePicture = (void(*)(Display*,Picture,unsigned long,const XRenderPictureAttributes*))pFunc; + pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderSetPictureClipRegion" ); if( !pFunc ) return; mpXRenderSetPictureClipRegion = (void(*)(Display*,Picture,XLIB_Region))pFunc; diff --git a/vcl/unx/source/gdi/xrender_peer.hxx b/vcl/unx/source/gdi/xrender_peer.hxx index f1e2fd77a273..27c8fb3dcaeb 100644 --- a/vcl/unx/source/gdi/xrender_peer.hxx +++ b/vcl/unx/source/gdi/xrender_peer.hxx @@ -66,6 +66,8 @@ public: const XRenderPictFormat& ) const; Picture CreatePicture( Drawable, const XRenderPictFormat*, unsigned long nDrawable, const XRenderPictureAttributes* ) const; + void ChangePicture( Picture, unsigned long nValueMask, + const XRenderPictureAttributes* ) const; void SetPictureClipRegion( Picture, XLIB_Region ) const; void CompositePicture( int nOp, Picture aSrc, Picture aMask, Picture aDst, int nXSrc, int nYSrc, int nXMask, int nYMask, @@ -103,6 +105,8 @@ private: Picture (*mpXRenderCreatePicture)(Display*,Drawable, const XRenderPictFormat*, unsigned long,const XRenderPictureAttributes*); + void (*mpXRenderChangePicture)(Display*,Picture, + unsigned long,const XRenderPictureAttributes*); void (*mpXRenderSetPictureClipRegion)(Display*,Picture,XLIB_Region); void (*mpXRenderFreePicture)(Display*,Picture); void (*mpXRenderComposite)(Display*,int,Picture,Picture,Picture, @@ -194,6 +198,16 @@ inline Picture XRenderPeer::CreatePicture( Drawable aDrawable, #endif } +inline void XRenderPeer::ChangePicture( Picture aPicture, + unsigned long nValueMask, const XRenderPictureAttributes* pRenderAttr ) const +{ +#ifdef XRENDER_LINK + XRenderChangePicture( mpDisplay, aPicture, nValueMask, pRenderAttr ); +#else + (*mpXRenderChangePicture)( mpDisplay, aPicture, nValueMask, pRenderAttr ); +#endif +} + inline void XRenderPeer::SetPictureClipRegion( Picture aPicture, XLIB_Region aXlibRegion ) const { diff --git a/vcl/unx/source/plugadapt/salplug.cxx b/vcl/unx/source/plugadapt/salplug.cxx index 14de25b13e4d..f1c63b8abee7 100644 --- a/vcl/unx/source/plugadapt/salplug.cxx +++ b/vcl/unx/source/plugadapt/salplug.cxx @@ -149,34 +149,53 @@ static const rtl::OUString& get_desktop_environment() return aRet; } -static const char* autodetect_plugin() +static SalInstance* autodetect_plugin() { + static const char* pKDEFallbackList[] = + { + "kde4", "kde", "gtk", "gen", 0 + }; + + static const char* pStandardFallbackList[] = + { + "gtk", "gen", 0 + }; + + static const char* pHeadlessFallbackList[] = + { + "svp", 0 + }; + const rtl::OUString& desktop( get_desktop_environment() ); - const char * pRet = "gen"; + const char ** pList = pStandardFallbackList; + int nListEntry = 0; // no server at all: dummy plugin if ( desktop.equalsAscii( desktop_strings[DESKTOP_NONE] ) ) - pRet = "svp"; + pList = pHeadlessFallbackList; else if ( desktop.equalsAscii( desktop_strings[DESKTOP_GNOME] ) ) - pRet = "gtk"; + pList = pStandardFallbackList; else if( desktop.equalsAscii( desktop_strings[DESKTOP_KDE] ) ) - pRet = "kde"; - else if( desktop.equalsAscii( desktop_strings[DESKTOP_KDE4] ) ) - pRet = "kde4"; - else { - // #i95296# use the much nicer looking gtk plugin - // on desktops that set gtk variables (e.g. XFCE) - static const char* pEnv = getenv( "GTK2_RC_FILES" ); - if( pEnv && *pEnv ) // check for existance and non emptiness - pRet = "gtk"; + pList = pKDEFallbackList; + nListEntry = 1; } + else if( desktop.equalsAscii( desktop_strings[DESKTOP_KDE4] ) ) + pList = pKDEFallbackList; -#if OSL_DEBUG_LEVEL > 1 - std::fprintf( stderr, "plugin autodetection: %s\n", pRet ); -#endif + SalInstance* pInst = NULL; + while( pList[nListEntry] && pInst == NULL ) + { + rtl::OUString aTry( rtl::OUString::createFromAscii( pList[nListEntry] ) ); + pInst = tryInstance( aTry ); + #if OSL_DEBUG_LEVEL > 1 + if( pInst ) + std::fprintf( stderr, "plugin autodetection: %s\n", pList[nListEntry] ); + #endif + nListEntry++; + } - return pRet; + return pInst; } static SalInstance* check_headless_plugin() @@ -202,10 +221,7 @@ SalInstance *CreateSalInstance() pInst = check_headless_plugin(); if( ! pInst && !(pUsePlugin && *pUsePlugin) ) - pUsePlugin = autodetect_plugin(); - - if( ! pInst && pUsePlugin && *pUsePlugin ) - pInst = tryInstance( OUString::createFromAscii( pUsePlugin ) ); + pInst = autodetect_plugin(); // fallback to gen if( ! pInst ) diff --git a/vcl/unx/source/printergfx/common_gfx.cxx b/vcl/unx/source/printergfx/common_gfx.cxx index 632f0d70aa2f..9b305ff323ba 100644 --- a/vcl/unx/source/printergfx/common_gfx.cxx +++ b/vcl/unx/source/printergfx/common_gfx.cxx @@ -7,7 +7,6 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: common_gfx.cxx,v $ - * $Revision: 1.20.18.1 $ * * This file is part of OpenOffice.org. * @@ -535,68 +534,47 @@ PrinterGfx::DrawPolyLineBezier (sal_uInt32 nPoints, const Point* pPath, const BY const sal_uInt32 nBezString = 1024; sal_Char pString[nBezString]; - if ( maLineColor.Is() && nPoints && pPath ) + if ( nPoints > 1 && maLineColor.Is() && pPath ) { PSSetColor (maLineColor); PSSetColor (); PSSetLineWidth (); - if (pFlgAry[0] != POLY_NORMAL) //There must be a starting point to moveto - { - return; - } - else - { - snprintf(pString, nBezString, "%li %li moveto\n", pPath[0].X(), pPath[0].Y()); - WritePS(mpPageBody, pString); - } + snprintf(pString, nBezString, "%li %li moveto\n", pPath[0].X(), pPath[0].Y()); + WritePS(mpPageBody, pString); // Handle the drawing of mixed lines mixed with curves // - a normal point followed by a normal point is a line // - a normal point followed by 2 control points and a normal point is a curve for (unsigned int i=1; i<nPoints;) { - if (pFlgAry[i+1] != POLY_CONTROL) //If the next point is a POLY_NORMAL, we're drawing a line + if (pFlgAry[i] != POLY_CONTROL) //If the next point is a POLY_NORMAL, we're drawing a line { - if (i+1 >= nPoints) return; //Make sure we don't pass the end of the array snprintf(pString, nBezString, "%li %li lineto\n", pPath[i].X(), pPath[i].Y()); i++; } else //Otherwise we're drawing a spline { - if (i+3 >= nPoints) return; //Make sure we don't pass the end of the array - snprintf(pString, nBezString, "%li %li %li %li %li %li curveto\n", - pPath[i+1].X(), pPath[i+1].Y(), - pPath[i+2].X(), pPath[i+2].Y(), - pPath[i+3].X(), pPath[i+3].Y()); + if (i+2 >= nPoints) + return; //Error: wrong sequence of contol/normal points somehow + if ((pFlgAry[i] == POLY_CONTROL) && (pFlgAry[i+1] == POLY_CONTROL) && + (pFlgAry[i+2] != POLY_CONTROL)) + { + snprintf(pString, nBezString, "%li %li %li %li %li %li curveto\n", + pPath[i].X(), pPath[i].Y(), + pPath[i+1].X(), pPath[i+1].Y(), + pPath[i+2].X(), pPath[i+2].Y()); + } + else + { + DBG_ERROR( "PrinterGfx::DrawPolyLineBezier: Strange output" ); + } i+=3; } WritePS(mpPageBody, pString); } - } - - // if eofill and stroke, save the current path - if( maFillColor.Is() && maLineColor.Is()) - PSGSave(); - - // first draw area - if( maFillColor.Is() ) - { - PSSetColor (maFillColor); - PSSetColor (); - WritePS (mpPageBody, "eofill\n"); - } - - // restore the current path - if( maFillColor.Is() && maLineColor.Is()) - PSGRestore(); - // now draw outlines - if( maLineColor.Is() ) - { - PSSetColor (maLineColor); - PSSetColor (); - PSSetLineWidth (); + // now draw outlines WritePS (mpPageBody, "stroke\n"); } } @@ -635,7 +613,7 @@ PrinterGfx::DrawPolygonBezier (sal_uInt32 nPoints, const Point* pPath, const BYT } else { - fprintf(stderr, "Strange output\n"); + DBG_ERROR( "PrinterGfx::DrawPolygonBezier: Strange output" ); } i+=3; } @@ -699,9 +677,7 @@ PrinterGfx::DrawPolyPolygonBezier (sal_uInt32 nPoly, const sal_uInt32 * pPoints, } else { -#if OSL_DEBUG_LEVEL > 1 - fprintf(stderr, "Strange output\n"); -#endif + DBG_ERROR( "PrinterGfx::DrawPolyPolygonBezier: Strange output" ); } j+=3; } diff --git a/vcl/unx/source/printergfx/glyphset.cxx b/vcl/unx/source/printergfx/glyphset.cxx index 156517d98220..5adff6683267 100644 --- a/vcl/unx/source/printergfx/glyphset.cxx +++ b/vcl/unx/source/printergfx/glyphset.cxx @@ -46,6 +46,7 @@ #include <set> #include <map> +#include <algorithm> using namespace vcl; using namespace psp; @@ -785,6 +786,17 @@ GlyphSet::PSUploadEncoding(osl::File* pOutFile, PrinterGfx &rGfx) return sal_True; } +struct EncEntry +{ + sal_uChar aEnc; + long aGID; + + EncEntry() : aEnc( 0 ), aGID( 0 ) {} + + bool operator<( const EncEntry& rRight ) const + { return aEnc < rRight.aEnc; } +}; + static void CreatePSUploadableFont( TrueTypeFont* pSrcFont, FILE* pTmpFile, const char* pGlyphSetName, int nGlyphCount, /*const*/ sal_uInt16* pRequestedGlyphs, /*const*/ sal_uChar* pEncoding, @@ -796,17 +808,29 @@ static void CreatePSUploadableFont( TrueTypeFont* pSrcFont, FILE* pTmpFile, if( bAllowType42 ) nTargetMask |= FontSubsetInfo::TYPE42_FONT; + std::vector< EncEntry > aSorted( nGlyphCount, EncEntry() ); + for( int i = 0; i < nGlyphCount; i++ ) + { + aSorted[i].aEnc = pEncoding[i]; + aSorted[i].aGID = pRequestedGlyphs[i]; + } + + std::stable_sort( aSorted.begin(), aSorted.end() ); + + std::vector< sal_uChar > aEncoding( nGlyphCount ); + std::vector< long > aRequestedGlyphs( nGlyphCount ); + + for( int i = 0; i < nGlyphCount; i++ ) + { + aEncoding[i] = aSorted[i].aEnc; + aRequestedGlyphs[i] = aSorted[i].aGID; + } + FontSubsetInfo aInfo; aInfo.LoadFont( pSrcFont ); -#if 1 // TODO: remove 16bit->long conversion when input args has been changed - long aRequestedGlyphs[256]; - for( int i = 0; i < nGlyphCount; ++i ) - aRequestedGlyphs[i] = pRequestedGlyphs[i]; -#endif - aInfo.CreateFontSubset( nTargetMask, pTmpFile, pGlyphSetName, - aRequestedGlyphs, pEncoding, nGlyphCount, NULL ); + &aRequestedGlyphs[0], &aEncoding[0], nGlyphCount, NULL ); } sal_Bool diff --git a/vcl/unx/source/window/salframe.cxx b/vcl/unx/source/window/salframe.cxx index 6219b50d6ec3..68c99e05da77 100644 --- a/vcl/unx/source/window/salframe.cxx +++ b/vcl/unx/source/window/salframe.cxx @@ -930,12 +930,13 @@ void X11SalFrame::ReleaseGraphics( SalGraphics *pGraphics ) pGraphics_ = NULL; } -void X11SalFrame::updateGraphics() +void X11SalFrame::updateGraphics( bool bClear ) { + Drawable aDrawable = bClear ? None : GetWindow(); if( pGraphics_ ) - pGraphics_->SetDrawable( GetWindow(), m_nScreen ); + pGraphics_->SetDrawable( aDrawable, m_nScreen ); if( pFreeGraphics_ ) - pFreeGraphics_->SetDrawable( GetWindow(), m_nScreen ); + pFreeGraphics_->SetDrawable( aDrawable, m_nScreen ); } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -2726,6 +2727,7 @@ void X11SalFrame::createNewWindow( XLIB_Window aNewParent, int nScreen ) } // first deinit frame + updateGraphics(true); if( mpInputContext ) { mpInputContext->UnsetICFocus( this ); @@ -2748,7 +2750,7 @@ void X11SalFrame::createNewWindow( XLIB_Window aNewParent, int nScreen ) Init( nStyle_ & ~SAL_FRAME_STYLE_PLUG, nScreen, NULL, true ); // update graphics if necessary - updateGraphics(); + updateGraphics(false); if( m_aTitle.Len() ) SetTitle( m_aTitle ); diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk index 32620d9e966a..ef4f13301ecd 100644 --- a/vcl/util/makefile.mk +++ b/vcl/util/makefile.mk @@ -73,7 +73,6 @@ HXXDEPNLST= $(INC)$/vcl$/accel.hxx \ $(INC)$/vcl$/fixed.hxx \ $(INC)$/vcl$/floatwin.hxx \ $(INC)$/vcl$/font.hxx \ - $(INC)$/vcl$/fontcvt.hxx \ $(INC)$/vcl$/floatwin.hxx \ $(INC)$/vcl$/graph.hxx \ $(INC)$/vcl$/group.hxx \ diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index 2b5ac6d3162d..68177795c8db 100644 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -55,6 +55,7 @@ #include <vcl/salimestatus.hxx> #include <vcl/timer.hxx> #include <wincomp.hxx> // CS_DROPSHADOW +#include <tools/solarmutex.hxx> #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) @@ -661,12 +662,14 @@ WinSalInstance::WinSalInstance() mpSalWaitMutex = new vos::OMutex; mnYieldWaitCount = 0; mpSalYieldMutex->acquire(); + ::tools::SolarMutex::SetSolarMutex( mpSalYieldMutex ); } // ----------------------------------------------------------------------- WinSalInstance::~WinSalInstance() { + ::tools::SolarMutex::SetSolarMutex( 0 ); mpSalYieldMutex->release(); delete mpSalYieldMutex; delete mpSalWaitMutex; diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index 0da51ccc2de9..12fdad65dfb1 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -558,7 +558,7 @@ static ImplDevFontAttributes WinFont2DevFontAttributes( const ENUMLOGFONTEXA& rE if( 0 != (rMetric.ntmFlags & (NTM_TT_OPENTYPE | NTM_PS_OPENTYPE)) || 0 != (rMetric.tmPitchAndFamily & TMPF_TRUETYPE)) aDFA.mbSubsettable = true; - else if( 0 != (rMetric.tmPitchAndFamily & NTM_TYPE1) ) // TODO: implement subsetting for type1 too + else if( 0 != (rMetric.ntmFlags & NTM_TYPE1) ) // TODO: implement subsetting for type1 too aDFA.mbEmbeddable = true; // heuristics for font quality @@ -637,7 +637,7 @@ static ImplDevFontAttributes WinFont2DevFontAttributes( const ENUMLOGFONTEXW& rE if( 0 != (rMetric.ntmFlags & (NTM_TT_OPENTYPE | NTM_PS_OPENTYPE)) || 0 != (rMetric.tmPitchAndFamily & TMPF_TRUETYPE)) aDFA.mbSubsettable = true; - else if( 0 != (rMetric.tmPitchAndFamily & NTM_TYPE1) ) // TODO: implement subsetting for type1 too + else if( 0 != (rMetric.ntmFlags & NTM_TYPE1) ) // TODO: implement subsetting for type1 too aDFA.mbEmbeddable = true; // heuristics for font quality @@ -2163,7 +2163,7 @@ void WinSalGraphics::GetDevFontList( ImplDevFontList* pFontList ) ::rtl::OUString aExecutableFile( aPath ); aPath = aPath.copy( 0, aPath.lastIndexOf('/') ); String aFontDirUrl = aPath.copy( 0, aPath.lastIndexOf('/') ); - aFontDirUrl += String( RTL_CONSTASCII_USTRINGPARAM("/share/fonts/truetype") ); + aFontDirUrl += String( RTL_CONSTASCII_USTRINGPARAM("/Basis/share/fonts/truetype") ); // collect fonts in font path that could not be registered osl::Directory aFontDir( aFontDirUrl ); @@ -2723,7 +2723,8 @@ const void* WinSalGraphics::GetEmbedFontData( const ImplFontData* pFont, TEXTMETRICA aTm; if( !::GetTextMetricsA( mhDC, &aTm ) ) *pDataLen = 0; - rInfo.m_nFontType = FontSubsetInfo::ANY_TYPE1; + const bool bPFA = (*aRawFontData.get() < 0x80); + rInfo.m_nFontType = bPFA ? FontSubsetInfo::TYPE1_PFA : FontSubsetInfo::TYPE1_PFB; WCHAR aFaceName[64]; int nFNLen = ::GetTextFaceW( mhDC, 64, aFaceName ); // #i59854# strip eventual null byte diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index 1b80bf578530..bf56b2a1082b 100644..100755 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: winlayout.cxx,v $ - * $Revision: 1.113.6.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -1385,7 +1382,7 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs ) mpScriptItems = NULL; if( nRC != E_OUTOFMEMORY ) return false; - if( nItemCapacity > (nSubStringEnd - mnSubStringMin) ) + if( nItemCapacity > (nSubStringEnd - mnSubStringMin) + 16 ) return false; } diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 78c4e4e6ddcc..fc92757e0925 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -39,6 +39,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/awt/Rectangle.hpp> #include <comphelper/processfactory.hxx> +#include <unotools/misccfg.hxx> #include <string.h> #include <limits.h> @@ -2158,15 +2159,15 @@ static void ImplSalToTop( HWND hWnd, USHORT nFlags ) if ( nFlags & SAL_FRAME_TOTOP_FOREGROUNDTASK ) { - // This magic code is necessary to connect the input focus of the
- // current window thread and the thread which owns the window that
- // should be the new foreground window.
- HWND hCurrWnd = GetForegroundWindow();
- DWORD myThreadID = GetCurrentThreadId();
- DWORD currThreadID = GetWindowThreadProcessId(hCurrWnd,NULL);
- AttachThreadInput(myThreadID, currThreadID,TRUE);
- SetForegroundWindow(hWnd);
- AttachThreadInput(myThreadID,currThreadID,FALSE);
+ // This magic code is necessary to connect the input focus of the + // current window thread and the thread which owns the window that + // should be the new foreground window. + HWND hCurrWnd = GetForegroundWindow(); + DWORD myThreadID = GetCurrentThreadId(); + DWORD currThreadID = GetWindowThreadProcessId(hCurrWnd,NULL); + AttachThreadInput(myThreadID, currThreadID,TRUE); + SetForegroundWindow(hWnd); + AttachThreadInput(myThreadID,currThreadID,FALSE); } if ( nFlags & SAL_FRAME_TOTOP_RESTOREWHENMIN ) @@ -3095,7 +3096,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) if ( (nValue > 1000) && (nValue < 10000) ) { MiscSettings aMiscSettings = rSettings.GetMiscSettings(); - aMiscSettings.SetTwoDigitYearStart( (USHORT)(nValue-99) ); + utl::MiscCfg().SetYear2000( (sal_Int32)(nValue-99) ); rSettings.SetMiscSettings( aMiscSettings ); } } @@ -5436,7 +5437,7 @@ static BOOL ImplHandleIMECompositionInput( WinSalFrame* pFrame, WCHAR* pTextBuf = new WCHAR[nTextLen]; ImmGetCompositionStringW( hIMC, GCS_RESULTSTR, pTextBuf, nTextLen*sizeof( WCHAR ) ); aEvt.maText = XubString( reinterpret_cast<const xub_Unicode*>(pTextBuf), (xub_StrLen)nTextLen ); - delete pTextBuf; + delete [] pTextBuf; } aEvt.mnCursorPos = aEvt.maText.Len(); @@ -5462,7 +5463,7 @@ static BOOL ImplHandleIMECompositionInput( WinSalFrame* pFrame, WCHAR* pTextBuf = new WCHAR[nTextLen]; ImmGetCompositionStringW( hIMC, GCS_COMPSTR, pTextBuf, nTextLen*sizeof( WCHAR ) ); aEvt.maText = XubString( reinterpret_cast<const xub_Unicode*>(pTextBuf), (xub_StrLen)nTextLen ); - delete pTextBuf; + delete [] pTextBuf; WIN_BYTE* pAttrBuf = NULL; LONG nAttrLen = ImmGetCompositionStringW( hIMC, GCS_COMPATTR, 0, 0 ); @@ -5498,7 +5499,7 @@ static BOOL ImplHandleIMECompositionInput( WinSalFrame* pFrame, } aEvt.mpTextAttr = pSalAttrAry; - delete pAttrBuf; + delete [] pAttrBuf; } } @@ -5535,7 +5536,7 @@ static BOOL ImplHandleIMECompositionInput( WinSalFrame* pFrame, } if ( pSalAttrAry ) - delete pSalAttrAry; + delete [] pSalAttrAry; } return !bDef; diff --git a/vcl/workben/outdevgrind.cxx b/vcl/workben/outdevgrind.cxx index a92da7c05531..1109111b63c5 100755 --- a/vcl/workben/outdevgrind.cxx +++ b/vcl/workben/outdevgrind.cxx @@ -163,12 +163,12 @@ void setupMethodStubs( functor_vector_type& res ) xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, MetricVector* pVector = NULL, String* pDisplayText = NULL ); */ - add(res, - "DrawText", - boost::bind( - &OutputDevice::DrawText, - _1, - aPt1, aString, (USHORT)0, aString.Len(), (MetricVector*)0, (String*)0 )); +// add(res, +// "DrawText", +// boost::bind( +// &OutputDevice::DrawText, +// _1, +// aPt1, aString, (USHORT)0, aString.Len(), (MetricVector*)0, (String*)0, (vcl::ITextLayout*)0 )); /* void DrawTextArray( const Point& rStartPt, const XubString& rStr, const sal_Int32* pDXAry = NULL, |