diff options
author | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2010-10-04 19:55:06 +0200 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2010-10-04 19:55:06 +0200 |
commit | e9c647712ad2bae33af42c27295c8cd435bf3158 (patch) | |
tree | 2611c1780dc7bf4ce62a6365ebc93be5b9521bec /vcl | |
parent | f12537fa393ce4efc512252168af0bdf2ee9be3a (diff) | |
parent | 525de6f8eeac6e357167467da0f9a9448433bb25 (diff) |
dba34b: pulled DEV300:m89
Diffstat (limited to 'vcl')
37 files changed, 414 insertions, 254 deletions
diff --git a/vcl/aqua/inc/salgdi.h b/vcl/aqua/inc/salgdi.h index a3d6c2793aae..17c4aa7acd44 100644 --- a/vcl/aqua/inc/salgdi.h +++ b/vcl/aqua/inc/salgdi.h @@ -59,7 +59,7 @@ public: virtual ImplFontEntry* CreateFontInstance( ImplFontSelectData& ) const; virtual sal_IntPtr GetFontId() const; - ImplFontCharMap* GetImplFontCharMap() const; + const ImplFontCharMap* GetImplFontCharMap() const; bool HasChar( sal_uInt32 cChar ) const; void ReadOs2Table() const; @@ -68,7 +68,7 @@ public: private: const ATSUFontID mnFontId; - mutable ImplFontCharMap* mpCharMap; + mutable const ImplFontCharMap* mpCharMap; mutable bool mbOs2Read; // true if OS2-table related info is valid mutable bool mbHasOs2Table; mutable bool mbCmapEncodingRead; // true if cmap encoding of Mac font is read @@ -281,7 +281,7 @@ public: // return only PairCount if (pKernPairs == NULL) virtual ULONG GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ); // get the repertoire of the current font - virtual ImplFontCharMap* GetImplFontCharMap() const; + virtual const ImplFontCharMap* GetImplFontCharMap() const; // graphics must fill supplied font list virtual void GetDevFontList( ImplDevFontList* ); // graphics should call ImplAddDevFontSubstitute on supplied diff --git a/vcl/aqua/source/dtrans/aqua_service.cxx b/vcl/aqua/source/dtrans/aqua_service.cxx index 571bea2e554f..57ef1f11175c 100644 --- a/vcl/aqua/source/dtrans/aqua_service.cxx +++ b/vcl/aqua/source/dtrans/aqua_service.cxx @@ -58,28 +58,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pRegistryKey ) -{ - sal_Bool bRetVal = sal_False; - - if ( pRegistryKey ) - { - try - { - Reference< XRegistryKey > pXNewKey( static_cast< XRegistryKey* >( pRegistryKey ) ); - pXNewKey->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM( AQUA_CLIPBOARD_REGKEY_NAME ) ) ); - bRetVal = sal_True; - } - catch( InvalidRegistryException& ) - { - OSL_ENSURE(sal_False, "InvalidRegistryException caught"); - bRetVal = sal_False; - } - } - - return bRetVal; -} - void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* pRegistryKey ) { void* pRet = 0; diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index b04fd9c75af7..e1daf649f6da 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -116,17 +116,15 @@ inline FourCharCode GetTag(const char aTagName[5]) static unsigned GetUShort( const unsigned char* p ){return((p[0]<<8)+p[1]);} static unsigned GetUInt( const unsigned char* p ) { return((p[0]<<24)+(p[1]<<16)+(p[2]<<8)+p[3]);} -ImplFontCharMap* ImplMacFontData::GetImplFontCharMap() const +const ImplFontCharMap* ImplMacFontData::GetImplFontCharMap() const { + // return the cached charmap if( mpCharMap ) - { - // return the cached charmap - mpCharMap->AddReference(); return mpCharMap; - } // set the default charmap mpCharMap = ImplFontCharMap::GetDefaultMap(); + mpCharMap->AddReference(); // get the CMAP byte size ATSFontRef rFont = FMGetATSFontRefFromFont( mnFontId ); @@ -149,10 +147,14 @@ ImplFontCharMap* ImplMacFontData::GetImplFontCharMap() const // parse the CMAP CmapResult aCmapResult; - if( !ParseCMAP( &aBuffer[0], nRawLength, aCmapResult ) ) - return mpCharMap; + if( ParseCMAP( &aBuffer[0], nRawLength, aCmapResult ) ) + { + // create the matching charmap + mpCharMap->DeReference(); + mpCharMap = new ImplFontCharMap( aCmapResult ); + mpCharMap->AddReference(); + } - mpCharMap = new ImplFontCharMap( aCmapResult ); return mpCharMap; } @@ -1992,7 +1994,7 @@ USHORT AquaSalGraphics::SetFont( ImplFontSelectData* pReqFont, int nFallbackLeve // ----------------------------------------------------------------------- -ImplFontCharMap* AquaSalGraphics::GetImplFontCharMap() const +const ImplFontCharMap* AquaSalGraphics::GetImplFontCharMap() const { if( !mpMacFontData ) return ImplFontCharMap::GetDefaultMap(); @@ -2367,6 +2369,8 @@ void AquaSalGraphics::GetGlyphWidths( const ImplFontData* pFontData, bool bVerti if( nGlyph > 0 ) rUnicodeEnc[ nUcsChar ] = nGlyph; } + + pMap->DeReference(); // TODO: add and use RAII object instead } ::CloseTTFont( pSftFont ); diff --git a/vcl/inc/vcl/glyphcache.hxx b/vcl/inc/vcl/glyphcache.hxx index a77c1626dc24..0e77d5dd6bc4 100644 --- a/vcl/inc/vcl/glyphcache.hxx +++ b/vcl/inc/vcl/glyphcache.hxx @@ -48,7 +48,6 @@ class ImplFontOptions; namespace basegfx { class B2DPolyPolygon; } class RawBitmap; -class CmapResult; #include <vcl/outfont.hxx> #include <vcl/impfont.hxx> @@ -190,7 +189,7 @@ public: virtual void FetchFontMetric( ImplFontMetricData&, long& rFactor ) const = 0; virtual ULONG GetKernPairs( ImplKernPairData** ) const { return 0; } virtual int GetGlyphKernValue( int, int ) const { return 0; } - virtual bool GetFontCodeRanges( CmapResult& ) const { return false; } + virtual const ImplFontCharMap* GetImplFontCharMap() const = 0; Point TransformPoint( const Point& ) const; GlyphData& GetGlyphData( int nGlyphIndex ); diff --git a/vcl/inc/vcl/impfont.hxx b/vcl/inc/vcl/impfont.hxx index a1104bbf4a86..e38e1dea78d4 100644 --- a/vcl/inc/vcl/impfont.hxx +++ b/vcl/inc/vcl/impfont.hxx @@ -196,8 +196,8 @@ public: int GetIndexFromChar( sal_uInt32 ) const; sal_uInt32 GetCharFromIndex( int ) const; - void AddReference(); - void DeReference(); + void AddReference() const; + void DeReference() const; int GetGlyphIndex( sal_uInt32 ) const; @@ -213,8 +213,8 @@ private: const int* mpStartGlyphs; // range-specific mapper to glyphs const USHORT* mpGlyphIds; // individual glyphid mappings int mnRangeCount; - int mnCharCount; - int mnRefCount; + int mnCharCount; // covered codepoints + mutable int mnRefCount; }; // CmapResult is a normalized version of the many CMAP formats diff --git a/vcl/inc/vcl/metric.hxx b/vcl/inc/vcl/metric.hxx index eae6b38c5f9d..6328890c1749 100644 --- a/vcl/inc/vcl/metric.hxx +++ b/vcl/inc/vcl/metric.hxx @@ -95,7 +95,7 @@ public: class VCL_DLLPUBLIC FontCharMap { private: - ImplFontCharMap* mpImpl; + const ImplFontCharMap* mpImpl; public: FontCharMap(); @@ -118,7 +118,7 @@ public: private: friend class OutputDevice; - void Reset( ImplFontCharMap* pNewMap = NULL ); + void Reset( const ImplFontCharMap* pNewMap = NULL ); // prevent assignment and copy construction FontCharMap( const FontCharMap& ); diff --git a/vcl/inc/vcl/salgdi.hxx b/vcl/inc/vcl/salgdi.hxx index cbe3581bedc4..d8276406746e 100644 --- a/vcl/inc/vcl/salgdi.hxx +++ b/vcl/inc/vcl/salgdi.hxx @@ -239,7 +239,7 @@ public: // return only PairCount if (pKernPairs == NULL) virtual ULONG GetKernPairs( ULONG nMaxPairCount, ImplKernPairData* ) = 0; // get the repertoire of the current font - virtual ImplFontCharMap* GetImplFontCharMap() const = 0; + virtual const ImplFontCharMap* GetImplFontCharMap() const = 0; // graphics must fill supplied font list virtual void GetDevFontList( ImplDevFontList* ) = 0; // graphics should call ImplAddDevFontSubstitute on supplied diff --git a/vcl/os2/inc/salgdi.h b/vcl/os2/inc/salgdi.h index cf05ff15d7e2..94b2b98b4183 100644 --- a/vcl/os2/inc/salgdi.h +++ b/vcl/os2/inc/salgdi.h @@ -74,7 +74,7 @@ public: bool AliasSymbolsHigh() const { return mbAliasSymbolsHigh; } bool AliasSymbolsLow() const { return mbAliasSymbolsLow; } - ImplFontCharMap* GetImplFontCharMap() const; + const ImplFontCharMap* GetImplFontCharMap() const; private: sal_IntPtr mnId; @@ -82,7 +82,7 @@ private: mutable bool mbHasKoreanRange; mutable bool mbHasCJKSupport; - mutable ImplFontCharMap* mpUnicodeMap; + mutable const ImplFontCharMap* mpUnicodeMap; // TODO: get rid of the members below needed to work with the Win9x non-unicode API BYTE* mpFontCharSets; // all Charsets for the current font (used on W98 for kerning) diff --git a/vcl/os2/source/gdi/salgdi3.cxx b/vcl/os2/source/gdi/salgdi3.cxx index e25e68ee5a4c..0e4cb1d58b0f 100644 --- a/vcl/os2/source/gdi/salgdi3.cxx +++ b/vcl/os2/source/gdi/salgdi3.cxx @@ -434,9 +434,8 @@ bool ImplOs2FontData::IsGSUBstituted( sal_Ucs cChar ) const // ----------------------------------------------------------------------- -ImplFontCharMap* ImplOs2FontData::GetImplFontCharMap() const +const ImplFontCharMap* ImplOs2FontData::GetImplFontCharMap() const { - mpUnicodeMap->AddReference(); return mpUnicodeMap; } @@ -592,6 +591,7 @@ void ImplOs2FontData::ReadCmapTable( HPS hPS ) const aResult.mpPairCodes, aResult.mpStartGlyphs ); else mpUnicodeMap = ImplFontCharMap::GetDefaultMap(); + mpUnicodeMap->AddReference(); } // ======================================================================= @@ -999,10 +999,10 @@ ULONG Os2SalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ) // ----------------------------------------------------------------------- -static ImplFontCharMap* pOs2DefaultImplFontCharMap = NULL; +static const ImplFontCharMap* pOs2DefaultImplFontCharMap = NULL; static const sal_uInt32 pOs2DefaultRangeCodes[] = {0x0020,0x00FF}; -ImplFontCharMap* Os2SalGraphics::GetImplFontCharMap() const +const ImplFontCharMap* Os2SalGraphics::GetImplFontCharMap() const { if( !mpOs2FontData[0] ) return ImplFontCharMap::GetDefaultMap(); @@ -1705,7 +1705,7 @@ void Os2SalGraphics::GetGlyphWidths( const ImplFontData* pFont, rUnicodeEnc.clear(); } const ImplOs2FontData* pWinFont = static_cast<const ImplOs2FontData*>(pFont); - ImplFontCharMap* pMap = pWinFont->GetImplFontCharMap(); + const ImplFontCharMap* pMap = pWinFont->GetImplFontCharMap(); DBG_ASSERT( pMap && pMap->GetCharCount(), "no map" ); int nCharCount = pMap->GetCharCount(); diff --git a/vcl/prj/d.lst b/vcl/prj/d.lst index d3aff731d0b6..59efccb8ee02 100644 --- a/vcl/prj/d.lst +++ b/vcl/prj/d.lst @@ -155,3 +155,4 @@ mkdir: %_DEST%\inc%_EXT%\vcl ..\inc\vcl\helper.hxx %_DEST%\inc%_EXT%\vcl\helper.hxx ..\inc\vcl\strhelper.hxx %_DEST%\inc%_EXT%\vcl\strhelper.hxx ..\inc\vcl\lazydelete.hxx %_DEST%\inc%_EXT%\vcl\lazydelete.hxx +..\%__SRC%\misc\vcl.component %_DEST%\xml%_EXT%\vcl.component diff --git a/vcl/source/components/factory.cxx b/vcl/source/components/factory.cxx index 6bed493cacde..c4debea79001 100644 --- a/vcl/source/components/factory.cxx +++ b/vcl/source/components/factory.cxx @@ -84,62 +84,6 @@ extern "C" { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } - VCL_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/, void* pXUnoKey ) - { - if( pXUnoKey ) - { - try - { - Reference< ::com::sun::star::registry::XRegistryKey > xKey( reinterpret_cast< ::com::sun::star::registry::XRegistryKey* >( pXUnoKey ) ); - - OUStringBuffer aImplName(64); - aImplName.appendAscii( "/" ); - aImplName.append( vcl_session_getImplementationName() ); - aImplName.appendAscii( "/UNO/SERVICES/" ); - aImplName.append( vcl_session_getSupportedServiceNames()[0] ); - xKey->createKey( aImplName.makeStringAndClear() ); - - aImplName.appendAscii( "/" ); - aImplName.append( vcl::DisplayAccess_getImplementationName() ); - aImplName.appendAscii( "/UNO/SERVICES/" ); - aImplName.append( vcl::DisplayAccess_getSupportedServiceNames()[0] ); - xKey->createKey( aImplName.makeStringAndClear() ); - - aImplName.appendAscii( "/" ); - aImplName.append( vcl::FontIdentificator_getImplementationName() ); - aImplName.appendAscii( "/UNO/SERVICES/" ); - aImplName.append( vcl::FontIdentificator_getSupportedServiceNames()[0] ); - xKey->createKey( aImplName.makeStringAndClear() ); - - #if defined UNX - aImplName.appendAscii( "/" ); - aImplName.append( vcl::Clipboard_getImplementationName() ); - aImplName.appendAscii( "/UNO/SERVICES/" ); - aImplName.append( vcl::Clipboard_getSupportedServiceNames()[0] ); - xKey->createKey( aImplName.makeStringAndClear() ); - - aImplName.appendAscii( "/" ); - aImplName.append( vcl::DragSource_getImplementationName() ); - aImplName.appendAscii( "/UNO/SERVICES/" ); - aImplName.append( vcl::DragSource_getSupportedServiceNames()[0] ); - xKey->createKey( aImplName.makeStringAndClear() ); - - aImplName.appendAscii( "/" ); - aImplName.append( vcl::DropTarget_getImplementationName() ); - aImplName.appendAscii( "/UNO/SERVICES/" ); - aImplName.append( vcl::DropTarget_getSupportedServiceNames()[0] ); - xKey->createKey( aImplName.makeStringAndClear() ); - #endif - - return sal_True; - } - catch( ::com::sun::star::registry::InvalidRegistryException& ) - { - } - } - return sal_False; - } - VCL_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* pImplementationName, void* pXUnoSMgr, diff --git a/vcl/source/gdi/metric.cxx b/vcl/source/gdi/metric.cxx index dffc7c82caf0..6d225ad7e0dc 100644 --- a/vcl/source/gdi/metric.cxx +++ b/vcl/source/gdi/metric.cxx @@ -34,6 +34,8 @@ #include <vector> #include <set> +#include <cstdio> + // ======================================================================= ImplFontMetric::ImplFontMetric() @@ -51,6 +53,7 @@ ImplFontMetric::ImplFontMetric() inline void ImplFontMetric::AddReference() { + // TODO: disable refcounting on the default maps? ++mnRefCount; } @@ -58,6 +61,7 @@ inline void ImplFontMetric::AddReference() inline void ImplFontMetric::DeReference() { + // TODO: disable refcounting on the default maps? if( --mnRefCount <= 0 ) delete this; } @@ -252,7 +256,7 @@ ImplFontCharMap::ImplFontCharMap( const CmapResult& rCR ) , mpGlyphIds( rCR.mpGlyphIds ) , mnRangeCount( rCR.mnRangeCount ) , mnCharCount( 0 ) -, mnRefCount( 1 ) +, mnRefCount( 0 ) { const sal_uInt32* pRangePtr = mpRangeCodes; for( int i = mnRangeCount; --i >= 0; pRangePtr += 2 ) @@ -285,7 +289,7 @@ ImplFontCharMap::~ImplFontCharMap() delete[] mpRangeCodes; delete[] mpStartGlyphs; delete[] mpGlyphIds; -} + } // ----------------------------------------------------------------------- @@ -293,14 +297,13 @@ namespace { ImplFontCharMap *GetDefaultUnicodeMap() { - if( pDefaultUnicodeImplFontCharMap ) - pDefaultUnicodeImplFontCharMap->AddReference(); - else + if( !pDefaultUnicodeImplFontCharMap ) { const sal_uInt32* pRangeCodes = aDefaultUnicodeRanges; int nCodesCount = sizeof(aDefaultUnicodeRanges) / sizeof(*pRangeCodes); CmapResult aDefaultCR( false, pRangeCodes, nCodesCount/2 ); pDefaultUnicodeImplFontCharMap = new ImplFontCharMap( aDefaultCR ); + pDefaultUnicodeImplFontCharMap->AddReference(); } return pDefaultUnicodeImplFontCharMap; @@ -308,14 +311,13 @@ namespace ImplFontCharMap *GetDefaultSymbolMap() { - if( pDefaultSymbolImplFontCharMap ) - pDefaultSymbolImplFontCharMap->AddReference(); - else + if( !pDefaultSymbolImplFontCharMap ) { const sal_uInt32* pRangeCodes = aDefaultSymbolRanges; int nCodesCount = sizeof(aDefaultSymbolRanges) / sizeof(*pRangeCodes); CmapResult aDefaultCR( true, pRangeCodes, nCodesCount/2 ); pDefaultSymbolImplFontCharMap = new ImplFontCharMap( aDefaultCR ); + pDefaultSymbolImplFontCharMap->AddReference(); } return pDefaultSymbolImplFontCharMap; @@ -329,14 +331,15 @@ ImplFontCharMap* ImplFontCharMap::GetDefaultMap( bool bSymbols) // ----------------------------------------------------------------------- -void ImplFontCharMap::AddReference() +void ImplFontCharMap::AddReference( void ) const { + // TODO: disable refcounting on the default maps? ++mnRefCount; } // ----------------------------------------------------------------------- -void ImplFontCharMap::DeReference() +void ImplFontCharMap::DeReference( void ) const { if( --mnRefCount <= 0 ) if( (this != pDefaultUnicodeImplFontCharMap) && (this != pDefaultSymbolImplFontCharMap) ) @@ -833,7 +836,9 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult ) FontCharMap::FontCharMap() : mpImpl( ImplFontCharMap::GetDefaultMap() ) -{} +{ + mpImpl->AddReference(); +} // ----------------------------------------------------------------------- @@ -859,19 +864,14 @@ int FontCharMap::CountCharsInRange( sal_uInt32 cMin, sal_uInt32 cMax ) const // ----------------------------------------------------------------------- -void FontCharMap::Reset( ImplFontCharMap* pNewMap ) +void FontCharMap::Reset( const ImplFontCharMap* pNewMap ) { + mpImpl->DeReference(); if( pNewMap == NULL ) - { - mpImpl->DeReference(); mpImpl = ImplFontCharMap::GetDefaultMap(); - } else if( pNewMap != mpImpl ) - { - mpImpl->DeReference(); mpImpl = pNewMap; - mpImpl->AddReference(); - } + mpImpl->AddReference(); } // ----------------------------------------------------------------------- diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 63bc233ef4e0..34d86b842ba2 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -8017,7 +8017,7 @@ BOOL OutputDevice::GetFontCharMap( FontCharMap& rFontCharMap ) const if( !mpFontEntry ) return FALSE; - // a little font charmap cache helps considerably +#ifdef ENABLE_IFC_CACHE // a little font charmap cache helps considerably static const int NMAXITEMS = 16; static int nUsedItems = 0, nCurItem = 0; @@ -8035,10 +8035,12 @@ BOOL OutputDevice::GetFontCharMap( FontCharMap& rFontCharMap ) const rFontCharMap.Reset( aCache[i].maCharMap.mpImpl ); } else // need to cache +#endif // ENABLE_IFC_CACHE { - ImplFontCharMap* pNewMap = mpGraphics->GetImplFontCharMap(); + const ImplFontCharMap* pNewMap = mpGraphics->GetImplFontCharMap(); rFontCharMap.Reset( pNewMap ); +#ifdef ENABLE_IFC_CACHE // manage cache round-robin and insert data CharMapCacheItem& rItem = aCache[ nCurItem ]; rItem.mpFontData = pFontData; @@ -8049,6 +8051,7 @@ BOOL OutputDevice::GetFontCharMap( FontCharMap& rFontCharMap ) const if( ++nUsedItems >= NMAXITEMS ) nUsedItems = NMAXITEMS; +#endif // ENABLE_IFC_CACHE } if( rFontCharMap.IsDefaultMap() ) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 09cf1734eb6f..7e023297fa74 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -8500,6 +8500,7 @@ void PDFWriterImpl::beginRedirect( SvStream* pStream, const Rectangle& rTargetRe { push( PUSH_ALL ); + // force reemitting clip region clearClipRegion(); updateGraphicsState(); @@ -8543,7 +8544,10 @@ SvStream* PDFWriterImpl::endRedirect() } pop(); - // force reemitting colors + // force reemitting colors and clip region + clearClipRegion(); + m_aCurrentPDFState.m_bClipRegion = m_aGraphicsStack.front().m_bClipRegion; + m_aCurrentPDFState.m_aClipRegion = m_aGraphicsStack.front().m_aClipRegion; m_aCurrentPDFState.m_aLineColor = Color( COL_TRANSPARENT ); m_aCurrentPDFState.m_aFillColor = Color( COL_TRANSPARENT ); diff --git a/vcl/source/glyphs/gcach_ftyp.cxx b/vcl/source/glyphs/gcach_ftyp.cxx index aeb928c46608..601e46411cd8 100644 --- a/vcl/source/glyphs/gcach_ftyp.cxx +++ b/vcl/source/glyphs/gcach_ftyp.cxx @@ -301,6 +301,7 @@ FtFontInfo::FtFontInfo( const ImplDevFontAttributes& rDevFontAttributes, mnSynthetic( nSynthetic ), mnFontId( nFontId ), maDevFontAttributes( rDevFontAttributes ), + mpFontCharMap( NULL ), mpChar2Glyph( NULL ), mpGlyph2Char( NULL ), mpExtraKernInfo( pExtraKernInfo ) @@ -318,6 +319,8 @@ FtFontInfo::FtFontInfo( const ImplDevFontAttributes& rDevFontAttributes, FtFontInfo::~FtFontInfo() { + if( mpFontCharMap ) + mpFontCharMap->DeReference(); delete mpExtraKernInfo; delete mpChar2Glyph; delete mpGlyph2Char; @@ -520,10 +523,25 @@ void* FreetypeServerFont::GetFtFace() const FreetypeManager::~FreetypeManager() { -// This crashes on Solaris 10 -// TODO: check which versions have this problem -// -// FT_Error rcFT = FT_Done_FreeType( aLibFT ); + // an application about to exit can omit garbage collecting the heap + // since it makes things slower and introduces risks if the heap was not perfect + // for debugging, for memory grinding or leak checking the env allows to force GC + const char* pEnv = getenv( "SAL_FORCE_GC_ON_EXIT" ); + if( pEnv && (*pEnv != '0') ) + { + // cleanup container of fontinfos + for( FontList::const_iterator it = maFontList.begin(); it != maFontList.end(); ++it ) + { + FtFontInfo* pInfo = (*it).second; + delete pInfo; + } + maFontList.clear(); + +#if 0 // FT_Done_FreeType crashes on Solaris 10 + // TODO: check which versions have this problem + FT_Error rcFT = FT_Done_FreeType( aLibFT ); +#endif + } } // ----------------------------------------------------------------------- @@ -1733,16 +1751,39 @@ bool FreetypeServerFont::GetGlyphBitmap8( int nGlyphIndex, RawBitmap& rRawBitmap // determine unicode ranges in font // ----------------------------------------------------------------------- -// TODO: replace with GetFontCharMap() -bool FreetypeServerFont::GetFontCodeRanges( CmapResult& rResult ) const +const ImplFontCharMap* FreetypeServerFont::GetImplFontCharMap( void ) const +{ + const ImplFontCharMap* pIFCMap = mpFontInfo->GetImplFontCharMap(); + return pIFCMap; +} + +const ImplFontCharMap* FtFontInfo::GetImplFontCharMap( void ) +{ + // check if the charmap is already cached + if( mpFontCharMap ) + return mpFontCharMap; + + // get the charmap and cache it + CmapResult aCmapResult; + bool bOK = GetFontCodeRanges( aCmapResult ); + if( bOK ) + mpFontCharMap = new ImplFontCharMap( aCmapResult ); + else + mpFontCharMap = ImplFontCharMap::GetDefaultMap(); + mpFontCharMap->AddReference(); + return mpFontCharMap; +} + +// TODO: merge into method GetFontCharMap() +bool FtFontInfo::GetFontCodeRanges( CmapResult& rResult ) const { - rResult.mbSymbolic = mpFontInfo->IsSymbolFont(); + rResult.mbSymbolic = IsSymbolFont(); // TODO: is the full CmapResult needed on platforms calling this? if( FT_IS_SFNT( maFaceFT ) ) { ULONG nLength = 0; - const unsigned char* pCmap = mpFontInfo->GetTable( "cmap", &nLength ); + const unsigned char* pCmap = GetTable( "cmap", &nLength ); if( pCmap && (nLength > 0) ) if( ParseCMAP( pCmap, nLength, rResult ) ) return true; diff --git a/vcl/source/glyphs/gcach_ftyp.hxx b/vcl/source/glyphs/gcach_ftyp.hxx index 5ebe70bcbdf9..d760ce1d1fed 100644 --- a/vcl/source/glyphs/gcach_ftyp.hxx +++ b/vcl/source/glyphs/gcach_ftyp.hxx @@ -94,6 +94,9 @@ public: int GetGlyphIndex( sal_UCS4 cChar ) const; void CacheGlyphIndex( sal_UCS4 cChar, int nGI ) const; + bool GetFontCodeRanges( CmapResult& ) const; + const ImplFontCharMap* GetImplFontCharMap( void ); + bool HasExtraKerning() const; int GetExtraKernPairs( ImplKernPairData** ) const; int GetExtraGlyphKernValue( int nLeftGlyph, int nRightGlyph ) const; @@ -108,6 +111,8 @@ private: sal_IntPtr mnFontId; ImplDevFontAttributes maDevFontAttributes; + const ImplFontCharMap* mpFontCharMap; + // cache unicode->glyphid mapping because looking it up is expensive // TODO: change to hash_multimap when a use case requires a m:n mapping typedef ::std::hash_map<int,int> Int2IntMap; @@ -181,6 +186,7 @@ public: virtual bool NeedsArtificialItalic() const { return mbArtItalic; } virtual void FetchFontMetric( ImplFontMetricData&, long& rFactor ) const; + virtual const ImplFontCharMap* GetImplFontCharMap( void ) const; virtual int GetGlyphIndex( sal_UCS4 ) const; int GetRawGlyphIndex( sal_UCS4 ) const; @@ -203,7 +209,6 @@ protected: int ApplyGlyphTransform( int nGlyphFlags, FT_GlyphRec_*, bool ) const; virtual void InitGlyphData( int nGlyphIndex, GlyphData& ) const; - virtual bool GetFontCodeRanges( CmapResult& ) const; bool ApplyGSUB( const ImplFontSelectData& ); virtual ServerFontLayoutEngine* GetLayoutEngine(); diff --git a/vcl/source/glyphs/glyphcache.cxx b/vcl/source/glyphs/glyphcache.cxx index 1953ecf553c4..7181db56dd4d 100644 --- a/vcl/source/glyphs/glyphcache.cxx +++ b/vcl/source/glyphs/glyphcache.cxx @@ -78,12 +78,18 @@ GlyphCache::~GlyphCache() void GlyphCache::InvalidateAllGlyphs() { -#if 0 // TODO: implement uncaching of all glyph shapes and metrics - for( FontList::iterator it = maFontList.begin(); it != maFontList.end(); ++it ) - delete const_cast<ServerFont*>( it->second ); - maFontList.clear(); - mpCurrentGCFont = NULL; -#endif + // an application about to exit can omit garbage collecting the heap + // since it makes things slower and introduces risks if the heap was not perfect + // for debugging, for memory grinding or leak checking the env allows to force GC + const char* pEnv = getenv( "SAL_FORCE_GC_ON_EXIT" ); + if( pEnv && (*pEnv != '0') ) + { + // uncache of all glyph shapes and metrics + for( FontList::iterator it = maFontList.begin(); it != maFontList.end(); ++it ) + delete const_cast<ServerFont*>( it->second ); + maFontList.clear(); + mpCurrentGCFont = NULL; + } } // ----------------------------------------------------------------------- diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx index 64f2b7e0d2a1..055b7e9fe80b 100644 --- a/vcl/source/window/dlgctrl.cxx +++ b/vcl/source/window/dlgctrl.cxx @@ -1058,29 +1058,10 @@ static sal_Unicode getAccel( const String& rStr ) return nChar; } -Window* Window::GetLabelFor() const +static Window* ImplGetLabelFor( Window* pFrameWindow, WindowType nMyType, Window* pLabel, sal_Unicode nAccel ) { - if ( mpWindowImpl->mbDisableAccessibleLabelForRelation ) - return NULL; - Window* pWindow = NULL; - Window* pFrameWindow = ImplGetFrameWindow(); - - WinBits nFrameStyle = pFrameWindow->GetStyle(); - if( ! ( nFrameStyle & WB_DIALOGCONTROL ) - || ( nFrameStyle & WB_NODIALOGCONTROL ) - ) - return NULL; - - if ( mpWindowImpl->mpRealParent ) - pWindow = mpWindowImpl->mpRealParent->GetParentLabelFor( this ); - - if( pWindow ) - return pWindow; - sal_Unicode nAccel = getAccel( GetText() ); - - WindowType nMyType = GetType(); if( nMyType == WINDOW_FIXEDTEXT || nMyType == WINDOW_FIXEDLINE || nMyType == WINDOW_GROUPBOX ) @@ -1092,7 +1073,7 @@ Window* Window::GetLabelFor() const // get index, form start and form end USHORT nIndex=0, nFormStart=0, nFormEnd=0; pSWindow = ::ImplFindDlgCtrlWindow( pFrameWindow, - const_cast<Window*>(this), + pLabel, nIndex, nFormStart, nFormEnd ); @@ -1139,32 +1120,39 @@ Window* Window::GetLabelFor() const return pWindow; } -// ----------------------------------------------------------------------- - -Window* Window::GetLabeledBy() const +Window* Window::GetLabelFor() const { - if ( mpWindowImpl->mbDisableAccessibleLabeledByRelation ) + if ( mpWindowImpl->mbDisableAccessibleLabelForRelation ) return NULL; Window* pWindow = NULL; Window* pFrameWindow = ImplGetFrameWindow(); + WinBits nFrameStyle = pFrameWindow->GetStyle(); + if( ! ( nFrameStyle & WB_DIALOGCONTROL ) + || ( nFrameStyle & WB_NODIALOGCONTROL ) + ) + return NULL; + if ( mpWindowImpl->mpRealParent ) - pWindow = mpWindowImpl->mpRealParent->GetParentLabeledBy( this ); + pWindow = mpWindowImpl->mpRealParent->GetParentLabelFor( this ); if( pWindow ) return pWindow; - // #i62723#, #104191# checkboxes and radiobuttons are not supposed to have labels - if( GetType() == WINDOW_CHECKBOX || GetType() == WINDOW_RADIOBUTTON ) - return NULL; + sal_Unicode nAccel = getAccel( GetText() ); -// if( ! ( GetType() == WINDOW_FIXEDTEXT || -// GetType() == WINDOW_FIXEDLINE || -// GetType() == WINDOW_GROUPBOX ) ) - // #i100833# MT 2010/02: Group box and fixed lines can also lable a fixed text. - // See tools/options/print for example. - WindowType nMyType = GetType(); + pWindow = ImplGetLabelFor( pFrameWindow, GetType(), const_cast<Window*>(this), nAccel ); + if( ! pWindow && mpWindowImpl->mpRealParent ) + pWindow = ImplGetLabelFor( mpWindowImpl->mpRealParent, GetType(), const_cast<Window*>(this), nAccel ); + return pWindow; +} + +// ----------------------------------------------------------------------- + +static Window* ImplGetLabeledBy( Window* pFrameWindow, WindowType nMyType, Window* pLabeled ) +{ + Window* pWindow = NULL; if ( (nMyType != WINDOW_GROUPBOX) && (nMyType != WINDOW_FIXEDLINE) ) { // search for a control that labels this window @@ -1176,16 +1164,16 @@ Window* Window::GetLabeledBy() const // get form start and form end and index of this control USHORT nIndex, nFormStart, nFormEnd; Window* pSWindow = ::ImplFindDlgCtrlWindow( pFrameWindow, - const_cast<Window*>(this), + pLabeled, nIndex, nFormStart, nFormEnd ); if( pSWindow && nIndex != nFormStart ) { - if( GetType() == WINDOW_PUSHBUTTON || - GetType() == WINDOW_HELPBUTTON || - GetType() == WINDOW_OKBUTTON || - GetType() == WINDOW_CANCELBUTTON ) + if( nMyType == WINDOW_PUSHBUTTON || + nMyType == WINDOW_HELPBUTTON || + nMyType == WINDOW_OKBUTTON || + nMyType == WINDOW_CANCELBUTTON ) { nFormStart = nIndex-1; } @@ -1217,6 +1205,39 @@ Window* Window::GetLabeledBy() const return pWindow; } +Window* Window::GetLabeledBy() const +{ + if ( mpWindowImpl->mbDisableAccessibleLabeledByRelation ) + return NULL; + + Window* pWindow = NULL; + Window* pFrameWindow = ImplGetFrameWindow(); + + if ( mpWindowImpl->mpRealParent ) + { + pWindow = mpWindowImpl->mpRealParent->GetParentLabeledBy( this ); + + if( pWindow ) + return pWindow; + } + + // #i62723#, #104191# checkboxes and radiobuttons are not supposed to have labels + if( GetType() == WINDOW_CHECKBOX || GetType() == WINDOW_RADIOBUTTON ) + return NULL; + +// if( ! ( GetType() == WINDOW_FIXEDTEXT || +// GetType() == WINDOW_FIXEDLINE || +// GetType() == WINDOW_GROUPBOX ) ) + // #i100833# MT 2010/02: Group box and fixed lines can also lable a fixed text. + // See tools/options/print for example. + + pWindow = ImplGetLabeledBy( pFrameWindow, GetType(), const_cast<Window*>(this) ); + if( ! pWindow && mpWindowImpl->mpRealParent ) + pWindow = ImplGetLabeledBy( mpWindowImpl->mpRealParent, GetType(), const_cast<Window*>(this) ); + + return pWindow; +} + // ----------------------------------------------------------------------- KeyEvent Window::GetActivationKey() const diff --git a/vcl/unx/headless/svpgdi.hxx b/vcl/unx/headless/svpgdi.hxx index 1ad9eca9d272..93ec080d0136 100644 --- a/vcl/unx/headless/svpgdi.hxx +++ b/vcl/unx/headless/svpgdi.hxx @@ -88,7 +88,7 @@ public: virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel ); virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel ); virtual ULONG GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ); - virtual ImplFontCharMap* GetImplFontCharMap() const; + virtual const ImplFontCharMap* GetImplFontCharMap() const; virtual void GetDevFontList( ImplDevFontList* ); virtual void GetDevFontSubstList( OutputDevice* ); virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName ); diff --git a/vcl/unx/headless/svppspgraphics.cxx b/vcl/unx/headless/svppspgraphics.cxx index 86f356031f52..c7b1f4f41fca 100644 --- a/vcl/unx/headless/svppspgraphics.cxx +++ b/vcl/unx/headless/svppspgraphics.cxx @@ -683,16 +683,13 @@ void PspGraphics::DrawServerFontLayout( const ServerFontLayout& rLayout ) DrawPrinterLayout( rLayout, *m_pPrinterGfx, true ); } -ImplFontCharMap* PspGraphics::GetImplFontCharMap() const +const ImplFontCharMap* PspGraphics::GetImplFontCharMap() const { - // TODO: get ImplFontCharMap directly from fonts if( !m_pServerFont[0] ) return NULL; - CmapResult aCmapResult; - if( !m_pServerFont[0]->GetFontCodeRanges( aCmapResult ) ) - return NULL; - return new ImplFontCharMap( aCmapResult ); + const ImplFontCharMap* pIFCMap = m_pServerFont[0]->GetImplFontCharMap(); + return pIFCMap; } USHORT PspGraphics::SetFont( ImplFontSelectData *pEntry, int nFallbackLevel ) diff --git a/vcl/unx/headless/svppspgraphics.hxx b/vcl/unx/headless/svppspgraphics.hxx index 987923eb40ff..138198239621 100644 --- a/vcl/unx/headless/svppspgraphics.hxx +++ b/vcl/unx/headless/svppspgraphics.hxx @@ -107,7 +107,7 @@ public: virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel ); virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel ); virtual ULONG GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ); - virtual ImplFontCharMap* GetImplFontCharMap() const; + virtual const ImplFontCharMap* GetImplFontCharMap() const; virtual void GetDevFontList( ImplDevFontList* ); virtual void GetDevFontSubstList( OutputDevice* ); virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName ); diff --git a/vcl/unx/headless/svptext.cxx b/vcl/unx/headless/svptext.cxx index 34941fc777db..dff1fd4d6ca7 100644 --- a/vcl/unx/headless/svptext.cxx +++ b/vcl/unx/headless/svptext.cxx @@ -272,15 +272,13 @@ ULONG SvpSalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ) // --------------------------------------------------------------------------- -ImplFontCharMap* SvpSalGraphics::GetImplFontCharMap() const +const ImplFontCharMap* SvpSalGraphics::GetImplFontCharMap() const { if( !m_pServerFont[0] ) return NULL; - CmapResult aCmapResult; - if( !m_pServerFont[0]->GetFontCodeRanges( aCmapResult ) ) - return NULL; - return new ImplFontCharMap( aCmapResult ); + const ImplFontCharMap* pIFCMap = m_pServerFont[0]->GetImplFontCharMap(); + return pIFCMap; } // --------------------------------------------------------------------------- diff --git a/vcl/unx/inc/pspgraphics.h b/vcl/unx/inc/pspgraphics.h index a91029e34580..d4f5a9f156e0 100644 --- a/vcl/unx/inc/pspgraphics.h +++ b/vcl/unx/inc/pspgraphics.h @@ -104,7 +104,7 @@ public: virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel ); virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel ); virtual ULONG GetKernPairs( ULONG nMaxPairs, ImplKernPairData* ); - virtual ImplFontCharMap* GetImplFontCharMap() const; + virtual const ImplFontCharMap* GetImplFontCharMap() const; virtual void GetDevFontList( ImplDevFontList* ); virtual void GetDevFontSubstList( OutputDevice* ); virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName ); diff --git a/vcl/unx/inc/salgdi.h b/vcl/unx/inc/salgdi.h index 33e6be054d48..b5fdce50eee9 100644 --- a/vcl/unx/inc/salgdi.h +++ b/vcl/unx/inc/salgdi.h @@ -255,7 +255,7 @@ public: virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel ); virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel ); virtual ULONG GetKernPairs( ULONG nMaxPairs, ImplKernPairData* ); - virtual ImplFontCharMap* GetImplFontCharMap() const; + virtual const ImplFontCharMap* GetImplFontCharMap() const; virtual void GetDevFontList( ImplDevFontList* ); virtual void GetDevFontSubstList( OutputDevice* ); virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName ); diff --git a/vcl/unx/source/gdi/pspgraphics.cxx b/vcl/unx/source/gdi/pspgraphics.cxx index 220d7bbcae87..bab78b0cb2df 100644 --- a/vcl/unx/source/gdi/pspgraphics.cxx +++ b/vcl/unx/source/gdi/pspgraphics.cxx @@ -694,7 +694,7 @@ void PspServerFontLayout::InitFont() const static void DrawPrinterLayout( const SalLayout& rLayout, ::psp::PrinterGfx& rGfx, bool bIsPspServerFontLayout ) { const int nMaxGlyphs = 200; - sal_GlyphId aGlyphAry[ nMaxGlyphs ]; + sal_uInt32 aGlyphAry[ nMaxGlyphs ]; // TODO: use sal_GlyphId sal_Int32 aWidthAry[ nMaxGlyphs ]; sal_Int32 aIdxAry [ nMaxGlyphs ]; sal_Unicode aUnicodes[ nMaxGlyphs ]; @@ -720,15 +720,20 @@ static void DrawPrinterLayout( const SalLayout& rLayout, ::psp::PrinterGfx& rGfx #ifdef ENABLE_GRAPHITE else if (pGrLayout) { + #if 0 // HACK: disabled for now due to #i114460#, see #desc12 there + // TODO: get rid of glyph->string mapping altogether for printing + // TODO: fix GraphiteServerFontLayout's returned aCharPosAry + // TODO: fix PrinterGfx's caching? pText = pGrLayout->getTextPtr(); nMinCharPos = pGrLayout->getMinCharPos(); nMaxCharPos = pGrLayout->getMaxCharPos(); + #endif } #endif } for( int nStart = 0;; ) { - int nGlyphCount = rLayout.GetNextGlyphs( nMaxGlyphs, aGlyphAry, aPos, nStart, aWidthAry, bIsPspServerFontLayout ? aCharPosAry : NULL ); + int nGlyphCount = rLayout.GetNextGlyphs( nMaxGlyphs, aGlyphAry, aPos, nStart, aWidthAry, pText ? aCharPosAry : NULL ); if( !nGlyphCount ) break; @@ -738,7 +743,7 @@ static void DrawPrinterLayout( const SalLayout& rLayout, ::psp::PrinterGfx& rGfx nXOffset += aWidthAry[ i ]; aIdxAry[ i ] = nXOffset / nUnitsPerPixel; sal_Int32 nGlyphIdx = aGlyphAry[i] & (GF_IDXMASK | GF_ROTMASK); - if( bIsPspServerFontLayout ) + if( pText ) aUnicodes[i] = (aCharPosAry[i] >= nMinCharPos && aCharPosAry[i] <= nMaxCharPos) ? pText[ aCharPosAry[i] ] : 0; else aUnicodes[i] = (aGlyphAry[i] & GF_ISCHAR) ? nGlyphIdx : 0; @@ -770,16 +775,13 @@ void PspGraphics::DrawServerFontLayout( const ServerFontLayout& rLayout ) DrawPrinterLayout( rLayout, *m_pPrinterGfx, true ); } -ImplFontCharMap* PspGraphics::GetImplFontCharMap() const +const ImplFontCharMap* PspGraphics::GetImplFontCharMap() const { - // TODO: get ImplFontCharMap directly from fonts if( !m_pServerFont[0] ) return NULL; - CmapResult aCmapResult; - if( !m_pServerFont[0]->GetFontCodeRanges( aCmapResult ) ) - return NULL; - return new ImplFontCharMap( aCmapResult ); + const ImplFontCharMap* pIFCMap = m_pServerFont[0]->GetImplFontCharMap(); + return pIFCMap; } USHORT PspGraphics::SetFont( ImplFontSelectData *pEntry, int nFallbackLevel ) diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx index 16529d3ce78f..62e575ebc5ef 100644 --- a/vcl/unx/source/gdi/salgdi3.cxx +++ b/vcl/unx/source/gdi/salgdi3.cxx @@ -1494,20 +1494,13 @@ void X11SalGraphics::DrawStringUCS2MB( ExtendedFontStruct& rFont, //-------------------------------------------------------------------------- -ImplFontCharMap* X11SalGraphics::GetImplFontCharMap() const +const ImplFontCharMap* X11SalGraphics::GetImplFontCharMap() const { - // TODO: get ImplFontCharMap directly from fonts if( !mpServerFont[0] ) -#if 0 // RIP XLFD fonts - if( mXFont[0] ) - // TODO?: nPairCount = mXFont[0]->GetFontCodeRanges( NULL ); -#endif return NULL; - CmapResult aCmapResult; - if( !mpServerFont[0]->GetFontCodeRanges( aCmapResult ) ) - return NULL; - return new ImplFontCharMap( aCmapResult ); + const ImplFontCharMap* pIFCMap = mpServerFont[0]->GetImplFontCharMap(); + return pIFCMap; } // ---------------------------------------------------------------------------- diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk index b864b7cb2685..d21e9dcb3eed 100644 --- a/vcl/util/makefile.mk +++ b/vcl/util/makefile.mk @@ -391,9 +391,6 @@ SHL4STDLIBS+= $(XRANDR_LIBS) .ENDIF .ENDIF -.IF "$(OS)$(CPU)" == "LINUXX" && "$(LIBRARY_PATH)" != "" -EXTRALIBPATHS+=-L$(LIBRARY_PATH) -.ENDIF # "$(OS)$(CPU)" == "LINUXX" .ENDIF # "$(ENABLE_GTK)" != "" # KDE plugin @@ -464,3 +461,16 @@ SHL6STDLIBS+= $(XRANDR_LIBS) .INCLUDE : target.mk +ALLTAR : $(MISC)/vcl.component + +.IF "$(OS)" == "MACOSX" +my_platform = .macosx +.ELIF "$(OS)" == "WNT" +my_platform = .windows +.END + +$(MISC)/vcl.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + vcl.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt vcl$(my_platform).component diff --git a/vcl/util/vcl.component b/vcl/util/vcl.component new file mode 100644 index 000000000000..da20fc916c32 --- /dev/null +++ b/vcl/util/vcl.component @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.datatransfer.X11ClipboardSupport"> + <service name="com.sun.star.datatransfer.clipboard.SystemClipboard"/> + </implementation> + <implementation name="com.sun.star.datatransfer.dnd.XdndDropTarget"> + <service name="com.sun.star.datatransfer.dnd.X11DropTarget"/> + </implementation> + <implementation name="com.sun.star.datatransfer.dnd.XdndSupport"> + <service name="com.sun.star.datatransfer.dnd.X11DragSource"/> + </implementation> + <implementation name="com.sun.star.frame.VCLSessionManagerClient"> + <service name="com.sun.star.frame.SessionManagerClient"/> + </implementation> + <implementation name="vcl::DisplayAccess"> + <service name="com.sun.star.awt.DisplayAccess"/> + </implementation> + <implementation name="vcl::FontIdentificator"> + <service name="com.sun.star.awt.FontIdentificator"/> + </implementation> +</component> diff --git a/vcl/util/vcl.macosx.component b/vcl/util/vcl.macosx.component new file mode 100644 index 000000000000..3aabcd8c7050 --- /dev/null +++ b/vcl/util/vcl.macosx.component @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.datatransfer.dnd.OleDragSource_V1"> + <service name="com.sun.star.datatransfer.dnd.OleDragSource"/> + </implementation> + <implementation name="com.sun.star.comp.datatransfer.dnd.OleDropTarget_V1"> + <service name="com.sun.star.datatransfer.dnd.OleDropTarget"/> + </implementation> + <implementation name="com.sun.star.datatransfer.clipboard.AquaClipboard"> + <service name="com.sun.star.datatransfer.clipboard.SystemClipboard"/> + </implementation> + <implementation name="com.sun.star.frame.VCLSessionManagerClient"> + <service name="com.sun.star.frame.SessionManagerClient"/> + </implementation> + <implementation name="vcl::DisplayAccess"> + <service name="com.sun.star.awt.DisplayAccess"/> + </implementation> + <implementation name="vcl::FontIdentificator"> + <service name="com.sun.star.awt.FontIdentificator"/> + </implementation> +</component> diff --git a/vcl/util/vcl.windows.component b/vcl/util/vcl.windows.component new file mode 100644 index 000000000000..72f7ace9f251 --- /dev/null +++ b/vcl/util/vcl.windows.component @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.frame.VCLSessionManagerClient"> + <service name="com.sun.star.frame.SessionManagerClient"/> + </implementation> + <implementation name="vcl::DisplayAccess"> + <service name="com.sun.star.awt.DisplayAccess"/> + </implementation> + <implementation name="vcl::FontIdentificator"> + <service name="com.sun.star.awt.FontIdentificator"/> + </implementation> +</component> diff --git a/vcl/win/inc/salgdi.h b/vcl/win/inc/salgdi.h index 5b8cfb099756..f592f53ae29c 100755 --- a/vcl/win/inc/salgdi.h +++ b/vcl/win/inc/salgdi.h @@ -57,10 +57,10 @@ class ImplFontAttrCache; class ImplWinFontData : public ImplFontData { public: - ImplWinFontData( const ImplDevFontAttributes&, + explicit ImplWinFontData( const ImplDevFontAttributes&, int nFontHeight, WIN_BYTE eWinCharSet, WIN_BYTE nPitchAndFamily ); - ~ImplWinFontData(); + virtual ~ImplWinFontData(); virtual ImplFontData* Clone() const; virtual ImplFontEntry* CreateFontInstance( ImplFontSelectData& ) const; @@ -82,7 +82,7 @@ public: bool SupportsGraphite() const { return mbHasGraphiteSupport; } #endif - ImplFontCharMap* GetImplFontCharMap() const; + const ImplFontCharMap* GetImplFontCharMap() const; const Ucs2SIntMap* GetEncodingVector() const { return mpEncodingVector; } void SetEncodingVector( const Ucs2SIntMap* pNewVec ) const { @@ -127,9 +127,9 @@ public: #endif // GNG_VERT_HACK }; -// ------------------- -// - SalGraphicsData - -// ------------------- +// ------------------ +// - WinSalGraphics - +// ------------------ class WinSalGraphics : public SalGraphics { @@ -179,7 +179,7 @@ public: HFONT ImplDoSetFont( ImplFontSelectData* i_pFont, float& o_rFontScale, HFONT& o_rOldFont ); public: - WinSalGraphics(); + explicit WinSalGraphics(); virtual ~WinSalGraphics(); protected: @@ -287,7 +287,7 @@ public: // return only PairCount if (pKernPairs == NULL) virtual ULONG GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ); // get the repertoire of the current font - virtual ImplFontCharMap* GetImplFontCharMap() const; + virtual const ImplFontCharMap* GetImplFontCharMap() const; // graphics must fill supplied font list virtual void GetDevFontList( ImplDevFontList* ); // graphics should call ImplAddDevFontSubstitute on supplied @@ -359,11 +359,11 @@ public: }; // Init/Deinit Graphics -void ImplSalInitGraphics( WinSalGraphics* mpData ); -void ImplSalDeInitGraphics( WinSalGraphics* mpData ); +void ImplSalInitGraphics( WinSalGraphics* ); +void ImplSalDeInitGraphics( WinSalGraphics* ); void ImplUpdateSysColorEntries(); int ImplIsSysColorEntry( SalColor nSalColor ); -void ImplGetLogFontFromFontSelect( HDC hDC, const ImplFontSelectData*, +void ImplGetLogFontFromFontSelect( HDC, const ImplFontSelectData*, LOGFONTW&, bool bTestVerticalAvail ); // ----------- @@ -397,7 +397,10 @@ inline bool ImplWinFontData::HasChar( sal_uInt32 cChar ) const cChar -= 0xF000; else if( mbAliasSymbolsHigh && (cChar <= 0xFF) ) cChar += 0xF000; + else + return false; return mpUnicodeMap->HasChar( cChar ); } #endif // _SV_SALGDI_H + diff --git a/vcl/win/source/gdi/salbmp.cxx b/vcl/win/source/gdi/salbmp.cxx index 444df039dd69..141c812dcd31 100644 --- a/vcl/win/source/gdi/salbmp.cxx +++ b/vcl/win/source/gdi/salbmp.cxx @@ -509,8 +509,8 @@ void WinSalBitmap::ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ) { PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( mhDIB ); const USHORT nCount = pBuffer->maPalette.GetEntryCount(); - - memcpy( pBI->bmiColors, pBuffer->maPalette.ImplGetColorBuffer(), nCount * sizeof( RGBQUAD ) ); + const USHORT nDIBColorCount = ImplGetDIBColorCount( mhDIB ); + memcpy( pBI->bmiColors, pBuffer->maPalette.ImplGetColorBuffer(), Min( nDIBColorCount, nCount ) * sizeof( RGBQUAD ) ); GlobalUnlock( mhDIB ); } diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index 01fecec94b2f..c8e0210196e6 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -533,9 +533,10 @@ bool WinGlyphFallbackSubstititution::HasMissingChars( const ImplFontData* pFace, // avoid fonts with unknown CMAP subtables for glyph fallback if( !pCharMap || pCharMap->IsDefaultMap() ) return false; + pCharMap->AddReference(); int nMatchCount = 0; - // static const int nMaxMatchCount = 1; // TODO: check more missing characters? + // static const int nMaxMatchCount = 1; // TODO: tolerate more missing characters? const sal_Int32 nStrLen = rMissingChars.getLength(); for( sal_Int32 nStrIdx = 0; nStrIdx < nStrLen; ++nStrIdx ) { @@ -543,6 +544,7 @@ bool WinGlyphFallbackSubstititution::HasMissingChars( const ImplFontData* pFace, nMatchCount += pCharMap->HasChar( uChar ); break; // for now } + pCharMap->DeReference(); const bool bHasMatches = (nMatchCount > 0); return bHasMatches; @@ -1206,11 +1208,10 @@ bool ImplWinFontData::IsGSUBstituted( sal_UCS4 cChar ) const // ----------------------------------------------------------------------- -ImplFontCharMap* ImplWinFontData::GetImplFontCharMap() const +const ImplFontCharMap* ImplWinFontData::GetImplFontCharMap() const { if( !mpUnicodeMap ) return NULL; - mpUnicodeMap->AddReference(); return mpUnicodeMap; } @@ -1320,6 +1321,7 @@ void ImplWinFontData::ReadCmapTable( HDC hDC ) const if( !mpUnicodeMap ) mpUnicodeMap = ImplFontCharMap::GetDefaultMap( bIsSymbolFont ); + mpUnicodeMap->AddReference(); } // ======================================================================= @@ -2060,7 +2062,7 @@ ULONG WinSalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ) // ----------------------------------------------------------------------- -ImplFontCharMap* WinSalGraphics::GetImplFontCharMap() const +const ImplFontCharMap* WinSalGraphics::GetImplFontCharMap() const { if( !mpWinFontData[0] ) return ImplFontCharMap::GetDefaultMap(); @@ -2882,8 +2884,6 @@ BOOL WinSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, ImplDoSetFont( &aIFSD, fScale, hOldFont ); ImplWinFontData* pWinFontData = (ImplWinFontData*)aIFSD.mpFontData; - pWinFontData->UpdateFromHDC( mhDC ); -/*const*/ ImplFontCharMap* pImplFontCharMap = pWinFontData->GetImplFontCharMap(); #if OSL_DEBUG_LEVEL > 1 // get font metrics @@ -2906,6 +2906,10 @@ BOOL WinSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, const RawFontData aRawCffData( mhDC, nCffTag ); if( aRawCffData.get() ) { + pWinFontData->UpdateFromHDC( mhDC ); + const ImplFontCharMap* pCharMap = pWinFontData->GetImplFontCharMap(); + pCharMap->AddReference(); + long nRealGlyphIds[ 256 ]; for( int i = 0; i < nGlyphCount; ++i ) { @@ -2913,13 +2917,15 @@ BOOL WinSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, // TODO: use GDI's GetGlyphIndices instead? Does it handle GSUB properly? sal_uInt32 nGlyphIdx = pGlyphIDs[i] & GF_IDXMASK; if( pGlyphIDs[i] & GF_ISCHAR ) // remaining pseudo-glyphs need to be translated - nGlyphIdx = pImplFontCharMap->GetGlyphIndex( nGlyphIdx ); + nGlyphIdx = pCharMap->GetGlyphIndex( nGlyphIdx ); if( (pGlyphIDs[i] & (GF_ROTMASK|GF_GSUB)) != 0) // TODO: vertical substitution {/*####*/} nRealGlyphIds[i] = nGlyphIdx; } + pCharMap->DeReference(); // TODO: and and use a RAII object + // provide a font subset from the CFF-table FILE* pOutFile = fopen( aToFile.GetBuffer(), "wb" ); rInfo.LoadFont( FontSubsetInfo::CFF_FONT, aRawCffData.get(), aRawCffData.size() ); @@ -3167,8 +3173,9 @@ void WinSalGraphics::GetGlyphWidths( const ImplFontData* pFont, rUnicodeEnc.clear(); } const ImplWinFontData* pWinFont = static_cast<const ImplWinFontData*>(pFont); - ImplFontCharMap* pMap = pWinFont->GetImplFontCharMap(); + const ImplFontCharMap* pMap = pWinFont->GetImplFontCharMap(); DBG_ASSERT( pMap && pMap->GetCharCount(), "no map" ); + pMap->AddReference(); int nCharCount = pMap->GetCharCount(); sal_uInt32 nChar = pMap->GetFirstChar(); @@ -3184,6 +3191,8 @@ void WinSalGraphics::GetGlyphWidths( const ImplFontData* pFont, } nChar = pMap->GetNextChar( nChar ); } + + pMap->DeReference(); // TODO: and and use a RAII object } } else if( pFont->IsEmbeddable() ) diff --git a/vcl/workben/makefile.mk b/vcl/workben/makefile.mk index 67c0289cc24f..abd0c23a3607 100644 --- a/vcl/workben/makefile.mk +++ b/vcl/workben/makefile.mk @@ -34,6 +34,8 @@ TARGETTYPE=GUI ENABLE_EXCEPTIONS=TRUE +my_components = i18npool i18nsearch + # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk @@ -136,16 +138,18 @@ APP5STDLIBS+=-lsocket .ENDIF .INCLUDE : target.mk -.IF "$(L10N_framework)"=="" -ALLTAR : $(BIN)$/applicat.rdb +ALLTAR : $(BIN)/applicat.rdb $(BIN)/types.rdb +$(BIN)/applicat.rdb .ERRREMOVE : $(SOLARENV)/bin/packcomponents.xslt \ + $(MISC)/applicat.input $(my_components:^"$(SOLARXMLDIR)/":+".component") + $(XSLTPROC) --nonet --stringparam prefix $(SOLARXMLDIR)/ -o $@ \ + $(SOLARENV)/bin/packcomponents.xslt $(MISC)/applicat.input -$(BIN)$/applicat.rdb : makefile.mk $(UNOUCRRDB) - rm -f $@ - $(GNUCOPY) $(UNOUCRRDB) $@ - cd $(BIN) && \ - $(REGCOMP) -register -r applicat.rdb \ - -c i18nsearch.uno$(DLLPOST) \ - -c i18npool.uno$(DLLPOST) -.ENDIF +$(MISC)/applicat.input : + echo \ + '<list>$(my_components:^"<filename>":+".component</filename>")</list>' \ + > $@ + +$(BIN)/types.rdb : $(SOLARBINDIR)/types.rdb + $(COPY) $< $@ diff --git a/vcl/workben/svdem.cxx b/vcl/workben/svdem.cxx index 5822f4024a59..297660d4b8df 100644 --- a/vcl/workben/svdem.cxx +++ b/vcl/workben/svdem.cxx @@ -55,7 +55,7 @@ SAL_IMPLEMENT_MAIN() tools::extendApplicationEnvironment(); Reference< XMultiServiceFactory > xMS; - xMS = cppu::createRegistryServiceFactory( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True ); + xMS = cppu::createRegistryServiceFactory( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "types.rdb" ) ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True ); InitVCL( xMS ); ::Main(); diff --git a/vcl/workben/svptest.cxx b/vcl/workben/svptest.cxx index cc7c0f2b0cce..8f901d1c200b 100644 --- a/vcl/workben/svptest.cxx +++ b/vcl/workben/svptest.cxx @@ -61,7 +61,7 @@ SAL_IMPLEMENT_MAIN() tools::extendApplicationEnvironment(); Reference< XMultiServiceFactory > xMS; - xMS = cppu::createRegistryServiceFactory( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True ); + xMS = cppu::createRegistryServiceFactory( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "types.rdb" ) ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True ); InitVCL( xMS ); ::Main(); diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 41ca76144e5c..dafd546b3d68 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -60,7 +60,7 @@ SAL_IMPLEMENT_MAIN() tools::extendApplicationEnvironment(); Reference< XMultiServiceFactory > xMS; - xMS = cppu::createRegistryServiceFactory( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True ); + xMS = cppu::createRegistryServiceFactory( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "types.rdb" ) ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True ); InitVCL( xMS ); ::Main(); |