filter/source/config/cache/constant.hxx                                |    1 
 filter/source/config/cache/filtercache.cxx                             |    1 
 filter/source/config/fragments/filters/Text.xcu                        |    1 
 filter/source/config/fragments/filters/Text___txt___csv__StarCalc_.xcu |    1 
 filter/source/config/fragments/filters/Text__encoded_.xcu              |    1 
 officecfg/registry/schema/org/openoffice/TypeDetection/Filter.xcs      |    3 
++
 sfx2/source/bastyp/fltfnc.cxx                                          |   15 
++++++++--
 7 files changed, 20 insertions(+), 3 deletions(-)

New commits:
commit ba03f2dc817c692fa8709391ec83d8e01a0f8b28
Author: Kohei Yoshida <kohei.yosh...@gmail.com>
Date:   Tue Aug 21 21:53:52 2012 -0400

    fdo#52451: Ensure that the extension for text is .txt from writer.
    
    Added a preferred extension property to the filter which overwrites
    one(s) given by the default file format type associated with it.
    
    Normally this property is not used for the majority of the filters,
    but for plain text filters, we need to use .txt when saving from
    writer whereas we do .csv from calc.
    
    Change-Id: I3453ad084e4379e5cc1101daeb9d2c3ddd919e92

diff --git a/filter/source/config/cache/constant.hxx 
b/filter/source/config/cache/constant.hxx
index bd9d063..22d1074 100644
--- a/filter/source/config/cache/constant.hxx
+++ b/filter/source/config/cache/constant.hxx
@@ -69,6 +69,7 @@
 #define  PROPNAME_USERDATA          "UserData"
 #define  PROPNAME_TEMPLATENAME      "TemplateName"
 #define  PROPNAME_FILEFORMATVERSION "FileFormatVersion"
+#define  PROPNAME_FILESAVEEXTENSION "FileSaveExtension"
 
 /** @short  used to identify a frame loader or detect service item
             property against the configuration API and can be used
diff --git a/filter/source/config/cache/filtercache.cxx 
b/filter/source/config/cache/filtercache.cxx
index bab9201..2a93c4f 100644
--- a/filter/source/config/cache/filtercache.cxx
+++ b/filter/source/config/cache/filtercache.cxx
@@ -1834,6 +1834,7 @@ CacheItem FilterCache::impl_loadItem(const 
css::uno::Reference< css::container::
                 aItem[PROPNAME_UICOMPONENT      ] = 
xItem->getByName(PROPNAME_UICOMPONENT      );
                 aItem[PROPNAME_FILTERSERVICE    ] = 
xItem->getByName(PROPNAME_FILTERSERVICE    );
                 aItem[PROPNAME_DOCUMENTSERVICE  ] = 
xItem->getByName(PROPNAME_DOCUMENTSERVICE  );
+                aItem[PROPNAME_FILESAVEEXTENSION] = 
xItem->getByName(PROPNAME_FILESAVEEXTENSION);
 
                 // special handling for flags! Convert it from a list of names 
to its
                 // int representation ...
diff --git a/filter/source/config/fragments/filters/Text.xcu 
b/filter/source/config/fragments/filters/Text.xcu
index 4a703d3..0da24d7 100644
--- a/filter/source/config/fragments/filters/Text.xcu
+++ b/filter/source/config/fragments/filters/Text.xcu
@@ -4,6 +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="FileSaveExtension"><value>*.txt</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>
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 f15fe5a..a866ff1 100644
--- a/filter/source/config/fragments/filters/Text___txt___csv__StarCalc_.xcu
+++ b/filter/source/config/fragments/filters/Text___txt___csv__StarCalc_.xcu
@@ -4,6 +4,7 @@
         <prop oor:name="FilterService"/>
         <prop oor:name="UserData"><value></value></prop>
         <prop oor:name="FileFormatVersion"><value>0</value></prop>
+        <prop oor:name="FileSaveExtension"><value>*.csv</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>
diff --git a/filter/source/config/fragments/filters/Text__encoded_.xcu 
b/filter/source/config/fragments/filters/Text__encoded_.xcu
index a27c3c7..af51016 100644
--- a/filter/source/config/fragments/filters/Text__encoded_.xcu
+++ b/filter/source/config/fragments/filters/Text__encoded_.xcu
@@ -4,6 +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="FileSaveExtension"><value>*.txt</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>
diff --git a/officecfg/registry/schema/org/openoffice/TypeDetection/Filter.xcs 
b/officecfg/registry/schema/org/openoffice/TypeDetection/Filter.xcs
index f87846f..1de918a 100644
--- a/officecfg/registry/schema/org/openoffice/TypeDetection/Filter.xcs
+++ b/officecfg/registry/schema/org/openoffice/TypeDetection/Filter.xcs
@@ -69,6 +69,9 @@
             <prop oor:name="UIName" oor:localized="true" oor:type="xs:string">
                 <info><desc>Localized name of the filter, whch can be shown at 
the UI.</desc></info>
             </prop>
+            <prop oor:name="FileSaveExtension" oor:type="xs:string" 
oor:nillable="true">
+                <info><desc>Extension to use when exporting content using this 
filter.  When this value is not given, it is inferred from the Type associated 
with this filter.</desc></info>
+            </prop>
                </group>
        </templates>
        <component>
diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx
index 4fe7602..b1c4723 100644
--- a/sfx2/source/bastyp/fltfnc.cxx
+++ b/sfx2/source/bastyp/fltfnc.cxx
@@ -979,6 +979,12 @@ void SfxFilterContainer::ReadSingleFilter_Impl(
             {
                 lFilterProperties[nFilterProperty].Value >>= sServiceName;
             }
+            else if (lFilterProperties[nFilterProperty].Name == 
"FileSaveExtension")
+            {
+                // Extension preferred by the filter.  This takes precedence
+                // over those that are given in the file format type.
+                lFilterProperties[nFilterProperty].Value >>= sExtension;
+            }
             else if ( lFilterProperties[nFilterProperty].Name == "Type" )
             {
                 lFilterProperties[nFilterProperty].Value >>= sType;
@@ -1015,9 +1021,12 @@ void SfxFilterContainer::ReadSingleFilter_Impl(
                         }
                         else if ( lTypeProperties[nTypeProperty].Name == 
"Extensions" )
                         {
-                            ::com::sun::star::uno::Sequence< ::rtl::OUString > 
lExtensions;
-                            lTypeProperties[nTypeProperty].Value >>= 
lExtensions;
-                            sExtension = implc_convertStringlistToString( 
lExtensions, ';', DEFINE_CONST_UNICODE("*.") );
+                            if (sExtension.isEmpty())
+                            {
+                                ::com::sun::star::uno::Sequence< 
::rtl::OUString > lExtensions;
+                                lTypeProperties[nTypeProperty].Value >>= 
lExtensions;
+                                sExtension = implc_convertStringlistToString( 
lExtensions, ';', DEFINE_CONST_UNICODE("*.") );
+                            }
                         }
                         else if ( lTypeProperties[nTypeProperty].Name == 
"URLPattern" )
                         {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to