1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_svtools.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #define _INSDLG_CXX 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir // include --------------------------------------------------------------- 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #include <svtools/insdlg.hxx> 36*cdf0e10cSrcweir #include <svtools/sores.hxx> 37*cdf0e10cSrcweir #include <svtools/svtdata.hxx> 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir #include <tools/rc.hxx> 40*cdf0e10cSrcweir #include <unotools/configmgr.hxx> 41*cdf0e10cSrcweir #include <sot/clsids.hxx> 42*cdf0e10cSrcweir #include <sot/stg.hxx> 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 45*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 46*cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 47*cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp> 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir using namespace ::com::sun::star; 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir //--------------------------------------------- 52*cdf0e10cSrcweir // this struct conforms to the Microsoft 53*cdf0e10cSrcweir // OBJECTDESCRIPTOR -> see oleidl.h 54*cdf0e10cSrcweir // (MS platform sdk) 55*cdf0e10cSrcweir //--------------------------------------------- 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir struct OleObjectDescriptor 58*cdf0e10cSrcweir { 59*cdf0e10cSrcweir sal_uInt32 cbSize; 60*cdf0e10cSrcweir ClsId clsid; 61*cdf0e10cSrcweir sal_uInt32 dwDrawAspect; 62*cdf0e10cSrcweir Size sizel; 63*cdf0e10cSrcweir Point pointl; 64*cdf0e10cSrcweir sal_uInt32 dwStatus; 65*cdf0e10cSrcweir sal_uInt32 dwFullUserTypeName; 66*cdf0e10cSrcweir sal_uInt32 dwSrcOfCopy; 67*cdf0e10cSrcweir }; 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir /********************** SvObjectServerList ******************************** 70*cdf0e10cSrcweir **************************************************************************/ 71*cdf0e10cSrcweir PRV_SV_IMPL_OWNER_LIST( SvObjectServerList, SvObjectServer ) 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir /************************************************************************* 74*cdf0e10cSrcweir |* SvObjectServerList::SvObjectServerList() 75*cdf0e10cSrcweir |* 76*cdf0e10cSrcweir |* Beschreibung 77*cdf0e10cSrcweir *************************************************************************/ 78*cdf0e10cSrcweir const SvObjectServer * SvObjectServerList::Get( const String & rHumanName ) const 79*cdf0e10cSrcweir { 80*cdf0e10cSrcweir for( sal_uLong i = 0; i < Count(); i++ ) 81*cdf0e10cSrcweir { 82*cdf0e10cSrcweir if( rHumanName == GetObject( i ).GetHumanName() ) 83*cdf0e10cSrcweir return &GetObject( i ); 84*cdf0e10cSrcweir } 85*cdf0e10cSrcweir return NULL; 86*cdf0e10cSrcweir } 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir /************************************************************************* 89*cdf0e10cSrcweir |* SvObjectServerList::SvObjectServerList() 90*cdf0e10cSrcweir |* 91*cdf0e10cSrcweir |* Beschreibung 92*cdf0e10cSrcweir *************************************************************************/ 93*cdf0e10cSrcweir const SvObjectServer * SvObjectServerList::Get( const SvGlobalName & rName ) const 94*cdf0e10cSrcweir { 95*cdf0e10cSrcweir for( sal_uLong i = 0; i < Count(); i++ ) 96*cdf0e10cSrcweir { 97*cdf0e10cSrcweir if( rName == GetObject( i ).GetClassName() ) 98*cdf0e10cSrcweir return &GetObject( i ); 99*cdf0e10cSrcweir } 100*cdf0e10cSrcweir return NULL; 101*cdf0e10cSrcweir } 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir void SvObjectServerList::Remove( const SvGlobalName & rName ) 104*cdf0e10cSrcweir { 105*cdf0e10cSrcweir SvObjectServer * pS = (SvObjectServer *)aTypes.First(); 106*cdf0e10cSrcweir while( pS ) 107*cdf0e10cSrcweir { 108*cdf0e10cSrcweir if( rName == pS->GetClassName() ) 109*cdf0e10cSrcweir { 110*cdf0e10cSrcweir Remove(); 111*cdf0e10cSrcweir pS = (SvObjectServer *)aTypes.GetCurObject(); 112*cdf0e10cSrcweir } 113*cdf0e10cSrcweir else 114*cdf0e10cSrcweir pS = (SvObjectServer *)aTypes.Next(); 115*cdf0e10cSrcweir } 116*cdf0e10cSrcweir } 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir //--------------------------------------------------------------------- 119*cdf0e10cSrcweir void SvObjectServerList::FillInsertObjects() 120*cdf0e10cSrcweir /* [Beschreibung] 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir Die Liste wird mit allen Typen gef"ullt, die im Insert-Dialog 123*cdf0e10cSrcweir ausgew"ahlt werden k"onnen. 124*cdf0e10cSrcweir */ 125*cdf0e10cSrcweir { 126*cdf0e10cSrcweir try{ 127*cdf0e10cSrcweir uno::Reference< lang::XMultiServiceFactory > _globalMSFactory= comphelper::getProcessServiceFactory(); 128*cdf0e10cSrcweir if( _globalMSFactory.is()) 129*cdf0e10cSrcweir { 130*cdf0e10cSrcweir ::rtl::OUString sProviderService = 131*cdf0e10cSrcweir ::rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" ); 132*cdf0e10cSrcweir uno::Reference< lang::XMultiServiceFactory > sProviderMSFactory( 133*cdf0e10cSrcweir _globalMSFactory->createInstance( sProviderService ), uno::UNO_QUERY ); 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir if( sProviderMSFactory.is()) 136*cdf0e10cSrcweir { 137*cdf0e10cSrcweir ::rtl::OUString sReaderService = 138*cdf0e10cSrcweir ::rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationAccess" ); 139*cdf0e10cSrcweir uno::Sequence< uno::Any > aArguments( 1 ); 140*cdf0e10cSrcweir beans::PropertyValue aPathProp; 141*cdf0e10cSrcweir aPathProp.Name = ::rtl::OUString::createFromAscii( "nodepath" ); 142*cdf0e10cSrcweir aPathProp.Value <<= ::rtl::OUString::createFromAscii( "/org.openoffice.Office.Embedding/ObjectNames"); 143*cdf0e10cSrcweir aArguments[0] <<= aPathProp; 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir uno::Reference< container::XNameAccess > xNameAccess( 146*cdf0e10cSrcweir sProviderMSFactory->createInstanceWithArguments( sReaderService,aArguments ), 147*cdf0e10cSrcweir uno::UNO_QUERY ); 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir if( xNameAccess.is()) 150*cdf0e10cSrcweir { 151*cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > seqNames= xNameAccess->getElementNames(); 152*cdf0e10cSrcweir sal_Int32 nInd; 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir ::rtl::OUString aStringProductName( RTL_CONSTASCII_USTRINGPARAM( "%PRODUCTNAME" ) ); 155*cdf0e10cSrcweir sal_Int32 nStringProductNameLength = aStringProductName.getLength(); 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir ::rtl::OUString aStringProductVersion( RTL_CONSTASCII_USTRINGPARAM( "%PRODUCTVERSION" ) ); 158*cdf0e10cSrcweir sal_Int32 nStringProductVersionLength = aStringProductVersion.getLength(); 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir // TODO/LATER: Do the request only once ( needs incompatible change ) 161*cdf0e10cSrcweir ::rtl::OUString aProductName; 162*cdf0e10cSrcweir ::rtl::OUString aProductVersion; 163*cdf0e10cSrcweir uno::Any aProperty = 164*cdf0e10cSrcweir ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME ); 165*cdf0e10cSrcweir if ( !( aProperty >>= aProductName ) ) 166*cdf0e10cSrcweir { 167*cdf0e10cSrcweir OSL_ENSURE( sal_False, "Coudn't get PRODUCTNAME variable!\n" ); 168*cdf0e10cSrcweir aProductName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StarOffice" ) ); 169*cdf0e10cSrcweir } 170*cdf0e10cSrcweir aProperty = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTVERSION ); 171*cdf0e10cSrcweir if ( !( aProperty >>= aProductVersion ) ) 172*cdf0e10cSrcweir { 173*cdf0e10cSrcweir OSL_ENSURE( sal_False, "Coudn't get PRODUCTVERSION variable!\n" ); 174*cdf0e10cSrcweir } 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir for( nInd = 0; nInd < seqNames.getLength(); nInd++ ) 177*cdf0e10cSrcweir { 178*cdf0e10cSrcweir uno::Reference< container::XNameAccess > xEntry ; 179*cdf0e10cSrcweir xNameAccess->getByName( seqNames[nInd] ) >>= xEntry; 180*cdf0e10cSrcweir if ( xEntry.is() ) 181*cdf0e10cSrcweir { 182*cdf0e10cSrcweir ::rtl::OUString aUIName; 183*cdf0e10cSrcweir ::rtl::OUString aClassID; 184*cdf0e10cSrcweir xEntry->getByName( ::rtl::OUString::createFromAscii("ObjectUIName") ) >>= aUIName; 185*cdf0e10cSrcweir xEntry->getByName( ::rtl::OUString::createFromAscii("ClassID") ) >>= aClassID; 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir if ( aUIName.getLength() ) 188*cdf0e10cSrcweir { 189*cdf0e10cSrcweir // replace %PRODUCTNAME 190*cdf0e10cSrcweir sal_Int32 nIndex = aUIName.indexOf( aStringProductName ); 191*cdf0e10cSrcweir while( nIndex != -1 ) 192*cdf0e10cSrcweir { 193*cdf0e10cSrcweir aUIName = aUIName.replaceAt( nIndex, nStringProductNameLength, aProductName ); 194*cdf0e10cSrcweir nIndex = aUIName.indexOf( aStringProductName ); 195*cdf0e10cSrcweir } 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir // replace %PRODUCTVERSION 198*cdf0e10cSrcweir nIndex = aUIName.indexOf( aStringProductVersion ); 199*cdf0e10cSrcweir while( nIndex != -1 ) 200*cdf0e10cSrcweir { 201*cdf0e10cSrcweir aUIName = aUIName.replaceAt( nIndex, nStringProductVersionLength, aProductVersion ); 202*cdf0e10cSrcweir nIndex = aUIName.indexOf( aStringProductVersion ); 203*cdf0e10cSrcweir } 204*cdf0e10cSrcweir } 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir SvGlobalName aClassName; 207*cdf0e10cSrcweir if( aClassName.MakeId( String( aClassID ))) 208*cdf0e10cSrcweir { 209*cdf0e10cSrcweir if( !Get( aClassName ) ) 210*cdf0e10cSrcweir // noch nicht eingetragen 211*cdf0e10cSrcweir Append( SvObjectServer( aClassName, String( aUIName.getStr() ) ) ); 212*cdf0e10cSrcweir } 213*cdf0e10cSrcweir } 214*cdf0e10cSrcweir } 215*cdf0e10cSrcweir } 216*cdf0e10cSrcweir } 217*cdf0e10cSrcweir } 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir #ifdef WNT 221*cdf0e10cSrcweir SvGlobalName aOleFact( SO3_OUT_CLASSID ); 222*cdf0e10cSrcweir String aOleObj( SvtResId( STR_FURTHER_OBJECT ) ); 223*cdf0e10cSrcweir Append( SvObjectServer( aOleFact, aOleObj ) ); 224*cdf0e10cSrcweir #endif 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir }catch( container::NoSuchElementException) 227*cdf0e10cSrcweir { 228*cdf0e10cSrcweir }catch( uno::Exception) 229*cdf0e10cSrcweir { 230*cdf0e10cSrcweir } 231*cdf0e10cSrcweir catch(...) 232*cdf0e10cSrcweir { 233*cdf0e10cSrcweir } 234*cdf0e10cSrcweir } 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir String SvPasteObjectHelper::GetSotFormatUIName( SotFormatStringId nId ) 237*cdf0e10cSrcweir { 238*cdf0e10cSrcweir struct SotResourcePair 239*cdf0e10cSrcweir { 240*cdf0e10cSrcweir SotFormatStringId mnSotId; 241*cdf0e10cSrcweir sal_uInt16 mnResId; 242*cdf0e10cSrcweir }; 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir static const SotResourcePair aSotResourcePairs[] = 245*cdf0e10cSrcweir { 246*cdf0e10cSrcweir { SOT_FORMAT_STRING, STR_FORMAT_STRING }, 247*cdf0e10cSrcweir { SOT_FORMAT_BITMAP, STR_FORMAT_BITMAP }, 248*cdf0e10cSrcweir { SOT_FORMAT_GDIMETAFILE, STR_FORMAT_GDIMETAFILE }, 249*cdf0e10cSrcweir { SOT_FORMAT_RTF, STR_FORMAT_RTF }, 250*cdf0e10cSrcweir { SOT_FORMATSTR_ID_DRAWING, STR_FORMAT_ID_DRAWING }, 251*cdf0e10cSrcweir { SOT_FORMATSTR_ID_SVXB, STR_FORMAT_ID_SVXB }, 252*cdf0e10cSrcweir { SOT_FORMATSTR_ID_INTERNALLINK_STATE, STR_FORMAT_ID_INTERNALLINK_STATE }, 253*cdf0e10cSrcweir { SOT_FORMATSTR_ID_SOLK, STR_FORMAT_ID_SOLK }, 254*cdf0e10cSrcweir { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, STR_FORMAT_ID_NETSCAPE_BOOKMARK }, 255*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARSERVER, STR_FORMAT_ID_STARSERVER }, 256*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STAROBJECT, STR_FORMAT_ID_STAROBJECT }, 257*cdf0e10cSrcweir { SOT_FORMATSTR_ID_APPLETOBJECT, STR_FORMAT_ID_APPLETOBJECT }, 258*cdf0e10cSrcweir { SOT_FORMATSTR_ID_PLUGIN_OBJECT, STR_FORMAT_ID_PLUGIN_OBJECT }, 259*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARWRITER_30, STR_FORMAT_ID_STARWRITER_30 }, 260*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARWRITER_40, STR_FORMAT_ID_STARWRITER_40 }, 261*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARWRITER_50, STR_FORMAT_ID_STARWRITER_50 }, 262*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARWRITERWEB_40, STR_FORMAT_ID_STARWRITERWEB_40 }, 263*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARWRITERWEB_50, STR_FORMAT_ID_STARWRITERWEB_50 }, 264*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARWRITERGLOB_40, STR_FORMAT_ID_STARWRITERGLOB_40 }, 265*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARWRITERGLOB_50, STR_FORMAT_ID_STARWRITERGLOB_50 }, 266*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARDRAW, STR_FORMAT_ID_STARDRAW }, 267*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARDRAW_40, STR_FORMAT_ID_STARDRAW_40 }, 268*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARIMPRESS_50, STR_FORMAT_ID_STARIMPRESS_50 }, 269*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARDRAW_50, STR_FORMAT_ID_STARDRAW_50 }, 270*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARCALC, STR_FORMAT_ID_STARCALC }, 271*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARCALC_40, STR_FORMAT_ID_STARCALC_40 }, 272*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARCALC_50, STR_FORMAT_ID_STARCALC_50 }, 273*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARCHART, STR_FORMAT_ID_STARCHART }, 274*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARCHART_40, STR_FORMAT_ID_STARCHART_40 }, 275*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARCHART_50, STR_FORMAT_ID_STARCHART_50 }, 276*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARIMAGE, STR_FORMAT_ID_STARIMAGE }, 277*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARIMAGE_40, STR_FORMAT_ID_STARIMAGE_40 }, 278*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARIMAGE_50, STR_FORMAT_ID_STARIMAGE_50 }, 279*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARMATH, STR_FORMAT_ID_STARMATH }, 280*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARMATH_40, STR_FORMAT_ID_STARMATH_40 }, 281*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARMATH_50, STR_FORMAT_ID_STARMATH_50 }, 282*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STAROBJECT_PAINTDOC, STR_FORMAT_ID_STAROBJECT_PAINTDOC }, 283*cdf0e10cSrcweir { SOT_FORMATSTR_ID_HTML, STR_FORMAT_ID_HTML }, 284*cdf0e10cSrcweir { SOT_FORMATSTR_ID_HTML_SIMPLE, STR_FORMAT_ID_HTML_SIMPLE }, 285*cdf0e10cSrcweir { SOT_FORMATSTR_ID_BIFF_5, STR_FORMAT_ID_BIFF_5 }, 286*cdf0e10cSrcweir { SOT_FORMATSTR_ID_BIFF_8, STR_FORMAT_ID_BIFF_8 }, 287*cdf0e10cSrcweir { SOT_FORMATSTR_ID_SYLK, STR_FORMAT_ID_SYLK }, 288*cdf0e10cSrcweir { SOT_FORMATSTR_ID_LINK, STR_FORMAT_ID_LINK }, 289*cdf0e10cSrcweir { SOT_FORMATSTR_ID_DIF, STR_FORMAT_ID_DIF }, 290*cdf0e10cSrcweir { SOT_FORMATSTR_ID_MSWORD_DOC, STR_FORMAT_ID_MSWORD_DOC }, 291*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STAR_FRAMESET_DOC, STR_FORMAT_ID_STAR_FRAMESET_DOC }, 292*cdf0e10cSrcweir { SOT_FORMATSTR_ID_OFFICE_DOC, STR_FORMAT_ID_OFFICE_DOC }, 293*cdf0e10cSrcweir { SOT_FORMATSTR_ID_NOTES_DOCINFO, STR_FORMAT_ID_NOTES_DOCINFO }, 294*cdf0e10cSrcweir { SOT_FORMATSTR_ID_SFX_DOC, STR_FORMAT_ID_SFX_DOC }, 295*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARCHARTDOCUMENT_50,STR_FORMAT_ID_STARCHARTDOCUMENT_50 }, 296*cdf0e10cSrcweir { SOT_FORMATSTR_ID_GRAPHOBJ, STR_FORMAT_ID_GRAPHOBJ }, 297*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARWRITER_60, STR_FORMAT_ID_STARWRITER_60 }, 298*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARWRITERWEB_60, STR_FORMAT_ID_STARWRITERWEB_60 }, 299*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARWRITERGLOB_60, STR_FORMAT_ID_STARWRITERGLOB_60 }, 300*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARDRAW_60, STR_FORMAT_ID_STARDRAW_60 }, 301*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARIMPRESS_60, STR_FORMAT_ID_STARIMPRESS_60 }, 302*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARCALC_60, STR_FORMAT_ID_STARCALC_60 }, 303*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARCHART_60, STR_FORMAT_ID_STARCHART_60 }, 304*cdf0e10cSrcweir { SOT_FORMATSTR_ID_STARMATH_60, STR_FORMAT_ID_STARMATH_60 }, 305*cdf0e10cSrcweir { SOT_FORMATSTR_ID_WMF, STR_FORMAT_ID_WMF }, 306*cdf0e10cSrcweir { SOT_FORMATSTR_ID_DBACCESS_QUERY, STR_FORMAT_ID_DBACCESS_QUERY }, 307*cdf0e10cSrcweir { SOT_FORMATSTR_ID_DBACCESS_TABLE, STR_FORMAT_ID_DBACCESS_TABLE }, 308*cdf0e10cSrcweir { SOT_FORMATSTR_ID_DBACCESS_COMMAND, STR_FORMAT_ID_DBACCESS_COMMAND }, 309*cdf0e10cSrcweir { SOT_FORMATSTR_ID_DIALOG_60, STR_FORMAT_ID_DIALOG_60 }, 310*cdf0e10cSrcweir { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, STR_FORMAT_ID_FILEGRPDESCRIPTOR }, 311*cdf0e10cSrcweir { SOT_FORMATSTR_ID_HTML_NO_COMMENT, STR_FORMAT_ID_HTML_NO_COMMENT } 312*cdf0e10cSrcweir }; 313*cdf0e10cSrcweir 314*cdf0e10cSrcweir String aUIName; 315*cdf0e10cSrcweir sal_uInt16 nResId = 0; 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir for( sal_uInt32 i = 0, nCount = sizeof( aSotResourcePairs ) / sizeof( aSotResourcePairs[ 0 ] ); ( i < nCount ) && !nResId; i++ ) 318*cdf0e10cSrcweir { 319*cdf0e10cSrcweir if( aSotResourcePairs[ i ].mnSotId == nId ) 320*cdf0e10cSrcweir nResId = aSotResourcePairs[ i ].mnResId; 321*cdf0e10cSrcweir } 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir if( nResId ) 324*cdf0e10cSrcweir aUIName = String( SvtResId( nResId ) ); 325*cdf0e10cSrcweir else 326*cdf0e10cSrcweir aUIName = SotExchange::GetFormatName( nId ); 327*cdf0e10cSrcweir 328*cdf0e10cSrcweir return aUIName; 329*cdf0e10cSrcweir } 330*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 331*cdf0e10cSrcweir sal_Bool SvPasteObjectHelper::GetEmbeddedName(const TransferableDataHelper& rData,String& _rName,String& _rSource,SotFormatStringId& _nFormat) 332*cdf0e10cSrcweir { 333*cdf0e10cSrcweir sal_Bool bRet = sal_False; 334*cdf0e10cSrcweir if( _nFormat == SOT_FORMATSTR_ID_EMBED_SOURCE_OLE || _nFormat == SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE ) 335*cdf0e10cSrcweir { 336*cdf0e10cSrcweir datatransfer::DataFlavor aFlavor; 337*cdf0e10cSrcweir SotExchange::GetFormatDataFlavor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR_OLE, aFlavor ); 338*cdf0e10cSrcweir 339*cdf0e10cSrcweir uno::Any aAny; 340*cdf0e10cSrcweir if( rData.HasFormat( aFlavor ) && 341*cdf0e10cSrcweir ( aAny = rData.GetAny( aFlavor ) ).hasValue() ) 342*cdf0e10cSrcweir { 343*cdf0e10cSrcweir uno::Sequence< sal_Int8 > anySequence; 344*cdf0e10cSrcweir aAny >>= anySequence; 345*cdf0e10cSrcweir 346*cdf0e10cSrcweir OleObjectDescriptor* pOleObjDescr = 347*cdf0e10cSrcweir reinterpret_cast< OleObjectDescriptor* >( anySequence.getArray( ) ); 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir // determine the user friendly description of the embedded object 350*cdf0e10cSrcweir if ( pOleObjDescr->dwFullUserTypeName ) 351*cdf0e10cSrcweir { 352*cdf0e10cSrcweir // we set the pointer to the start of user friendly description 353*cdf0e10cSrcweir // string. it starts at &OleObjectDescriptor + dwFullUserTypeName. 354*cdf0e10cSrcweir // dwFullUserTypeName is the offset in bytes. 355*cdf0e10cSrcweir // the user friendly description string is '\0' terminated. 356*cdf0e10cSrcweir const sal_Unicode* pUserTypeName = 357*cdf0e10cSrcweir reinterpret_cast< sal_Unicode* >( 358*cdf0e10cSrcweir reinterpret_cast< sal_Char* >( pOleObjDescr ) + 359*cdf0e10cSrcweir pOleObjDescr->dwFullUserTypeName ); 360*cdf0e10cSrcweir 361*cdf0e10cSrcweir _rName.Append( pUserTypeName ); 362*cdf0e10cSrcweir // the following statement was here for historical reasons, it is commented out since it causes bug i49460 363*cdf0e10cSrcweir // _nFormat = SOT_FORMATSTR_ID_EMBED_SOURCE_OLE; 364*cdf0e10cSrcweir } 365*cdf0e10cSrcweir 366*cdf0e10cSrcweir // determine the source of the embedded object 367*cdf0e10cSrcweir if ( pOleObjDescr->dwSrcOfCopy ) 368*cdf0e10cSrcweir { 369*cdf0e10cSrcweir // we set the pointer to the start of source string 370*cdf0e10cSrcweir // it starts at &OleObjectDescriptor + dwSrcOfCopy. 371*cdf0e10cSrcweir // dwSrcOfCopy is the offset in bytes. 372*cdf0e10cSrcweir // the source string is '\0' terminated. 373*cdf0e10cSrcweir const sal_Unicode* pSrcOfCopy = 374*cdf0e10cSrcweir reinterpret_cast< sal_Unicode* >( 375*cdf0e10cSrcweir reinterpret_cast< sal_Char* >( pOleObjDescr ) + 376*cdf0e10cSrcweir pOleObjDescr->dwSrcOfCopy ); 377*cdf0e10cSrcweir 378*cdf0e10cSrcweir _rSource.Append( pSrcOfCopy ); 379*cdf0e10cSrcweir } 380*cdf0e10cSrcweir else 381*cdf0e10cSrcweir _rSource = 382*cdf0e10cSrcweir String( SvtResId( STR_UNKNOWN_SOURCE ) ); 383*cdf0e10cSrcweir } 384*cdf0e10cSrcweir bRet = sal_True; 385*cdf0e10cSrcweir } 386*cdf0e10cSrcweir return bRet; 387*cdf0e10cSrcweir } 388*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 389*cdf0e10cSrcweir 390