summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-08-21 21:53:52 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-08-21 22:07:39 -0400
commitba03f2dc817c692fa8709391ec83d8e01a0f8b28 (patch)
tree93415b497c5088d2302b9f9ad7f18c2eeb21d180
parent601bfe2ce3113719b2f8edaba2ccb6b630051a9a (diff)
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
-rw-r--r--filter/source/config/cache/constant.hxx1
-rw-r--r--filter/source/config/cache/filtercache.cxx1
-rw-r--r--filter/source/config/fragments/filters/Text.xcu1
-rw-r--r--filter/source/config/fragments/filters/Text___txt___csv__StarCalc_.xcu1
-rw-r--r--filter/source/config/fragments/filters/Text__encoded_.xcu1
-rw-r--r--officecfg/registry/schema/org/openoffice/TypeDetection/Filter.xcs3
-rw-r--r--sfx2/source/bastyp/fltfnc.cxx15
7 files changed, 20 insertions, 3 deletions
diff --git a/filter/source/config/cache/constant.hxx b/filter/source/config/cache/constant.hxx
index bd9d0639dd5e..22d1074df6a4 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 bab9201f4d7f..2a93c4f08fdb 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 4a703d3ac35c..0da24d7c4920 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 f15fe5a3b05e..a866ff10e699 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 a27c3c7cf5a1..af51016b1970 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 f87846f00c99..1de918a7ab49 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 4fe76029276b..b1c47238d7eb 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" )
{