summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-05-22 12:55:22 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-05-22 14:32:52 -0400
commit552bebe6fa27fa58d07d87283a4b24e6052ab3d4 (patch)
treeef711876e2d057be53e247491f2575782d15b324
parente5ace9ef5a0035e0fa1970903c056015aea81025 (diff)
When the caller specifies filter type, stick to it and don't overwrite it.
Change-Id: I35a3efc506bbcc33ea4c3d2466929f8227dae102
-rw-r--r--filter/source/config/cache/typedetection.cxx19
1 files changed, 12 insertions, 7 deletions
diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx
index 5b57dc90414b..47a06e197d95 100644
--- a/filter/source/config/cache/typedetection.cxx
+++ b/filter/source/config/cache/typedetection.cxx
@@ -140,15 +140,24 @@ TypeDetection::~TypeDetection()
css::util::URL aURL;
aURL.Complete = sURL;
css::uno::Reference< css::util::XURLTransformer > xParser(m_xSMGR->createInstance(SERVICE_URLTRANSFORMER), css::uno::UNO_QUERY);
xParser->parseStrict(aURL);
- //*******************************************
- // preselected filter, type or document service?
- // use it as first "flat" detected type later!
+ rtl::OUString aSelectedFilter = stlDescriptor.getUnpackedValueOrDefault(
+ comphelper::MediaDescriptor::PROP_FILTERNAME(), rtl::OUString());
+ if (!aSelectedFilter.isEmpty())
+ {
+ // Caller specified the filter type. Honor it. Just get the default
+ // type for that filter, and bail out.
+ if (impl_validateAndSetFilterOnDescriptor(stlDescriptor, aSelectedFilter))
+ return stlDescriptor[comphelper::MediaDescriptor::PROP_TYPENAME()].get<rtl::OUString>();
+ }
+
+ // preselected type or document service? use it as first "flat" detected
+ // type later!
FlatDetection lFlatTypes;
impl_getPreselection(aURL, stlDescriptor, lFlatTypes);
//*******************************************
// get all types, which match to the given descriptor
// That can be true by: extensions/url pattern/mime type etcpp.
@@ -679,16 +688,12 @@ void TypeDetection::impl_getPreselection(const css::util::URL& aP
*/
::rtl::OUString sSelectedType = rDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_TYPENAME(), ::rtl::OUString());
if (!sSelectedType.isEmpty())
impl_getPreselectionForType(sSelectedType, aParsedURL, rFlatTypes);
- ::rtl::OUString sSelectedFilter = rDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_FILTERNAME(), ::rtl::OUString());
- if (!sSelectedFilter.isEmpty())
- impl_getPreselectionForFilter(sSelectedFilter, aParsedURL, rFlatTypes);
-
::rtl::OUString sSelectedDoc = rDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_DOCUMENTSERVICE(), ::rtl::OUString());
if (!sSelectedDoc.isEmpty())
impl_getPreselectionForDocumentService(sSelectedDoc, aParsedURL, rFlatTypes);
}