diff options
-rw-r--r-- | filter/Configuration_filter.mk | 2 | ||||
-rw-r--r-- | filter/qa/complex/filter/detection/typeDetection/files.csv | 2 | ||||
-rw-r--r-- | filter/qa/complex/filter/detection/typeDetection/preselectedFilter.csv | 4 | ||||
-rw-r--r-- | filter/qa/complex/filter/detection/typeDetection/preselectedType.csv | 4 | ||||
-rw-r--r-- | filter/qa/complex/filter/detection/typeDetection/serviceName.csv | 4 | ||||
-rw-r--r-- | filter/source/config/fragments/filters/Text___txt___csv__StarCalc_.xcu | 2 | ||||
-rw-r--r-- | filter/source/config/fragments/types/generic_Text.xcu (renamed from filter/source/config/fragments/types/calc_Text_txt_csv_StarCalc.xcu) | 5 | ||||
-rw-r--r-- | filter/source/textfilterdetect/filterdetect.cxx | 2 | ||||
-rw-r--r-- | filter/type-detection-debug.diff | 135 | ||||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/vba/vbaworkbooks.cxx | 2 | ||||
-rwxr-xr-x | sc/workben/dpcache/perf-test | bin | 0 -> 221794 bytes |
12 files changed, 149 insertions, 15 deletions
diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk index f143840a9f18..4709bc2fce80 100644 --- a/filter/Configuration_filter.mk +++ b/filter/Configuration_filter.mk @@ -426,6 +426,7 @@ $(call filter_Configuration_add_ui_filters,fcfg_langpack,filter/source/config/fr # fcfg_global $(call filter_Configuration_add_types,fcfg_langpack,fcfg_global_types.xcu,filter/source/config/fragments/types,\ + generic_Text \ writer_Text \ writer_StarOffice_XML_Writer \ writer_globaldocument_StarOffice_XML_Writer_GlobalDocument \ @@ -468,7 +469,6 @@ $(call filter_Configuration_add_types,fcfg_langpack,fcfg_calc_types.xcu,filter/s writer_Rich_Text_Format \ calc_SYLK \ calc_StarOffice_XML_Calc \ - calc_Text_txt_csv_StarCalc \ calc_StarOffice_XML_Calc_Template \ pdf_Portable_Document_Format \ calc_dBase\ diff --git a/filter/qa/complex/filter/detection/typeDetection/files.csv b/filter/qa/complex/filter/detection/typeDetection/files.csv index eaad74e7ca55..f5dafdd3bf05 100644 --- a/filter/qa/complex/filter/detection/typeDetection/files.csv +++ b/filter/qa/complex/filter/detection/typeDetection/files.csv @@ -46,7 +46,7 @@ csv2;Writer/Text_CSV.txt;writer_Text_encoded:writer_Text;writer_Text_encoded:wri ################################### # C A L C D O C U M E N T S ################################## -csv1;Calc/Text_CSV.csv;calc_Text_txt_csv_StarCalc;writer_Text_encoded:writer_Text +csv1;Calc/Text_CSV.csv;generic_Text;writer_Text_encoded:writer_Text Calc1;Calc/Calc1.SDC;calc_StarCalc_10;calc_StarCalc_10 Calc2_document;Calc/Calc3.SDC;calc_StarCalc_30_VorlageTemplate;calc_StarCalc_30 Calc2_template;Calc/Calc3.vor;calc_StarCalc_30;calc_StarCalc_30 diff --git a/filter/qa/complex/filter/detection/typeDetection/preselectedFilter.csv b/filter/qa/complex/filter/detection/typeDetection/preselectedFilter.csv index 71370e0b78f2..827e1eef33ee 100644 --- a/filter/qa/complex/filter/detection/typeDetection/preselectedFilter.csv +++ b/filter/qa/complex/filter/detection/typeDetection/preselectedFilter.csv @@ -1,6 +1,6 @@ fileAlias;FilterName;FilterOptions;FilterData;expectedFileType text1;%SO6productname %SO6formatversion Textdokument;;;writer_Text_encoded:writer_Text csv1;%SO6productname %SO6formatversion Textdokument;;;writer_Text_encoded:writer_Text -csv1;Text - txt - csv (StarCalc);;;calc_Text_txt_csv_StarCalc +csv1;Text - txt - csv (StarCalc);;;generic_Text csv2;%SO6productname %SO6formatversion Textdokument;;;writer_Text_encoded:writer_Text -csv2;Text - txt - csv (StarCalc);;;calc_Text_txt_csv_StarCalc +csv2;Text - txt - csv (StarCalc);;;generic_Text diff --git a/filter/qa/complex/filter/detection/typeDetection/preselectedType.csv b/filter/qa/complex/filter/detection/typeDetection/preselectedType.csv index 7fa0c2462da9..701db3301608 100644 --- a/filter/qa/complex/filter/detection/typeDetection/preselectedType.csv +++ b/filter/qa/complex/filter/detection/typeDetection/preselectedType.csv @@ -1,6 +1,6 @@ fileAlias;preselectFileType;expectFileType csv1;writer_Text;writer_Text_encoded:writer_Text -csv1;calc_Text_txt_csv_StarCalc;calc_Text_txt_csv_StarCalc +csv1;generic_Text;generic_Text #csv2;writer_Text_encoded -#csv2;calc_Text_txt_csv_StarCalc +#csv2;generic_Text text1;writer_Text_encoded;writer_Text_encoded:writer_Text
\ No newline at end of file diff --git a/filter/qa/complex/filter/detection/typeDetection/serviceName.csv b/filter/qa/complex/filter/detection/typeDetection/serviceName.csv index 744a5ac993e0..34f941ad0f12 100644 --- a/filter/qa/complex/filter/detection/typeDetection/serviceName.csv +++ b/filter/qa/complex/filter/detection/typeDetection/serviceName.csv @@ -1,6 +1,6 @@ fileAlias;serviceName;expectedType text1;com.sun.star.text.FormatDetector csv1;com.sun.star.text.FormatDetector;writer_Text_encoded -csv1;com.sun.star.comp.calc.FormatDetector;calc_Text_txt_csv_StarCalc +csv1;com.sun.star.comp.filters.PlainTextFilterDetect;generic_Text csv2;com.sun.star.text.FormatDetector;writer_Text_encoded -csv2;com.sun.star.comp.calc.FormatDetector;calc_Text_txt_csv_StarCalc +csv2;com.sun.star.comp.filters.PlainTextFilterDetect;generic_Text diff --git a/filter/source/config/fragments/filters/Text___txt___csv__StarCalc_.xcu b/filter/source/config/fragments/filters/Text___txt___csv__StarCalc_.xcu index 69b4ff752f06..f15fe5a3b05e 100644 --- a/filter/source/config/fragments/filters/Text___txt___csv__StarCalc_.xcu +++ b/filter/source/config/fragments/filters/Text___txt___csv__StarCalc_.xcu @@ -4,7 +4,7 @@ <prop oor:name="FilterService"/> <prop oor:name="UserData"><value></value></prop> <prop oor:name="FileFormatVersion"><value>0</value></prop> - <prop oor:name="Type"><value>calc_Text_txt_csv_StarCalc</value></prop> + <prop oor:name="Type"><value>generic_Text</value></prop> <prop oor:name="TemplateName"/> <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop> </node> diff --git a/filter/source/config/fragments/types/calc_Text_txt_csv_StarCalc.xcu b/filter/source/config/fragments/types/generic_Text.xcu index 0d51558f6897..de250225c0a9 100644 --- a/filter/source/config/fragments/types/calc_Text_txt_csv_StarCalc.xcu +++ b/filter/source/config/fragments/types/generic_Text.xcu @@ -1,12 +1,11 @@ - <node oor:name="calc_Text_txt_csv_StarCalc" oor:op="replace" > + <node oor:name="generic_Text" oor:op="replace" > <prop oor:name="DetectService"><value>com.sun.star.comp.filters.PlainTextFilterDetect</value></prop> <prop oor:name="URLPattern"/> <prop oor:name="Extensions"><value>csv txt</value></prop> <prop oor:name="MediaType"><value>text/plain</value></prop> <prop oor:name="Preferred"><value>false</value></prop> - <prop oor:name="PreferredFilter"><value>Text - txt - csv (StarCalc)</value></prop> <prop oor:name="UIName"> - <value>Text - txt - csv (StarOffice Calc)</value> + <value>Text</value> </prop> <prop oor:name="ClipboardFormat"/> </node> diff --git a/filter/source/textfilterdetect/filterdetect.cxx b/filter/source/textfilterdetect/filterdetect.cxx index 9cb9405438f0..7dd2ddd76cf0 100644 --- a/filter/source/textfilterdetect/filterdetect.cxx +++ b/filter/source/textfilterdetect/filterdetect.cxx @@ -88,7 +88,7 @@ rtl::OUString SAL_CALL PlainTextFilterDetect::detect(uno::Sequence<beans::Proper } } - if (aType == "calc_Text_txt_csv_StarCalc") + if (aType == "generic_Text") { // Generic text type. Decide which filter to use based on the // document service first, then on extension if that's not available. diff --git a/filter/type-detection-debug.diff b/filter/type-detection-debug.diff new file mode 100644 index 000000000000..84fc5dcc168f --- /dev/null +++ b/filter/type-detection-debug.diff @@ -0,0 +1,135 @@ +diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx +index cac9b14..f24198b 100644 +--- a/filter/source/config/cache/typedetection.cxx ++++ b/filter/source/config/cache/typedetection.cxx +@@ -43,6 +43,49 @@ + #include <tools/urlobj.hxx> + #include <unotools/localfilehelper.hxx> + ++ ++#include <stdio.h> ++#include <string> ++#include <sys/time.h> ++ ++namespace { ++ ++class stack_printer ++{ ++public: ++ explicit stack_printer(const char* msg) : ++ msMsg(msg) ++ { ++ fprintf(stdout, "%s: --begin\n", msMsg.c_str()); ++ mfStartTime = getTime(); ++ } ++ ++ ~stack_printer() ++ { ++ double fEndTime = getTime(); ++ fprintf(stdout, "%s: --end (duration: %g sec)\n", msMsg.c_str(), (fEndTime-mfStartTime)); ++ } ++ ++ void printTime(int line) const ++ { ++ double fEndTime = getTime(); ++ fprintf(stdout, "%s: --(%d) (duration: %g sec)\n", msMsg.c_str(), line, (fEndTime-mfStartTime)); ++ } ++ ++private: ++ double getTime() const ++ { ++ timeval tv; ++ gettimeofday(&tv, NULL); ++ return tv.tv_sec + tv.tv_usec / 1000000.0; ++ } ++ ++ ::std::string msMsg; ++ double mfStartTime; ++}; ++ ++} ++ + //_______________________________________________ + // namespace + +@@ -108,6 +151,21 @@ TypeDetection::~TypeDetection() + + namespace { + ++void print(const FlatDetection& rFD, const char* msg) ++{ ++ fprintf(stdout, "--- %s\n", msg); ++ FlatDetection::const_iterator i = rFD.begin(), iend = rFD.end(); ++ for (; i != iend; ++i) ++ { ++ const FlatDetectionInfo& r = *i; ++ fprintf(stdout, " * type = '%s' match by extension = %d match by pattern = %d pre-selected as type = %d pre-selected as filter = %d pre-selected as doc service = %d\n", ++ rtl::OUStringToOString(r.sType, RTL_TEXTENCODING_UTF8).getStr(), ++ r.bMatchByExtension, r.bMatchByPattern, r.bPreselectedAsType, ++ r.bPreselectedByFilter, r.bPreselectedByDocumentService); ++ } ++ fprintf(stdout, "---\n"); ++} ++ + /** + * Types with matching extension come first, then types that are supported + * by the document service come next. +@@ -129,6 +187,7 @@ struct SortByPriority : public std::binary_function<FlatDetectionInfo, FlatDetec + sal_Bool bAllowDeep ) + throw (css::uno::RuntimeException) + { ++ stack_printer __stack_printer__("filter/config/TypeDetection::queryTypeByDescriptor"); + // make the descriptor more useable :-) + ::comphelper::MediaDescriptor stlDescriptor(lDescriptor); + +@@ -164,16 +223,21 @@ struct SortByPriority : public std::binary_function<FlatDetectionInfo, FlatDetec + FlatDetection lFlatTypes; + impl_getPreselection(aURL, stlDescriptor, lFlatTypes); + ++ print(lFlatTypes, "pre-selection"); ++ + //******************************************* + // get all types, which match to the given descriptor + // That can be true by: extensions/url pattern/mime type etcpp. + m_rCache->detectFlatForURL(aURL, lFlatTypes); + ++ print(lFlatTypes, "flat by url"); ++ + aLock.clear(); + // <- SAFE ---------------------------------- + + // Properly prioritize all candidate types. + lFlatTypes.sort(SortByPriority()); ++ print(lFlatTypes, "sorted by priority"); + + ::rtl::OUString sType ; + ::rtl::OUString sLastChance; +@@ -190,8 +254,16 @@ struct SortByPriority : public std::binary_function<FlatDetectionInfo, FlatDetec + // stream failed by e.g. an IO exception ... + OUStringList lUsedDetectors; + if (lFlatTypes.size()>0) ++ { + sType = impl_detectTypeFlatAndDeep(stlDescriptor, lFlatTypes, bAllowDeep, lUsedDetectors, sLastChance); + ++ { ++ rtl::OUString aFilter = stlDescriptor.getUnpackedValueOrDefault(comphelper::MediaDescriptor::PROP_FILTERNAME(), rtl::OUString()); ++ fprintf(stdout, "TypeDetection::queryTypeByDescriptor: filter = '%s' type = '%s' (flat and deep)\n", ++ rtl::OUStringToOString(aFilter, RTL_TEXTENCODING_UTF8).getStr(), rtl::OUStringToOString(sType, RTL_TEXTENCODING_UTF8).getStr()); ++ } ++ } ++ + //******************************************* + // if no flat detected (nor preselected!) type could be + // verified and no error occurred during creation of +@@ -203,6 +275,11 @@ struct SortByPriority : public std::binary_function<FlatDetectionInfo, FlatDetec + ) + { + sType = impl_detectTypeDeepOnly(stlDescriptor, lUsedDetectors); ++ { ++ rtl::OUString aFilter = stlDescriptor.getUnpackedValueOrDefault(comphelper::MediaDescriptor::PROP_FILTERNAME(), rtl::OUString()); ++ fprintf(stdout, "TypeDetection::queryTypeByDescriptor: filter = '%s' type = '%s' (deep only)\n", ++ rtl::OUStringToOString(aFilter, RTL_TEXTENCODING_UTF8).getStr(), rtl::OUStringToOString(sType, RTL_TEXTENCODING_UTF8).getStr()); ++ } + } + + //******************************************* diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index e6ec96b5efd1..68b5bf087b7f 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -72,7 +72,7 @@ FileFormat aFileFormats[] = { { "ods" , "calc8", "", ODS_FORMAT_TYPE }, { "xls" , "MS Excel 97", "calc_MS_EXCEL_97", XLS_FORMAT_TYPE }, { "xlsx", "Calc MS Excel 2007 XML" , "MS Excel 2007 XML", XLSX_FORMAT_TYPE }, - { "csv" , "Text - txt - csv (StarCalc)", "calc_Text_txt_csv_StarCalc", CSV_FORMAT_TYPE } + { "csv" , "Text - txt - csv (StarCalc)", "generic_Text", CSV_FORMAT_TYPE } }; } diff --git a/sc/source/ui/vba/vbaworkbooks.cxx b/sc/source/ui/vba/vbaworkbooks.cxx index 9466200b1b09..2d2b0424a890 100644 --- a/sc/source/ui/vba/vbaworkbooks.cxx +++ b/sc/source/ui/vba/vbaworkbooks.cxx @@ -195,7 +195,7 @@ ScVbaWorkbooks::isTextFile( const rtl::OUString& sType ) // c) unknown // returning true basically means treat this like a csv file const static rtl::OUString txtType( RTL_CONSTASCII_USTRINGPARAM("writer_Text" ) ); - const static rtl::OUString csvType( RTL_CONSTASCII_USTRINGPARAM("calc_Text_txt_csv_StarCalc" ) ); + const static rtl::OUString csvType("generic_Text"); const static rtl::OUString encodedTxtType( RTL_CONSTASCII_USTRINGPARAM("writer_Text_encoded" ) ); return sType.equals( txtType ) || sType.equals( csvType ) || sType.isEmpty() || sType.equals( encodedTxtType ); } diff --git a/sc/workben/dpcache/perf-test b/sc/workben/dpcache/perf-test Binary files differnew file mode 100755 index 000000000000..b6a66294bbb6 --- /dev/null +++ b/sc/workben/dpcache/perf-test |