diff options
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.cxx | 31 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.hxx | 10 | ||||
-rw-r--r-- | sc/source/ui/dbgui/langchooser.cxx | 120 | ||||
-rw-r--r-- | sc/source/ui/dbgui/langchooser.src | 112 | ||||
-rw-r--r-- | sc/source/ui/dbgui/makefile.mk | 5 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 49 | ||||
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/inc/docsh.hxx | 1 | ||||
-rw-r--r-- | sc/source/ui/inc/langchooser.hrc | 42 | ||||
-rw-r--r-- | sc/source/ui/inc/langchooser.hxx | 76 | ||||
-rw-r--r-- | sc/source/ui/unoobj/filtuno.cxx | 31 |
11 files changed, 472 insertions, 7 deletions
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index 60b101d482c0..9690470ebfc8 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -74,6 +74,7 @@ #include "validate.hxx" //add for ScValidationDlg #include "validate.hrc" //add for ScValidationDlg #include "sortdlg.hxx" //add for ScSortDlg +#include "langchooser.hxx" #include "opredlin.hxx" //add for ScRedlineOptionsTabPage #include "tpcalc.hxx" //add for ScTpCalcOptions #include "tpprint.hxx" //add for ScTpPrintOptions @@ -115,6 +116,7 @@ IMPL_ABSTDLG_BASE(AbstractScNewScenarioDlg_Impl); //add for ScNewScenarioDlg IMPL_ABSTDLG_BASE(AbstractScShowTabDlg_Impl); //add for ScShowTabDlg IMPL_ABSTDLG_BASE(AbstractScStringInputDlg_Impl); //add for ScStringInputDlg IMPL_ABSTDLG_BASE(AbstractScImportOptionsDlg_Impl); //add for ScImportOptionsDlg +IMPL_ABSTDLG_BASE(AbstractScLangChooserDlg_Impl); IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl); //add for ScAttrDlg, ScHFEditDlg, ScStyleDlg, ScSubTotalDlg,ScCharDlg, ScParagraphDlg, ScValidationDlg, ScSortDlg // AbstractTabDialog_Impl begin @@ -620,6 +622,20 @@ void AbstractScImportOptionsDlg_Impl::GetImportOptions( ScImportOptions& rOption pDlg->GetImportOptions(rOptions); } // add for AbstractScImportOptionsDlg_Impl end + +//add for AbstractScLangChooserDlg_Impl begin +LanguageType AbstractScLangChooserDlg_Impl::GetLanguageType() const +{ + return pDlg->getLanguageType(); +} + +bool AbstractScLangChooserDlg_Impl::IsDateConversionSet() const +{ + return pDlg->isDateConversionSet(); +} + +//add for AbstractScLangChooserDlg_Impl end + // =========================Factories for createdialog =================== //add for ScImportAsciiDlg begin @@ -642,6 +658,21 @@ AbstractScImportAsciiDlg * ScAbstractDialogFactory_Impl::CreateScImportAsciiDlg } // ScImportAsciiDlg end +AbstractScLangChooserDlg * ScAbstractDialogFactory_Impl::CreateScLangChooserDlg( Window* pParent, int nId ) +{ + ScLangChooserDlg* pDlg = NULL; + switch (nId) + { + case RID_SCDLG_LANG_CHOOSER: + pDlg = new ScLangChooserDlg(pParent); + break; + default: + ; + } + + return pDlg ? new AbstractScLangChooserDlg_Impl(pDlg) : NULL; +} + //add for ScAutoFormatDlg begin AbstractScAutoFormatDlg * ScAbstractDialogFactory_Impl::CreateScAutoFormatDlg( Window* pParent, //add for ScAutoFormatDlg diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index 40f6d3bee976..dfdcbcced3e9 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -64,6 +64,7 @@ class ScStringInputDlg; class ScImportOptionsDlg; class SfxTabDialog; class ScSortWarningDlg; +class ScLangChooserDlg; #define DECL_ABSTDLG_BASE(Class,DialogClass) \ DialogClass* pDlg; \ @@ -343,6 +344,13 @@ class AbstractScImportOptionsDlg_Impl : public AbstractScImportOptionsDlg //add virtual void GetImportOptions( ScImportOptions& rOptions ) const; }; +class AbstractScLangChooserDlg_Impl : public AbstractScLangChooserDlg +{ + DECL_ABSTDLG_BASE( AbstractScLangChooserDlg_Impl, ScLangChooserDlg) + virtual LanguageType GetLanguageType() const; + virtual bool IsDateConversionSet() const; +}; + //add for ScAttrDlg , ScHFEditDlg, ScStyleDlg, ScSubTotalDlg, ScCharDlg, ScParagraphDlg, ScValidationDlg, ScSortDlg class AbstractTabDialog_Impl : public SfxAbstractTabDialog { @@ -384,6 +392,8 @@ public: SvStream* pInStream, int nId, sal_Unicode cSep = '\t'); + virtual AbstractScLangChooserDlg * CreateScLangChooserDlg( Window* pParent, int nId ); + virtual AbstractScAutoFormatDlg * CreateScAutoFormatDlg( Window* pParent, //add for ScAutoFormatDlg ScAutoFormat* pAutoFormat, const ScAutoFormatData* pSelFormatData, diff --git a/sc/source/ui/dbgui/langchooser.cxx b/sc/source/ui/dbgui/langchooser.cxx new file mode 100644 index 000000000000..6640afc3bd3f --- /dev/null +++ b/sc/source/ui/dbgui/langchooser.cxx @@ -0,0 +1,120 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: langbox.hxx,v $ + * $Revision: 1.4.242.1 $ + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sc.hxx" + +#undef SC_DLLIMPLEMENTATION + +//------------------------------------------------------------------------ + +#include "langchooser.hxx" +#include "langchooser.hrc" + +#include "scresid.hxx" +#include "vcl/window.hxx" +#include "vcl/msgbox.hxx" +#include "vcl/svapp.hxx" + +ScLangChooserDlg::ScLangChooserDlg(Window* pParent) : + ModalDialog(pParent, ScResId(RID_SCDLG_LANG_CHOOSER)), + + maBtnOk(this, ScResId(BTN_OK)), + maBtnCancel(this, ScResId(BTN_CANCEL)), + maBtnHelp(this, ScResId(BTN_HELP)), + maFlChooseLang(this, ScResId(FL_CHOOSE_LANG)), + maRbAutomatic(this, ScResId(RB_AUTOMATIC)), + maRbCustom(this, ScResId(RB_CUSTOM)), + maLbCustomLang(this, ScResId(LB_CUSTOM_LANG)), + maFlOption(this, ScResId(FL_OPTION)), + maBtnConvertDate(this, ScResId(BTN_CONVERT_DATE)) +{ + init(); +} + +ScLangChooserDlg::~ScLangChooserDlg() +{ +} + +short ScLangChooserDlg::Execute() +{ + return ModalDialog::Execute(); +} + +LanguageType ScLangChooserDlg::getLanguageType() const +{ + if (maRbAutomatic.IsChecked()) + return LANGUAGE_SYSTEM; + + return maLbCustomLang.GetSelectLanguage(); +} + +bool ScLangChooserDlg::isDateConversionSet() const +{ + return maBtnConvertDate.IsChecked(); +} + +void ScLangChooserDlg::init() +{ + Link aLink = LINK( this, ScLangChooserDlg, OKHdl ); + maBtnOk.SetClickHdl(aLink); + aLink = LINK( this, ScLangChooserDlg, RadioHdl ); + maRbAutomatic.SetClickHdl(aLink); + maRbCustom.SetClickHdl(aLink); + + maRbAutomatic.Check(true); + + maLbCustomLang.SetLanguageList( + LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, false, false); + + LanguageType eLang = Application::GetSettings().GetLanguage(); + maLbCustomLang.SelectLanguage(eLang); + maLbCustomLang.Disable(); +} + +IMPL_LINK( ScLangChooserDlg, OKHdl, OKButton*, EMPTYARG ) +{ + EndDialog(RET_OK); + return 0; +} + +IMPL_LINK( ScLangChooserDlg, RadioHdl, RadioButton*, pBtn ) +{ + if (pBtn == &maRbAutomatic) + { + maLbCustomLang.Disable(); + } + else if (pBtn == &maRbCustom) + { + maLbCustomLang.Enable(); + } + return 0; +} + diff --git a/sc/source/ui/dbgui/langchooser.src b/sc/source/ui/dbgui/langchooser.src new file mode 100644 index 000000000000..313084299aba --- /dev/null +++ b/sc/source/ui/dbgui/langchooser.src @@ -0,0 +1,112 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: retypepassdlg.src,v $ + * $Revision: 1.1.2.3 $ + * + * 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. + * + ************************************************************************/ + +#include "langchooser.hrc" + +ModalDialog RID_SCDLG_LANG_CHOOSER +{ + Text [ en-US ] = "Select Language" ; + Size = MAP_APPFONT ( 190 , 101 ) ; + Moveable = TRUE ; + Closeable = TRUE ; + OutputSize = TRUE ; + + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 135, 6 ) ; + Size = MAP_APPFONT ( 50, 14 ) ; + DefButton = TRUE ; + }; + + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 135, 23 ) ; + Size = MAP_APPFONT ( 50, 14 ) ; + }; + + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 135, 43 ) ; + Size = MAP_APPFONT ( 50, 14 ) ; + }; + + FixedLine FL_CHOOSE_LANG + { + Pos = MAP_APPFONT( 6, 3 ) ; + Size = MAP_APPFONT( 125, 14 ) ; + + Text [ en-US ] = "Select the language to use for import" ; + }; + + RadioButton RB_AUTOMATIC + { + Pos = MAP_APPFONT( 12, 20 ) ; + Size = MAP_APPFONT( 50, 10 ) ; + TabStop = TRUE ; + + Text [ en-US ] = "Automatic" ; + }; + + RadioButton RB_CUSTOM + { + Pos = MAP_APPFONT( 12, 34 ) ; + Size = MAP_APPFONT( 50, 10 ) ; + TabStop = TRUE ; + + Text [ en-US ] = "Custom" ; + }; + + ListBox LB_CUSTOM_LANG + { + Pos = MAP_APPFONT( 20, 50 ) ; + Size = MAP_APPFONT( 100, 55 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + Sort = TRUE ; + }; + + FixedLine FL_OPTION + { + Pos = MAP_APPFONT( 6, 70 ); + Size = MAP_APPFONT( 125, 14 ); + + Text [ en-US ] = "Options" ; + }; + + CheckBox BTN_CONVERT_DATE + { + Pos = MAP_APPFONT( 12, 86 ); + Size = MAP_APPFONT( 125, 10 ); + TabStop = TRUE ; + + Text [ en-US ] = "Detect special numbers (such as dates)." ; + }; +}; + diff --git a/sc/source/ui/dbgui/makefile.mk b/sc/source/ui/dbgui/makefile.mk index 5d716552ca71..5bf847ef9a93 100644 --- a/sc/source/ui/dbgui/makefile.mk +++ b/sc/source/ui/dbgui/makefile.mk @@ -53,6 +53,7 @@ SLOFILES = \ $(SLO)$/pfiltdlg.obj \ $(SLO)$/dbnamdlg.obj \ $(SLO)$/expftext.obj \ + $(SLO)$/langchooser.obj \ $(SLO)$/subtdlg.obj \ $(SLO)$/tpsubt.obj \ $(SLO)$/fieldwnd.obj \ @@ -85,6 +86,7 @@ EXCEPTIONSFILES= \ SRS1NAME=$(TARGET) SRC1FILES = \ + langchooser.src \ pivot.src \ pvfundlg.src \ dpgroupdlg.src \ @@ -114,7 +116,8 @@ LIB1OBJFILES = \ $(SLO)$/csvruler.obj \ $(SLO)$/csvgrid.obj \ $(SLO)$/csvtablebox.obj \ - $(SLO)$/asciiopt.obj + $(SLO)$/asciiopt.obj \ + $(SLO)$/langchooser.obj # --- Tagets ------------------------------------------------------- diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index c62c2dc41fdf..ed7952db9695 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -129,6 +129,8 @@ #include <comphelper/processfactory.hxx> using namespace com::sun::star; +using ::rtl::OUString; +using ::rtl::OUStringBuffer; // STATIC DATA ----------------------------------------------------------- @@ -794,6 +796,34 @@ BOOL __EXPORT ScDocShell::LoadFrom( SfxMedium& rMedium ) return bRet; } +static void lcl_parseHtmlFilterOption(const OUString& rOption, LanguageType& rLang, bool& rDateConvert) +{ + OUStringBuffer aBuf; + OUString aTokens[2]; + sal_Int32 n = rOption.getLength(); + const sal_Unicode* p = rOption.getStr(); + sal_Int32 nTokenId = 0; + for (sal_Int32 i = 0; i < n; ++i) + { + const sal_Unicode c = p[i]; + if (c == sal_Unicode(' ')) + { + if (aBuf.getLength()) + aTokens[nTokenId++] = aBuf.makeStringAndClear(); + } + else + aBuf.append(c); + + if (nTokenId >= 2) + break; + } + + if (aBuf.getLength()) + aTokens[nTokenId] = aBuf.makeStringAndClear(); + + rLang = static_cast<LanguageType>(aTokens[0].toInt32()); + rDateConvert = static_cast<bool>(aTokens[1].toInt32()); +} BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium ) { @@ -1167,12 +1197,24 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium ) SvStream* pInStream = rMedium.GetInStream(); if (pInStream) { + LanguageType eLang = LANGUAGE_SYSTEM; + bool bDateConvert = false; + SfxItemSet* pSet = rMedium.GetItemSet(); + const SfxPoolItem* pItem; + if ( pSet && SFX_ITEM_SET == + pSet->GetItemState( SID_FILE_FILTEROPTIONS, TRUE, &pItem ) ) + { + String aFilterOption = (static_cast<const SfxStringItem*>(pItem))->GetValue(); + lcl_parseHtmlFilterOption(aFilterOption, eLang, bDateConvert); + } + pInStream->Seek( 0 ); ScRange aRange; // HTML macht eigenes ColWidth/RowHeight CalcOutputFactor(); + SvNumberFormatter aNumFormatter(aDocument.GetServiceManager(), eLang); eError = ScFormatFilter::Get().ScImportHTML( *pInStream, rMedium.GetBaseURL(), &aDocument, aRange, - GetOutputFactor(), !bWebQuery ); + GetOutputFactor(), !bWebQuery, &aNumFormatter, bDateConvert ); if (eError != eERR_OK) { if (!GetError()) @@ -2149,6 +2191,11 @@ String ScDocShell::GetOwnFilterName() // static return String::CreateFromAscii(pFilterSc50); } +String ScDocShell::GetHtmlFilterName() +{ + return String::CreateFromAscii(pFilterHtml); +} + String ScDocShell::GetWebQueryFilterName() // static { return String::CreateFromAscii(pFilterHtmlWebQ); diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index a351c1f1b3fd..288ad755cb52 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -2044,7 +2044,7 @@ class ScFormatFilterMissing : public ScFormatFilterPlugin { virtual FltError ScImportDif( SvStream&, ScDocument*, const ScAddress&, const CharSet, UINT32 ) RETURN_ERROR virtual FltError ScImportRTF( SvStream&, const String&, ScDocument*, ScRange& ) RETURN_ERROR - virtual FltError ScImportHTML( SvStream&, const String&, ScDocument*, ScRange&, double, BOOL ) RETURN_ERROR + virtual FltError ScImportHTML( SvStream&, const String&, ScDocument*, ScRange&, double, BOOL, SvNumberFormatter*, bool ) RETURN_ERROR virtual ScEEAbsImport *CreateRTFImport( ScDocument*, const ScRange& ) { return NULL; } virtual ScEEAbsImport *CreateHTMLImport( ScDocument*, const String&, const ScRange&, BOOL ) { return NULL; } diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index b8b8d10f0c6e..85903014aa39 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -405,6 +405,7 @@ public: static ScDocShell* GetShellByNum( USHORT nDocNo ); static String GetOwnFilterName(); + static String GetHtmlFilterName(); static String GetWebQueryFilterName(); static String GetAsciiFilterName(); static String GetLotusFilterName(); diff --git a/sc/source/ui/inc/langchooser.hrc b/sc/source/ui/inc/langchooser.hrc new file mode 100644 index 000000000000..93c554ef5c45 --- /dev/null +++ b/sc/source/ui/inc/langchooser.hrc @@ -0,0 +1,42 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: retypepassdlg.src,v $ + * $Revision: 1.1.2.3 $ + * + * 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. + * + ************************************************************************/ + +#include <sc.hrc> + +#define BTN_OK 1 +#define BTN_CANCEL 2 +#define BTN_HELP 3 + +#define FL_CHOOSE_LANG 4 +#define RB_AUTOMATIC 5 +#define RB_CUSTOM 6 +#define LB_CUSTOM_LANG 7 +#define FL_OPTION 8 +#define BTN_CONVERT_DATE 9 diff --git a/sc/source/ui/inc/langchooser.hxx b/sc/source/ui/inc/langchooser.hxx new file mode 100644 index 000000000000..4ff849fc2bc0 --- /dev/null +++ b/sc/source/ui/inc/langchooser.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: langbox.hxx,v $ + * $Revision: 1.4.242.1 $ + * + * 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 SC_UI_LANGCHOOSER_HXX +#define SC_UI_LANGCHOOSER_HXX + +#include "vcl/dialog.hxx" +#include "vcl/button.hxx" +#include "vcl/fixed.hxx" +#include "i18npool/lang.h" +#include "svx/langbox.hxx" + +class ScLangChooserDlg : public ModalDialog +{ +public: + ScLangChooserDlg(Window* pParent); + virtual ~ScLangChooserDlg(); + + virtual short Execute(); + + LanguageType getLanguageType() const; + bool isDateConversionSet() const; + +private: + void init(); + +private: + OKButton maBtnOk; + CancelButton maBtnCancel; + HelpButton maBtnHelp; + + FixedLine maFlChooseLang; + + RadioButton maRbAutomatic; + RadioButton maRbCustom; + + SvxLanguageBox maLbCustomLang; + + FixedLine maFlOption; + + CheckBox maBtnConvertDate; + + DECL_LINK( OKHdl, OKButton* ); + + DECL_LINK( RadioHdl, RadioButton* ); +}; + + +#endif diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx index eb415d1d3ff3..0fab38c8c1da 100644 --- a/sc/source/ui/unoobj/filtuno.cxx +++ b/sc/source/ui/unoobj/filtuno.cxx @@ -51,7 +51,12 @@ #include "sc.hrc" //CHINA001 #include "scabstdlg.hxx" //CHINA001 +#include "i18npool/lang.h" + +#include <memory> + using namespace ::com::sun::star; +using ::rtl::OUStringBuffer; //------------------------------------------------------------------------ @@ -146,6 +151,10 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException) sal_Int16 nRet = ui::dialogs::ExecutableDialogResults::CANCEL; String aFilterString( aFilterName ); + + ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "ScAbstractFactory create fail!"); + if ( !bExport && aFilterString == ScDocShell::GetAsciiFilterName() ) { // ascii import is special... @@ -164,8 +173,6 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException) pInStream = utl::UcbStreamHelper::CreateStream( xInputStream ); //CHINA001 ScImportAsciiDlg* pDlg = new ScImportAsciiDlg( NULL, aPrivDatName, pInStream, cAsciiDel ); - ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 AbstractScImportAsciiDlg* pDlg = pFact->CreateScImportAsciiDlg( NULL, aPrivDatName, pInStream, RID_SCDLG_ASCII, cAsciiDel); DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 if ( pDlg->Execute() == RET_OK ) @@ -178,6 +185,24 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException) delete pDlg; delete pInStream; } + else if ( aFilterString == ScDocShell::GetWebQueryFilterName() || aFilterString == ScDocShell::GetHtmlFilterName() ) + { + // HTML import. + ::std::auto_ptr<AbstractScLangChooserDlg> pDlg( + pFact->CreateScLangChooserDlg(NULL, RID_SCDLG_LANG_CHOOSER)); + + if (pDlg->Execute() == RET_OK) + { + LanguageType eLang = pDlg->GetLanguageType(); + OUStringBuffer aBuf; + + aBuf.append(String::CreateFromInt32(static_cast<sal_Int32>(eLang))); + aBuf.append(sal_Unicode(' ')); + aBuf.append(pDlg->IsDateConversionSet() ? sal_Unicode('1') : sal_Unicode('0')); + aFilterOptions = aBuf.makeStringAndClear(); + nRet = ui::dialogs::ExecutableDialogResults::OK; + } + } else { sal_Bool bMultiByte = sal_True; @@ -249,8 +274,6 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException) //CHINA001 &aOptions, &aTitle, bMultiByte, bDBEnc, //CHINA001 !bExport ); //CHINA001 - ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 AbstractScImportOptionsDlg* pDlg = pFact->CreateScImportOptionsDlg( NULL, RID_SCDLG_IMPORTOPT, bAscii, &aOptions, &aTitle, bMultiByte, bDBEnc, |