/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
bool bShow; // The "ShowFilterDialog" flag is passed from SfxApplication::OpenDocExec_Impl if (!(css::uno::getCurrentContext()->getValueByName(u"ShowFilterDialog"_ustr) >>= bShow))
bShow = utl::isShowFilterOptionsDialog(aFilterString); constbool bOk = !bShow || pDlg->Execute() == RET_OK;
if (bOk)
{
ScAsciiOptions aOptions;
pDlg->GetOptions( aOptions );
pDlg->SaveParameters();
aFilterOptions = aOptions.WriteToString();
nRet = ui::dialogs::ExecutableDialogResults::OK;
}
} elseif ( aFilterString == ScDocShell::GetWebQueryFilterName() || aFilterString == ScDocShell::GetHtmlFilterName() )
{ if (bExport)
nRet = ui::dialogs::ExecutableDialogResults::OK; // export HTML without dialog else
{ // HTML import.
ScopedVclPtr<AbstractScTextImportOptionsDlg> pDlg(
pFact->CreateScTextImportOptionsDlg(Application::GetFrameWeld(xDialogParent)));
std::unique_ptr<SvStream> pInStream; if ( xInputStream.is() )
pInStream = utl::UcbStreamHelper::CreateStream( xInputStream ); switch(load_CharSet( eEncoding, bExport, pInStream.get()))
{ case charsetSource::charset_from_file:
skipDialog = true; break; case charsetSource::charset_from_user_setting: case charsetSource::charset_default: break;
}
bDBEnc = true; // pInStream goes out of scope, the stream is automatically closed
} elseif ( aFilterString == ScDocShell::GetDifFilterName() )
{ if ( bExport )
{ // DIF export
aTitle = ScResId( STR_EXPORT_DIF );
} else
{ // DIF import
aTitle = ScResId( STR_IMPORT_DIF );
} // common for DIF import/export
eEncoding = RTL_TEXTENCODING_MS_1252;
}
ScImportOptions aOptions( cAsciiDel, cStrDel, eEncoding);
aOptions.bIncludeBOM = bIncludeBOM; if(skipDialog)
{ // TODO: check we are not missing some of the stuff that ScImportOptionsDlg::GetImportOptions // (file sc/source/ui/dbgui/scuiimoptdlg.cxx) does // that is, if the dialog sets options that are not selected by the user (!) // then we are missing them here. // Then we may need to rip them out of the dialog. // Or we actually change the dialog to not display if skipDialog==true // in that case, add an argument skipDialog to CreateScImportOptionsDlg
nRet = ui::dialogs::ExecutableDialogResults::OK;
} else
{
ScopedVclPtr<AbstractScImportOptionsDlg> pDlg(pFact->CreateScImportOptionsDlg(Application::GetFrameWeld(xDialogParent),
bAscii, &aOptions, &aTitle,
bDBEnc, !bExport)); if ( pDlg->Execute() == RET_OK )
{
pDlg->SaveImportOptions();
pDlg->GetImportOptions( aOptions );
save_CharSet( aOptions.eCharSet, bExport );
nRet = ui::dialogs::ExecutableDialogResults::OK;
}
} if (nRet == ui::dialogs::ExecutableDialogResults::OK)
{ if ( bAscii )
aFilterOptions = aOptions.BuildString(); else
aFilterOptions = aOptions.aStrFont;
}
}
xInputStream.clear(); // don't hold the stream longer than necessary
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.