[Libreoffice-commits] .: 3 commits - filter/Configuration_filter.mk filter/qa filter/source sfx2/source wizards/com
Kohei Yoshida
kohei at kemper.freedesktop.org
Tue May 22 11:37:27 PDT 2012
filter/Configuration_filter.mk | 6
filter/qa/complex/filter/detection/typeDetection/files.csv | 6
filter/source/config/cache/typedetection.cxx | 19
filter/source/config/cache/typedetection.hxx | 800 ++++------
filter/source/config/fragments/filters/HTML.xcu | 2
filter/source/config/fragments/filters/HTML_MasterDoc.xcu | 2
filter/source/config/fragments/filters/HTML__StarCalc_.xcu | 2
filter/source/config/fragments/filters/HTML__StarWriter_.xcu | 2
filter/source/config/fragments/filters/calc_HTML_WebQuery.xcu | 2
filter/source/config/fragments/filters/writerglobal8_HTML.xcu | 2
filter/source/config/fragments/types/generic_HTML.xcu | 12
filter/source/config/fragments/types/writer_web_HTML.xcu | 12
sfx2/source/dialog/filtergrouping.cxx | 2
sfx2/source/view/viewsh.cxx | 2
wizards/com/sun/star/wizards/web/data/CGDocument.java | 13
wizards/com/sun/star/wizards/web/data/CGDocument.py | 11
16 files changed, 446 insertions(+), 449 deletions(-)
New commits:
commit 3f76713dbfc4adef9966ba5afd3eaf6480854064
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue May 22 14:31:39 2012 -0400
Renamed writer_web_HTML to generic_HTML.
This should reflect the fact that this type was already used as a
generic HTML type.
Change-Id: I0a209d51ed229f07aff001075c39bfc82d4c3088
diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk
index 9c49027..01548f3 100644
--- a/filter/Configuration_filter.mk
+++ b/filter/Configuration_filter.mk
@@ -310,7 +310,7 @@ $(call filter_Configuration_add_ui_filters,fcfg_langpack,filter/source/config/fr
# fcfg_writer
$(call filter_Configuration_add_types,fcfg_langpack,fcfg_writer_types.xcu,filter/source/config/fragments/types,\
- writer_web_HTML \
+ generic_HTML \
writer_Lotus_1_2_3_10_DOS_StarWriter \
writer_Lotus_1_2_3_10_WIN_StarWriter \
calc_MS_Excel_40 \
@@ -396,7 +396,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,\
- writer_web_HTML \
+ generic_HTML \
writer_Text \
writer_web_HTML_help \
writer_StarOffice_XML_Writer \
@@ -457,7 +457,7 @@ $(call filter_Configuration_add_ui_filters,fcfg_langpack,filter/source/config/fr
# fcfg_calc
$(call filter_Configuration_add_types,fcfg_langpack,fcfg_calc_types.xcu,filter/source/config/fragments/types,\
calc_DIF \
- writer_web_HTML \
+ generic_HTML \
calc_Lotus \
calc_QPro \
calc_MS_Excel_40 \
diff --git a/filter/qa/complex/filter/detection/typeDetection/files.csv b/filter/qa/complex/filter/detection/typeDetection/files.csv
index 84b593f..eaad74e 100644
--- a/filter/qa/complex/filter/detection/typeDetection/files.csv
+++ b/filter/qa/complex/filter/detection/typeDetection/files.csv
@@ -28,7 +28,7 @@ Writer5_document;Writer/Writer5.sdw;writer_StarWriter_50;writer_StarWriter_50_Vo
Writer5_template;Writer/Writer5_template.vor;writer_StarWriter_50_VorlageTemplate;writer_StarWriter_50_VorlageTemplate
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;writer_web_HTML;writer_web_HTML
+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
@@ -66,11 +66,11 @@ Exel95_template;Calc/Excel5_template.XLT;calc_MS_Excel_5095;calc_MS_Excel_5095
Excel97_document;Calc/Excel97_2000_XP.xls;calc_MS_Excel_97;calc_MS_Excel_97
#Excel97_1dummy;Calc/Excel97_2000_XP.dummy;calc_MS_Excel_97;calc_MS_Excel_97
Excel97_template;Calc/Excel97_2000_XP.xlt;calc_MS_Excel_97;calc_MS_Excel_97
-Calc_html;Calc/HTML_Calc.html;writer_web_HTML;writer_web_HTML
+Calc_html;Calc/HTML_Calc.html;generic_HTML;generic_HTML
Lotus;Calc/Lotus.WK1;writer_Lotus_1_2_3_10_DOS_StarWriter;writer_Lotus_1_2_3_10_DOS_StarWriter
Calc_rtf;Calc/RTF_StarOffice_Calc.rtf;writer_Rich_Text_Format;writer_Rich_Text_Format
slk;Calc/SYLK.SLK;calc_SYLK;writer_Text_encoded:writer_Text_encoded
-Webpagequery;Calc/Webpagequery.html;writer_web_HTML;writer_web_HTML
+Webpagequery;Calc/Webpagequery.html;generic_HTML;generic_HTML
dbase;Calc/dbase.DBF;calc_dBase;writer_Text_encoded
######################################################
# D R A W
diff --git a/filter/source/config/fragments/filters/HTML.xcu b/filter/source/config/fragments/filters/HTML.xcu
index 853b32d..19c3412 100644
--- a/filter/source/config/fragments/filters/HTML.xcu
+++ b/filter/source/config/fragments/filters/HTML.xcu
@@ -4,7 +4,7 @@
<prop oor:name="FilterService"/>
<prop oor:name="UserData"><value>HTML</value></prop>
<prop oor:name="FileFormatVersion"><value>0</value></prop>
- <prop oor:name="Type"><value>writer_web_HTML</value></prop>
+ <prop oor:name="Type"><value>generic_HTML</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/HTML_MasterDoc.xcu b/filter/source/config/fragments/filters/HTML_MasterDoc.xcu
index edcec04..b17b501 100644
--- a/filter/source/config/fragments/filters/HTML_MasterDoc.xcu
+++ b/filter/source/config/fragments/filters/HTML_MasterDoc.xcu
@@ -1,6 +1,6 @@
<node oor:name="HTML_MasterDoc" oor:op="replace">
<prop oor:name="FileFormatVersion"><value>0</value></prop>
- <prop oor:name="Type"><value>writer_web_HTML</value></prop>
+ <prop oor:name="Type"><value>generic_HTML</value></prop>
<prop oor:name="DocumentService"><value>com.sun.star.text.GlobalDocument</value></prop>
<prop oor:name="UIComponent"/>
<prop oor:name="UserData"><value>HTML</value></prop>
diff --git a/filter/source/config/fragments/filters/HTML__StarCalc_.xcu b/filter/source/config/fragments/filters/HTML__StarCalc_.xcu
index 01d88c8..e4d3c6b 100644
--- a/filter/source/config/fragments/filters/HTML__StarCalc_.xcu
+++ b/filter/source/config/fragments/filters/HTML__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>writer_web_HTML</value></prop>
+ <prop oor:name="Type"><value>generic_HTML</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/filters/HTML__StarWriter_.xcu b/filter/source/config/fragments/filters/HTML__StarWriter_.xcu
index 285fb7d..412031d 100644
--- a/filter/source/config/fragments/filters/HTML__StarWriter_.xcu
+++ b/filter/source/config/fragments/filters/HTML__StarWriter_.xcu
@@ -4,7 +4,7 @@
<prop oor:name="FilterService"/>
<prop oor:name="UserData"><value>HTML</value></prop>
<prop oor:name="FileFormatVersion"><value>0</value></prop>
- <prop oor:name="Type"><value>writer_web_HTML</value></prop>
+ <prop oor:name="Type"><value>generic_HTML</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/calc_HTML_WebQuery.xcu b/filter/source/config/fragments/filters/calc_HTML_WebQuery.xcu
index cd9e434..e81ced8 100644
--- a/filter/source/config/fragments/filters/calc_HTML_WebQuery.xcu
+++ b/filter/source/config/fragments/filters/calc_HTML_WebQuery.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>writer_web_HTML</value></prop>
+ <prop oor:name="Type"><value>generic_HTML</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/filters/writerglobal8_HTML.xcu b/filter/source/config/fragments/filters/writerglobal8_HTML.xcu
index 65bfdb5..b381b76 100644
--- a/filter/source/config/fragments/filters/writerglobal8_HTML.xcu
+++ b/filter/source/config/fragments/filters/writerglobal8_HTML.xcu
@@ -4,7 +4,7 @@
<prop oor:name="FilterService"/>
<prop oor:name="UserData"><value>HTML</value></prop>
<prop oor:name="FileFormatVersion"><value>0</value></prop>
- <prop oor:name="Type"><value>writer_web_HTML</value></prop>
+ <prop oor:name="Type"><value>generic_HTML</value></prop>
<prop oor:name="TemplateName"/>
<prop oor:name="DocumentService"><value>com.sun.star.text.GlobalDocument</value></prop>
<prop oor:name="UIName">
diff --git a/filter/source/config/fragments/types/generic_HTML.xcu b/filter/source/config/fragments/types/generic_HTML.xcu
new file mode 100644
index 0000000..c0885f7
--- /dev/null
+++ b/filter/source/config/fragments/types/generic_HTML.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="generic_HTML" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.text.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"><value>private:factory/swriter/web*</value></prop>
+ <prop oor:name="Extensions"><value>html htm</value></prop>
+ <prop oor:name="MediaType"><value>text/html</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>HTML</value></prop>
+ <prop oor:name="UIName">
+ <value>HTML Document</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_web_HTML.xcu b/filter/source/config/fragments/types/writer_web_HTML.xcu
deleted file mode 100644
index a1d9a09..0000000
--- a/filter/source/config/fragments/types/writer_web_HTML.xcu
+++ /dev/null
@@ -1,12 +0,0 @@
- <node oor:name="writer_web_HTML" oor:op="replace" >
- <prop oor:name="DetectService"><value>com.sun.star.text.FormatDetector</value></prop>
- <prop oor:name="URLPattern"><value>private:factory/swriter/web*</value></prop>
- <prop oor:name="Extensions"><value>html htm</value></prop>
- <prop oor:name="MediaType"><value>text/html</value></prop>
- <prop oor:name="Preferred"><value>false</value></prop>
- <prop oor:name="PreferredFilter"><value>HTML</value></prop>
- <prop oor:name="UIName">
- <value>HTML Document</value>
- </prop>
- <prop oor:name="ClipboardFormat"/>
- </node>
diff --git a/sfx2/source/dialog/filtergrouping.cxx b/sfx2/source/dialog/filtergrouping.cxx
index 25f7a39..e91c512 100644
--- a/sfx2/source/dialog/filtergrouping.cxx
+++ b/sfx2/source/dialog/filtergrouping.cxx
@@ -999,7 +999,7 @@ namespace sfx2
std::vector< ExportFilter > aFilterGroup;
Reference< XFilterGroupManager > xFilterGroupManager( _rxFilterManager, UNO_QUERY );
::rtl::OUString sTypeName;
- const ::rtl::OUString sWriterHTMLType( DEFINE_CONST_OUSTRING("writer_web_HTML") );
+ const ::rtl::OUString sWriterHTMLType( DEFINE_CONST_OUSTRING("generic_HTML") );
const ::rtl::OUString sGraphicHTMLType( DEFINE_CONST_OUSTRING("graphic_HTML") );
const ::rtl::OUString sXHTMLType( DEFINE_CONST_OUSTRING("XHTML_File") );
const ::rtl::OUString sPDFType( DEFINE_CONST_OUSTRING("pdf_Portable_Document_Format") );
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index d4cb20b..6b6b067 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -607,7 +607,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
case SID_WEBHTML:
{
- static const char HTML_DOCUMENT_TYPE[] = "writer_web_HTML";
+ static const char HTML_DOCUMENT_TYPE[] = "generic_HTML";
static const char HTML_GRAPHIC_TYPE[] = "graphic_HTML";
const sal_Int32 FILTERFLAG_EXPORT = 0x00000002;
diff --git a/wizards/com/sun/star/wizards/web/data/CGDocument.java b/wizards/com/sun/star/wizards/web/data/CGDocument.java
index 1eed684..7f30bac 100644
--- a/wizards/com/sun/star/wizards/web/data/CGDocument.java
+++ b/wizards/com/sun/star/wizards/web/data/CGDocument.java
@@ -264,16 +264,13 @@ public class CGDocument extends ConfigSetItem implements XMLProvider
{
return TypeDetection.NO_TYPE;
}
+ if (media.startsWith("generic_HTML"))
+ {
+ return TypeDetection.HTML_DOC;
+ }
if (media.startsWith("writer"))
{
- if (media.startsWith("writer_web_HTML"))
- {
- return TypeDetection.HTML_DOC;
- }
- else
- {
- return TypeDetection.WRITER_DOC;
- }
+ return TypeDetection.WRITER_DOC;
}
else if (media.startsWith("calc"))
{
diff --git a/wizards/com/sun/star/wizards/web/data/CGDocument.py b/wizards/com/sun/star/wizards/web/data/CGDocument.py
index 11f6dae..a5a4163 100644
--- a/wizards/com/sun/star/wizards/web/data/CGDocument.py
+++ b/wizards/com/sun/star/wizards/web/data/CGDocument.py
@@ -153,13 +153,10 @@ class CGDocument(ConfigGroup):
def getDocType(self, media):
if media == "":
return NO_TYPE
-
- if media.startswith("writer"):
- if media.startswith("writer_web_HTML"):
- return HTML_DOC
- else:
- return WRITER_DOC
-
+ elif media.startswith("generic_HTML"):
+ return HTML_DOC
+ elif media.startswith("writer"):
+ return WRITER_DOC
elif media.startswith("calc"):
return CALC_DOC
elif media.startswith("draw"):
commit 552bebe6fa27fa58d07d87283a4b24e6052ab3d4
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue May 22 12:55:22 2012 -0400
When the caller specifies filter type, stick to it and don't overwrite it.
Change-Id: I35a3efc506bbcc33ea4c3d2466929f8227dae102
diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx
index 5b57dc9..47a06e1 100644
--- a/filter/source/config/cache/typedetection.cxx
+++ b/filter/source/config/cache/typedetection.cxx
@@ -143,9 +143,18 @@ TypeDetection::~TypeDetection()
css::uno::Reference< css::util::XURLTransformer > xParser(m_xSMGR->createInstance(SERVICE_URLTRANSFORMER), css::uno::UNO_QUERY);
xParser->parseStrict(aURL);
- //*******************************************
- // preselected filter, type or document service?
- // use it as first "flat" detected type later!
+ rtl::OUString aSelectedFilter = stlDescriptor.getUnpackedValueOrDefault(
+ comphelper::MediaDescriptor::PROP_FILTERNAME(), rtl::OUString());
+ if (!aSelectedFilter.isEmpty())
+ {
+ // Caller specified the filter type. Honor it. Just get the default
+ // type for that filter, and bail out.
+ if (impl_validateAndSetFilterOnDescriptor(stlDescriptor, aSelectedFilter))
+ return stlDescriptor[comphelper::MediaDescriptor::PROP_TYPENAME()].get<rtl::OUString>();
+ }
+
+ // preselected type or document service? use it as first "flat" detected
+ // type later!
FlatDetection lFlatTypes;
impl_getPreselection(aURL, stlDescriptor, lFlatTypes);
@@ -682,10 +691,6 @@ void TypeDetection::impl_getPreselection(const css::util::URL& aP
if (!sSelectedType.isEmpty())
impl_getPreselectionForType(sSelectedType, aParsedURL, rFlatTypes);
- ::rtl::OUString sSelectedFilter = rDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_FILTERNAME(), ::rtl::OUString());
- if (!sSelectedFilter.isEmpty())
- impl_getPreselectionForFilter(sSelectedFilter, aParsedURL, rFlatTypes);
-
::rtl::OUString sSelectedDoc = rDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_DOCUMENTSERVICE(), ::rtl::OUString());
if (!sSelectedDoc.isEmpty())
impl_getPreselectionForDocumentService(sSelectedDoc, aParsedURL, rFlatTypes);
commit e5ace9ef5a0035e0fa1970903c056015aea81025
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue May 22 12:05:44 2012 -0400
Reduce indentation.
Change-Id: Ie335ee44a347ab588dbf6cdeb38ef19246c1ad47
diff --git a/filter/source/config/cache/typedetection.hxx b/filter/source/config/cache/typedetection.hxx
index c7a18ef..c55d0c4 100644
--- a/filter/source/config/cache/typedetection.hxx
+++ b/filter/source/config/cache/typedetection.hxx
@@ -40,8 +40,7 @@
//_______________________________________________
// namespace
-namespace filter{
- namespace config{
+namespace filter{ namespace config {
namespace css = ::com::sun::star;
@@ -55,407 +54,406 @@ namespace css = ::com::sun::star;
class TypeDetection : public ::cppu::ImplInheritanceHelper1< BaseContainer ,
css::document::XTypeDetection >
{
- //-------------------------------------------
- // native interface
-
- public:
-
- //---------------------------------------
- // ctor/dtor
-
- /** @short standard ctor to connect this interface wrapper to
- the global filter cache instance ...
-
- @param xSMGR
- reference to the uno service manager, which created this service instance.
- */
- TypeDetection(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
-
- //---------------------------------------
-
- /** @short standard dtor.
- */
- virtual ~TypeDetection();
-
- //-------------------------------------------
- // private helper
-
- private:
-
- //---------------------------------------
- /** TODO document me */
- sal_Bool impl_getPreselectionForType(const ::rtl::OUString& sPreSelType,
- const css::util::URL& aParsedURL ,
- FlatDetection& rFlatTypes );
-
- //---------------------------------------
- /** TODO document me */
- sal_Bool impl_getPreselectionForFilter(const ::rtl::OUString& sPreSelFilter,
- const css::util::URL& aParsedURL ,
- FlatDetection& rFlatTypes );
-
- //---------------------------------------
- /** TODO document me */
- sal_Bool impl_getPreselectionForDocumentService(const ::rtl::OUString& sPreSelDocumentService,
- const css::util::URL& aParsedURL ,
- FlatDetection& rFlatTypes );
-
- //---------------------------------------
-
- /** @short check if a filter or a type was preselected inside the given
- MediaDescriptor and validate this information.
-
- @descr Only in case the preselected filter exists and its type registration
- seems to be usefully, it would be used realy as valid type detection
- result. This method doesnt make any deep detection here. It checks only
- if the preselection match to the URL by an URLPattern.
- This information has to be added to the given rFlatTypes list too.
- The outside code can use it to supress a deep detection then in general.
- Because pattern are defined as non detectable at all!
-
- @param pDescriptor
- provides any easy-to-use stl interface to the MediaDescriptor.
- Note : Its content will be adapted to returned result of this method.
- Means: The type/filter entries of it will be actualized or removed.
-
- @param rFlatTypes
- the preselected type (or the registered type of a preselected filter)
- will be added here as first(!) element. Further we have to provide the
- information, if this type match to the given URL by its URLPattern
- registration.
- */
- void impl_getPreselection(const css::util::URL& aParsedURL ,
- ::comphelper::MediaDescriptor& rDescriptor,
- FlatDetection& rFlatTypes );
-
- //---------------------------------------
-
- /** @short make a combined flat/deep type detection
-
- @descr It steps over all flat detected types (given by the parameter lFlatTypes),
- try it and search for most suitable one.
- The specified MediaDescriptor will be patched, so it contain
- the right values everytime. Using of any deep detection service
- can be enabled/disabled. And last but not least: If the results
- wont be realy clear (because a flat detected type has no deep
- detection service), a "sugested" type name will be returned as "rLastChance".
- It can be used after e.g. all well known deep detection services
- was used without getting any result. Then this "last-chance-type"
- should be returned. Of course using of it can fail too ... but its a try :-)
-
- As an optimization - this method collects the names of all used deep
- detection services. This information can be usefull inside the may be
- afterwards called method "impl_detectTypeDeepOnly()"!
-
- @param rDescriptor
- provides any easy-to-use stl interface to the MediaDescriptor.
- Note : Its content will be adapted to returned result of this method.
- Means: The type/filter entries of it will be actualized or removed from it.
-
- @param lFlatTypes
- a list of all flat detected types, which should be checked here.
- No other types are allowed here!
-
- @param rLastChance
- the internal name of a "suggested type" ... (see before)
- Note: it will be reseted to an empty string everytimes. So
- a set value of "rLastChance" can be detected outside very easy.
-
- @param rUsedDetectors
- used as [out] parameter. It contains a list of names of all deep
- detection services, which was used inside this method.
- Such detectors can be ignored later if "impl_detectTypeDeepOnly()"
- is called.
-
- @param bAllowDeep
- enable/disable using of a might existing deep detection service.
-
- @return The internal name of a detected type.
- An empty value if detection failed. .... but see rLastChance
- for additional returns!
- */
- ::rtl::OUString impl_detectTypeFlatAndDeep( ::comphelper::MediaDescriptor& rDescriptor ,
- const FlatDetection& lFlatTypes ,
- sal_Bool bAllowDeep ,
- OUStringList& rUsedDetectors,
- ::rtl::OUString& rLastChance );
-
- //---------------------------------------
-
- /** @short make a deep type detection only
-
- @descr It steps over all well known deep detection services
- and check her results. The first positive result will be
- used for return. Its more a "try and error" algorithm then
- a real type detection and will be used if a flat detection
- cant work realy ... e.g. if the extension of an URL is
- missing or wrong.
-
- @param rDescriptor
- provides any easy-to-use stl interface to the MediaDescriptor.
- Note : Its content will be adapted to returned result of this method.
- Means: The type/filter entries of it will be actualized or removed from it.
-
- @param rUsedDetectors
- It contains a list of names of all deep detection services,
- which was already used inside the method "impl_detectTypeFlatAndDeep()"!
- Such detectors must be ignored here!
-
- @return The internal name of a detected type.
- An empty value if detection failed.
- */
- ::rtl::OUString impl_detectTypeDeepOnly( ::comphelper::MediaDescriptor& rDescriptor ,
- const OUStringList& rUsedDetectors);
-
- //---------------------------------------
-
- /** @short seek a might existing stream to position 0.
-
- @descr This is an optinal action to be more robust
- in case any detect service doesnt make this seek ...
- Normaly it's part of any called detect service or filter ...
- but sometimes it's not done there.
-
- @param rDescriptor
- a stl representation of the MediaDescriptor as in/out parameter.
- */
- void impl_seekStreamToZero(comphelper::MediaDescriptor& rDescriptor);
-
- //---------------------------------------
-
- /** @short make deep type detection for a specified
- detect service (threadsafe!).
-
- @descr It creates the right uno service, prepare the
- needed MediaDescriptor, call ths right interfaces,
- and return the results.
-
- @attention The results (means type and corresponding filter)
- are already part of the in/out parameter pDescriptor.
- (in case they was valid).
-
- @param sDetectService
- uno service name of the detect service.
-
- @param rDescriptor
- a stl representation of the MediaDescriptor as in/out parameter.
- */
- ::rtl::OUString impl_askDetectService(const ::rtl::OUString& sDetectService,
- ::comphelper::MediaDescriptor& rDescriptor );
-
- //---------------------------------------
-
- /** @short try to find an interaction handler and
- ask him to select a possible filter for
- this unknown format.
-
- @descr If the user select a filter, it will be used as return value
- without further checking against the given file content!
-
- @param rDescriptor
- a stl representation of the MediaDescriptor as in/out parameter.
-
- @return [string]
- a valid type name or an empty string if user canceled interaction.
- */
- ::rtl::OUString impl_askUserForTypeAndFilterIfAllowed(::comphelper::MediaDescriptor& rDescriptor);
-
- //---------------------------------------
-
- /** @short check if an input stream is already part of the
- given MediaDesciptor and creates a new one if neccessary.
-
- @attention This method does further something special!
- <ul>
- <li>
- If the given URL seem to be a streamable content, but creation of the stream
- failed (might by an IOException), this method throws an exception.
- (May be an existing interaction handler must be called here too ...)
- The whole detection must be interrupted then and the interface method queryTypeByDescriptor()
- must return an empty type name value.
-
- That prevent us against multiple handling of the same error more then ones
- (e.g. if we ask all detect services as fallback ...).
- </li>
- <li>
- In case the stream already exists inside the descriptor this method does nothing.
- </li>
- <li>
- In case the stream does not exists but can be created successfully, the stream will
- be added to the descriptor.
- </li>
- </ul>
-
- @param rDescriptor
- provides any easy-to-use stl interface to the MediaDescriptor.
- Note : Its content will be adapted to returned result of this method.
- Means: The stream will be added to it.
-
- @throw Any suitable exception if stream should be opened but operation was not sucessfull.
- Note: If an interactionHandler is part of the given descriptor too, it was already used.
- Means: let the exception pass trough the top most interface method!
- */
- void impl_openStream(::comphelper::MediaDescriptor& rDescriptor)
- throw (css::uno::Exception);
-
- //---------------------------------------
-
- /** @short validate the specified type and its relation ships
- and set all needed informations related to this type
- in the specified descriptor.
-
- @descr Related informations are: - corresponding filter
- - media type
- - ...
-
- @param rDescriptor
- provides access to the outside MediaDescriptor.
-
- @param sType
- the name of the type, which should be set on the descriptor.
- Can be empty to remove any related value from the descriptor!
-
- @return TRUE the specified type and its registrations was valid(!) and
- could be set on the descriptor.
- */
- sal_Bool impl_validateAndSetTypeOnDescriptor( ::comphelper::MediaDescriptor& rDescriptor,
- const ::rtl::OUString& sType );
-
- //---------------------------------------
-
- /** @short validate the specified filter and its relation ships
- and set all needed informations related to this filter
- in the specified descriptor.
-
- @descr Related informations are: - corresponding type
- - ...
-
- @param rDescriptor
- provides access to the outside MediaDescriptor.
-
- @param sFilter
- the name of the filter, which should be set on the descriptor.
- Can be empty to remove any related value from the descriptor!
-
- @return TRUE the specified type and its registrations was valid(!) and
- could be set on the descriptor.
- */
- sal_Bool impl_validateAndSetFilterOnDescriptor( ::comphelper::MediaDescriptor& rDescriptor,
- const ::rtl::OUString& sFilter );
-
- //---------------------------------------
-
- /** @short remove anythimng related to a TYPE/FILTER entry from the
- specified MediaDescriptor.
-
- @descr This method works together with impl_validateAndSetTypeOnDescriptor()/
- impl_validateAndSetFilterOnDescriptor(). All informations, which can be
- set by these two operations must be "removable" by this method.
-
- @param rDescriptor
- reference to the MediaDescriptor (represented by an easy-to-use
- stl interface!), which should be patched.
- */
- void impl_removeTypeFilterFromDescriptor(::comphelper::MediaDescriptor& rDescriptor);
-
- //---------------------------------------
-
- /** @short search the best suitable filter for the given type
- and add it into the media descriptor.
-
- @descr Normaly this is a type detection only ...
- but for some special features we must overwrite our detection
- because a file must be loaded into a special (means preselected)
- application.
-
- E.g. CSV/TXT format are sometimes ugly to handle .-)
-
- Note: If the descriptor already include a filter
- (may be selected by a FilterSelect interaction or preselected
- by the user itself) ... we dont change that here !
-
- @param rDescriptor
- reference to the MediaDescriptor (represented by an easy-to-use
- stl interface!), which should be patched.
-
- @param sType
- the internal type name, where we search a filter for.
- Used as IN/OUT parameter so we can overrule the detection result for
- types too !
-
- @note #i60158#
- sometimes our text ascii and our csv filter cant work together.
- Then we overwrite our detection hardly.
- sType param is used as out parameter then too ... and
- rDescriptor will be changed by selecting another filter.
- (see code)
- */
- void impl_checkResultsAndAddBestFilter(::comphelper::MediaDescriptor& rDescriptor,
- ::rtl::OUString& sType );
-
- //-------------------------------------------
- // uno interface
-
- public:
-
- //---------------------------------------
- // XTypeDetection
-
- virtual ::rtl::OUString SAL_CALL queryTypeByURL(const ::rtl::OUString& sURL)
- throw (css::uno::RuntimeException);
-
- virtual ::rtl::OUString SAL_CALL queryTypeByDescriptor(css::uno::Sequence< css::beans::PropertyValue >& lDescriptor,
- sal_Bool bAllowDeep )
- throw (css::uno::RuntimeException);
-
- //-------------------------------------------
- // static uno helper!
-
- public:
-
- //---------------------------------------
-
- /** @short return the uno implementation name of this class.
-
- @descr Because this information is used at several places
- (and mostly an object instance of this class is not possible)
- its implemented as a static function!
-
- @return The fix uno implementation name of this class.
- */
- static ::rtl::OUString impl_getImplementationName();
-
- //---------------------------------------
-
- /** @short return the list of supported uno services of this class.
-
- @descr Because this information is used at several places
- (and mostly an object instance of this class is not possible)
- its implemented as a static function!
-
- @return The fix list of uno services supported by this class.
- */
- static css::uno::Sequence< ::rtl::OUString > impl_getSupportedServiceNames();
-
- //---------------------------------------
-
- /** @short return a new intsnace of this class.
-
- @descr This method is used by the uno service manager, to create
- a new instance of this service if needed.
-
- @param xSMGR
- reference to the uno service manager, which require
- this new instance. It should be passed to the new object
- so it can be used internaly to create own needed uno resources.
-
- @return The new instance of this service as an uno reference.
- */
- static css::uno::Reference< css::uno::XInterface > impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
+//-------------------------------------------
+// native interface
+
+public:
+
+ //---------------------------------------
+ // ctor/dtor
+
+ /** @short standard ctor to connect this interface wrapper to
+ the global filter cache instance ...
+
+ @param xSMGR
+ reference to the uno service manager, which created this service instance.
+ */
+ TypeDetection(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
+
+ //---------------------------------------
+
+ /** @short standard dtor.
+ */
+ virtual ~TypeDetection();
+
+//-------------------------------------------
+// private helper
+
+private:
+
+ //---------------------------------------
+ /** TODO document me */
+ sal_Bool impl_getPreselectionForType(const ::rtl::OUString& sPreSelType,
+ const css::util::URL& aParsedURL ,
+ FlatDetection& rFlatTypes );
+
+ //---------------------------------------
+ /** TODO document me */
+ sal_Bool impl_getPreselectionForFilter(const ::rtl::OUString& sPreSelFilter,
+ const css::util::URL& aParsedURL ,
+ FlatDetection& rFlatTypes );
+
+ //---------------------------------------
+ /** TODO document me */
+ sal_Bool impl_getPreselectionForDocumentService(const ::rtl::OUString& sPreSelDocumentService,
+ const css::util::URL& aParsedURL ,
+ FlatDetection& rFlatTypes );
+
+ //---------------------------------------
+
+ /** @short check if a filter or a type was preselected inside the given
+ MediaDescriptor and validate this information.
+
+ @descr Only in case the preselected filter exists and its type registration
+ seems to be usefully, it would be used realy as valid type detection
+ result. This method doesnt make any deep detection here. It checks only
+ if the preselection match to the URL by an URLPattern.
+ This information has to be added to the given rFlatTypes list too.
+ The outside code can use it to supress a deep detection then in general.
+ Because pattern are defined as non detectable at all!
+
+ @param pDescriptor
+ provides any easy-to-use stl interface to the MediaDescriptor.
+ Note : Its content will be adapted to returned result of this method.
+ Means: The type/filter entries of it will be actualized or removed.
+
+ @param rFlatTypes
+ the preselected type (or the registered type of a preselected filter)
+ will be added here as first(!) element. Further we have to provide the
+ information, if this type match to the given URL by its URLPattern
+ registration.
+ */
+ void impl_getPreselection(const css::util::URL& aParsedURL ,
+ ::comphelper::MediaDescriptor& rDescriptor,
+ FlatDetection& rFlatTypes );
+
+ //---------------------------------------
+
+ /** @short make a combined flat/deep type detection
+
+ @descr It steps over all flat detected types (given by the parameter lFlatTypes),
+ try it and search for most suitable one.
+ The specified MediaDescriptor will be patched, so it contain
+ the right values everytime. Using of any deep detection service
+ can be enabled/disabled. And last but not least: If the results
+ wont be realy clear (because a flat detected type has no deep
+ detection service), a "sugested" type name will be returned as "rLastChance".
+ It can be used after e.g. all well known deep detection services
+ was used without getting any result. Then this "last-chance-type"
+ should be returned. Of course using of it can fail too ... but its a try :-)
+
+ As an optimization - this method collects the names of all used deep
+ detection services. This information can be usefull inside the may be
+ afterwards called method "impl_detectTypeDeepOnly()"!
+
+ @param rDescriptor
+ provides any easy-to-use stl interface to the MediaDescriptor.
+ Note : Its content will be adapted to returned result of this method.
+ Means: The type/filter entries of it will be actualized or removed from it.
+
+ @param lFlatTypes
+ a list of all flat detected types, which should be checked here.
+ No other types are allowed here!
+
+ @param rLastChance
+ the internal name of a "suggested type" ... (see before)
+ Note: it will be reseted to an empty string everytimes. So
+ a set value of "rLastChance" can be detected outside very easy.
+
+ @param rUsedDetectors
+ used as [out] parameter. It contains a list of names of all deep
+ detection services, which was used inside this method.
+ Such detectors can be ignored later if "impl_detectTypeDeepOnly()"
+ is called.
+
+ @param bAllowDeep
+ enable/disable using of a might existing deep detection service.
+
+ @return The internal name of a detected type.
+ An empty value if detection failed. .... but see rLastChance
+ for additional returns!
+ */
+ ::rtl::OUString impl_detectTypeFlatAndDeep( ::comphelper::MediaDescriptor& rDescriptor ,
+ const FlatDetection& lFlatTypes ,
+ sal_Bool bAllowDeep ,
+ OUStringList& rUsedDetectors,
+ ::rtl::OUString& rLastChance );
+
+ //---------------------------------------
+
+ /** @short make a deep type detection only
+
+ @descr It steps over all well known deep detection services
+ and check her results. The first positive result will be
+ used for return. Its more a "try and error" algorithm then
+ a real type detection and will be used if a flat detection
+ cant work realy ... e.g. if the extension of an URL is
+ missing or wrong.
+
+ @param rDescriptor
+ provides any easy-to-use stl interface to the MediaDescriptor.
+ Note : Its content will be adapted to returned result of this method.
+ Means: The type/filter entries of it will be actualized or removed from it.
+
+ @param rUsedDetectors
+ It contains a list of names of all deep detection services,
+ which was already used inside the method "impl_detectTypeFlatAndDeep()"!
+ Such detectors must be ignored here!
+
+ @return The internal name of a detected type.
+ An empty value if detection failed.
+ */
+ ::rtl::OUString impl_detectTypeDeepOnly( ::comphelper::MediaDescriptor& rDescriptor ,
+ const OUStringList& rUsedDetectors);
+
+ //---------------------------------------
+
+ /** @short seek a might existing stream to position 0.
+
+ @descr This is an optinal action to be more robust
+ in case any detect service doesnt make this seek ...
+ Normaly it's part of any called detect service or filter ...
+ but sometimes it's not done there.
+
+ @param rDescriptor
+ a stl representation of the MediaDescriptor as in/out parameter.
+ */
+ void impl_seekStreamToZero(comphelper::MediaDescriptor& rDescriptor);
+
+ //---------------------------------------
+
+ /** @short make deep type detection for a specified
+ detect service (threadsafe!).
+
+ @descr It creates the right uno service, prepare the
+ needed MediaDescriptor, call ths right interfaces,
+ and return the results.
+
+ @attention The results (means type and corresponding filter)
+ are already part of the in/out parameter pDescriptor.
+ (in case they was valid).
+
+ @param sDetectService
+ uno service name of the detect service.
+
+ @param rDescriptor
+ a stl representation of the MediaDescriptor as in/out parameter.
+ */
+ ::rtl::OUString impl_askDetectService(const ::rtl::OUString& sDetectService,
+ ::comphelper::MediaDescriptor& rDescriptor );
+
+ //---------------------------------------
+
+ /** @short try to find an interaction handler and
+ ask him to select a possible filter for
+ this unknown format.
+
+ @descr If the user select a filter, it will be used as return value
+ without further checking against the given file content!
+
+ @param rDescriptor
+ a stl representation of the MediaDescriptor as in/out parameter.
+
+ @return [string]
+ a valid type name or an empty string if user canceled interaction.
+ */
+ ::rtl::OUString impl_askUserForTypeAndFilterIfAllowed(::comphelper::MediaDescriptor& rDescriptor);
+
+ //---------------------------------------
+
+ /** @short check if an input stream is already part of the
+ given MediaDesciptor and creates a new one if neccessary.
+
+ @attention This method does further something special!
+ <ul>
+ <li>
+ If the given URL seem to be a streamable content, but creation of the stream
+ failed (might by an IOException), this method throws an exception.
+ (May be an existing interaction handler must be called here too ...)
+ The whole detection must be interrupted then and the interface method queryTypeByDescriptor()
+ must return an empty type name value.
+
+ That prevent us against multiple handling of the same error more then ones
+ (e.g. if we ask all detect services as fallback ...).
+ </li>
+ <li>
+ In case the stream already exists inside the descriptor this method does nothing.
+ </li>
+ <li>
+ In case the stream does not exists but can be created successfully, the stream will
+ be added to the descriptor.
+ </li>
+ </ul>
+
+ @param rDescriptor
+ provides any easy-to-use stl interface to the MediaDescriptor.
+ Note : Its content will be adapted to returned result of this method.
+ Means: The stream will be added to it.
+
+ @throw Any suitable exception if stream should be opened but operation was not sucessfull.
+ Note: If an interactionHandler is part of the given descriptor too, it was already used.
+ Means: let the exception pass trough the top most interface method!
+ */
+ void impl_openStream(::comphelper::MediaDescriptor& rDescriptor)
+ throw (css::uno::Exception);
+
+ //---------------------------------------
+
+ /** @short validate the specified type and its relation ships
+ and set all needed informations related to this type
+ in the specified descriptor.
+
+ @descr Related informations are: - corresponding filter
+ - media type
+ - ...
+
+ @param rDescriptor
+ provides access to the outside MediaDescriptor.
+
+ @param sType
+ the name of the type, which should be set on the descriptor.
+ Can be empty to remove any related value from the descriptor!
+
+ @return TRUE the specified type and its registrations was valid(!) and
+ could be set on the descriptor.
+ */
+ sal_Bool impl_validateAndSetTypeOnDescriptor( ::comphelper::MediaDescriptor& rDescriptor,
+ const ::rtl::OUString& sType );
+
+ //---------------------------------------
+
+ /** @short validate the specified filter and its relation ships
+ and set all needed informations related to this filter
+ in the specified descriptor.
+
+ @descr Related informations are: - corresponding type
+ - ...
+
+ @param rDescriptor
+ provides access to the outside MediaDescriptor.
+
+ @param sFilter
+ the name of the filter, which should be set on the descriptor.
+ Can be empty to remove any related value from the descriptor!
+
+ @return TRUE the specified type and its registrations was valid(!) and
+ could be set on the descriptor.
+ */
+ sal_Bool impl_validateAndSetFilterOnDescriptor( ::comphelper::MediaDescriptor& rDescriptor,
+ const ::rtl::OUString& sFilter );
+
+ //---------------------------------------
+
+ /** @short remove anythimng related to a TYPE/FILTER entry from the
+ specified MediaDescriptor.
+
+ @descr This method works together with impl_validateAndSetTypeOnDescriptor()/
+ impl_validateAndSetFilterOnDescriptor(). All informations, which can be
+ set by these two operations must be "removable" by this method.
+
+ @param rDescriptor
+ reference to the MediaDescriptor (represented by an easy-to-use
+ stl interface!), which should be patched.
+ */
+ void impl_removeTypeFilterFromDescriptor(::comphelper::MediaDescriptor& rDescriptor);
+
+ //---------------------------------------
+
+ /** @short search the best suitable filter for the given type
+ and add it into the media descriptor.
+
+ @descr Normaly this is a type detection only ...
+ but for some special features we must overwrite our detection
+ because a file must be loaded into a special (means preselected)
+ application.
+
+ E.g. CSV/TXT format are sometimes ugly to handle .-)
+
+ Note: If the descriptor already include a filter
+ (may be selected by a FilterSelect interaction or preselected
+ by the user itself) ... we dont change that here !
+
+ @param rDescriptor
+ reference to the MediaDescriptor (represented by an easy-to-use
+ stl interface!), which should be patched.
+
+ @param sType
+ the internal type name, where we search a filter for.
+ Used as IN/OUT parameter so we can overrule the detection result for
+ types too !
+
+ @note #i60158#
+ sometimes our text ascii and our csv filter cant work together.
+ Then we overwrite our detection hardly.
+ sType param is used as out parameter then too ... and
+ rDescriptor will be changed by selecting another filter.
+ (see code)
+ */
+ void impl_checkResultsAndAddBestFilter(::comphelper::MediaDescriptor& rDescriptor,
+ ::rtl::OUString& sType );
+
+//-------------------------------------------
+// uno interface
+
+public:
+
+ //---------------------------------------
+ // XTypeDetection
+
+ virtual ::rtl::OUString SAL_CALL queryTypeByURL(const ::rtl::OUString& sURL)
+ throw (css::uno::RuntimeException);
+
+ virtual ::rtl::OUString SAL_CALL queryTypeByDescriptor(css::uno::Sequence< css::beans::PropertyValue >& lDescriptor,
+ sal_Bool bAllowDeep )
+ throw (css::uno::RuntimeException);
+
+//-------------------------------------------
+// static uno helper!
+
+public:
+
+ //---------------------------------------
+
+ /** @short return the uno implementation name of this class.
+
+ @descr Because this information is used at several places
+ (and mostly an object instance of this class is not possible)
+ its implemented as a static function!
+
+ @return The fix uno implementation name of this class.
+ */
+ static ::rtl::OUString impl_getImplementationName();
+
+ //---------------------------------------
+
+ /** @short return the list of supported uno services of this class.
+
+ @descr Because this information is used at several places
+ (and mostly an object instance of this class is not possible)
+ its implemented as a static function!
+
+ @return The fix list of uno services supported by this class.
+ */
+ static css::uno::Sequence< ::rtl::OUString > impl_getSupportedServiceNames();
+
+ //---------------------------------------
+
+ /** @short return a new intsnace of this class.
+
+ @descr This method is used by the uno service manager, to create
+ a new instance of this service if needed.
+
+ @param xSMGR
+ reference to the uno service manager, which require
+ this new instance. It should be passed to the new object
+ so it can be used internaly to create own needed uno resources.
+
+ @return The new instance of this service as an uno reference.
+ */
+ static css::uno::Reference< css::uno::XInterface > impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
};
- } // namespace config
-} // namespace filter
+}}
#endif // __FILTER_CONFIG_TYPEDETECTION_HXX_
More information about the Libreoffice-commits
mailing list