[Libreoffice-commits] .: Branch 'feature/mspub' - 57 commits - android/experimental autodoc/source connectivity/source dbaccess/source desktop/win32 filter/Configuration_filter.mk filter/Library_textfd.mk filter/Module_filter.mk filter/qa filter/source filter/type-detection-debug.diff framework/source i18npool/source libvisio/libvisio-0.0.16-fdo50178.patch libvisio/makefile.mk oox/CustomTarget_generated.mk oox/Library_oox.mk oox/Module_oox.mk oox/Package_generated.mk oox/source postprocess/packcomponents qadevOOo/tests Repository.mk sc/inc sc/Library_scfilt.mk scp2/source sc/qa sc/source sc/workben sfx2/source solenv/bin sw/inc sw/qa sw/source unotools/source unusedcode.easy writerfilter/source xmloff/inc xmloff/source

Fridrich Strba fridrich at kemper.freedesktop.org
Thu May 24 23:11:33 PDT 2012


 Repository.mk                                                                                |    1 
 android/experimental/DocumentLoader/Makefile                                                 |    2 
 android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java |   32 +
 autodoc/source/display/idl/hfi_globalindex.cxx                                               |   12 
 connectivity/source/drivers/postgresql/pq_xtables.cxx                                        |    2 
 dbaccess/source/ui/dlg/dlgsave.cxx                                                           |    2 
 desktop/win32/source/applauncher/launcher.cxx                                                |    3 
 filter/Configuration_filter.mk                                                               |    8 
 filter/Library_textfd.mk                                                                     |   58 +++
 filter/Module_filter.mk                                                                      |    1 
 filter/qa/complex/filter/detection/typeDetection/TypeDetection.java                          |    6 
 filter/qa/complex/filter/detection/typeDetection/files.csv                                   |   34 +-
 filter/qa/complex/filter/detection/typeDetection/preselectedFilter.csv                       |   10 
 filter/qa/complex/filter/detection/typeDetection/preselectedType.csv                         |    6 
 filter/qa/complex/filter/detection/typeDetection/serviceName.csv                             |    4 
 filter/source/config/cache/typedetection.cxx                                                 |   23 +
 filter/source/config/fragments/filters/Text.xcu                                              |    2 
 filter/source/config/fragments/filters/Text__StarWriter_Web_.xcu                             |    2 
 filter/source/config/fragments/filters/Text___txt___csv__StarCalc_.xcu                       |    2 
 filter/source/config/fragments/filters/Text__encoded___StarWriter_GlobalDocument_.xcu        |    2 
 filter/source/config/fragments/filters/Text__encoded___StarWriter_Web_.xcu                   |    2 
 filter/source/config/fragments/types/calc_Text_txt_csv_StarCalc.xcu                          |   12 
 filter/source/config/fragments/types/generic_Text.xcu                                        |   11 
 filter/source/config/fragments/types/writer_Text.xcu                                         |   12 
 filter/source/svg/svgwriter.cxx                                                              |    4 
 filter/source/textfilterdetect/fdcomp.cxx                                                    |   72 ++++
 filter/source/textfilterdetect/filterdetect.cxx                                              |  169 ++++++++++
 filter/source/textfilterdetect/filterdetect.hxx                                              |   83 ++++
 filter/source/textfilterdetect/textfd.component                                              |   36 ++
 filter/type-detection-debug.diff                                                             |  135 +++++++
 framework/source/fwi/uielement/constitemcontainer.cxx                                        |    2 
 framework/source/uiconfiguration/uicategorydescription.cxx                                   |    1 
 framework/source/uielement/uicommanddescription.cxx                                          |    2 
 i18npool/source/localedata/data/zh_TW.xml                                                    |    6 
 libvisio/libvisio-0.0.16-fdo50178.patch                                                      |   29 +
 libvisio/makefile.mk                                                                         |    1 
 oox/CustomTarget_generated.mk                                                                |   62 +++
 oox/Library_oox.mk                                                                           |   56 ---
 oox/Module_oox.mk                                                                            |    1 
 oox/Package_generated.mk                                                                     |    3 
 oox/source/token/Makefile                                                                    |  126 -------
 postprocess/packcomponents/makefile.mk                                                       |    1 
 qadevOOo/tests/java/mod/_fwl/TypeDetection.java                                              |    2 
 sc/Library_scfilt.mk                                                                         |    1 
 sc/inc/colorscale.hxx                                                                        |    1 
 sc/inc/dbdata.hxx                                                                            |    1 
 sc/inc/document.hxx                                                                          |   19 -
 sc/inc/fmtuno.hxx                                                                            |    2 
 sc/inc/table.hxx                                                                             |   17 +
 sc/qa/unit/subsequent_filters-test.cxx                                                       |    2 
 sc/source/core/data/attarray.cxx                                                             |   19 -
 sc/source/core/data/colorscale.cxx                                                           |    5 
 sc/source/core/data/conditio.cxx                                                             |    2 
 sc/source/core/data/documen2.cxx                                                             |   26 -
 sc/source/core/data/documen3.cxx                                                             |    4 
 sc/source/core/data/documen4.cxx                                                             |   82 ++--
 sc/source/core/data/documen7.cxx                                                             |  101 +++--
 sc/source/core/data/document.cxx                                                             |   23 -
 sc/source/core/data/fillinfo.cxx                                                             |    6 
 sc/source/core/data/patattr.cxx                                                              |   34 --
 sc/source/core/data/table1.cxx                                                               |   79 ++++
 sc/source/core/data/table2.cxx                                                               |   24 -
 sc/source/core/tool/dbdata.cxx                                                               |    7 
 sc/source/filter/excel/xecontent.cxx                                                         |   14 
 sc/source/filter/excel/xestyle.cxx                                                           |  128 +++----
 sc/source/filter/excel/xetable.cxx                                                           |   53 ++-
 sc/source/filter/excel/xicontent.cxx                                                         |    2 
 sc/source/filter/oox/condformatbuffer.cxx                                                    |    4 
 sc/source/filter/xml/xmlexprt.cxx                                                            |  130 +++++++
 sc/source/filter/xml/xmlexprt.hxx                                                            |    3 
 sc/source/ui/docshell/docsh4.cxx                                                             |    9 
 sc/source/ui/inc/refundo.hxx                                                                 |    2 
 sc/source/ui/undo/refundo.cxx                                                                |   14 
 sc/source/ui/unoobj/cellsuno.cxx                                                             |    6 
 sc/source/ui/unoobj/fmtuno.cxx                                                               |    4 
 sc/source/ui/vba/vbaworkbooks.cxx                                                            |    5 
 sc/source/ui/view/viewfun2.cxx                                                               |    2 
 sc/workben/dpcache/perf-test                                                                 |binary
 scp2/source/ooo/file_library_ooo.scp                                                         |    1 
 sfx2/source/control/unoctitm.cxx                                                             |   14 
 solenv/bin/modules/installer/windows/file.pm                                                 |    2 
 sw/inc/dbmgr.hxx                                                                             |    4 
 sw/inc/doc.hxx                                                                               |   10 
 sw/inc/docary.hxx                                                                            |   31 +
 sw/inc/editsh.hxx                                                                            |    3 
 sw/inc/flypos.hxx                                                                            |    4 
 sw/inc/rubylist.hxx                                                                          |    4 
 sw/inc/section.hxx                                                                           |    3 
 sw/inc/sortopt.hxx                                                                           |    3 
 sw/qa/extras/ooxmltok/data/n652364.docx                                                      |binary
 sw/qa/extras/ooxmltok/data/n750255.docx                                                      |binary
 sw/qa/extras/ooxmltok/ooxmltok.cxx                                                           |   88 +++++
 sw/qa/extras/ww8tok/data/n652364.doc                                                         |binary
 sw/qa/extras/ww8tok/data/n750255.doc                                                         |binary
 sw/qa/extras/ww8tok/ww8tok.cxx                                                               |   82 ++++
 sw/source/core/bastyp/swcache.cxx                                                            |   46 +-
 sw/source/core/crsr/crstrvl.cxx                                                              |    4 
 sw/source/core/doc/dbgoutsw.cxx                                                              |    2 
 sw/source/core/doc/doc.cxx                                                                   |   25 -
 sw/source/core/doc/docdesc.cxx                                                               |   24 -
 sw/source/core/doc/docfld.cxx                                                                |  113 +++---
 sw/source/core/doc/docfmt.cxx                                                                |    8 
 sw/source/core/doc/doclay.cxx                                                                |   12 
 sw/source/core/doc/docnew.cxx                                                                |   47 +-
 sw/source/core/doc/docnum.cxx                                                                |   25 -
 sw/source/core/doc/docruby.cxx                                                               |   18 -
 sw/source/core/doc/docsort.cxx                                                               |   12 
 sw/source/core/doc/doctxm.cxx                                                                |   14 
 sw/source/core/doc/number.cxx                                                                |    2 
 sw/source/core/doc/poolfmt.cxx                                                               |    6 
 sw/source/core/doc/sortopt.cxx                                                               |   10 
 sw/source/core/docnode/node.cxx                                                              |    2 
 sw/source/core/docnode/section.cxx                                                           |   64 +--
 sw/source/core/edit/edfld.cxx                                                                |   10 
 sw/source/core/edit/edfldexp.cxx                                                             |    2 
 sw/source/core/edit/editsh.cxx                                                               |    9 
 sw/source/core/fields/fldbas.cxx                                                             |   13 
 sw/source/core/fields/fldlst.cxx                                                             |    4 
 sw/source/core/inc/docsort.hxx                                                               |   10 
 sw/source/core/inc/rolbck.hxx                                                                |   21 -
 sw/source/core/inc/swcache.hxx                                                               |   11 
 sw/source/core/layout/flypos.cxx                                                             |    2 
 sw/source/core/layout/newfrm.cxx                                                             |    2 
 sw/source/core/layout/pagedesc.cxx                                                           |    6 
 sw/source/core/table/swtable.cxx                                                             |    1 
 sw/source/core/text/EnhancedPDFExportHelper.cxx                                              |    2 
 sw/source/core/tox/tox.cxx                                                                   |   13 
 sw/source/core/undo/rolbck.cxx                                                               |   41 +-
 sw/source/core/undo/unsort.cxx                                                               |    4 
 sw/source/core/unocore/unocoll.cxx                                                           |    6 
 sw/source/core/unocore/unofield.cxx                                                          |    8 
 sw/source/core/unocore/unoidx.cxx                                                            |    2 
 sw/source/core/unocore/unoobj.cxx                                                            |    8 
 sw/source/core/unocore/unoobj2.cxx                                                           |    4 
 sw/source/core/unocore/unosect.cxx                                                           |    8 
 sw/source/core/unocore/unostyle.cxx                                                          |    2 
 sw/source/filter/basflt/fltini.cxx                                                           |   24 -
 sw/source/filter/html/htmlfly.cxx                                                            |    9 
 sw/source/filter/rtf/rtffly.cxx                                                              |   22 -
 sw/source/filter/rtf/swparrtf.cxx                                                            |   28 -
 sw/source/filter/rtf/swparrtf.hxx                                                            |   15 
 sw/source/filter/writer/writer.cxx                                                           |    2 
 sw/source/filter/ww8/rtfexport.cxx                                                           |    4 
 sw/source/filter/ww8/writerhelper.cxx                                                        |   11 
 sw/source/filter/ww8/wrtw8num.cxx                                                            |   28 -
 sw/source/filter/ww8/wrtww8.cxx                                                              |    2 
 sw/source/filter/ww8/ww8par.cxx                                                              |    6 
 sw/source/ui/app/docstyle.cxx                                                                |    6 
 sw/source/ui/dbui/dbmgr.cxx                                                                  |   33 -
 sw/source/ui/envelp/label1.cxx                                                               |   16 
 sw/source/ui/envelp/labelcfg.cxx                                                             |    2 
 sw/source/ui/envelp/labimp.hxx                                                               |   10 
 sw/source/ui/misc/srtdlg.cxx                                                                 |    6 
 sw/source/ui/uno/unotxvw.cxx                                                                 |    6 
 sw/source/ui/utlui/content.cxx                                                               |    4 
 sw/source/ui/vba/vbalisthelper.cxx                                                           |   10 
 unotools/source/config/historyoptions.cxx                                                    |    1 
 unusedcode.easy                                                                              |    1 
 writerfilter/source/dmapper/PropertyMap.cxx                                                  |   18 +
 xmloff/inc/xmloff/xmlnmspe.hxx                                                               |    3 
 xmloff/inc/xmloff/xmltoken.hxx                                                               |   11 
 xmloff/source/core/xmlexp.cxx                                                                |    3 
 xmloff/source/core/xmltoken.cxx                                                              |   11 
 163 files changed, 1987 insertions(+), 1048 deletions(-)

New commits:
commit c3fc2a15e27f02646753d02a760b6f00ca63fcd4
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri May 25 01:39:52 2012 -0400

    Removed writer_Text type; combined it with generic_Text.
    
    Change-Id: Id7d5744af4800ef5ac6bd70b97f79a76299a2e6b

diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk
index a26efe3..149be2a 100644
--- a/filter/Configuration_filter.mk
+++ b/filter/Configuration_filter.mk
@@ -328,7 +328,7 @@ $(call filter_Configuration_add_types,fcfg_langpack,fcfg_writer_types.xcu,filter
 	writer_MS_Works_Document \
 	writer_T602_Document \
 	writer_LotusWordPro_Document \
-	writer_Text \
+	generic_Text \
 	writer_Text_encoded \
 	writer_MIZI_Hwp_97 \
 	writer_StarOffice_XML_Writer_Template \
@@ -394,7 +394,7 @@ $(call filter_Configuration_add_ui_filters,fcfg_langpack,filter/source/config/fr
 # fcfg_web
 $(call filter_Configuration_add_types,fcfg_langpack,fcfg_web_types.xcu,filter/source/config/fragments/types,\
 	generic_HTML \
-	writer_Text \
+	generic_Text \
 	writer_web_HTML_help \
 	writer_StarOffice_XML_Writer \
 	writer_web_StarOffice_XML_Writer_Web_Template \
@@ -427,7 +427,6 @@ $(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 \
 	pdf_Portable_Document_Format \
@@ -456,6 +455,7 @@ $(call filter_Configuration_add_ui_filters,fcfg_langpack,filter/source/config/fr
 $(call filter_Configuration_add_types,fcfg_langpack,fcfg_calc_types.xcu,filter/source/config/fragments/types,\
 	calc_DIF \
 	generic_HTML \
+	generic_Text \
 	calc_Lotus \
 	calc_QPro \
 	calc_MS_Excel_40 \
diff --git a/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java b/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java
index f706c41..d8e98a8 100644
--- a/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java
+++ b/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java
@@ -100,7 +100,7 @@ import util.utils;
  * Example:
  *
  * Writer6_1;Writer/Writer6.sxw;writer_StarOffice_XML_Writer;writer_StarOffice_XML_Writer
- * text1;Writer/Text.txt;writer_Text_encoded:writer_Text;writer_Text_encoded:writer_Text
+ * text1;Writer/Text.txt;writer_Text_encoded:generic_Text;writer_Text_encoded:generic_Text
  *
  * The first example shows you the following:
  * <code>Writer6_1</code> is a free chosen name
@@ -110,10 +110,10 @@ import util.utils;
  * this file
  *
  * The second example displays two document types for <code>XInputStream</CODE>
- * (<code>writer_Text_encoded</CODE> and <code>writer_Text</CODE>. This two
+ * (<code>writer_Text_encoded</CODE> and <code>generic_Text</CODE>. This two
  * document types are listed by a colon ':' as separator. This is needed because
  * XInputStream can detect a text file as writer_Text_encoded as well as
- * writer_Text.
+ * generic_Text.
  * <p>
  *
  * <H3><A name="preselectedFilter.csv"</a>
diff --git a/filter/qa/complex/filter/detection/typeDetection/files.csv b/filter/qa/complex/filter/detection/typeDetection/files.csv
index f5dafdd..9a3cb3b 100644
--- a/filter/qa/complex/filter/detection/typeDetection/files.csv
+++ b/filter/qa/complex/filter/detection/typeDetection/files.csv
@@ -10,7 +10,7 @@ fileAlias;fileURL;defaultFileType;streamFileType
 # W R I T E R   D O C U M E N T S
 #################################
 rtf1;Writer/AoE2a.rtf;writer_Rich_Text_Format;writer_Rich_Text_Format;writer_Rich_Text_Format
-text1;Writer/Text_DOS.txt;writer_Text_encoded:writer_Text;writer_Text_encoded:writer_Text
+text1;Writer/Text_DOS.txt;writer_Text_encoded:generic_Text;writer_Text_encoded:generic_Text
 Word2000_document;Writer/Word2000.doc;writer_MS_Word_97;writer_MS_Word_97
 Word2000_template;Writer/Word2000_template.dot;writer_MS_Word_97_Vorlage;writer_MS_Word_97_Vorlage
 Word6_document;Writer/Word6.doc;writer_MS_WinWord_60;writer_MS_WinWord_60
@@ -29,24 +29,24 @@ Writer5_template;Writer/Writer5_template.vor;writer_StarWriter_50_VorlageTemplat
 Writer6_document;Writer/Writer6.sxw;writer_StarOffice_XML_Writer;writer_StarOffice_XML_Writer
 Writer6_template;Writer/Writer6_template.stw;writer_StarOffice_XML_Writer_Template;writer_StarOffice_XML_Writer
 Writer6_html;Writer/WriterWeb.html;generic_HTML;generic_HTML
-ApiPro3;Writer/AmiPro_3x.sam;writer_Text_encoded:writer_Text;writer_Text_encoded:writer_Text
-Applix;Writer/Applix.aw;writer_Text_encoded:writer_Text;writer_Text_encoded:writer_Text
-Text2;Writer/Counterstrike I.txt;writer_Text_encoded:writer_Text;writer_Text_encoded:writer_Text
-FrameMake_document;Writer/FrameMaker.mif;writer_Text_encoded:writer_Text;writer_Text_encoded:writer_Text
-WordPro_Hangul;Writer/HangulWordPro.hwp;writer_Text_encoded:writer_Text;writer_Text_encoded:writer_Text
+ApiPro3;Writer/AmiPro_3x.sam;writer_Text_encoded:generic_Text;writer_Text_encoded:generic_Text
+Applix;Writer/Applix.aw;writer_Text_encoded:generic_Text;writer_Text_encoded:generic_Text
+Text2;Writer/Counterstrike I.txt;writer_Text_encoded:generic_Text;writer_Text_encoded:generic_Text
+FrameMake_document;Writer/FrameMaker.mif;writer_Text_encoded:generic_Text;writer_Text_encoded:generic_Text
+WordPro_Hangul;Writer/HangulWordPro.hwp;writer_Text_encoded:generic_Text;writer_Text_encoded:generic_Text
 Ichitaro;Writer/Ichitaro.jtd;writer_JustSystem_Ichitaro_10;writer_JustSystem_Ichitaro_10
-MacWord5_document;Writer/MacWord_5.mcw;writer_Text_encoded:writer_Text;writer_Text_encoded:writer_Text
+MacWord5_document;Writer/MacWord_5.mcw;writer_Text_encoded:generic_Text;writer_Text_encoded:generic_Text
 rtf2;Writer/RTF.rtf;writer_Rich_Text_Format;writer_Rich_Text_Format
 wps2000_document;Writer/WPS_2000.wps;writer_WPSSystem_WPS2000_10;writer_WPSSystem_WPS2000_10
-WinWord2_document;Writer/WinWord_2x.doc;writer_Text_encoded:writer_Text;writer_Text_encoded:writer_Text
+WinWord2_document;Writer/WinWord_2x.doc;writer_Text_encoded:generic_Text;writer_Text_encoded:generic_Text
 WinWord6_95_document;Writer/WinWord_6_95.doc;writer_MS_WinWord_60;writer_MS_WinWord_60
 WinWord97_2000_XP_document;Writer/Winword_97_2000_xp.doc;writer_MS_Word_97;writer_MS_Word_97
-WordPerfect;Writer/WordPerfect.wpd;writer_Text_encoded:writer_Text;writer_Text_encoded:writer_Text
-csv2;Writer/Text_CSV.txt;writer_Text_encoded:writer_Text;writer_Text_encoded:writer_Text
+WordPerfect;Writer/WordPerfect.wpd;writer_Text_encoded:generic_Text;writer_Text_encoded:generic_Text
+csv2;Writer/Text_CSV.txt;writer_Text_encoded:generic_Text;writer_Text_encoded:generic_Text
 ###################################
 # C A L C   D O C U M E N T S
 ##################################
-csv1;Calc/Text_CSV.csv;generic_Text;writer_Text_encoded:writer_Text
+csv1;Calc/Text_CSV.csv;generic_Text;writer_Text_encoded:generic_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
@@ -56,7 +56,7 @@ Calc5_document;Calc/Calc5.sdc;calc_StarCalc_50;calc_StarCalc_50
 Calc5_template;Calc/Calc5.vor;calc_StarCalc_50_VorlageTemplate;calc_StarCalc_50
 Calc6_document;Calc/Calc_6.stc;calc_StarOffice_XML_Calc;calc_StarOffice_XML_Calc
 Calc6_template;Calc/Calc_6.sxc;calc_StarOffice_XML_Calc_Template;calc_StarOffice_XML_Calc
-dif;Calc/DIF.DIF;calc_DIF;writer_Text_encoded:writer_Text
+dif;Calc/DIF.DIF;calc_DIF;writer_Text_encoded:generic_Text
 Excel2;Calc/Excel2.XLS;calc_MS_Excel_40;calc_MS_Excel_40
 Excel3;Calc/Excel3.XLS;calc_MS_Excel_40;calc_MS_Excel_40
 Excel4_document;Calc/Excel4.XLS;calc_MS_Excel_40;calc_MS_Excel_40
@@ -99,19 +99,19 @@ Impress5_template;Impress/imp9.vor;impress_StarImpress_50_Vorlage;impress_StarIm
 # G R A P H I C S
 ######################################################
 bitmap;Graphics/pic.bmp;bmp_MS_Windows;bmp_MS_Windows
-emf;Graphics/pic.emf;emf_MS_Windows_Metafile;emf_MS_Windows_Metafile:writer_Text_encoded:writer_Text
+emf;Graphics/pic.emf;emf_MS_Windows_Metafile;emf_MS_Windows_Metafile:writer_Text_encoded:generic_Text
 eps;Graphics/pic.eps;eps_Encapsulated_PostScript;eps_Encapsulated_PostScript
 gif;Graphics/pic.gif;gif_Graphics_Interchange;gif_Graphics_Interchange
 jpg;Graphics/pic.jpg;jpg_JPEG;jpg_JPEG
-met;Graphics/pic.met;met_OS2_Metafile;met_OS2_Metafile:writer_Text_encoded:writer_Text
+met;Graphics/pic.met;met_OS2_Metafile;met_OS2_Metafile:writer_Text_encoded:generic_Text
 pbm;Graphics/pic.pbm;pbm_Portable_Bitmap;pbm_Portable_Bitmap
 pct;Graphics/pic.pct;pct_Mac_Pict;pct_Mac_Pict
 pgm;Graphics/pic.pgm;pgm_Portable_Graymap;pgm_Portable_Graymap
 png;Graphics/pic.png;png_Portable_Network_Graphic;png_Portable_Network_Graphic
 ppm;Graphics/pic.ppm;ppm_Portable_Pixelmap;ppm_Portable_Pixelmap
 ras;Graphics/pic.ras;ras_Sun_Rasterfile;ras_Sun_Rasterfile
-svm;Graphics/pic.svm;svm_StarView_Metafile;svm_StarView_Metafile:writer_Text_encoded:writer_Text
-tif;Graphics/pic.tif;tif_Tag_Image_File;tif_Tag_Image_File:writer_Text_encoded:writer_Text
-wmf;Graphics/pic.wmf;wmf_MS_Windows_Metafile;wmf_MS_Windows_Metafile:writer_Text_encoded:writer_Text
+svm;Graphics/pic.svm;svm_StarView_Metafile;svm_StarView_Metafile:writer_Text_encoded:generic_Text
+tif;Graphics/pic.tif;tif_Tag_Image_File;tif_Tag_Image_File:writer_Text_encoded:generic_Text
+wmf;Graphics/pic.wmf;wmf_MS_Windows_Metafile;wmf_MS_Windows_Metafile:writer_Text_encoded:generic_Text
 
 
diff --git a/filter/qa/complex/filter/detection/typeDetection/preselectedFilter.csv b/filter/qa/complex/filter/detection/typeDetection/preselectedFilter.csv
index 827e1ee..c7055a2 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
+text1;%SO6productname %SO6formatversion Textdokument;;;writer_Text_encoded:generic_Text
+csv1;%SO6productname %SO6formatversion Textdokument;;;writer_Text_encoded:generic_Text
 csv1;Text - txt - csv (StarCalc);;;generic_Text
-csv2;%SO6productname %SO6formatversion Textdokument;;;writer_Text_encoded:writer_Text
+csv2;%SO6productname %SO6formatversion Textdokument;;;writer_Text_encoded:generic_Text
 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 701db33..ec6a6d8 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;generic_Text;writer_Text_encoded:generic_Text
 csv1;generic_Text;generic_Text
 #csv2;writer_Text_encoded
 #csv2;generic_Text
-text1;writer_Text_encoded;writer_Text_encoded:writer_Text
\ No newline at end of file
+text1;writer_Text_encoded;writer_Text_encoded:generic_Text
\ No newline at end of file
diff --git a/filter/source/config/fragments/filters/Text.xcu b/filter/source/config/fragments/filters/Text.xcu
index ac11931..4a703d3 100644
--- a/filter/source/config/fragments/filters/Text.xcu
+++ b/filter/source/config/fragments/filters/Text.xcu
@@ -4,7 +4,7 @@
         <prop oor:name="FilterService"/>
         <prop oor:name="UserData"><value>TEXT</value></prop>
         <prop oor:name="FileFormatVersion"><value>0</value></prop>
-        <prop oor:name="Type"><value>writer_Text</value></prop>
+        <prop oor:name="Type"><value>generic_Text</value></prop>
         <prop oor:name="TemplateName"/>
         <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
     </node>
diff --git a/filter/source/config/fragments/filters/Text__StarWriter_Web_.xcu b/filter/source/config/fragments/filters/Text__StarWriter_Web_.xcu
index 5161a52..29ad18a 100644
--- a/filter/source/config/fragments/filters/Text__StarWriter_Web_.xcu
+++ b/filter/source/config/fragments/filters/Text__StarWriter_Web_.xcu
@@ -4,7 +4,7 @@
         <prop oor:name="FilterService"/>
         <prop oor:name="UserData"><value>TEXT</value></prop>
         <prop oor:name="FileFormatVersion"><value>0</value></prop>
-        <prop oor:name="Type"><value>writer_Text</value></prop>
+        <prop oor:name="Type"><value>generic_Text</value></prop>
         <prop oor:name="TemplateName"/>
         <prop oor:name="DocumentService"><value>com.sun.star.text.WebDocument</value></prop>
     </node>
diff --git a/filter/source/config/fragments/filters/Text__encoded___StarWriter_GlobalDocument_.xcu b/filter/source/config/fragments/filters/Text__encoded___StarWriter_GlobalDocument_.xcu
index 2c39de8..d4fd201 100644
--- a/filter/source/config/fragments/filters/Text__encoded___StarWriter_GlobalDocument_.xcu
+++ b/filter/source/config/fragments/filters/Text__encoded___StarWriter_GlobalDocument_.xcu
@@ -4,7 +4,7 @@
         <prop oor:name="FilterService"/>
         <prop oor:name="UserData"><value>TEXT_DLG</value></prop>
         <prop oor:name="FileFormatVersion"><value>0</value></prop>
-        <prop oor:name="Type"><value>writer_Text</value></prop>
+        <prop oor:name="Type"><value>generic_Text</value></prop>
         <prop oor:name="TemplateName"/>
         <prop oor:name="DocumentService"><value>com.sun.star.text.GlobalDocument</value></prop>
     </node>
diff --git a/filter/source/config/fragments/filters/Text__encoded___StarWriter_Web_.xcu b/filter/source/config/fragments/filters/Text__encoded___StarWriter_Web_.xcu
index f8ced30..b347977 100644
--- a/filter/source/config/fragments/filters/Text__encoded___StarWriter_Web_.xcu
+++ b/filter/source/config/fragments/filters/Text__encoded___StarWriter_Web_.xcu
@@ -4,7 +4,7 @@
         <prop oor:name="FilterService"/>
         <prop oor:name="UserData"><value>TEXT_DLG</value></prop>
         <prop oor:name="FileFormatVersion"><value>0</value></prop>
-        <prop oor:name="Type"><value>writer_Text</value></prop>
+        <prop oor:name="Type"><value>generic_Text</value></prop>
         <prop oor:name="TemplateName"/>
         <prop oor:name="DocumentService"><value>com.sun.star.text.WebDocument</value></prop>
     </node>
diff --git a/filter/source/config/fragments/types/writer_Text.xcu b/filter/source/config/fragments/types/writer_Text.xcu
deleted file mode 100644
index 014c73d..0000000
--- a/filter/source/config/fragments/types/writer_Text.xcu
+++ /dev/null
@@ -1,12 +0,0 @@
-    <node oor:name="writer_Text" oor:op="replace" >
-        <prop oor:name="DetectService"><value>com.sun.star.text.FormatDetector</value></prop>
-        <prop oor:name="URLPattern"/>
-        <prop oor:name="Extensions"><value>txt</value></prop>
-        <prop oor:name="MediaType"><value>text/plain</value></prop>
-        <prop oor:name="Preferred"><value>true</value></prop>
-        <prop oor:name="PreferredFilter"><value>Text</value></prop>
-        <prop oor:name="UIName">
-            <value>Text</value>
-        </prop>
-        <prop oor:name="ClipboardFormat"/>
-    </node>
diff --git a/qadevOOo/tests/java/mod/_fwl/TypeDetection.java b/qadevOOo/tests/java/mod/_fwl/TypeDetection.java
index 4a298e8..989f4c5 100644
--- a/qadevOOo/tests/java/mod/_fwl/TypeDetection.java
+++ b/qadevOOo/tests/java/mod/_fwl/TypeDetection.java
@@ -143,7 +143,7 @@ public class TypeDetection extends TestCase {
         NamedValue[] querySequenze = new NamedValue[1];
         NamedValue query = new NamedValue();
         query.Name = "Name";
-        query.Value = "writer_Text";
+        query.Value = "generic_Text";
         querySequenze[0] = query;
 
 
diff --git a/sc/source/ui/vba/vbaworkbooks.cxx b/sc/source/ui/vba/vbaworkbooks.cxx
index 2d2b042..00461b1 100644
--- a/sc/source/ui/vba/vbaworkbooks.cxx
+++ b/sc/source/ui/vba/vbaworkbooks.cxx
@@ -194,10 +194,9 @@ ScVbaWorkbooks::isTextFile( const rtl::OUString& sType )
     // b) a csv file
     // 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("generic_Text");
+    const static rtl::OUString txtType("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 );
+    return sType.equals( txtType ) || sType.isEmpty() || sType.equals( encodedTxtType );
 }
 
 bool
commit 99201254162097143cc28a64e7f053d0a223c59d
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri May 25 01:18:42 2012 -0400

    Renamed calc_Text_text_csv_StarCalc type to generic_Text.
    
    Change-Id: Ica6aef56733c7c71568e37166a2f78d6aa05a118

diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk
index aa689ca..a26efe3 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 eaad74e..f5dafdd 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 71370e0..827e1ee 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 7fa0c24..701db33 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 744a5ac..34f941a 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 69b4ff7..f15fe5a 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/calc_Text_txt_csv_StarCalc.xcu
deleted file mode 100644
index 0d51558..0000000
--- a/filter/source/config/fragments/types/calc_Text_txt_csv_StarCalc.xcu
+++ /dev/null
@@ -1,12 +0,0 @@
-    <node oor:name="calc_Text_txt_csv_StarCalc" 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>
-        </prop>
-        <prop oor:name="ClipboardFormat"/>
-    </node>
diff --git a/filter/source/config/fragments/types/generic_Text.xcu b/filter/source/config/fragments/types/generic_Text.xcu
new file mode 100644
index 0000000..de25022
--- /dev/null
+++ b/filter/source/config/fragments/types/generic_Text.xcu
@@ -0,0 +1,11 @@
+    <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="UIName">
+            <value>Text</value>
+        </prop>
+        <prop oor:name="ClipboardFormat"/>
+    </node>
diff --git a/filter/source/textfilterdetect/filterdetect.cxx b/filter/source/textfilterdetect/filterdetect.cxx
index 9cb9405..7dd2ddd 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 0000000..84fc5dc
--- /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 e6ec96b..68b5bf0 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 9466200..2d2b042 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
new file mode 100755
index 0000000..b6a6629
Binary files /dev/null and b/sc/workben/dpcache/perf-test differ
commit df1a6a8e44634f19e2c2ae9a1f1daa8673d54d9c
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri May 25 00:22:58 2012 -0400

    Do the real detection work for plain text & forgot to add a makefile.
    
    Change-Id: I95edb869b00764464d91e1f396da1bb648b74515

diff --git a/filter/Library_textfd.mk b/filter/Library_textfd.mk
new file mode 100644
index 0000000..ac7303a
--- /dev/null
+++ b/filter/Library_textfd.mk
@@ -0,0 +1,58 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License or as specified alternatively below. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Initial Developer of the Original Code is
+#       Kohei Yoshida <kohei.yoshida at suse.com>
+# Portions created by the Initial Developer are Copyright (C) 2011 the
+# Initial Developer. All Rights Reserved.
+#
+# Major Contributor(s):
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+#*************************************************************************
+
+$(eval $(call gb_Library_Library,textfd))
+
+$(eval $(call gb_Library_set_componentfile,textfd,filter/source/textfilterdetect/textfd))
+
+$(eval $(call gb_Library_use_api,textfd,\
+	udkapi \
+	offapi \
+))
+
+$(eval $(call gb_Library_set_include,textfd,\
+	$$(INCLUDE) \
+))
+
+$(eval $(call gb_Library_use_libraries,textfd,\
+	ucbhelper \
+	cppuhelper \
+	cppu \
+	sal \
+	tl \
+	$(gb_STDLIBS) \
+))
+
+$(eval $(call gb_Library_add_exception_objects,textfd,\
+	filter/source/textfilterdetect/fdcomp \
+	filter/source/textfilterdetect/filterdetect \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/filter/source/textfilterdetect/filterdetect.cxx b/filter/source/textfilterdetect/filterdetect.cxx
index 55bfd0a..9cb9405 100644
--- a/filter/source/textfilterdetect/filterdetect.cxx
+++ b/filter/source/textfilterdetect/filterdetect.cxx
@@ -27,49 +27,98 @@
  */
 
 #include "filterdetect.hxx"
+
+#include "tools/urlobj.hxx"
+
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 
+#define WRITER_TEXT_FILTER "Text"
+#define CALC_TEXT_FILTER   "Text - txt - csv (StarCalc)"
+
 using namespace ::com::sun::star;
 
+namespace {
+
+void setFilter(uno::Sequence<beans::PropertyValue>& rProps, sal_Int32 nPos, const rtl::OUString& rFilter)
+{
+    if (nPos >= 0)
+        rProps[nPos].Value <<= rFilter;
+    else
+    {
+        sal_Int32 n = rProps.getLength();
+        rProps.realloc(n+1);
+        rProps[n].Name = "FilterName";
+        rProps[n].Value <<= rFilter;
+    }
+}
+
+}
+
 PlainTextFilterDetect::PlainTextFilterDetect(const uno::Reference<lang::XMultiServiceFactory> &xMSF) :
     mxMSF(xMSF) {}
 
 PlainTextFilterDetect::~PlainTextFilterDetect() {}
 
-rtl::OUString SAL_CALL PlainTextFilterDetect::detect(uno::Sequence<beans::PropertyValue>& aArguments) throw (uno::RuntimeException)
+rtl::OUString SAL_CALL PlainTextFilterDetect::detect(uno::Sequence<beans::PropertyValue>& lDescriptor) throw (uno::RuntimeException)
 {
+    rtl::OUString aType;
+    rtl::OUString aDocService;
+    rtl::OUString aExt;
+
+    sal_Int32 nFilter = -1;
+
+    for (sal_Int32 i = 0, n = lDescriptor.getLength(); i < n; ++i)
+    {
+        if (lDescriptor[i].Name == "TypeName")
+            lDescriptor[i].Value >>= aType;
+        else if (lDescriptor[i].Name == "FilterName")
+            nFilter = i;
+        else if (lDescriptor[i].Name == "DocumentService")
+            lDescriptor[i].Value >>= aDocService;
+        else if (lDescriptor[i].Name == "URL")
+        {
+            rtl::OUString aURL;
+            lDescriptor[i].Value >>= aURL;
+
+            // Get the file name extension.
+            INetURLObject aParser(aURL);
+            aExt = aParser.getExtension(
+                INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET);
+            aExt = aExt.toAsciiLowerCase();
+        }
+    }
+
+    if (aType == "calc_Text_txt_csv_StarCalc")
+    {
+        // Generic text type.  Decide which filter to use based on the
+        // document service first, then on extension if that's not available.
+
+        if (aDocService == "com.sun.star.sheet.SpreadsheetDocument")
+            // Open it in Calc.
+            setFilter(lDescriptor, nFilter, CALC_TEXT_FILTER);
+        else if (aDocService == "com.sun.star.text.TextDocument")
+            // Open it in Writer.
+            setFilter(lDescriptor, nFilter, WRITER_TEXT_FILTER);
+        else if (aExt == "csv")
+            setFilter(lDescriptor, nFilter, CALC_TEXT_FILTER);
+        else if (aExt == "txt")
+            setFilter(lDescriptor, nFilter, WRITER_TEXT_FILTER);
+        else
+            // No clue.  Open it in Writer by default.
+            setFilter(lDescriptor, nFilter, WRITER_TEXT_FILTER);
+
+        return aType;
+    }
+
+    // failed!
     return rtl::OUString();
 }
 
 // XInitialization
 
-void SAL_CALL PlainTextFilterDetect::initialize(const uno::Sequence<uno::Any>& aArguments)
+void SAL_CALL PlainTextFilterDetect::initialize(const uno::Sequence<uno::Any>& /*aArguments*/)
     throw (uno::Exception, uno::RuntimeException)
 {
-    uno::Sequence<beans::PropertyValue> aAnySeq;
-    sal_Int32 nLength = aArguments.getLength();
-    if (nLength && (aArguments[0] >>= aAnySeq))
-    {
-        const beans::PropertyValue * pValue = aAnySeq.getConstArray();
-        for (sal_Int32 i = 0, n = aAnySeq.getLength(); i < n; ++i)
-        {
-            if (pValue[i].Name == "Type")
-            {
-                fprintf(stdout, "PlainTextFilterDetect::initialize:   type = '%s'\n",
-                        rtl::OUStringToOString(pValue[i].Value.get<rtl::OUString>(), RTL_TEXTENCODING_UTF8).getStr());
-            }
-            else if (pValue[i].Name == "UserData")
-            {
-                fprintf(stdout, "PlainTextFilterDetect::initialize:   user data = '%s'\n",
-                        rtl::OUStringToOString(pValue[i].Value.get<rtl::OUString>(), RTL_TEXTENCODING_UTF8).getStr());
-            }
-            else if (pValue[i].Name == "TemplateName")
-            {
-                fprintf(stdout, "PlainTextFilterDetect::initialize:   template name = '%s'\n",
-                        rtl::OUStringToOString(pValue[i].Value.get<rtl::OUString>(), RTL_TEXTENCODING_UTF8).getStr());
-            }
-        }
-    }
 }
 
 rtl::OUString PlainTextFilterDetect_getImplementationName()
commit b061cb4e9d90d46ddca12be124beda37c3509770
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu May 24 23:14:02 2012 -0400

    Use the new plain text type detection service for text/csv type.
    
    Change-Id: I50d5cee6302e8d6b4b329e30b7a5ce47b47bc945

diff --git a/filter/source/config/fragments/types/calc_Text_txt_csv_StarCalc.xcu b/filter/source/config/fragments/types/calc_Text_txt_csv_StarCalc.xcu
index 7087172..0d51558 100644
--- a/filter/source/config/fragments/types/calc_Text_txt_csv_StarCalc.xcu
+++ b/filter/source/config/fragments/types/calc_Text_txt_csv_StarCalc.xcu
@@ -1,5 +1,5 @@
     <node oor:name="calc_Text_txt_csv_StarCalc" oor:op="replace" >
-        <prop oor:name="DetectService"><value>com.sun.star.comp.calc.FormatDetector</value></prop>
+        <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>
diff --git a/postprocess/packcomponents/makefile.mk b/postprocess/packcomponents/makefile.mk
index f4be7f2..3ee6612 100644
--- a/postprocess/packcomponents/makefile.mk
+++ b/postprocess/packcomponents/makefile.mk
@@ -57,6 +57,7 @@ my_components = \
     component/filter/source/placeware/placeware \
     component/filter/source/svg/svgfilter \
     component/filter/source/t602/t602filter \
+    component/filter/source/textfilterdetect/textfd \
     component/filter/source/xmlfilteradaptor/xmlfa \
     component/filter/source/xmlfilterdetect/xmlfd \
     component/filter/source/xsltdialog/xsltdlg \
diff --git a/scp2/source/ooo/file_library_ooo.scp b/scp2/source/ooo/file_library_ooo.scp
index f229e84..0b4a78e 100644
--- a/scp2/source/ooo/file_library_ooo.scp
+++ b/scp2/source/ooo/file_library_ooo.scp
@@ -1398,6 +1398,7 @@ STD_LIB_FILE( gid_File_Lib_Xsltdlg, xsltdlg )
 STD_LIB_FILE( gid_File_Lib_Xsltfilter, xsltfilter )
 STD_LIB_FILE( gid_File_Lib_Xmlfa, xmlfa )
 STD_LIB_FILE( gid_File_Lib_Xmlfd, xmlfd )
+STD_LIB_FILE( gid_File_Lib_Textfd, textfd )
 STD_LIB_FILE( gid_File_Lib_Odfflatxml, odfflatxml )
 
 #ifdef SOLAR_JAVA
commit f78d5cf20d0a1a687057c2fe7b8693dd4ab0adfd
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu May 24 22:36:09 2012 -0400

    Initial skeleton code for plain text filter detection service.
    
    Right now it will always fail.
    
    Change-Id: I50011bbf7ce59c3b299d23e688dd1af87bcafeb6

diff --git a/Repository.mk b/Repository.mk
index 3f641d6..a7d7e53 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -335,6 +335,7 @@ $(eval $(call gb_Helper_register_libraries,OOOLIBS, \
     swui \
     t602filter \
     textconversiondlgs \
+    textfd \
     tk \
     tl \
     unordf \
diff --git a/filter/Module_filter.mk b/filter/Module_filter.mk
index 03f13e2..922d4f5 100644
--- a/filter/Module_filter.mk
+++ b/filter/Module_filter.mk
@@ -60,6 +60,7 @@ $(eval $(call gb_Module_add_targets,filter,\
 	Library_placeware \
 	Library_svgfilter \
 	Library_t602filter \
+	Library_textfd \
 	Library_xmlfa \
 	Library_xmlfd \
 	Library_xsltdlg \
diff --git a/filter/source/textfilterdetect/fdcomp.cxx b/filter/source/textfilterdetect/fdcomp.cxx
new file mode 100644
index 0000000..6be78b3
--- /dev/null
+++ b/filter/source/textfilterdetect/fdcomp.cxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ *   Copyright (C) 2012 Kohei Yoshida <kohei.yoshida at suse.com>
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <stdio.h>
+
+#include <osl/mutex.hxx>
+#include <osl/thread.h>
+#include <cppuhelper/factory.hxx>
+
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+
+#include "filterdetect.hxx"
+
+using namespace ::cppu;
+using namespace com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+
+extern "C" {
+
+SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
+    const sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ )
+{
+    void* pRet = NULL;
+    rtl::OUString implName = rtl::OUString::createFromAscii(pImplName);
+    if (pServiceManager && implName == PlainTextFilterDetect_getImplementationName())
+    {
+        uno::Reference<lang::XSingleServiceFactory> xFactory(
+            createSingleFactory(
+            reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
+            implName,
+            PlainTextFilterDetect_createInstance, PlainTextFilterDetect_getSupportedServiceNames()));
+
+        if (xFactory.is())
+        {
+            xFactory->acquire();
+            pRet = xFactory.get();
+        }
+    }
+
+    return pRet;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/textfilterdetect/filterdetect.cxx b/filter/source/textfilterdetect/filterdetect.cxx
new file mode 100644
index 0000000..55bfd0a
--- /dev/null
+++ b/filter/source/textfilterdetect/filterdetect.cxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ *   Copyright (C) 2012 Kohei Yoshida <kohei.yoshida at suse.com>
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "filterdetect.hxx"
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+using namespace ::com::sun::star;
+
+PlainTextFilterDetect::PlainTextFilterDetect(const uno::Reference<lang::XMultiServiceFactory> &xMSF) :
+    mxMSF(xMSF) {}
+
+PlainTextFilterDetect::~PlainTextFilterDetect() {}
+
+rtl::OUString SAL_CALL PlainTextFilterDetect::detect(uno::Sequence<beans::PropertyValue>& aArguments) throw (uno::RuntimeException)
+{
+    return rtl::OUString();
+}
+
+// XInitialization
+
+void SAL_CALL PlainTextFilterDetect::initialize(const uno::Sequence<uno::Any>& aArguments)
+    throw (uno::Exception, uno::RuntimeException)
+{
+    uno::Sequence<beans::PropertyValue> aAnySeq;
+    sal_Int32 nLength = aArguments.getLength();
+    if (nLength && (aArguments[0] >>= aAnySeq))
+    {
+        const beans::PropertyValue * pValue = aAnySeq.getConstArray();
+        for (sal_Int32 i = 0, n = aAnySeq.getLength(); i < n; ++i)
+        {
+            if (pValue[i].Name == "Type")
+            {
+                fprintf(stdout, "PlainTextFilterDetect::initialize:   type = '%s'\n",
+                        rtl::OUStringToOString(pValue[i].Value.get<rtl::OUString>(), RTL_TEXTENCODING_UTF8).getStr());
+            }
+            else if (pValue[i].Name == "UserData")
+            {
+                fprintf(stdout, "PlainTextFilterDetect::initialize:   user data = '%s'\n",
+                        rtl::OUStringToOString(pValue[i].Value.get<rtl::OUString>(), RTL_TEXTENCODING_UTF8).getStr());
+            }
+            else if (pValue[i].Name == "TemplateName")
+            {
+                fprintf(stdout, "PlainTextFilterDetect::initialize:   template name = '%s'\n",
+                        rtl::OUStringToOString(pValue[i].Value.get<rtl::OUString>(), RTL_TEXTENCODING_UTF8).getStr());
+            }
+        }
+    }
+}
+
+rtl::OUString PlainTextFilterDetect_getImplementationName()
+{
+    return rtl::OUString("com.sun.star.comp.filters.PlainTextFilterDetect");
+}
+
+sal_Bool PlainTextFilterDetect_supportsService(const rtl::OUString& ServiceName)
+{
+    return ServiceName == "com.sun.star.document.ExtendedTypeDetection" ||
+        ServiceName == "com.sun.star.comp.filters.PlainTextFilterDetect";
+}
+
+uno::Sequence<rtl::OUString> PlainTextFilterDetect_getSupportedServiceNames()
+{
+    uno::Sequence<rtl::OUString> aRet(2);
+    rtl::OUString* pArray = aRet.getArray();
+    pArray[0] = "com.sun.star.document.ExtendedTypeDetection";
+    pArray[1] = "com.sun.star.comp.filters.PlainTextFilterDetect";
+    return aRet;
+}
+
+uno::Reference<uno::XInterface> PlainTextFilterDetect_createInstance(
+    const uno::Reference<lang::XMultiServiceFactory> & rSMgr)
+{
+    return (cppu::OWeakObject*) new PlainTextFilterDetect(rSMgr);
+}
+
+// XServiceInfo
+rtl::OUString SAL_CALL PlainTextFilterDetect::getImplementationName()
+    throw (uno::RuntimeException)
+{
+    return PlainTextFilterDetect_getImplementationName();
+}
+
+sal_Bool SAL_CALL PlainTextFilterDetect::supportsService(const rtl::OUString& rServiceName)
+    throw (uno::RuntimeException)
+{
+    return PlainTextFilterDetect_supportsService(rServiceName);
+}
+
+uno::Sequence<rtl::OUString> SAL_CALL PlainTextFilterDetect::getSupportedServiceNames()
+    throw (uno::RuntimeException)
+{
+    return PlainTextFilterDetect_getSupportedServiceNames();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/textfilterdetect/filterdetect.hxx b/filter/source/textfilterdetect/filterdetect.hxx
new file mode 100644
index 0000000..7f3ad15
--- /dev/null
+++ b/filter/source/textfilterdetect/filterdetect.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __FILTER_TEXTFILTERDETECT_FILTERDETECT_HXX__
+#define __FILTER_TEXTFILTERDETECT_FILTERDETECT_HXX__
+
+#include <com/sun/star/document/XExtendedFilterDetection.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+#include <cppuhelper/implbase3.hxx>
+
+class PlainTextFilterDetect : public cppu::WeakImplHelper3<
+    com::sun::star::document::XExtendedFilterDetection,
+    com::sun::star::lang::XInitialization,
+    com::sun::star::lang::XServiceInfo>
+{
+    com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> mxMSF;
+
+public:
+
+    PlainTextFilterDetect (const com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> &xMSF);
+    virtual ~PlainTextFilterDetect();
+
+    // XExtendedFilterDetection
+
+    virtual ::rtl::OUString SAL_CALL detect(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& lDescriptor)
+            throw( com::sun::star::uno::RuntimeException );
+
+    // XInitialization
+
+    virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence<com::sun::star::uno::Any>& aArguments)
+        throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
+
+    // XServiceInfo
+
+    virtual ::rtl::OUString SAL_CALL getImplementationName()
+        throw (com::sun::star::uno::RuntimeException);
+
+    virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName)
+        throw (com::sun::star::uno::RuntimeException);
+
+    virtual com::sun::star::uno::Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames()
+        throw (com::sun::star::uno::RuntimeException);
+};
+
+rtl::OUString PlainTextFilterDetect_getImplementationName();
+
+sal_Bool PlainTextFilterDetect_supportsService(const rtl::OUString& ServiceName);
+
+com::sun::star::uno::Sequence<rtl::OUString> PlainTextFilterDetect_getSupportedServiceNames();
+
+com::sun::star::uno::Reference<com::sun::star::uno::XInterface>
+PlainTextFilterDetect_createInstance(const com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory>& rSMgr);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/textfilterdetect/textfd.component b/filter/source/textfilterdetect/textfd.component
new file mode 100644
index 0000000..e1708e7
--- /dev/null
+++ b/filter/source/textfilterdetect/textfd.component
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+* Version: MPL 1.1 / GPLv3+ / LGPLv3+
+*
+* The contents of this file are subject to the Mozilla Public License Version
+* 1.1 (the "License"); you may not use this file except in compliance with
+* the License or as specified alternatively below. You may obtain a copy of
+* the License at http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Initial Developer of the Original Code is
+*       Kohei Yoshida <kohei.yoshida at suse.com> (Initial Developer)
+* Portions created by the Initial Developer are Copyright (C) 2011 the
+* Initial Developer. All Rights Reserved.
+*
+* Major Contributor(s):
+*
+* For minor contributions see the git repository.
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+* the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+* in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+* instead of those above.
+**************************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+    xmlns="http://openoffice.org/2010/uno-components">
+  <implementation name="com.sun.star.comp.filters.PlainTextFilterDetect">
+    <service name="com.sun.star.document.ExtendedTypeDetection"/>
+  </implementation>
+</component>
commit 6fe98f29c4e6275478817b49e9db25c2877908d1
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu May 24 21:21:31 2012 -0400

    Patterns should precede extensions.
    
    Change-Id: Ib401fb6287efda68d07732382fc814961138d8a9

diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx
index cac9b14..303ebfc 100644
--- a/filter/source/config/cache/typedetection.cxx
+++ b/filter/source/config/cache/typedetection.cxx
@@ -109,13 +109,16 @@ TypeDetection::~TypeDetection()
 namespace {
 
 /**
- * Types with matching extension come first, then types that are supported
- * by the document service come next.
+ * Types with matching pattern first, then extension, then types that are
+ * supported by the document service come next.
  */
 struct SortByPriority : public std::binary_function<FlatDetectionInfo, FlatDetectionInfo, bool>
 {
     bool operator() (const FlatDetectionInfo& r1, const FlatDetectionInfo& r2) const
     {
+        if (r1.bMatchByPattern != r2.bMatchByPattern)
+            return r1.bMatchByPattern;
+
         if (r1.bMatchByExtension != r2.bMatchByExtension)
             return r1.bMatchByExtension;
 
commit 57fc15f42303bca55a383ba681186320668d1c6b
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu May 24 21:14:40 2012 -0400

    Prioritize candidate types by extension first, then by document service.
    
    This unfortunately breaks plain text format detection for writer, but I'll
    get to that next.
    
    Change-Id: I70382529596dbc3e3af4935d6e98ad6d58bb4d91

diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx
index 0b7a887..cac9b14 100644
--- a/filter/source/config/cache/typedetection.cxx
+++ b/filter/source/config/cache/typedetection.cxx
@@ -106,7 +106,24 @@ TypeDetection::~TypeDetection()
     // <- SAFE
 }
 
+namespace {
 
+/**
+ * Types with matching extension come first, then types that are supported
+ * by the document service come next.
+ */
+struct SortByPriority : public std::binary_function<FlatDetectionInfo, FlatDetectionInfo, bool>
+{
+    bool operator() (const FlatDetectionInfo& r1, const FlatDetectionInfo& r2) const
+    {
+        if (r1.bMatchByExtension != r2.bMatchByExtension)
+            return r1.bMatchByExtension;
+
+        return r1.bPreselectedByDocumentService;
+    }
+};
+
+}
 
 ::rtl::OUString SAL_CALL TypeDetection::queryTypeByDescriptor(css::uno::Sequence< css::beans::PropertyValue >& lDescriptor,
                                                               sal_Bool                                         bAllowDeep )
@@ -155,6 +172,9 @@ TypeDetection::~TypeDetection()
     aLock.clear();
     // <- SAFE ----------------------------------
 
+    // Properly prioritize all candidate types.
+    lFlatTypes.sort(SortByPriority());
+
     ::rtl::OUString sType      ;
     ::rtl::OUString sLastChance;
 
commit 39a802411662f25e5b5142b486433f35cae81486
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Fri May 25 07:43:42 2012 +0200

    Drop unused function "findByTable"
    
    Change-Id: I396bd5a6eb9ecc123529259f668f98be4b4245ca

diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx
index f770deb..538ea9e 100644
--- a/sc/inc/dbdata.hxx
+++ b/sc/inc/dbdata.hxx
@@ -213,7 +213,6 @@ public:
         const_iterator end() const;
         const ScDBData* findAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bStartOnly) const;
         const ScDBData* findByRange(const ScRange& rRange) const;
-        const ScDBData* findByTable(SCTAB nTab) const;
         ScDBData* getByRange(const ScRange& rRange);
         void insert(ScDBData* p);
         void erase(iterator itr);
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index 60e6d28..32b15c7 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -808,13 +808,6 @@ const ScDBData* ScDBCollection::AnonDBs::findByRange(const ScRange& rRange) cons
     return itr == maDBs.end() ? NULL : &(*itr);
 }
 
-const ScDBData* ScDBCollection::AnonDBs::findByTable(SCTAB nTab) const
-{
-    DBsType::const_iterator itr = find_if(
-        maDBs.begin(), maDBs.end(), FindFilterDBByTable(nTab));
-    return itr == maDBs.end() ? NULL : &(*itr);
-}
-
 ScDBData* ScDBCollection::AnonDBs::getByRange(const ScRange& rRange)
 {
     const ScDBData* pData = findByRange(rRange);
diff --git a/unusedcode.easy b/unusedcode.easy
index 4ad7d19..11dec4a 100755
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -40,7 +40,6 @@ ScCompressedArray<int, unsigned short>::ScCompressedArray(int, unsigned short co
 ScCompressedArray<int, unsigned short>::SetValue(int, unsigned short const&)
 ScCsvControl::ScCsvControl(Window*, ScCsvLayoutData const&, long)
 ScDBCollection::AnonDBs::erase(boost::void_ptr_iterator<__gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<void**, std::__cxx1998::vector<void*, std::allocator<void*> > >, std::__debug::vector<void*, std::allocator<void*> > >, ScDBData>)
-ScDBCollection::AnonDBs::findByTable(short) const
 ScDPLabelData::ScDPLabelData(rtl::OUString const&, short, bool)
 ScHTMLColOffset::Insert(ScHTMLColOffset const*, unsigned short, unsigned short)
 ScHTMLColOffset::Insert(unsigned long const&, unsigned short&)
commit 7345b8428c99a2c46804993236de42abda734081
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri May 25 00:12:55 2012 +0200

    SwHistory::Move parameter nEnd was unused
    
    ... which is good because apparently the use of the non-default value
    has always been wrong, until the STL conversion fixed it by accident.

diff --git a/sw/source/core/inc/rolbck.hxx b/sw/source/core/inc/rolbck.hxx
index 0eb6efa..efb6f41 100644
--- a/sw/source/core/inc/rolbck.hxx
+++ b/sw/source/core/inc/rolbck.hxx
@@ -398,10 +398,10 @@ public:
 
     // for SwUndoDelete::Undo/Redo
     void Move( sal_uInt16 nPos, SwHistory *pIns,
-               sal_uInt16 nStart = 0, sal_uInt16 nEnd = USHRT_MAX )
+               sal_uInt16 const nStart = 0)
     {
         SwpHstry::iterator itSourceBegin = pIns->m_SwpHstry.begin() + nStart;
-        SwpHstry::iterator itSourceEnd = nEnd == USHRT_MAX ? pIns->m_SwpHstry.end() : pIns->m_SwpHstry.begin() + nEnd;
+        SwpHstry::iterator itSourceEnd = pIns->m_SwpHstry.end();
         std::copy( itSourceBegin, itSourceEnd, m_SwpHstry.begin() + nPos );
         pIns->m_SwpHstry.erase( itSourceBegin, itSourceEnd );
     }
commit ed18e0217f23f373b353b306d5b68aad0a1a3e66
Author: Noel Grandin <noel at peralex.com>
Date:   Thu May 24 09:51:14 2012 +0200

    Convert SV_DECL_PTRARR_DEL(SwpHstry) to std::vector
    
    Could not use boost::ptr_vector here because the code moves
    pointers around by hand.
    
    Change-Id: I60d19741ad08add18d99ee3b75e9dc3810d2c675

diff --git a/sw/source/core/inc/rolbck.hxx b/sw/source/core/inc/rolbck.hxx
index f030c23..0eb6efa 100644
--- a/sw/source/core/inc/rolbck.hxx
+++ b/sw/source/core/inc/rolbck.hxx
@@ -353,8 +353,11 @@ public:
 
 #endif
 
-typedef SwHistoryHint* SwHistoryHintPtr;
-SV_DECL_PTRARR_DEL( SwpHstry, SwHistoryHintPtr, 0 )
+class SwpHstry : public std::vector<SwHistoryHint*> {
+public:
+    // the destructor will free all objects still in the vector
+    ~SwpHstry();
+};
 
 class SwHistory
 {
@@ -386,8 +389,8 @@ public:
     void Add( const SwTxtFtn& );
     void Add( const SfxItemSet & rSet, const SwCharFmt & rCharFmt);
 
-    sal_uInt16 Count() const { return m_SwpHstry.Count(); }
-    sal_uInt16 GetTmpEnd() const { return m_SwpHstry.Count() - m_nEndDiff; }
+    sal_uInt16 Count() const { return m_SwpHstry.size(); }
+    sal_uInt16 GetTmpEnd() const { return m_SwpHstry.size() - m_nEndDiff; }
     sal_uInt16 SetTmpEnd( sal_uInt16 nTmpEnd );        // return previous value
     SwHistoryHint      * operator[]( sal_uInt16 nPos ) { return m_SwpHstry[nPos]; }
     SwHistoryHint const* operator[]( sal_uInt16 nPos ) const
@@ -397,10 +400,10 @@ public:
     void Move( sal_uInt16 nPos, SwHistory *pIns,
                sal_uInt16 nStart = 0, sal_uInt16 nEnd = USHRT_MAX )
     {
-        m_SwpHstry.Insert( &pIns->m_SwpHstry, nPos, nStart, nEnd );
-        pIns->m_SwpHstry.Remove( nStart, (nEnd == USHRT_MAX)
-                                            ? pIns->Count() - nStart
-                                            : nEnd );
+        SwpHstry::iterator itSourceBegin = pIns->m_SwpHstry.begin() + nStart;
+        SwpHstry::iterator itSourceEnd = nEnd == USHRT_MAX ? pIns->m_SwpHstry.end() : pIns->m_SwpHstry.begin() + nEnd;
+        std::copy( itSourceBegin, itSourceEnd, m_SwpHstry.begin() + nPos );
+        pIns->m_SwpHstry.erase( itSourceBegin, itSourceEnd );
     }
 
     // helper methods for recording attribute in History
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index 38e02bb..b0ca37d 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -69,8 +69,6 @@
 #include <undo.hrc>
 #include <bookmrk.hxx>
 
-SV_IMPL_PTRARR( SwpHstry, SwHistoryHintPtr)
-
 String SwHistoryHint::GetDescription() const
 {
     return String();
@@ -1015,9 +1013,11 @@ void SwHistoryChangeCharFmt::SetInDoc(SwDoc * pDoc, bool )
 
 
 SwHistory::SwHistory( sal_uInt16 nInitSz )
-    : m_SwpHstry( (sal_uInt8)nInitSz )
+    : m_SwpHstry()
     , m_nEndDiff( 0 )
-{}
+{
+    m_SwpHstry.reserve( (sal_uInt8)nInitSz );
+}
 
 
 SwHistory::~SwHistory()
@@ -1053,7 +1053,7 @@ void SwHistory::Add( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue,
     {
         pHt = new SwHistoryResetFmt( pNewValue, nNodeIdx );
     }
-    m_SwpHstry.Insert( pHt, Count() );
+    m_SwpHstry.push_back( pHt );
 }
 
 
@@ -1098,7 +1098,7 @@ void SwHistory::Add( SwTxtAttr* pHint, sal_uLong nNodeIdx, bool bNewAttr )
         pHt = new SwHistoryResetTxt( pHint->Which(), *pHint->GetStart(),
                                     *pHint->GetAnyEnd(), nNodeIdx );
     }
-    m_SwpHstry.Insert( pHt, Count() );
+    m_SwpHstry.push_back( pHt );
 }
 
 
@@ -1108,7 +1108,7 @@ void SwHistory::Add( SwFmtColl* pColl, sal_uLong nNodeIdx, sal_uInt8 nWhichNd )
 
     SwHistoryHint * pHt =
         new SwHistoryChangeFmtColl( pColl, nNodeIdx, nWhichNd );
-    m_SwpHstry.Insert( pHt, Count() );
+    m_SwpHstry.push_back( pHt );
 }
 
 
@@ -1117,14 +1117,14 @@ void SwHistory::Add(const ::sw::mark::IMark& rBkmk, bool bSavePos, bool bSaveOth
     OSL_ENSURE( !m_nEndDiff, "History was not deleted after REDO" );
 
     SwHistoryHint * pHt = new SwHistoryBookmark(rBkmk, bSavePos, bSaveOtherPos);
-    m_SwpHstry.Insert( pHt, Count() );
+    m_SwpHstry.push_back( pHt );
 }
 
 
 void SwHistory::Add( SwFrmFmt& rFmt )
 {
     SwHistoryHint * pHt = new SwHistoryChangeFlyAnchor( rFmt );
-    m_SwpHstry.Insert( pHt, Count() );
+    m_SwpHstry.push_back( pHt );
 }
 
 void SwHistory::Add( SwFlyFrmFmt& rFmt, sal_uInt16& rSetPos )
@@ -1136,7 +1136,7 @@ void SwHistory::Add( SwFlyFrmFmt& rFmt, sal_uInt16& rSetPos )
     if( RES_FLYFRMFMT == nWh || RES_DRAWFRMFMT == nWh )
     {
         pHint = new SwHistoryTxtFlyCnt( &rFmt );
-        m_SwpHstry.Insert( pHint, Count() );
+        m_SwpHstry.push_back( pHint );
 
         const SwFmtChain* pChainItem;
         if( SFX_ITEM_SET == rFmt.GetItemState( RES_CHAIN, sal_False,
@@ -1146,7 +1146,7 @@ void SwHistory::Add( SwFlyFrmFmt& rFmt, sal_uInt16& rSetPos )
             {
                 SwHistoryHint * pHt =
                     new SwHistoryChangeFlyChain( rFmt, *pChainItem );
-                m_SwpHstry.Insert( pHt, rSetPos++ );
+                m_SwpHstry.insert( m_SwpHstry.begin() + rSetPos++, pHt );
                 if ( pChainItem->GetNext() )
                 {
                     SwFmtChain aTmp( pChainItem->GetNext()->GetChain() );
@@ -1168,14 +1168,14 @@ void SwHistory::Add( SwFlyFrmFmt& rFmt, sal_uInt16& rSetPos )
 void SwHistory::Add( const SwTxtFtn& rFtn )
 {
     SwHistoryHint *pHt = new SwHistorySetFootnote( rFtn );
-    m_SwpHstry.Insert( pHt, Count() );
+    m_SwpHstry.push_back( pHt );
 }
 
 // #i27615#
 void SwHistory::Add(const SfxItemSet & rSet, const SwCharFmt & rFmt)
 {
     SwHistoryHint * pHt = new SwHistoryChangeCharFmt(rSet, rFmt.GetName());
-    m_SwpHstry.Insert(pHt, Count());
+    m_SwpHstry.push_back( pHt );
 }
 
 /*************************************************************************
@@ -1200,7 +1200,7 @@ bool SwHistory::Rollback( SwDoc* pDoc, sal_uInt16 nStart )
         pHHt->SetInDoc( pDoc, false );
         delete pHHt;
     }
-    m_SwpHstry.Remove( nStart, Count() - nStart );
+    m_SwpHstry.erase( m_SwpHstry.begin() + nStart, m_SwpHstry.end() );
     m_nEndDiff = 0;
     return true;
 }
@@ -1238,7 +1238,8 @@ void SwHistory::Delete( sal_uInt16 nStart )
 {
     for ( sal_uInt16 n = Count(); n > nStart; )
     {
-        m_SwpHstry.DeleteAndDestroy( --n, 1 );
+        delete m_SwpHstry[ --n ];
+        m_SwpHstry.erase( m_SwpHstry.begin() + n );
     }
     m_nEndDiff = 0;
 }
@@ -1404,7 +1405,7 @@ void SwRegHistory::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
                     pNewHstr = new SwHistoryResetFmt( pItem, m_nNodeIndex );
                 }
             }
-            m_pHistory->m_SwpHstry.Insert( pNewHstr, m_pHistory->Count() );
+            m_pHistory->m_SwpHstry.push_back( pNewHstr );
         }
     }
 }
@@ -1452,7 +1453,7 @@ bool SwRegHistory::InsertItems( const SfxItemSet& rSet,
                                     pTxtNode->GetIndex(), nStart, nEnd );
         // der NodeIndex kann verschoben sein !!
 
-        m_pHistory->m_SwpHstry.Insert( pNewHstr, m_pHistory->Count() );
+        m_pHistory->m_SwpHstry.push_back( pNewHstr );
     }
 
     return bInserted;
@@ -1506,4 +1507,10 @@ void SwRegHistory::_MakeSetWhichIds()
     }
 }
 
+SwpHstry::~SwpHstry()
+{
+    for(const_iterator it = begin(); it != end(); ++it)
+        delete *it;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 6fa2d1343cb21ae638d91e6d37d8f582f7ec7b71
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu May 24 22:42:46 2012 +0200

    SwCache: fix non-DBGUTIL memory leak in previous commit

diff --git a/sw/source/core/bastyp/swcache.cxx b/sw/source/core/bastyp/swcache.cxx
index adbcb94..c63afb5 100644
--- a/sw/source/core/bastyp/swcache.cxx
+++ b/sw/source/core/bastyp/swcache.cxx
@@ -70,9 +70,9 @@ void SwCache::Check()
         SAL_WARN_IF( pObj == pRekursive, "sw", "Recursion in SwCache." );
     }
     SAL_WARN_IF( !bFirstFound, "sw", "First not Found." );
-    SAL_WARN_IF( nCnt + aFreePositions.size() != Count(), "sw", "Lost Chain." );
+    SAL_WARN_IF( nCnt + aFreePositions.size() != size(), "sw", "Lost Chain." );
     SAL_WARN_IF(
-        Count() == nCurMax && nCurMax != aFreePositions.size() + nCnt, "sw",
+        size() == nCurMax && nCurMax != aFreePositions.size() + nCnt, "sw",
         "Lost FreePositions." );
 }
 #endif
@@ -119,9 +119,9 @@ SwCache::SwCache( const sal_uInt16 nInitSize
     m_aCacheObjects.reserve( (sal_uInt8)nInitSize );
 }
 
-#ifdef DBG_UTIL
 SwCache::~SwCache()
 {
+#ifdef DBG_UTIL
     {
         rtl::OStringBuffer sOut(m_aName);
 
@@ -182,11 +182,11 @@ SwCache::~SwCache()
         OSL_TRACE(sOut.getStr());
     }
     Check();
+#endif
 
     for(SwCacheObjArr::const_iterator it = m_aCacheObjects.begin(); it != m_aCacheObjects.end(); ++it)
         delete *it;
 }
-#endif
 
 /*************************************************************************
 |*  SwCache::Flush()
diff --git a/sw/source/core/inc/swcache.hxx b/sw/source/core/inc/swcache.hxx
index f4167da..5934c11 100644
--- a/sw/source/core/inc/swcache.hxx
+++ b/sw/source/core/inc/swcache.hxx
@@ -106,11 +106,11 @@ public:
     //nur sal_uInt8 hineinstecken!!!
 #ifdef DBG_UTIL
     SwCache( const sal_uInt16 nInitSize, const rtl::OString &rNm );
-    // the destructor will free all objects still in the vector
-    ~SwCache();
 #else
     SwCache( const sal_uInt16 nInitSize );
 #endif
+    // the destructor will free all objects still in the vector
+    ~SwCache();
 
     void Flush( const sal_uInt8 nPercent = 100 );
 
commit 5144461ce9a517dbe3cc63bde2a21ba9f9e68a3d
Author: Noel Grandin <noel at peralex.com>
Date:   Wed May 23 16:13:53 2012 +0200

    Inline SV_DECL_PTRARR_DEL(SwCacheObjArr) into a std::vector
    
    ..inside of the SwCache class.
    
    Change-Id: Ie8cf55c28a04d3776b99a8608880ac7a19f748b2

diff --git a/sw/source/core/bastyp/swcache.cxx b/sw/source/core/bastyp/swcache.cxx
index 9c0187f..adbcb94 100644
--- a/sw/source/core/bastyp/swcache.cxx
+++ b/sw/source/core/bastyp/swcache.cxx
@@ -30,8 +30,6 @@
 #include <swcache.hxx>
 #include <rtl/strbuf.hxx>
 
-SV_IMPL_PTRARR(SwCacheObjArr,SwCacheObj*);
-
 #ifdef DBG_UTIL
 #define INCREMENT( nVar )   ++nVar
 #else
@@ -95,7 +93,7 @@ SwCache::SwCache( const sal_uInt16 nInitSize
     , const rtl::OString &rNm
 #endif
     ) :
-    SwCacheObjArr( (sal_uInt8)nInitSize ),
+    m_aCacheObjects(),
     pRealFirst( 0 ),
     pFirst( 0 ),
     pLast( 0 ),
@@ -118,6 +116,7 @@ SwCache::SwCache( const sal_uInt16 nInitSize
     , m_nDecreaseMax( 0 )
 #endif
 {
+    m_aCacheObjects.reserve( (sal_uInt8)nInitSize );
 }
 
 #ifdef DBG_UTIL
@@ -183,6 +182,9 @@ SwCache::~SwCache()
         OSL_TRACE(sOut.getStr());
     }
     Check();
+
+    for(SwCacheObjArr::const_iterator it = m_aCacheObjects.begin(); it != m_aCacheObjects.end(); ++it)
+        delete *it;
 }
 #endif
 
@@ -225,7 +227,7 @@ void SwCache::Flush( const sal_uInt8 )
             pTmp = (SwCacheObj*)pObj;
             pObj = pTmp->GetNext();
             aFreePositions.push_back( pTmp->GetCachePos() );
-            *(pData + pTmp->GetCachePos()) = (void*)0;
+            m_aCacheObjects[pTmp->GetCachePos()] = NULL;
             delete pTmp;
             INCREMENT( m_nFlushedObjects );
         }
@@ -306,7 +308,7 @@ SwCacheObj *SwCache::Get( const void *pOwner, const sal_uInt16 nIndex,
                           const sal_Bool bToTop )
 {
     SwCacheObj *pRet;
-    if ( 0 != (pRet = nIndex < Count() ? operator[]( nIndex ) : 0) )
+    if ( 0 != (pRet = nIndex < m_aCacheObjects.size() ? m_aCacheObjects[ nIndex ] : 0) )
     {
         if ( !pRet->IsOwner( pOwner ) )
             pRet = 0;
@@ -377,23 +379,23 @@ void SwCache::DeleteObj( SwCacheObj *pObj )
         pObj->GetNext()->SetPrev( pObj->GetPrev() );
 
     aFreePositions.push_back( pObj->GetCachePos() );
-    *(pData + pObj->GetCachePos()) = (void*)0;
+    m_aCacheObjects[pObj->GetCachePos()] = NULL;
     delete pObj;
 
     CHECK;
-    if ( Count() > nCurMax &&
-         (nCurMax <= (Count() - aFreePositions.size())) )
+    if ( m_aCacheObjects.size() > nCurMax &&
+         (nCurMax <= (m_aCacheObjects.size() - aFreePositions.size())) )
     {
         //Falls moeglich wieder verkleinern, dazu muessen allerdings ausreichend
         //Freie Positionen bereitstehen.
         //Unangenehmer Nebeneffekt ist, das die Positionen verschoben werden
         //muessen, und die Eigentuemer der Objekte diese wahrscheinlich nicht
         //wiederfinden werden.
-        for ( sal_uInt16 i = 0; i < Count(); ++i )
+        for ( sal_uInt16 i = 0; i < m_aCacheObjects.size(); ++i )
         {
-            SwCacheObj *pTmpObj = operator[](i);
+            SwCacheObj *pTmpObj = m_aCacheObjects[i];
             if ( !pTmpObj )
-            {   SwCacheObjArr::Remove( i, 1 );
+            {   m_aCacheObjects.erase( m_aCacheObjects.begin() + i );
                 --i;
             }
             else
@@ -424,12 +426,12 @@ sal_Bool SwCache::Insert( SwCacheObj *pNew )
     OSL_ENSURE( !pNew->GetPrev() && !pNew->GetNext(), "New but not new." );
 
     sal_uInt16 nPos;//Wird hinter den if's zum setzen am Obj benutzt.
-    if ( Count() < nCurMax )
+    if ( m_aCacheObjects.size() < nCurMax )
     {
         //Es ist noch Platz frei, also einfach einfuegen.
         INCREMENT( m_nAppend );
-        nPos = Count();
-        SwCacheObjArr::C40_INSERT( SwCacheObj, pNew, nPos );
+        nPos = m_aCacheObjects.size();
+        m_aCacheObjects.push_back(pNew);
     }
     else if ( !aFreePositions.empty() )
     {
@@ -437,7 +439,7 @@ sal_Bool SwCache::Insert( SwCacheObj *pNew )
         INCREMENT( m_nInsertFree );
         const sal_uInt16 nFreePos = aFreePositions.size() - 1;
         nPos = aFreePositions[ nFreePos ];
-        *(pData + nPos) = pNew;
+        m_aCacheObjects[nPos] = pNew;
         aFreePositions.erase( aFreePositions.begin() + nFreePos );
     }
     else
@@ -468,7 +470,7 @@ sal_Bool SwCache::Insert( SwCacheObj *pNew )
                 pObj->GetNext()->SetPrev( pObj->GetPrev() );
         }
         delete pObj;
-        *(pData + nPos) = pNew;
+        m_aCacheObjects[nPos] = pNew;
     }
     pNew->SetCachePos( nPos );
 
@@ -502,12 +504,12 @@ sal_Bool SwCache::Insert( SwCacheObj *pNew )
 
 void SwCache::SetLRUOfst( const sal_uInt16 nOfst )
 {
-    if ( !pRealFirst || ((Count() - aFreePositions.size()) < nOfst) )
+    if ( !pRealFirst || ((m_aCacheObjects.size() - aFreePositions.size()) < nOfst) )
         return;
 
     CHECK;
     pFirst = pRealFirst;
-    for ( sal_uInt16 i = 0; i < Count() && i < nOfst; ++i )
+    for ( sal_uInt16 i = 0; i < m_aCacheObjects.size() && i < nOfst; ++i )
     {
         if ( pFirst->GetNext() && pFirst->GetNext()->GetNext() )
             pFirst = pFirst->GetNext();
diff --git a/sw/source/core/inc/swcache.hxx b/sw/source/core/inc/swcache.hxx
index 63995ea..f4167da 100644
--- a/sw/source/core/inc/swcache.hxx
+++ b/sw/source/core/inc/swcache.hxx
@@ -61,10 +61,10 @@
 
 class SwCacheObj;
 
-SV_DECL_PTRARR_DEL(SwCacheObjArr,SwCacheObj*,1)
-
-class SwCache : public SwCacheObjArr
+typedef std::vector<SwCacheObj*> SwCacheObjArr;
+class SwCache
 {
+    SwCacheObjArr m_aCacheObjects;
     std::vector<sal_uInt16> aFreePositions; //Freie Positionen fuer das Insert wenn
                                     //die Maximalgrenze nicht erreicht ist.
                                     //Immer wenn ein Objekt ausgetragen wird,
@@ -106,6 +106,7 @@ public:
     //nur sal_uInt8 hineinstecken!!!
 #ifdef DBG_UTIL
     SwCache( const sal_uInt16 nInitSize, const rtl::OString &rNm );
+    // the destructor will free all objects still in the vector
     ~SwCache();
 #else
     SwCache( const sal_uInt16 nInitSize );
@@ -133,6 +134,8 @@ public:
     inline SwCacheObj *First() { return pRealFirst; }
     inline SwCacheObj *Last()  { return pLast; }
     inline SwCacheObj *Next( SwCacheObj *pCacheObj);
+    inline SwCacheObj* operator[](sal_uInt16 nIndex) { return m_aCacheObjects[nIndex]; }
+    inline sal_uInt16 size() { return m_aCacheObjects.size(); }
 };
 
 //Cache-Manipulation auf die sichere Art.
diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx
index 40b4339..2c01b92 100644
--- a/sw/source/core/layout/newfrm.cxx
+++ b/sw/source/core/layout/newfrm.cxx
@@ -377,7 +377,7 @@ void _FrmFinit()
 {
 #if OSL_DEBUG_LEVEL > 0
     // The cache may only contain null pointers at this time.
-    for( sal_uInt16 n = SwFrm::GetCachePtr()->Count(); n; )
+    for( sal_uInt16 n = SwFrm::GetCachePtr()->size(); n; )
         if( (*SwFrm::GetCachePtr())[ --n ] )
         {
             SwCacheObj* pObj = (*SwFrm::GetCachePtr())[ n ];
commit 50c26a6241f332afbbdbe6e4a1546f181138a7ed
Author: Noel Grandin <noel at peralex.com>
Date:   Wed May 23 15:35:26 2012 +0200

    Convert SV_DECL_PTRARR(SwMovedBoxes) to std::vector
    
    Change-Id: I6df8a2929569ec0a2ee670002833b6a142d42318

diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index 5125207..2412d98 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -633,7 +633,7 @@ void MoveRow(SwDoc* pDoc, const FlatFndBox& rBox, sal_uInt16 nS, sal_uInt16 nT,
         // and move it
         MoveCell(pDoc, pS, pT, bMoved, pUD);
 
-        rMovedList.Insert(pS, rMovedList.Count() );
+        rMovedList.push_back(pS);
 
         if( pS != pT )
         {
@@ -679,7 +679,7 @@ void MoveCol(SwDoc* pDoc, const FlatFndBox& rBox, sal_uInt16 nS, sal_uInt16 nT,
         sal_Bool bMoved = rMovedList.GetPos(pT) != USHRT_MAX;
         MoveCell(pDoc, pS, pT, bMoved, pUD);
 
-        rMovedList.Insert(pS, rMovedList.Count() );
+        rMovedList.push_back(pS);
 
         if( pS != pT )
         {
@@ -977,4 +977,10 @@ const SfxItemSet* FlatFndBox::GetItemSet(sal_uInt16 n_Col, sal_uInt16 n_Row) con
     return ppItemSets ? *(ppItemSets + (n_Row * nCols + n_Col )) : 0;
 }
 
+sal_uInt16 SwMovedBoxes::GetPos(const SwTableBox* pTableBox) const
+{
+    const_iterator it = std::find(begin(), end(), pTableBox);
+    return it == end() ? USHRT_MAX : it - begin();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/inc/docsort.hxx b/sw/source/core/inc/docsort.hxx
index e3df48b..f91be1f 100644
--- a/sw/source/core/inc/docsort.hxx
+++ b/sw/source/core/inc/docsort.hxx
@@ -31,6 +31,7 @@
 
 #include <svl/svarray.hxx>
 #include <ndindex.hxx>
+#include <vector>
 
 
 class SwDoc;
@@ -54,10 +55,15 @@ namespace com { namespace sun { namespace star { namespace lang {
  --------------------------------------------------------------------*/
 typedef const _FndBox*      _FndBoxPtr;
 typedef SwSortElement*      SwSortElementPtr;
-typedef const SwTableBox*   SwMovedBoxPtr;
 
 SV_DECL_PTRARR_SORT(SwSortElements, SwSortElementPtr, 0)
-SV_DECL_PTRARR(SwMovedBoxes,        SwMovedBoxPtr, 10)
+
+class SwMovedBoxes : public std::vector<const SwTableBox*>
+{
+public:
+    sal_uInt16 GetPos(const SwTableBox* pTableBox) const;
+};
+
 
 /*--------------------------------------------------------------------
     Beschreibung: Funktionen zum Moven von Boxen
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 537c201..3a57a75 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2826,5 +2826,4 @@ void SwTableBox::ForgetFrmFmt()
         GetRegisteredInNonConst()->Remove(this);
 }
 
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/undo/unsort.cxx b/sw/source/core/undo/unsort.cxx
index 8712383..22c9be7 100644
--- a/sw/source/core/undo/unsort.cxx
+++ b/sw/source/core/undo/unsort.cxx
@@ -121,7 +121,7 @@ void SwUndoSort::UndoImpl(::sw::UndoRedoContext & rContext)
                      USHRT_MAX != aMovedList.GetPos(pSource) );
 
             // schon Verschobenen in der Liste merken
-            aMovedList.Insert(pTarget, aMovedList.Count() );
+            aMovedList.push_back(pTarget);
         }
 
         // Restore table frames:
@@ -197,7 +197,7 @@ void SwUndoSort::RedoImpl(::sw::UndoRedoContext & rContext)
             MoveCell(&rDoc, pSource, pTarget,
                      USHRT_MAX != aMovedList.GetPos( pTarget ) );
             // schon Verschobenen in der Liste merken
-            aMovedList.Insert( pSource, aMovedList.Count() );
+            aMovedList.push_back( pSource );
         }
 
         if( pUndoTblAttr )
commit 19ced6bf1437d74724dfd81387277b0cdf2448fe
Author: Noel Grandin <noel at peralex.com>
Date:   Wed May 23 15:01:34 2012 +0200

    Convert V_DECL_PTRARR_DEL(SwFlySaveArr) to std::vector
    
    I can't use boost::ptr_vector here because the code moves objects
    around with free'ing them.
    
    Change-Id: I42b8f347e2bac51bd63e2c42d6ebab2e7ad4b61c

diff --git a/sw/source/filter/rtf/rtffly.cxx b/sw/source/filter/rtf/rtffly.cxx
index 826cb7e..e31d4d3 100644
--- a/sw/source/filter/rtf/rtffly.cxx
+++ b/sw/source/filter/rtf/rtffly.cxx
@@ -75,8 +75,6 @@ using namespace ::com::sun::star;
 // steht in shellio.hxx
 extern SwCntntNode* GoNextNds( SwNodeIndex * pIdx, sal_Bool bChk );
 
-SV_IMPL_PTRARR( SwFlySaveArr, SwFlySave* )
-
 inline const SwFmtFrmSize GetFrmSize(const SfxItemSet& rSet, sal_Bool bInP=sal_True)
 {
     return (const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE,bInP);
@@ -226,7 +224,7 @@ void SwRTFParser::SetFlysInDoc()
     rtfFmtMap aPrevFmts;
 
     SwFrmFmt* pParent = pDoc->GetFrmFmtFromPool( RES_POOLFRM_FRAME );
-    for( sal_uInt16 n = 0; n < aFlyArr.Count(); ++n )
+    for( sal_uInt16 n = 0; n < aFlyArr.size(); ++n )
     {
         SwFlySave* pFlySave = aFlyArr[ n ];
 
@@ -276,7 +274,7 @@ void SwRTFParser::SetFlysInDoc()
 
         // liegt Ende und Start vom Naechsten im gleichen Node, dann muss
         // gesplittet werden
-        if( n + 1 < aFlyArr.Count() && pFlySave->nEndCnt &&
+        if( n + 1 < (sal_uInt16)aFlyArr.size() && pFlySave->nEndCnt &&
             pFlySave->nEndNd == aFlyArr[ n + 1 ]->nSttNd )
         {
             SwCntntNode *const pCNd = pFlySave->nEndNd.GetNode().GetCntntNode();
@@ -523,7 +521,7 @@ void SwRTFParser::SetFlysInDoc()
         }
     }
 
-    aFlyArr.Remove(0, aFlyArr.Count());
+    aFlyArr.clear();
 }
 
 // clips the text box to the min or max position if it is outside our min or max boundry
@@ -979,7 +977,7 @@ void SwRTFParser::ReadFly( int nToken, SfxItemSet* pSet )
     // ein neues FlyFormat anlegen oder das alte benutzen ?
     // (teste ob es die selben Attribute besitzt!)
     SwFlySave* pFlySave = 0;
-    sal_uInt16 nFlyArrCnt = aFlyArr.Count();
+    sal_uInt16 nFlyArrCnt = aFlyArr.size();
     /*
     #i5263#
     There were not enough frame properties found to actually justify creating
@@ -1007,7 +1005,8 @@ void SwRTFParser::ReadFly( int nToken, SfxItemSet* pSet )
                      pFlySavePrev->nEndNd=pFlySave->nSttNd;
                 }
             }
-            aFlyArr.Insert(  pFlySave, nFlyArrCnt++ );
+            aFlyArr.push_back( pFlySave );
+            nFlyArrCnt++;
             // #i83368# - reset
             mbReadCellWhileReadSwFly = false;
         }
@@ -1090,7 +1089,8 @@ void SwRTFParser::ReadFly( int nToken, SfxItemSet* pSet )
         !pPam->GetPoint()->nContent.GetIndex() )
     {
         // dann zerstoere den FlySave wieder.
-        aFlyArr.DeleteAndDestroy( --nFlyArrCnt );
+        delete aFlyArr[ --nFlyArrCnt ];
+        aFlyArr.erase( aFlyArr.begin() + nFlyArrCnt );
 
         // Remove the properties that have been parsed before in the paragraph
         GetAttrStack().pop_back();
@@ -1237,12 +1237,12 @@ void SwRTFParser::InsPicture( const String& rGrfNm, const Graphic* pGrf,
         if( pGrfAttrSet )
             pGrfNd->SetAttr( *pGrfAttrSet );
 
-        SwFlySave* pFlySave = aFlyArr[ aFlyArr.Count()-1 ];
+        SwFlySave* pFlySave = aFlyArr[ aFlyArr.size()-1 ];
         pFlySave->nSttNd = rIdx.GetIndex() - 1;
 
-        if( 1 < aFlyArr.Count() )
+        if( 1 < aFlyArr.size() )
         {
-            pFlySave = aFlyArr[ aFlyArr.Count() - 2 ];
+            pFlySave = aFlyArr[ aFlyArr.size() - 2 ];
             if( pFlySave->nEndNd == rIdx )
                 pFlySave->nEndNd = rIdx.GetIndex() - 1;
         }
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx
index 221b512..396de09 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -398,7 +398,7 @@ void SwRTFParser::Continue( int nToken )
         // ein am 1. Absatz verankerter Fly falsch eingefuegt
         if( SVPAR_ACCEPTED == eState )
         {
-            if( aFlyArr.Count() )
+            if( !aFlyArr.empty() )
                 SetFlysInDoc();
             pRelNumRule->SetOultineRelSpaces( *pSttNdIdx, pPam->GetPoint()->nNode );
         }
@@ -475,7 +475,7 @@ if( pSttNdIdx->GetIndex()+1 == pPam->GetBound( sal_False ).nNode.GetIndex() )
         for (rtfSections::myrDummyIter aI = maSegments.maDummyPageNos.rbegin(); aI != aDEnd; ++aI)
             pDoc->DelPageDesc(*aI);
 
-        if( aFlyArr.Count() )
+        if( !aFlyArr.empty() )
             SetFlysInDoc();
 
         // jetzt noch den letzten ueberfluessigen Absatz loeschen
@@ -1145,9 +1145,6 @@ SwRTFParser::~SwRTFParser()
     delete pPam;
     delete pRelNumRule;
 
-    if (aFlyArr.Count())
-        aFlyArr.DeleteAndDestroy( 0, aFlyArr.Count() );
-
     if (pGrfAttrSet)
         DELETEZ( pGrfAttrSet );
 }
@@ -3546,9 +3543,9 @@ void SwRTFParser::ReadHeaderFooter( int nToken, SwPageDesc* pPageDesc )
 
     // save the fly array - after read, all flys may be set into
     // the header/footer
-    SwFlySaveArr aSaveArray( 255 < aFlyArr.Count() ? aFlyArr.Count() : 255 );
-    aSaveArray.Insert( &aFlyArr, 0 );
-    aFlyArr.Remove( 0, aFlyArr.Count() );
+    SwFlySaveArr aSaveArray(aFlyArr);
+    aSaveArray.reserve(255);
+    aFlyArr.clear();
     sal_Bool bSetFlyInDoc = sal_True;
 
     const SwNodeIndex* pSttIdx = 0;
@@ -3665,7 +3662,7 @@ void SwRTFParser::ReadHeaderFooter( int nToken, SwPageDesc* pPageDesc )
         break;
     }
 
-    sal_uInt16 nOldFlyArrCnt = aFlyArr.Count();
+    sal_uInt16 nOldFlyArrCnt = aFlyArr.size();
     if( !pSttIdx )
         SkipGroup();
     else
@@ -3718,7 +3715,7 @@ void SwRTFParser::ReadHeaderFooter( int nToken, SwPageDesc* pPageDesc )
         }
 
         SetAllAttrOfStk();
-        if( aFlyArr.Count() && bSetFlyInDoc )
+        if( !aFlyArr.empty() && bSetFlyInDoc )
             SetFlysInDoc();
 
         // sollte der letze Node leer sein, dann loesche ihn
@@ -3730,12 +3727,13 @@ void SwRTFParser::ReadHeaderFooter( int nToken, SwPageDesc* pPageDesc )
     if( pTxtAttr && RES_TXTATR_FLYCNT == pTxtAttr->Which() )
     {
         // is add a new fly ?
-        if( nOldFlyArrCnt < aFlyArr.Count() )
+        if( nOldFlyArrCnt < aFlyArr.size() )
         {
-            SwFlySave* pFlySave = aFlyArr[ aFlyArr.Count()-1 ];
+            SwFlySave* pFlySave = aFlyArr.back();
             pFlySave->aFlySet.ClearItem( RES_ANCHOR );
             pHdFtFmt->SetFmtAttr( pFlySave->aFlySet );
-            aFlyArr.DeleteAndDestroy( aFlyArr.Count() - 1 );
+            delete aFlyArr.back();
+            aFlyArr.pop_back();
         }
         else
         {
@@ -3758,8 +3756,8 @@ void SwRTFParser::ReadHeaderFooter( int nToken, SwPageDesc* pPageDesc )
     mbIsFootnote = bOldIsFootnote;
     GetAttrStack() = aSaveStack;
 
-    aFlyArr.Insert( &aSaveArray, 0 );
-    aSaveArray.Remove( 0, aSaveArray.Count() );
+    std::copy(aSaveArray.begin(), aSaveArray.end(), aFlyArr.begin() );
+    aSaveArray.clear();
     bContainsPara = bContainsParaCache;
 }
 
diff --git a/sw/source/filter/rtf/swparrtf.hxx b/sw/source/filter/rtf/swparrtf.hxx
index feab408..ff9fa97 100644
--- a/sw/source/filter/rtf/swparrtf.hxx
+++ b/sw/source/filter/rtf/swparrtf.hxx
@@ -146,8 +146,19 @@ struct SwListEntry
                     bRuleUsed = sal_False; }
 };
 
-typedef SwFlySave* SwFlySavePtr;
-SV_DECL_PTRARR_DEL( SwFlySaveArr, SwFlySavePtr, 0 )
+class SwFlySaveArr : public std::vector<SwFlySave*>
+{
+public:
+    SwFlySaveArr() : vector() {}
+    SwFlySaveArr(const SwFlySaveArr& other) : vector(other) {}
+
+    ~SwFlySaveArr()
+    {
+        for(const_iterator it = begin(); it != end(); ++it)
+            delete *it;
+    }
+};
+
 typedef std::deque< SwListEntry > SwListArr;
 
 struct DocPageInformation
commit 29e36d6b525b32184e419fda3ea4313c085d0921
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu May 24 22:38:52 2012 +0200

    fix previous commit:
    
    erase in SwLabDlg::_ReplaceGroup should go until end()

diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx
index 2c6257c..25ca092 100644
--- a/sw/source/ui/envelp/label1.cxx
+++ b/sw/source/ui/envelp/label1.cxx
@@ -84,7 +84,7 @@ void SwLabRec::FillItem( SwLabItem& rItem ) const
 void SwLabDlg::_ReplaceGroup( const String &rMake )
 {
     // Remove old entries
-    pRecs->erase( pRecs->begin() + 1, pRecs->begin() + pRecs->size() - 1 );
+    pRecs->erase(pRecs->begin() + 1, pRecs->end());
     aLabelsCfg.FillLabels(rtl::OUString(rMake), *pRecs);
     aLstGroup = rMake;
 }
commit e9e14a738d5e739f981413387c1a472f66b93f9d
Author: Noel Grandin <noel at peralex.com>
Date:   Wed May 23 14:15:24 2012 +0200

    Convert SV_DECL_PTRARR_DEL(SwLabRecs) to std::vector
    
    I can't use boost::ptr_vector here because the code removes
    entries from the list without free'ing them.
    
    Change-Id: I1640d0bb97443998c02148ed24bbd6ad0d390234

diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx
index 72c2af3..2c6257c 100644
--- a/sw/source/ui/envelp/label1.cxx
+++ b/sw/source/ui/envelp/label1.cxx
@@ -52,8 +52,6 @@
 extern SW_DLLPUBLIC String MakeSender();
 
 
-SV_IMPL_PTRARR( SwLabRecs, SwLabRec* );
-
 void SwLabRec::SetFromItem( const SwLabItem& rItem )
 {
     lHDist  = rItem.lHDist;
@@ -86,7 +84,7 @@ void SwLabRec::FillItem( SwLabItem& rItem ) const
 void SwLabDlg::_ReplaceGroup( const String &rMake )
 {
     // Remove old entries
-    pRecs->Remove( 1, pRecs->Count() - 1 );
+    pRecs->erase( pRecs->begin() + 1, pRecs->begin() + pRecs->size() - 1 );
     aLabelsCfg.FillLabels(rtl::OUString(rMake), *pRecs);
     aLstGroup = rMake;
 }
@@ -154,10 +152,10 @@ SwLabDlg::SwLabDlg(Window* pParent, const SfxItemSet& rSet,
 
     sal_Bool bDouble = sal_False;
 
-    for (sal_uInt16 nRecPos = 0; nRecPos < pRecs->Count(); nRecPos++)
+    for (sal_uInt16 nRecPos = 0; nRecPos < pRecs->size(); nRecPos++)
     {
-        if (pRec->aMake == pRecs->GetObject(nRecPos)->aMake &&
-            pRec->aType == pRecs->GetObject(nRecPos)->aType)
+        if (pRec->aMake == (*pRecs)[nRecPos]->aMake &&
+            pRec->aType == (*pRecs)[nRecPos]->aType)
         {
             bDouble = sal_True;
             break;
@@ -165,7 +163,7 @@ SwLabDlg::SwLabDlg(Window* pParent, const SfxItemSet& rSet,
     }
 
     if (!bDouble)
-        pRecs->C40_INSERT( SwLabRec, pRec, 0 );
+        pRecs->insert( pRecs->begin(), pRec );
 
     sal_uInt16 nLstGroup = 0;
     const ::com::sun::star::uno::Sequence<rtl::OUString>& rMan = aLabelsCfg.GetManufacturers();
@@ -216,7 +214,7 @@ SwLabRec* SwLabDlg::GetRecord(const String &rRecName, sal_Bool bCont)
     sal_Bool bFound = sal_False;
     String sCustom(SW_RES(STR_CUSTOM));
 
-    const sal_uInt16 nCount = Recs().Count();
+    const sal_uInt16 nCount = Recs().size();
     for (sal_uInt16 i = 0; i < nCount; i++)
     {
         pRec = Recs()[i];
@@ -418,7 +416,7 @@ IMPL_LINK_NOARG(SwLabPage, MakeHdl)
     aItem.aLstMake = aMake;
 
     const sal_Bool   bCont    = aContButton.IsChecked();
-    const sal_uInt16 nCount   = GetParent()->Recs().Count();
+    const sal_uInt16 nCount   = GetParent()->Recs().size();
           sal_uInt16 nLstType = 0;
 
     const String sCustom(SW_RES(STR_CUSTOM));
diff --git a/sw/source/ui/envelp/labelcfg.cxx b/sw/source/ui/envelp/labelcfg.cxx
index 3ee9fe3..78f86a2 100644
--- a/sw/source/ui/envelp/labelcfg.cxx
+++ b/sw/source/ui/envelp/labelcfg.cxx
@@ -177,7 +177,7 @@ void    SwLabelConfig::FillLabels(const OUString& rManufacturer, SwLabRecs& rLab
         Sequence<OUString> aPropNames = lcl_CreatePropertyNames(sPrefix);
         Sequence<Any>   aValues = GetProperties(aPropNames);
         SwLabRec* pNewRec = lcl_CreateSwLabRec(aValues, rManufacturer);
-        rLabArr.C40_INSERT( SwLabRec, pNewRec, rLabArr.Count() );
+        rLabArr.push_back( pNewRec );
     }
 }
 
diff --git a/sw/source/ui/envelp/labimp.hxx b/sw/source/ui/envelp/labimp.hxx
index a20415e..bc004e1 100644
--- a/sw/source/ui/envelp/labimp.hxx
+++ b/sw/source/ui/envelp/labimp.hxx
@@ -83,6 +83,7 @@
 #include <svtools/svtreebx.hxx>
 #include <label.hxx>
 #include <labimg.hxx>
+#include <vector>
 
 #define GETFLDVAL(rField)         (rField).Denormalize((rField).GetValue(FUNIT_TWIP))
 #define SETFLDVAL(rField, lValue) (rField).SetValue((rField).Normalize(lValue), FUNIT_TWIP)
@@ -113,7 +114,14 @@ public:
 };
 
 
-SV_DECL_PTRARR_DEL( SwLabRecs, SwLabRec*, 110 )
+class SwLabRecs : public std::vector<SwLabRec*> {
+public:
+    ~SwLabRecs()
+    {
+        for(const_iterator it = begin(); it != end(); ++it)
+            delete *it;
+    }
+};
 
 #endif
 
commit 3c6506792a1caa5dfaeaa26ea7664c004b7a96ba
Author: Noel Grandin <noel at peralex.com>
Date:   Wed May 23 13:49:36 2012 +0200

    Convert SV_DECL_PTRARR_DEL(SwDSParamArr) to boost::ptr_vector
    
    Change-Id: I685a79cb14b0bb1d44d2013b3dd74150929cdf4b

diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx
index 313c34e..34fc0ae 100644
--- a/sw/inc/dbmgr.hxx
+++ b/sw/inc/dbmgr.hxx
@@ -39,6 +39,7 @@
 #include <com/sun/star/uno/Sequence.hxx>
 #include <com/sun/star/lang/Locale.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
 namespace com{namespace sun{namespace star{
     namespace sdbc{
         class XConnection;
@@ -144,8 +145,7 @@ struct SwDSParam : public SwDBData
                 bAfterSelection = sal_True;
         }
 };
-typedef SwDSParam* SwDSParamPtr;
-SV_DECL_PTRARR_DEL(SwDSParamArr, SwDSParamPtr, 0)
+typedef boost::ptr_vector<SwDSParam> SwDSParamArr;
 
 struct SwMergeDescriptor
 {
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 78f7e87..4d0aa72 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -1759,9 +1759,9 @@ void SwDoc::GetAllDBNames( std::vector<String>& rAllDBNames )
     SwNewDBMgr* pMgr = GetNewDBMgr();
 
     const SwDSParamArr& rArr = pMgr->GetDSParamArray();
-    for(sal_uInt16 i = 0; i < rArr.Count(); i++)
+    for(sal_uInt16 i = 0; i < rArr.size(); i++)
     {
-        SwDSParam* pParam = rArr[i];
+        const SwDSParam* pParam = &rArr[i];
         String* pStr = new String( pParam->sDataSource );
         (*pStr) += DB_DELIM;
         (*pStr) += (String)pParam->sCommand;
diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx
index 30d9fa6..eada5cc 100644
--- a/sw/source/ui/dbui/dbmgr.cxx
+++ b/sw/source/ui/dbui/dbmgr.cxx
@@ -152,7 +152,6 @@ using namespace ::com::sun::star::ui::dialogs;
 #define DB_SEP_RETURN   2
 #define DB_SEP_NEWLINE  3
 
-SV_IMPL_PTRARR(SwDSParamArr, SwDSParamPtr);
 const sal_Char cCursor[] = "Cursor";
 const sal_Char cCommand[] = "Command";
 const sal_Char cCommandType[] = "CommandType";
@@ -367,7 +366,7 @@ sal_Bool SwNewDBMgr::MergeNew(const SwMergeDescriptor& rMergeDesc )
         else
         {
             SwDSParam* pInsert = new SwDSParam(*pImpl->pMergeData);
-            aDataSourceParams.Insert(pInsert, aDataSourceParams.Count());
+            aDataSourceParams.push_back(pInsert);
             try
             {
                 uno::Reference<XComponent> xComponent(pInsert->xConnection, UNO_QUERY);
@@ -730,9 +729,9 @@ SwNewDBMgr::SwNewDBMgr() :
 
 SwNewDBMgr::~SwNewDBMgr()
 {
-    for(sal_uInt16 nPos = 0; nPos < aDataSourceParams.Count(); nPos++)
+    for(sal_uInt16 nPos = 0; nPos < aDataSourceParams.size(); nPos++)
     {
-        SwDSParam* pParam = aDataSourceParams[nPos];
+        SwDSParam* pParam = &aDataSourceParams[nPos];
         if(pParam->xConnection.is())
         {
             try
@@ -2070,9 +2069,9 @@ void    SwNewDBMgr::CloseAll(sal_Bool bIncludingMerge)
 {
     //the only thing done here is to reset the selection index
     //all connections stay open
-    for(sal_uInt16 nPos = 0; nPos < aDataSourceParams.Count(); nPos++)
+    for(sal_uInt16 nPos = 0; nPos < aDataSourceParams.size(); nPos++)
     {
-        SwDSParam* pParam = aDataSourceParams[nPos];
+        SwDSParam* pParam = &aDataSourceParams[nPos];
         if(bIncludingMerge || pParam != pImpl->pMergeData)
         {
             pParam->nSelectionIndex = 0;
@@ -2101,9 +2100,9 @@ SwDSParam* SwNewDBMgr::FindDSData(const SwDBData& rData, sal_Bool bCreate)
     }
 
     SwDSParam* pFound = 0;
-    for(sal_uInt16 nPos = aDataSourceParams.Count(); nPos; nPos--)
+    for(sal_uInt16 nPos = aDataSourceParams.size(); nPos; nPos--)
     {
-        SwDSParam* pParam = aDataSourceParams[nPos - 1];
+        SwDSParam* pParam = &aDataSourceParams[nPos - 1];
         if(rData.sDataSource == pParam->sDataSource &&
             rData.sCommand == pParam->sCommand &&
             (rData.nCommandType == -1 || rData.nCommandType == pParam->nCommandType ||
@@ -2123,7 +2122,7 @@ SwDSParam* SwNewDBMgr::FindDSData(const SwDBData& rData, sal_Bool bCreate)
         if(!pFound)
         {
             pFound = new SwDSParam(rData);
-            aDataSourceParams.Insert(pFound, aDataSourceParams.Count());
+            aDataSourceParams.push_back(pFound);
             try
             {
                 uno::Reference<XComponent> xComponent(pFound->xConnection, UNO_QUERY);
@@ -2146,9 +2145,9 @@ SwDSParam*  SwNewDBMgr::FindDSConnection(const rtl::OUString& rDataSource, sal_B
          return pImpl->pMergeData;
     }
     SwDSParam* pFound = 0;
-    for(sal_uInt16 nPos = 0; nPos < aDataSourceParams.Count(); nPos++)
+    for(sal_uInt16 nPos = 0; nPos < aDataSourceParams.size(); nPos++)
     {
-        SwDSParam* pParam = aDataSourceParams[nPos];
+        SwDSParam* pParam = &aDataSourceParams[nPos];
         if(rDataSource == pParam->sDataSource)
         {
             pFound = pParam;
@@ -2160,7 +2159,7 @@ SwDSParam*  SwNewDBMgr::FindDSConnection(const rtl::OUString& rDataSource, sal_B
         SwDBData aData;
         aData.sDataSource = rDataSource;
         pFound = new SwDSParam(aData);
-        aDataSourceParams.Insert(pFound, aDataSourceParams.Count());
+        aDataSourceParams.push_back(pFound);
         try
         {

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list