typedetection.cxx (2e3a1b6e) typedetection.cxx (01ad09a0)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 264 unchanged lines hidden (view full) ---

273 {
274 sRealType = ::rtl::OUString::createFromAscii("writer_Text");
275 }
276 #endif // WORKAROUND_CSV_TXT_BUG_i60158
277
278 // SAFE ->
279 ::osl::ResettableMutexGuard aLock(m_aLock);
280
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 264 unchanged lines hidden (view full) ---

273 {
274 sRealType = ::rtl::OUString::createFromAscii("writer_Text");
275 }
276 #endif // WORKAROUND_CSV_TXT_BUG_i60158
277
278 // SAFE ->
279 ::osl::ResettableMutexGuard aLock(m_aLock);
280
281 // Attention: For executing next lines of code, We must be shure that
281 // Attention: For executing next lines of code, We must be sure that
282 // all filters already loaded :-(
283 // That can disturb our "load on demand feature". But we have no other chance!
284 m_rCache->load(FilterCache::E_CONTAINS_FILTERS);
285
286 CacheItem lIProps;
287 lIProps[PROPNAME_DOCUMENTSERVICE] <<= sDocumentService;
288 lIProps[PROPNAME_TYPE ] <<= sRealType;
289 OUStringList lFilters = m_rCache->getMatchingItemsByProps(FilterCache::E_FILTER, lIProps);

--- 64 unchanged lines hidden (view full) ---

