summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2011-08-01 15:18:29 -0400
committerKohei Yoshida <kyoshida@novell.com>2011-08-01 15:18:49 -0400
commitce03635b49b973ff1af4d6e4392994ce2032abf6 (patch)
treecb3a2d4faba01dce243091765fa54b51226215fd
parent17d137a657999dfc0124ff1d23ee47064d10c6ea (diff)
Fixed messed up indentations.
-rw-r--r--filter/source/xmlfilterdetect/filterdetect.cxx151
1 files changed, 73 insertions, 78 deletions
diff --git a/filter/source/xmlfilterdetect/filterdetect.cxx b/filter/source/xmlfilterdetect/filterdetect.cxx
index 35f749f09..7f70a4aa8 100644
--- a/filter/source/xmlfilterdetect/filterdetect.cxx
+++ b/filter/source/xmlfilterdetect/filterdetect.cxx
@@ -99,97 +99,92 @@ Reference< com::sun::star::frame::XModel > xModel;
::rtl::OUString SAL_CALL FilterDetect::detect( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& aArguments ) throw( com::sun::star::uno::RuntimeException )
{
- ::rtl::OUString sTypeName;
- ::rtl::OUString sUrl;
- ::rtl::OUString originalTypeName;
- Sequence<PropertyValue > lProps ;
-
- com::sun::star::uno::Reference< com::sun::star::io::XInputStream > xInStream;
- ::rtl::OUString temp;
- const PropertyValue * pValue = aArguments.getConstArray();
- sal_Int32 nLength;
- ::rtl::OString resultString;
-
- nLength = aArguments.getLength();
- sal_Int32 location=nLength;
- for ( sal_Int32 i = 0 ; i < nLength; i++)
+ ::rtl::OUString sTypeName;
+ ::rtl::OUString sUrl;
+ ::rtl::OUString originalTypeName;
+ Sequence<PropertyValue > lProps ;
+
+ com::sun::star::uno::Reference< com::sun::star::io::XInputStream > xInStream;
+ ::rtl::OUString temp;
+ const PropertyValue * pValue = aArguments.getConstArray();
+ sal_Int32 nLength;
+ ::rtl::OString resultString;
+
+ nLength = aArguments.getLength();
+ sal_Int32 location=nLength;
+ for (sal_Int32 i = 0 ; i < nLength; i++)
+ {
+ if (pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "TypeName" ) ))
{
- if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "TypeName" ) ) )
- {
- location=i;
- }
- else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "URL" ) ) )
- {
- pValue[i].Value >>= sUrl;
- }
- else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "InputStream" ) ) )
+ location=i;
+ }
+ else if (pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "URL" ) ))
+ {
+ pValue[i].Value >>= sUrl;
+ }
+ else if (pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "InputStream" ) ))
+ {
+ pValue[i].Value >>= xInStream ;
+ }
+ }
+ try
+ {
+ Reference< com::sun::star::ucb::XCommandEnvironment > xEnv;
+ if (!xInStream.is())
+ {
+ ::ucbhelper::Content aContent(sUrl,xEnv);
+ xInStream = aContent.openStream();
+ if (!xInStream.is())
{
- pValue[i].Value >>= xInStream ;
+ return sTypeName;
}
-
-
}
- try{
- Reference< com::sun::star::ucb::XCommandEnvironment > xEnv;
- if (!xInStream.is())
- {
- ::ucbhelper::Content aContent(sUrl,xEnv);
- xInStream = aContent.openStream();
- if (!xInStream.is())
- {
- return sTypeName;
- }
- }
com::sun::star::uno::Sequence< sal_Int8 > aData;
- /* long nBytesToRead= */ xInStream->available();
- xInStream->skipBytes (0);
- long bytestRead =xInStream->readBytes (aData, 4000);
- resultString=::rtl::OString((const sal_Char *)aData.getConstArray(),bytestRead) ;
-
-
- // test typedetect code
- Reference <XNameAccess> xTypeCont(mxMSF->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.TypeDetection" ))),UNO_QUERY);
- Sequence < ::rtl::OUString > myTypes= xTypeCont->getElementNames();
- nLength = myTypes.getLength();
-
-
- sal_Int32 new_nlength=0;
- sal_Int32 i = 0 ;
- while( (i < nLength) && (sTypeName.getLength() == 0))
+ /* long nBytesToRead= */ xInStream->available();
+ xInStream->skipBytes (0);
+ long bytestRead =xInStream->readBytes (aData, 4000);
+ resultString=::rtl::OString((const sal_Char *)aData.getConstArray(),bytestRead) ;
+
+ // test typedetect code
+ Reference <XNameAccess> xTypeCont(mxMSF->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.TypeDetection" ))),UNO_QUERY);
+ Sequence < ::rtl::OUString > myTypes= xTypeCont->getElementNames();
+ nLength = myTypes.getLength();
+
+ sal_Int32 new_nlength=0;
+ sal_Int32 i = 0 ;
+ while ((i < nLength) && (sTypeName.getLength() == 0))
+ {
+ Any elem = xTypeCont->getByName(myTypes[i]);
+ elem >>=lProps;
+ new_nlength = lProps.getLength();
+ sal_Int32 j =0;
+ while (j < new_nlength && (sTypeName.getLength() == 0))
{
-
- Any elem = xTypeCont->getByName(myTypes[i]);
- elem >>=lProps;
- new_nlength = lProps.getLength();
- sal_Int32 j =0;
- while( j < new_nlength && (sTypeName.getLength() == 0))
+ ::rtl::OUString tmpStr;
+ lProps[j].Value >>=tmpStr;
+ if ((lProps[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ClipboardFormat"))) && tmpStr.getLength())
{
- ::rtl::OUString tmpStr;
- lProps[j].Value >>=tmpStr;
- if((lProps[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ClipboardFormat"))) && tmpStr.getLength() )
- {
- sTypeName = supportedByType(tmpStr,resultString, myTypes[i]);
- }
- j++;
+ sTypeName = supportedByType(tmpStr,resultString, myTypes[i]);
}
+ j++;
+ }
i++;
}
- //end test
+ }
+ catch (Exception &)
+ {
+ OSL_FAIL( "An Exception occurred while opening File stream" );
+ }
- }
- catch(Exception &)
- {
- OSL_FAIL( "An Exception occurred while opening File stream" );
- }
- if (sTypeName.getLength())
+ if (sTypeName.getLength())
+ {
+ if (location == aArguments.getLength())
{
- if ( location == aArguments.getLength() )
- {
- aArguments.realloc(nLength+1);
- aArguments[location].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TypeName" ));
- }
- aArguments[location].Value <<=sTypeName;
+ aArguments.realloc(nLength+1);
+ aArguments[location].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TypeName" ));
}
+ aArguments[location].Value <<=sTypeName;
+ }
return sTypeName;
}