summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-04-22 12:27:25 +0200
committerTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-04-24 22:51:13 +0200
commit7ab34f414bc14b1cfa491952e259e11a83df5b9e (patch)
tree62d62865d674df2a46b6008a3d3ac37fa231bb65
parentea9989ad770f31aae379dbe6d2cadece3f4f10d7 (diff)
sc filter: Read "FilterOptions" in HTML export filter
Change-Id: I3644b5d0bf5f485e1261c478996c95981f6055cb
-rw-r--r--sc/inc/filter.hxx2
-rw-r--r--sc/source/filter/html/htmlexp.cxx9
-rw-r--r--sc/source/filter/inc/ftools.hxx2
-rw-r--r--sc/source/filter/inc/htmlexp.hxx3
-rw-r--r--sc/source/ui/docshell/docsh.cxx27
-rw-r--r--sc/source/ui/docshell/impex.cxx9
-rw-r--r--sc/source/ui/inc/impex.hxx2
7 files changed, 36 insertions, 18 deletions
diff --git a/sc/inc/filter.hxx b/sc/inc/filter.hxx
index db519556976e..ce1f4d42fd53 100644
--- a/sc/inc/filter.hxx
+++ b/sc/inc/filter.hxx
@@ -111,7 +111,7 @@ class ScFormatFilterPlugin {
virtual FltError ScExportDif( SvStream&, ScDocument*, const ScRange& rRange, const rtl_TextEncoding eDest,
sal_uInt32 nDifOption = SC_DIFOPT_EXCEL ) = 0;
virtual FltError ScExportHTML( SvStream&, const OUString& rBaseURL, ScDocument*, const ScRange& rRange, const rtl_TextEncoding eDest, bool bAll,
- const OUString& rStreamPath, OUString& rNonConvertibleChars ) = 0;
+ const OUString& rStreamPath, OUString& rNonConvertibleChars, const OUString& rFilterOptions ) = 0;
virtual FltError ScExportRTF( SvStream&, ScDocument*, const ScRange& rRange, const rtl_TextEncoding eDest ) = 0;
virtual ScOrcusFilters* GetOrcusFilters() = 0;
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index 329d9e04336d..4a960116af6b 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -130,9 +130,9 @@ const sal_Char ScHTMLExport::sIndentSource[nIndentMax+1] =
FltError ScFormatFilterPluginImpl::ScExportHTML( SvStream& rStrm, const OUString& rBaseURL, ScDocument* pDoc,
const ScRange& rRange, const rtl_TextEncoding /*eNach*/, bool bAll,
- const OUString& rStreamPath, OUString& rNonConvertibleChars )
+ const OUString& rStreamPath, OUString& rNonConvertibleChars, const OUString& rFilterOptions )
{
- ScHTMLExport aEx( rStrm, rBaseURL, pDoc, rRange, bAll, rStreamPath );
+ ScHTMLExport aEx( rStrm, rBaseURL, pDoc, rRange, bAll, rStreamPath, rFilterOptions );
FltError nErr = aEx.Write();
rNonConvertibleChars = aEx.GetNonConvertibleChars();
return nErr;
@@ -203,11 +203,12 @@ static OString lcl_makeHTMLColorTriplet(const Color& rColor)
}
ScHTMLExport::ScHTMLExport( SvStream& rStrmP, const OUString& rBaseURL, ScDocument* pDocP,
- const ScRange& rRangeP,
- bool bAllP, const OUString& rStreamPathP ) :
+ const ScRange& rRangeP, bool bAllP,
+ const OUString& rStreamPathP, const OUString& rFilterOptions ) :
ScExportBase( rStrmP, pDocP, rRangeP ),
aBaseURL( rBaseURL ),
aStreamPath( rStreamPathP ),
+ aFilterOptions( rFilterOptions ),
pAppWin( Application::GetDefaultDevice() ),
nUsedTables( 0 ),
nIndent( 0 ),
diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx
index 20903e21c226..95a33953f2fa 100644
--- a/sc/source/filter/inc/ftools.hxx
+++ b/sc/source/filter/inc/ftools.hxx
@@ -299,7 +299,7 @@ public:
virtual FltError ScExportDif( SvStream&, ScDocument*, const ScRange& rRange, const rtl_TextEncoding eDest,
sal_uInt32 nDifOption = SC_DIFOPT_EXCEL ) SAL_OVERRIDE;
virtual FltError ScExportHTML( SvStream&, const OUString& rBaseURL, ScDocument*, const ScRange& rRange, const rtl_TextEncoding eDest, bool bAll,
- const OUString& rStreamPath, OUString& rNonConvertibleChars ) SAL_OVERRIDE;
+ const OUString& rStreamPath, OUString& rNonConvertibleChars, const OUString& rFilterOptions ) SAL_OVERRIDE;
virtual FltError ScExportRTF( SvStream&, ScDocument*, const ScRange& rRange, const rtl_TextEncoding eDest ) SAL_OVERRIDE;
virtual ScOrcusFilters* GetOrcusFilters() SAL_OVERRIDE;
diff --git a/sc/source/filter/inc/htmlexp.hxx b/sc/source/filter/inc/htmlexp.hxx
index 80c19aa23609..c79aa264d374 100644
--- a/sc/source/filter/inc/htmlexp.hxx
+++ b/sc/source/filter/inc/htmlexp.hxx
@@ -98,6 +98,7 @@ class ScHTMLExport : public ScExportBase
ScHTMLStyle aHTMLStyle;
OUString aBaseURL;
OUString aStreamPath;
+ OUString aFilterOptions;
OUString aCId; // Content-Id fuer Mail-Export
OutputDevice* pAppWin; // fuer Pixelei
boost::scoped_ptr< std::map<OUString, OUString> > pFileNameMap; // fuer CopyLocalFileToINet
@@ -155,7 +156,7 @@ class ScHTMLExport : public ScExportBase
public:
ScHTMLExport( SvStream&, const OUString&, ScDocument*, const ScRange&,
- bool bAll, const OUString& aStreamPath );
+ bool bAll, const OUString& aStreamPath, const OUString& rFilterOptions );
virtual ~ScHTMLExport();
sal_uLong Write();
const OUString& GetNonConvertibleChars() const
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 871adbe8bcc3..87011f08de33 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -2424,26 +2424,35 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed )
SvStream* pStream = rMed.GetOutStream();
if ( pStream )
{
- WaitObject aWait( GetActiveDialogParent() );
- ScImportExport aImExport( &aDocument );
- aImExport.SetStreamPath( rMed.GetName() );
- bRet = aImExport.ExportStream( *pStream, rMed.GetBaseURL( true ), SOT_FORMATSTR_ID_HTML );
- if ( bRet && !aImExport.GetNonConvertibleChars().isEmpty() )
- SetError( *new StringErrorInfo(
+ SfxItemSet* pSet = rMed.GetItemSet();
+ const SfxPoolItem* pItem;
+ OUString sFilterOptions;
+
+ if (pSet->GetItemState(SID_FILE_FILTEROPTIONS, true, &pItem) == SFX_ITEM_SET)
+ sFilterOptions = ((SfxStringItem*)pItem)->GetValue();
+
+ WaitObject aWait(GetActiveDialogParent());
+ ScImportExport aImExport(&aDocument);
+ aImExport.SetStreamPath(rMed.GetName());
+ aImExport.SetFilterOptions(sFilterOptions);
+ bRet = aImExport.ExportStream(*pStream, rMed.GetBaseURL(true), SOT_FORMATSTR_ID_HTML);
+ if (bRet && !aImExport.GetNonConvertibleChars().isEmpty())
+ {
+ SetError(*new StringErrorInfo(
SCWARN_EXPORT_NONCONVERTIBLE_CHARS,
aImExport.GetNonConvertibleChars(),
- ERRCODE_BUTTON_OK | ERRCODE_MSG_INFO ), OUString( OSL_LOG_PREFIX ) );
+ ERRCODE_BUTTON_OK | ERRCODE_MSG_INFO), OUString(OSL_LOG_PREFIX));
+ }
}
}
else
{
if (GetError())
- SetError(SCERR_IMPORT_NI, OUString( OSL_LOG_PREFIX ) );
+ SetError(SCERR_IMPORT_NI, OUString(OSL_LOG_PREFIX));
}
return bRet;
}
-
bool ScDocShell::SaveCompleted( const uno::Reference < embed::XStorage >& xStor )
{
return SfxObjectShell::SaveCompleted( xStor );
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index bb103b5ca020..9882966a1992 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -183,6 +183,11 @@ void ScImportExport::SetExtOptions( const ScAsciiOptions& rOpt )
cStr = rOpt.GetTextSep();
}
+void ScImportExport::SetFilterOptions(const OUString& rFilterOptions)
+{
+ maFilterOptions = rFilterOptions;
+}
+
bool ScImportExport::IsFormatSupported( sal_uLong nFormat )
{
return nFormat == FORMAT_STRING
@@ -2064,7 +2069,7 @@ bool ScImportExport::Doc2HTML( SvStream& rStrm, const OUString& rBaseURL )
{
// rtl_TextEncoding is ignored in ScExportHTML, read from Load/Save HTML options
ScFormatFilter::Get().ScExportHTML( rStrm, rBaseURL, pDoc, aRange, RTL_TEXTENCODING_DONTKNOW, bAll,
- aStreamPath, aNonConvertibleChars );
+ aStreamPath, aNonConvertibleChars, maFilterOptions );
return rStrm.GetError() == SVSTREAM_OK;
}
@@ -2199,7 +2204,7 @@ class ScFormatFilterMissing : public ScFormatFilterPlugin {
virtual FltError ScExportDif( SvStream&, ScDocument*, const ScAddress&, const rtl_TextEncoding, sal_uInt32 ) SAL_OVERRIDE { return eERR_INTERN; }
virtual FltError ScExportDif( SvStream&, ScDocument*, const ScRange&, const rtl_TextEncoding, sal_uInt32 ) SAL_OVERRIDE { return eERR_INTERN; }
virtual FltError ScExportHTML( SvStream&, const OUString&, ScDocument*, const ScRange&, const rtl_TextEncoding, bool,
- const OUString&, OUString& ) SAL_OVERRIDE { return eERR_INTERN; }
+ const OUString&, OUString&, const OUString& ) SAL_OVERRIDE { return eERR_INTERN; }
virtual FltError ScExportRTF( SvStream&, ScDocument*, const ScRange&, const rtl_TextEncoding ) SAL_OVERRIDE { return eERR_INTERN; }
virtual ScOrcusFilters* GetOrcusFilters() SAL_OVERRIDE { return NULL; }
diff --git a/sc/source/ui/inc/impex.hxx b/sc/source/ui/inc/impex.hxx
index bde5f46e3367..9faa1a69ac52 100644
--- a/sc/source/ui/inc/impex.hxx
+++ b/sc/source/ui/inc/impex.hxx
@@ -53,6 +53,7 @@ class ScImportExport
ScRange aRange;
OUString aStreamPath;
OUString aNonConvertibleChars;
+ OUString maFilterOptions;
sal_uLong nSizeLimit;
sal_Unicode cSep; // Separator
sal_Unicode cStr; // String Delimiter
@@ -92,6 +93,7 @@ public:
~ScImportExport();
void SetExtOptions( const ScAsciiOptions& rOpt );
+ void SetFilterOptions( const OUString& rFilterOptions );
bool IsDoubleRef() const { return !( bAll || bSingle ); }
bool IsSingleRef() const { return bSingle; }