354 // d)
355 // Search for any import(!) filter, which is registered for this type.
356 sFilter = ::rtl::OUString();
357 try
358 {
359 // SAFE ->
360 ::osl::ResettableMutexGuard aLock(m_aLock);
361
282 // all filters already loaded :-(
283 // That can disturb our "load on demand feature". But we have no other chance!
284 m_rCache->load(FilterCache::E_CONTAINS_FILTERS);
285
286 CacheItem lIProps;
287 lIProps[PROPNAME_DOCUMENTSERVICE] <<= sDocumentService;
288 lIProps[PROPNAME_TYPE ] <<= sRealType;
289 OUStringList lFilters = m_rCache->getMatchingItemsByProps(FilterCache::E_FILTER, lIProps);

--- 64 unchanged lines hidden (view full) ---

354 // d)
355 // Search for any import(!) filter, which is registered for this type.
356 sFilter = ::rtl::OUString();
357 try
358 {
359 // SAFE ->
360 ::osl::ResettableMutexGuard aLock(m_aLock);
361
362 // Attention: For executing next lines of code, We must be shure that
362 // Attention: For executing next lines of code, We must be sure that
363 // all filters already loaded :-(
364 // That can disturb our "load on demand feature". But we have no other chance!
365 m_rCache->load(FilterCache::E_CONTAINS_FILTERS);
366
367 CacheItem lIProps;
368 lIProps[PROPNAME_TYPE] <<= sType;
369 OUStringList lFilters = m_rCache->getMatchingItemsByProps(FilterCache::E_FILTER, lIProps);
370

--- 240 unchanged lines hidden (view full) ---

611{
612 // get all filters, which match to this doc service
613 OUStringList lFilters;
614 try
615 {
616 // SAFE -> --------------------------
617 ::osl::ResettableMutexGuard aLock(m_aLock);
618
363 // all filters already loaded :-(
364 // That can disturb our "load on demand feature". But we have no other chance!
365 m_rCache->load(FilterCache::E_CONTAINS_FILTERS);
366
367 CacheItem lIProps;
368 lIProps[PROPNAME_TYPE] <<= sType;
369 OUStringList lFilters = m_rCache->getMatchingItemsByProps(FilterCache::E_FILTER, lIProps);
370

--- 240 unchanged lines hidden (view full) ---

611{
612 // get all filters, which match to this doc service
613 OUStringList lFilters;
614 try
615 {
616 // SAFE -> --------------------------
617 ::osl::ResettableMutexGuard aLock(m_aLock);
618
619 // Attention: For executing next lines of code, We must be shure that
619 // Attention: For executing next lines of code, We must be sure that
620 // all filters already loaded :-(
621 // That can disturb our "load on demand feature". But we have no other chance!
622 m_rCache->load(FilterCache::E_CONTAINS_FILTERS);
623
624 CacheItem lIProps;
625 lIProps[PROPNAME_DOCUMENTSERVICE] <<= sPreSelDocumentService;
626 lFilters = m_rCache->getMatchingItemsByProps(FilterCache::E_FILTER, lIProps);
627

--- 54 unchanged lines hidden (view full) ---

682
683/*-----------------------------------------------
684 14.11.2003 12:21
685-----------------------------------------------*/
686void TypeDetection::impl_getPreselection(const css::util::URL& aParsedURL ,
687 ::comphelper::MediaDescriptor& rDescriptor,
688 FlatDetection& rFlatTypes )
689{
620 // all filters already loaded :-(
621 // That can disturb our "load on demand feature". But we have no other chance!
622 m_rCache->load(FilterCache::E_CONTAINS_FILTERS);
623
624 CacheItem lIProps;
625 lIProps[PROPNAME_DOCUMENTSERVICE] <<= sPreSelDocumentService;
626 lFilters = m_rCache->getMatchingItemsByProps(FilterCache::E_FILTER, lIProps);
627

--- 54 unchanged lines hidden (view full) ---

682
683/*-----------------------------------------------
684 14.11.2003 12:21
685-----------------------------------------------*/
686void TypeDetection::impl_getPreselection(const css::util::URL& aParsedURL ,
687 ::comphelper::MediaDescriptor& rDescriptor,
688 FlatDetection& rFlatTypes )
689{
690 // done to be shure, that only valid results leave this function!
690 // done to be sure, that only valid results leave this function!
691 rFlatTypes.clear();
692
693 /* #i55122#
694 Sometimes we must detect files without or with real unknown extensions.
695 If it does not work /which can happen of course .-)/, the user tried to preselect
696 the right format. But some special dialogs (e.g. "Insert->Sheet From File")
697 add it's own preselection too.
698 So we have a combination of preselected values ...

--- 382 unchanged lines hidden (view full) ---

1081 ::rtl::OUString());
1082
1083 css::uno::Reference< css::io::XInputStream > xStream =
1084 rDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_INPUTSTREAM(),
1085 css::uno::Reference< css::io::XInputStream >());
1086
1087 // Dont distrub the user for "non existing files - means empty URLs" or
1088 // if we was forced to detect a stream.
691 rFlatTypes.clear();
692
693 /* #i55122#
694 Sometimes we must detect files without or with real unknown extensions.
695 If it does not work /which can happen of course .-)/, the user tried to preselect
696 the right format. But some special dialogs (e.g. "Insert->Sheet From File")
697 add it's own preselection too.
698 So we have a combination of preselected values ...

--- 382 unchanged lines hidden (view full) ---

1081 ::rtl::OUString());
1082
1083 css::uno::Reference< css::io::XInputStream > xStream =
1084 rDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_INPUTSTREAM(),
1085 css::uno::Reference< css::io::XInputStream >());
1086
1087 // Dont distrub the user for "non existing files - means empty URLs" or
1088 // if we was forced to detect a stream.
1089 // Reason behind: We must be shure to ask user for "unknown contents" only ...
1089 // Reason behind: We must be sure to ask user for "unknown contents" only ...
1090 // and not for "missing files". Especially if detection is done by a stream only
1091 // we can't check if the stream points to an "existing content"!
1092 if (
1093 (!sURL.getLength() ) || // "non existing file" ?
1094 (!xStream.is() ) || // non existing file !
1095 (sURL.equalsIgnoreAsciiCaseAsciiL("private:stream", 14)) // not a good idea .-)
1096 )
1097 return ::rtl::OUString();

--- 6 unchanged lines hidden (view full) ---

1104
1105 // "Cancel" pressed? => return with error
1106 if (aRequest.isAbort())
1107 return ::rtl::OUString();
1108
1109 // "OK" pressed => verify the selected filter, get it's coressponding
1110 // type and return it. (BTW: We must update the media descriptor here ...)
1111 // The user selected explicitly a filter ... but normally we are interested on
1090 // and not for "missing files". Especially if detection is done by a stream only
1091 // we can't check if the stream points to an "existing content"!
1092 if (
1093 (!sURL.getLength() ) || // "non existing file" ?
1094 (!xStream.is() ) || // non existing file !
1095 (sURL.equalsIgnoreAsciiCaseAsciiL("private:stream", 14)) // not a good idea .-)
1096 )
1097 return ::rtl::OUString();

--- 6 unchanged lines hidden (view full) ---

1104
1105 // "Cancel" pressed? => return with error
1106 if (aRequest.isAbort())
1107 return ::rtl::OUString();
1108
1109 // "OK" pressed => verify the selected filter, get it's coressponding
1110 // type and return it. (BTW: We must update the media descriptor here ...)
1111 // The user selected explicitly a filter ... but normally we are interested on
1112 // a type here only. But we must be shure, that the selected filter is used
1112 // a type here only. But we must be sure, that the selected filter is used
1113 // too and no ambigous filter registration disturb us .-)
1114
1115 ::rtl::OUString sFilter = aRequest.getFilter();
1116 if (!impl_validateAndSetFilterOnDescriptor(rDescriptor, sFilter))
1117 return ::rtl::OUString();
1118
1119 ::rtl::OUString sType;
1120 rDescriptor[::comphelper::MediaDescriptor::PROP_TYPENAME()] >>= sType;

--- 132 unchanged lines hidden ---
1113 // too and no ambigous filter registration disturb us .-)
1114
1115 ::rtl::OUString sFilter = aRequest.getFilter();
1116 if (!impl_validateAndSetFilterOnDescriptor(rDescriptor, sFilter))
1117 return ::rtl::OUString();
1118
1119 ::rtl::OUString sType;
1120 rDescriptor[::comphelper::MediaDescriptor::PROP_TYPENAME()] >>= sType;

--- 132 unchanged lines hidden ---