diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2007-10-23 10:40:42 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2007-10-23 10:40:42 +0000 |
commit | 7a6f2415e2f7b8eb6aa0303e8c01423eae1ea96b (patch) | |
tree | 40c5f28aceef2ae73d38597d172fa9bce40741b2 /filter/source/xmlfilterdetect/filterdetect.cxx | |
parent | 1ae6f15e4aa0f122790d2c38819d064626edf42c (diff) |
INTEGRATION: CWS xsltfilter08 (1.8.14); FILE MERGED
2007/07/06 17:46:01 sus 1.8.14.1: #i79345# enhance deep filter detection to 4000 bytes
Diffstat (limited to 'filter/source/xmlfilterdetect/filterdetect.cxx')
-rw-r--r-- | filter/source/xmlfilterdetect/filterdetect.cxx | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/filter/source/xmlfilterdetect/filterdetect.cxx b/filter/source/xmlfilterdetect/filterdetect.cxx index d1d5c89228ae..0e99201ef4e0 100644 --- a/filter/source/xmlfilterdetect/filterdetect.cxx +++ b/filter/source/xmlfilterdetect/filterdetect.cxx @@ -4,9 +4,9 @@ * * $RCSfile: filterdetect.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: ihi $ $Date: 2007-06-05 14:44:30 $ + * last change: $Author: vg $ $Date: 2007-10-23 11:40:42 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -222,13 +222,11 @@ Reference< com::sun::star::frame::XModel > xModel; com::sun::star::uno::Sequence< sal_Int8 > aData; /* long nBytesToRead= */ xInStream->available(); xInStream->skipBytes (0); - long bytestRead =xInStream->readBytes (aData, 1000); + long bytestRead =xInStream->readBytes (aData, 4000); resultString=::rtl::OString((const sal_Char *)aData.getConstArray(),bytestRead) ; // test typedetect code - - Reference <XNameAccess> xTypeCont(mxMSF->createInstance(OUString::createFromAscii("com.sun.star.document.TypeDetection")),UNO_QUERY); Sequence < ::rtl::OUString > myTypes= xTypeCont->getElementNames(); nLength = myTypes.getLength(); @@ -262,7 +260,6 @@ Reference< com::sun::star::frame::XModel > xModel; { OSL_ENSURE( sal_False, "An Exception occured while opening File stream" ); } - if(sTypeName.equalsAscii("")) { //sTypeName=::rtl::OUString::createFromAscii("writer_Flat_XML_File"); @@ -274,7 +271,6 @@ Reference< com::sun::star::frame::XModel > xModel; aArguments.realloc(nLength+1); aArguments[location].Name = ::rtl::OUString::createFromAscii( "TypeName" ); } - aArguments[location].Value <<=sTypeName; } // OSL_ENSURE( sal_False, ::rtl::OUStringToOString(sTypeName,RTL_TEXTENCODING_ASCII_US).getStr() ); @@ -287,20 +283,15 @@ Reference< com::sun::star::frame::XModel > xModel; ::rtl::OUString SAL_CALL supportedByType( const ::rtl::OUString clipBoardFormat , const ::rtl::OString resultString, const ::rtl::OUString checkType) { - sal_Int32 checked =0; + ::rtl::OUString sTypeName= OUString::createFromAscii(""); if((clipBoardFormat.match(OUString::createFromAscii("doctype:")))) { ::rtl::OString tryStr = ::rtl::OUStringToOString(clipBoardFormat.copy(8),RTL_TEXTENCODING_ASCII_US).getStr(); // OSL_ENSURE( sal_False, tryStr); - while((checked <=resultString.getLength())&& (sTypeName.equalsAscii(""))) + if (resultString.indexOf(tryStr) >= 0) { - if( resultString.match(tryStr,checked)) - { sTypeName = checkType; - break; - } - checked++; } } return sTypeName; |