diff options
-rw-r--r-- | svtools/inc/svtools/embedhlp.hxx | 10 | ||||
-rw-r--r-- | svtools/source/misc/embedhlp.cxx | 41 | ||||
-rw-r--r-- | vcl/aqua/source/gdi/salgdi.cxx | 6 | ||||
-rw-r--r-- | vcl/source/fontsubset/cff.cxx | 78 | ||||
-rwxr-xr-x | vcl/source/gdi/sallayout.cxx | 8 | ||||
-rw-r--r-- | vcl/win/source/gdi/winlayout.cxx | 5 |
6 files changed, 96 insertions, 52 deletions
diff --git a/svtools/inc/svtools/embedhlp.hxx b/svtools/inc/svtools/embedhlp.hxx index f4cccd3115b8..68763a3fd487 100644 --- a/svtools/inc/svtools/embedhlp.hxx +++ b/svtools/inc/svtools/embedhlp.hxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: embedhlp.hxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -131,6 +128,13 @@ namespace svt BOOL is() const { return mxObj.is(); } BOOL IsChart() const; + + // #i104867# + // Provides a graphic version number for the fetchable Graphic during this object's lifetime. Internally, + // that number is incremented at each change of the Graphic. This mechanism is needed to identify if a + // remembered Graphic (e.g. primitives) has changed compared to the current one, but without actively + // fetching the Graphic what would be too expensive e.g. for charts + sal_uInt32 getGraphicVersion() const; void SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM );//#i103460# charts do not necessaryly have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this method }; } diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx index 6bd1126f8082..edddb7c1ab6d 100644 --- a/svtools/source/misc/embedhlp.cxx +++ b/svtools/source/misc/embedhlp.cxx @@ -7,7 +7,6 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: embedhlp.cxx,v $ - * $Revision: 1.28 $ * * This file is part of OpenOffice.org. * @@ -189,7 +188,6 @@ void SAL_CALL EmbedEventListener_Impl::modified( const lang::EventObject& ) thro pObject->UpdateReplacementOnDemand(); } } - } void SAL_CALL EmbedEventListener_Impl::notifyEvent( const document::EventObject& aEvent ) throw( uno::RuntimeException ) @@ -250,6 +248,9 @@ struct EmbeddedObjectRef_Impl sal_Int64 nViewAspect; BOOL bIsLocked; sal_Bool bNeedUpdate; + + // #i104867# + sal_uInt32 mnGraphicVersion; awt::Size aDefaultSizeForChart_In_100TH_MM;//#i103460# charts do not necessaryly have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this member }; @@ -262,6 +263,7 @@ void EmbeddedObjectRef::Construct_Impl() mpImp->nViewAspect = embed::Aspects::MSOLE_CONTENT; mpImp->bIsLocked = FALSE; mpImp->bNeedUpdate = sal_False; + mpImp->mnGraphicVersion = 0; mpImp->aDefaultSizeForChart_In_100TH_MM = awt::Size(8000,7000); } @@ -297,12 +299,14 @@ EmbeddedObjectRef::EmbeddedObjectRef( const EmbeddedObjectRef& rObj ) mpImp->pGraphic = 0; mpImp->pHCGraphic = 0; + mpImp->mnGraphicVersion = 0; } EmbeddedObjectRef::~EmbeddedObjectRef() { delete mpImp->pGraphic; - if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic ); + if ( mpImp->pHCGraphic ) + DELETEZ( mpImp->pHCGraphic ); Clear(); } /* @@ -453,10 +457,15 @@ void EmbeddedObjectRef::GetReplacement( BOOL bUpdate ) DELETEZ( mpImp->pGraphic ); mpImp->aMediaType = ::rtl::OUString(); mpImp->pGraphic = new Graphic; - if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic ); + if ( mpImp->pHCGraphic ) + DELETEZ( mpImp->pHCGraphic ); + mpImp->mnGraphicVersion++; } else if ( !mpImp->pGraphic ) + { mpImp->pGraphic = new Graphic; + mpImp->mnGraphicVersion++; + } else { DBG_ERROR("No update, but replacement exists already!"); @@ -469,6 +478,7 @@ void EmbeddedObjectRef::GetReplacement( BOOL bUpdate ) GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); if( mpImp->pGraphic ) pGF->ImportGraphic( *mpImp->pGraphic, String(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW ); + mpImp->mnGraphicVersion++; delete pGraphicStream; } } @@ -598,6 +608,7 @@ Graphic* EmbeddedObjectRef::GetHCGraphic() const mpImp->pHCGraphic = pGraphic; else delete pGraphic; + mpImp->mnGraphicVersion++; } delete pStream; @@ -615,7 +626,9 @@ void EmbeddedObjectRef::SetGraphicStream( const uno::Reference< io::XInputStream delete mpImp->pGraphic; mpImp->pGraphic = new Graphic(); mpImp->aMediaType = rMediaType; - if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic ); + if ( mpImp->pHCGraphic ) + DELETEZ( mpImp->pHCGraphic ); + mpImp->mnGraphicVersion++; SvStream* pGraphicStream = ::utl::UcbStreamHelper::CreateStream( xInGrStream ); @@ -623,6 +636,7 @@ void EmbeddedObjectRef::SetGraphicStream( const uno::Reference< io::XInputStream { GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); pGF->ImportGraphic( *mpImp->pGraphic, String(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW ); + mpImp->mnGraphicVersion++; if ( mpImp->pContainer ) { @@ -645,7 +659,9 @@ void EmbeddedObjectRef::SetGraphic( const Graphic& rGraphic, const ::rtl::OUStri delete mpImp->pGraphic; mpImp->pGraphic = new Graphic( rGraphic ); mpImp->aMediaType = rMediaType; - if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic ); + if ( mpImp->pHCGraphic ) + DELETEZ( mpImp->pHCGraphic ); + mpImp->mnGraphicVersion++; if ( mpImp->pContainer ) SetGraphicToContainer( rGraphic, *mpImp->pContainer, mpImp->aPersistName, rMediaType ); @@ -880,7 +896,9 @@ void EmbeddedObjectRef::UpdateReplacementOnDemand() { DELETEZ( mpImp->pGraphic ); mpImp->bNeedUpdate = sal_True; - if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic ); + if ( mpImp->pHCGraphic ) + DELETEZ( mpImp->pHCGraphic ); + mpImp->mnGraphicVersion++; if( mpImp->pContainer ) { @@ -914,6 +932,12 @@ BOOL EmbeddedObjectRef::IsChart() const return sal_False; } +// #i104867# +sal_uInt32 EmbeddedObjectRef::getGraphicVersion() const +{ + return mpImp->mnGraphicVersion; +} + void EmbeddedObjectRef::SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM ) { //#i103460# charts do not necessaryly have an own size within ODF files, @@ -928,4 +952,5 @@ void EmbeddedObjectRef::SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM ) xSizeTransmitter->setDefaultSize( mpImp->aDefaultSizeForChart_In_100TH_MM ); } -} +} // namespace svt + diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index e0905fe1d377..f389abd19a82 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -966,13 +966,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 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/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 21ac05a498fc..1f44b823ce44 100755 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -95,11 +95,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}, @@ -107,7 +108,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/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index 1b80bf578530..bf56b2a1082b 100644 --- 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; } |