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