From 19568c0682aaaeff3469902fb0ea03aba6b01092 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Tue, 27 Oct 2009 15:20:25 +0000 Subject: CWS-TOOLING: integrate CWS ooo32gsl01 2009-10-13 15:59:25 +0200 hdu r276868 : #i100000# fix remaining merge conflict 2009-10-12 16:08:38 +0200 hdu r276837 : CWS-TOOLING: rebase CWS ooo32gsl01 to branches/OOO320@276773 (milestone: OOO320:m1) 2009-09-15 10:09:52 +0200 hdu r276150 : #i104861# adjust metrics to pseudo-emUnits==1000 expectation for better precision allow non-integer charwidth/stemwidth 2009-09-15 09:58:00 +0200 hdu r276149 : #i104861# prepare to fix by updating cff.cxx to latest version from CWS vcl105 2009-09-14 16:06:46 +0200 hdu r276130 : #i104221# treat judeo-spanish varika as diacritic also in problematic fonts (thanks yoramg) 2009-09-14 15:27:14 +0200 hdu r276126 : #i104221# fix regression with he/ar diacritics 2009-09-10 15:39:58 +0200 aw r276038 : #i104867# added a GraphicVersion number to EmbeddedObjectRef to allow Grahic chamge checks without fetching the graphic 2009-09-10 15:38:41 +0200 aw r276037 : #i104867# added GraphicVersionNumber to SdrOleContentPrimitive to detect OLE content change without getting the Graphic 2009-09-09 17:16:43 +0200 hdu r276006 : #i104886# Aqua: fix for 101491 only applies to non-hairlines 2009-09-09 16:39:05 +0200 hdu r276002 : #i99849# don't give up on ScriptItemize too early --- shell/source/aqua/sysshell/makefile.mk | 61 ++++++++++ shell/source/aqua/sysshell/systemshell.cxx | 133 +++++++++++++++++++++ .../sdr/primitive2d/sdrolecontentprimitive2d.hxx | 7 ++ svx/source/sdr/contact/viewcontactofsdrole2obj.cxx | 5 + .../sdr/primitive2d/sdrolecontentprimitive2d.cxx | 7 ++ 5 files changed, 213 insertions(+) create mode 100644 shell/source/aqua/sysshell/makefile.mk create mode 100644 shell/source/aqua/sysshell/systemshell.cxx diff --git a/shell/source/aqua/sysshell/makefile.mk b/shell/source/aqua/sysshell/makefile.mk new file mode 100644 index 0000000000..b3cf3abdec --- /dev/null +++ b/shell/source/aqua/sysshell/makefile.mk @@ -0,0 +1,61 @@ +#************************************************************************* +# +# 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: makefile.mk,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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=shell +TARGET=sysshell +LIBTARGET=NO +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +CFLAGSCXX+=$(OBJCXXFLAGS) + +# --- Files -------------------------------------------------------- + +.IF "$(OS)" == "MACOSX" + +LIB1OBJFILES=$(SLO)$/systemshell.obj +LIB1TARGET=$(SLB)$/$(TARGET).lib +LIB1ARCHIV=$(SLB)$/lib$(TARGET).a + +.ELSE + +dummy: + @echo "Nothing to build for $(OS)" + +.ENDIF # MACOSX +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/shell/source/aqua/sysshell/systemshell.cxx b/shell/source/aqua/sysshell/systemshell.cxx new file mode 100644 index 0000000000..11d02aa921 --- /dev/null +++ b/shell/source/aqua/sysshell/systemshell.cxx @@ -0,0 +1,133 @@ +/************************************************************************* + * + * 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: systemshell.cxx,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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_shell.hxx" +#include "systemshell.hxx" + +#include + +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_Hpp_ +#include +#endif +#include +#include +#include +#include + +#include +#include +#include + +using namespace ::com::sun::star; + +// We need to re-encode file urls because osl_getFileURLFromSystemPath converts +// to UTF-8 before encoding non ascii characters, which is not what other apps expect. +static rtl::OUString translateToExternalUrl(const rtl::OUString& internalUrl) +{ + rtl::OUString extUrl; + + uno::Reference< lang::XMultiServiceFactory > sm = comphelper::getProcessServiceFactory(); + if (sm.is()) + { + uno::Reference< beans::XPropertySet > pset; + sm->queryInterface( getCppuType( &pset )) >>= pset; + if (pset.is()) + { + uno::Reference< uno::XComponentContext > context; + static const rtl::OUString DEFAULT_CONTEXT( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ); + pset->getPropertyValue(DEFAULT_CONTEXT) >>= context; + if (context.is()) + extUrl = uri::ExternalUriReferenceTranslator::create(context)->translateToExternal(internalUrl); + } + } + return extUrl; +} + +// #i104525# many versions of OSX have problems with some URLs: +// when an app requests OSX to add one of these URLs to the "Recent Items" list +// then this app gets killed (TextEdit, Preview, etc. and also OOo) +static bool isDangerousUrl( const rtl::OUString& rUrl) +{ + // use a heuristic that detects all known cases since there is no official comment + // on the exact impact and root cause of the OSX bug + const int nLen = rUrl.getLength(); + const sal_Unicode* p = rUrl.getStr(); + for( int i = 0; i < nLen-3; ++i, ++p) { + if( p[0] != '%') + continue; + // escaped percent? + if( (p[1] == '2') && (p[2] == '5')) + return true; + // escapes are considered to be UTF-8 encoded + // => check for invalid UTF-8 leading byte + if( (p[1] != 'f') && (p[1] != 'F')) + continue; + int cLowNibble = p[2]; + if( (cLowNibble >= '0') && (cLowNibble <= '9')) + return false; + if( cLowNibble >= 'a') + cLowNibble -= 'a' - 'A'; + if( (cLowNibble < 'A') || (cLowNibble >= 'C')) + return true; + } + + return false; +} + +namespace SystemShell { + + //############################## + void AddToRecentDocumentList(const rtl::OUString& aFileUrl, const rtl::OUString& /*aMimeType*/) + { + // Convert file URL for external use (see above) + rtl::OUString externalUrl = translateToExternalUrl(aFileUrl); + if( 0 == externalUrl.getLength() ) + externalUrl = aFileUrl; + + if( externalUrl.getLength() + && !isDangerousUrl( externalUrl)) + { + NSString* pString = [[NSString alloc] initWithCharacters: externalUrl.getStr() length: externalUrl.getLength()]; + NSURL* pURL = [NSURL URLWithString: pString]; + + if( pURL ) + { + NSDocumentController* pCtrl = [NSDocumentController sharedDocumentController]; + [pCtrl noteNewRecentDocumentURL: pURL]; + } + if( pString ) + [pString release]; + + } + } + +} // namespace SystemShell + diff --git a/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx index f54028d134..e29bfb674d 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx @@ -53,6 +53,11 @@ namespace drawinglayer SdrObjectWeakRef mpSdrOle2Obj; basegfx::B2DHomMatrix maObjectTransform; + // #i104867# The GraphicVersion number to identify in operator== if + // the graphic has changed, but without fetching it (which may + // be expensive, e.g. triggering chart creation) + sal_uInt32 mnGraphicVersion; + // bitfield unsigned mbHighContrast : 1; @@ -64,6 +69,7 @@ namespace drawinglayer SdrOleContentPrimitive2D( const SdrOle2Obj& rSdrOle2Obj, const basegfx::B2DHomMatrix& rObjectTransform, + sal_uInt32 nGraphicVersion, bool bHighContrast); // compare operator @@ -74,6 +80,7 @@ namespace drawinglayer // data access const basegfx::B2DHomMatrix& getObjectTransform() const { return maObjectTransform; } + sal_uInt32 getGraphicVersion() const { return mnGraphicVersion; } bool getHighContrast() const { return mbHighContrast; } // provide unique ID diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx index 454b68cbfb..3facc1c031 100644 --- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx @@ -113,6 +113,11 @@ namespace sdr new drawinglayer::primitive2d::SdrOleContentPrimitive2D( GetOle2Obj(), aObjectMatrix, + + // #i104867# add GraphicVersion number to be able to check for + // content change in the primitive later + GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion(), + bHighContrast)); // create primitive. Use Ole2 primitive here. Prepare attribute settings, will be used soon anyways. diff --git a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx index 9c5616ebff..164e122e67 100644 --- a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx @@ -157,10 +157,12 @@ namespace drawinglayer SdrOleContentPrimitive2D::SdrOleContentPrimitive2D( const SdrOle2Obj& rSdrOle2Obj, const basegfx::B2DHomMatrix& rObjectTransform, + sal_uInt32 nGraphicVersion, bool bHighContrast) : BasePrimitive2D(), mpSdrOle2Obj(const_cast< SdrOle2Obj* >(&rSdrOle2Obj)), maObjectTransform(rObjectTransform), + mnGraphicVersion(nGraphicVersion), mbHighContrast(bHighContrast) { } @@ -176,6 +178,11 @@ namespace drawinglayer return ((bBothNot || bBothAndEqual) && getObjectTransform() == rCompare.getObjectTransform() + + // #i104867# to find out if the Graphic content of the + // OLE has changed, use GraphicVersion number + && getGraphicVersion() == rCompare.getGraphicVersion() + && getHighContrast() == rCompare.getHighContrast()); } -- cgit v1.2.3