Lines 204-210
Link Here
|
204 |
sal_Int32 nFlags = 0; |
204 |
sal_Int32 nFlags = 0; |
205 |
try |
205 |
try |
206 |
{ |
206 |
{ |
207 |
if ( aFilterName.getLength() ) |
207 |
if ( !aFilterName.isEmpty() ) |
208 |
{ |
208 |
{ |
209 |
uno::Reference< container::XNameAccess > xFilterFactory( |
209 |
uno::Reference< container::XNameAccess > xFilterFactory( |
210 |
GetFilterFactory(), |
210 |
GetFilterFactory(), |
Lines 277-286
Link Here
|
277 |
{ |
277 |
{ |
278 |
::rtl::OUString aFilterName; |
278 |
::rtl::OUString aFilterName; |
279 |
if ( aType[nInd].Name.equalsAscii( "PreferredFilter" ) |
279 |
if ( aType[nInd].Name.equalsAscii( "PreferredFilter" ) |
280 |
&& ( aType[nInd].Value >>= aFilterName ) && aFilterName.getLength() ) |
280 |
&& ( aType[nInd].Value >>= aFilterName ) && !aFilterName.isEmpty() ) |
281 |
{ |
281 |
{ |
282 |
::rtl::OUString aDocumentName = GetDocServiceNameFromFilter( aFilterName ); |
282 |
::rtl::OUString aDocumentName = GetDocServiceNameFromFilter( aFilterName ); |
283 |
if ( aDocumentName.getLength() ) |
283 |
if ( !aDocumentName.isEmpty() ) |
284 |
return aDocumentName; |
284 |
return aDocumentName; |
285 |
} |
285 |
} |
286 |
} |
286 |
} |
Lines 442-448
Link Here
|
442 |
} |
442 |
} |
443 |
|
443 |
|
444 |
::rtl::OUString aStringClassID = GetStringClassIDRepresentation( aClassID ); |
444 |
::rtl::OUString aStringClassID = GetStringClassIDRepresentation( aClassID ); |
445 |
if ( aStringClassID.getLength() ) |
445 |
if ( !aStringClassID.isEmpty() ) |
446 |
{ |
446 |
{ |
447 |
uno::Reference< container::XNameAccess > xObjConfig = GetObjConfiguration(); |
447 |
uno::Reference< container::XNameAccess > xObjConfig = GetObjConfiguration(); |
448 |
uno::Reference< container::XNameAccess > xObjectProps; |
448 |
uno::Reference< container::XNameAccess > xObjectProps; |
Lines 468-474
Link Here
|
468 |
return aObject; |
468 |
return aObject; |
469 |
|
469 |
|
470 |
::rtl::OUString aDocumentName = GetDocServiceNameFromMediaType( aMediaType ); |
470 |
::rtl::OUString aDocumentName = GetDocServiceNameFromMediaType( aMediaType ); |
471 |
if ( aDocumentName.getLength() ) |
471 |
if ( !aDocumentName.isEmpty() ) |
472 |
return GetObjectPropsByDocumentName( aDocumentName ); |
472 |
return GetObjectPropsByDocumentName( aDocumentName ); |
473 |
|
473 |
|
474 |
return uno::Sequence< beans::NamedValue >(); |
474 |
return uno::Sequence< beans::NamedValue >(); |
Lines 478-484
Link Here
|
478 |
uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByFilter( const ::rtl::OUString& aFilterName ) |
478 |
uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByFilter( const ::rtl::OUString& aFilterName ) |
479 |
{ |
479 |
{ |
480 |
::rtl::OUString aDocumentName = GetDocServiceNameFromFilter( aFilterName ); |
480 |
::rtl::OUString aDocumentName = GetDocServiceNameFromFilter( aFilterName ); |
481 |
if ( aDocumentName.getLength() ) |
481 |
if ( !aDocumentName.isEmpty() ) |
482 |
return GetObjectPropsByDocumentName( aDocumentName ); |
482 |
return GetObjectPropsByDocumentName( aDocumentName ); |
483 |
|
483 |
|
484 |
return uno::Sequence< beans::NamedValue >(); |
484 |
return uno::Sequence< beans::NamedValue >(); |
Lines 487-493
Link Here
|
487 |
//----------------------------------------------------------------------- |
487 |
//----------------------------------------------------------------------- |
488 |
uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByDocumentName( const ::rtl::OUString& aDocName ) |
488 |
uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByDocumentName( const ::rtl::OUString& aDocName ) |
489 |
{ |
489 |
{ |
490 |
if ( aDocName.getLength() ) |
490 |
if ( !aDocName.isEmpty() ) |
491 |
{ |
491 |
{ |
492 |
uno::Reference< container::XNameAccess > xObjConfig = GetObjConfiguration(); |
492 |
uno::Reference< container::XNameAccess > xObjConfig = GetObjConfiguration(); |
493 |
if ( xObjConfig.is() ) |
493 |
if ( xObjConfig.is() ) |
Lines 529-535
Link Here
|
529 |
{ |
529 |
{ |
530 |
::rtl::OUString aResult; |
530 |
::rtl::OUString aResult; |
531 |
|
531 |
|
532 |
if ( aStringClassID.getLength() ) |
532 |
if ( !aStringClassID.isEmpty() ) |
533 |
{ |
533 |
{ |
534 |
uno::Reference< container::XNameAccess > xObjConfig = GetObjConfiguration(); |
534 |
uno::Reference< container::XNameAccess > xObjConfig = GetObjConfiguration(); |
535 |
uno::Reference< container::XNameAccess > xObjectProps; |
535 |
uno::Reference< container::XNameAccess > xObjectProps; |
Lines 554-560
Link Here
|
554 |
{ |
554 |
{ |
555 |
::rtl::OUString aResult; |
555 |
::rtl::OUString aResult; |
556 |
|
556 |
|
557 |
if ( aDocName.getLength() ) |
557 |
if ( !aDocName.isEmpty() ) |
558 |
{ |
558 |
{ |
559 |
uno::Reference< container::XNameAccess > xObjConfig = GetObjConfiguration(); |
559 |
uno::Reference< container::XNameAccess > xObjConfig = GetObjConfiguration(); |
560 |
if ( xObjConfig.is() ) |
560 |
if ( xObjConfig.is() ) |
Lines 591-600
Link Here
|
591 |
{ |
591 |
{ |
592 |
::rtl::OUString aResult = GetFactoryNameByStringClassID( GetExplicitlyRegisteredObjClassID( aMediaType ) ); |
592 |
::rtl::OUString aResult = GetFactoryNameByStringClassID( GetExplicitlyRegisteredObjClassID( aMediaType ) ); |
593 |
|
593 |
|
594 |
if ( !aResult.getLength() ) |
594 |
if ( aResult.isEmpty() ) |
595 |
{ |
595 |
{ |
596 |
::rtl::OUString aDocumentName = GetDocServiceNameFromMediaType( aMediaType ); |
596 |
::rtl::OUString aDocumentName = GetDocServiceNameFromMediaType( aMediaType ); |
597 |
if ( aDocumentName.getLength() ) |
597 |
if ( !aDocumentName.isEmpty() ) |
598 |
aResult = GetFactoryNameByDocumentName( aDocumentName ); |
598 |
aResult = GetFactoryNameByDocumentName( aDocumentName ); |
599 |
} |
599 |
} |
600 |
|
600 |
|
Lines 612-618
Link Here
|
612 |
if ( aMediaDescr[nInd].Name.equalsAscii( "FilterName" ) ) |
612 |
if ( aMediaDescr[nInd].Name.equalsAscii( "FilterName" ) ) |
613 |
aMediaDescr[nInd].Value >>= aFilterName; |
613 |
aMediaDescr[nInd].Value >>= aFilterName; |
614 |
|
614 |
|
615 |
if ( !aFilterName.getLength() ) |
615 |
if ( aFilterName.isEmpty() ) |
616 |
{ |
616 |
{ |
617 |
// filter name is not specified, so type detection should be done |
617 |
// filter name is not specified, so type detection should be done |
618 |
|
618 |
|
Lines 634-640
Link Here
|
634 |
if ( aTempMD[nInd].Name.equalsAscii( "FilterName" ) ) |
634 |
if ( aTempMD[nInd].Name.equalsAscii( "FilterName" ) ) |
635 |
aTempMD[nInd].Value >>= aFilterName; |
635 |
aTempMD[nInd].Value >>= aFilterName; |
636 |
|
636 |
|
637 |
if ( aFilterName.getLength() ) |
637 |
if ( !aFilterName.isEmpty() ) |
638 |
{ |
638 |
{ |
639 |
sal_Int32 nOldLen = aMediaDescr.getLength(); |
639 |
sal_Int32 nOldLen = aMediaDescr.getLength(); |
640 |
aMediaDescr.realloc( nOldLen + 1 ); |
640 |
aMediaDescr.realloc( nOldLen + 1 ); |
Lines 642-648
Link Here
|
642 |
aMediaDescr[ nOldLen ].Value <<= aFilterName; |
642 |
aMediaDescr[ nOldLen ].Value <<= aFilterName; |
643 |
|
643 |
|
644 |
} |
644 |
} |
645 |
else if ( aTypeName.getLength() && !bIgnoreType ) |
645 |
else if ( !aTypeName.isEmpty() && !bIgnoreType ) |
646 |
{ |
646 |
{ |
647 |
uno::Reference< container::XNameAccess > xNameAccess( xTypeDetection, uno::UNO_QUERY ); |
647 |
uno::Reference< container::XNameAccess > xNameAccess( xTypeDetection, uno::UNO_QUERY ); |
648 |
uno::Sequence< beans::PropertyValue > aTypes; |
648 |
uno::Sequence< beans::PropertyValue > aTypes; |
Lines 679-685
Link Here
|
679 |
break; |
679 |
break; |
680 |
} |
680 |
} |
681 |
|
681 |
|
682 |
OSL_ENSURE( aDocName.getLength(), "The name must exist at this point!\n" ); |
682 |
OSL_ENSURE( !aDocName.isEmpty(), "The name must exist at this point!\n" ); |
683 |
|
683 |
|
684 |
|
684 |
|
685 |
sal_Bool bNeedsAddition = sal_True; |
685 |
sal_Bool bNeedsAddition = sal_True; |
Lines 708-714
Link Here
|
708 |
sal_Bool bResult = sal_False; |
708 |
sal_Bool bResult = sal_False; |
709 |
|
709 |
|
710 |
::rtl::OUString aFilterName = UpdateMediaDescriptorWithFilterName( aMediaDescr, sal_False ); |
710 |
::rtl::OUString aFilterName = UpdateMediaDescriptorWithFilterName( aMediaDescr, sal_False ); |
711 |
if ( aFilterName.getLength() ) |
711 |
if ( !aFilterName.isEmpty() ) |
712 |
{ |
712 |
{ |
713 |
sal_Int32 nFlags = GetFilterFlags( aFilterName ); |
713 |
sal_Int32 nFlags = GetFilterFlags( aFilterName ); |
714 |
// check the OWN flag |
714 |
// check the OWN flag |
Lines 723-729
Link Here
|
723 |
{ |
723 |
{ |
724 |
rtl::OUString aResult; |
724 |
rtl::OUString aResult; |
725 |
|
725 |
|
726 |
if ( aServiceName.getLength() && nVersion ) |
726 |
if ( !aServiceName.isEmpty() && nVersion ) |
727 |
try |
727 |
try |
728 |
{ |
728 |
{ |
729 |
uno::Reference< container::XContainerQuery > xFilterQuery( |
729 |
uno::Reference< container::XContainerQuery > xFilterQuery( |
Lines 757-763
Link Here
|
757 |
{ |
757 |
{ |
758 |
// if there are more than one filter the preffered one should be used |
758 |
// if there are more than one filter the preffered one should be used |
759 |
// if there is no preffered filter the first one will be used |
759 |
// if there is no preffered filter the first one will be used |
760 |
if ( !aResult.getLength() || ( nFlags & SFX_FILTER_PREFERED ) ) |
760 |
if ( aResult.isEmpty() || ( nFlags & SFX_FILTER_PREFERED ) ) |
761 |
aResult = aPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Name" ), |
761 |
aResult = aPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Name" ), |
762 |
::rtl::OUString() ); |
762 |
::rtl::OUString() ); |
763 |
if ( nFlags & SFX_FILTER_PREFERED ) |
763 |
if ( nFlags & SFX_FILTER_PREFERED ) |
Lines 779-785
Link Here
|
779 |
|
779 |
|
780 |
try |
780 |
try |
781 |
{ |
781 |
{ |
782 |
if ( aImportFilterName.getLength() ) |
782 |
if ( !aImportFilterName.isEmpty() ) |
783 |
{ |
783 |
{ |
784 |
uno::Reference< container::XNameAccess > xFilterFactory( |
784 |
uno::Reference< container::XNameAccess > xFilterFactory( |
785 |
GetFilterFactory(), |
785 |
GetFilterFactory(), |
Lines 808-815
Link Here
|
808 |
::rtl::OUString aDocumentServiceName = aImpFilterHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "DocumentService" ), ::rtl::OUString() ); |
808 |
::rtl::OUString aDocumentServiceName = aImpFilterHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "DocumentService" ), ::rtl::OUString() ); |
809 |
::rtl::OUString aTypeName = aImpFilterHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Type" ), ::rtl::OUString() ); |
809 |
::rtl::OUString aTypeName = aImpFilterHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Type" ), ::rtl::OUString() ); |
810 |
|
810 |
|
811 |
OSL_ENSURE( aDocumentServiceName.getLength() && aTypeName.getLength(), "Incomplete filter data!" ); |
811 |
OSL_ENSURE( !aDocumentServiceName.isEmpty() && !aTypeName.isEmpty(), "Incomplete filter data!" ); |
812 |
if ( aDocumentServiceName.getLength() && aTypeName.getLength() ) |
812 |
if ( !aDocumentServiceName.isEmpty() && !aTypeName.isEmpty() ) |
813 |
{ |
813 |
{ |
814 |
uno::Sequence< beans::NamedValue > aSearchRequest( 2 ); |
814 |
uno::Sequence< beans::NamedValue > aSearchRequest( 2 ); |
815 |
aSearchRequest[0].Name = ::rtl::OUString::createFromAscii( "Type" ); |
815 |
aSearchRequest[0].Name = ::rtl::OUString::createFromAscii( "Type" ); |