tdf#65872 Remove import dialog for normal paste in Calc
Remove the import dialog when performing a normal paste. Show the dialog only for Paste Special to avoid unnecessary interruptions. For normal paste, use the last selected preferences from Paste Special. Change-Id: Idfc985b9c13cb3b995c91e947e815d1789e6f041 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181225 Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org> Tested-by: Jenkins
This commit is contained in:
committed by
Heiko Tietze
parent
fa1ce426bd
commit
fec431aeef
@@ -1207,6 +1207,17 @@
|
||||
<value/>
|
||||
</prop>
|
||||
</group>
|
||||
<group oor:name="ClipboardHTMLImport">
|
||||
<prop oor:name="Language" oor:type="xs:int" oor:nillable="false">
|
||||
<value>0</value> <!-- LANGUAGE_SYSTEM -->
|
||||
</prop>
|
||||
<prop oor:name="DetectSpecialNumbers" oor:type="xs:boolean" oor:nillable="false">
|
||||
<value>false</value>
|
||||
</prop>
|
||||
<prop oor:name="DetectScientificNumbers" oor:type="xs:boolean" oor:nillable="false">
|
||||
<value>false</value>
|
||||
</prop>
|
||||
</group>
|
||||
<group oor:name="TextToColumnsImport">
|
||||
<info>
|
||||
<desc>Contains setting for Text to Columns Import</desc>
|
||||
|
||||
@@ -396,7 +396,6 @@ public:
|
||||
virtual LanguageType GetLanguageType() const = 0;
|
||||
virtual bool IsDateConversionSet() const = 0;
|
||||
virtual bool IsScientificConversionSet() const = 0;
|
||||
virtual bool IsKeepAskingSet() const = 0;
|
||||
};
|
||||
|
||||
class AbstractScGoToTabDlg : public VclAbstractDialog
|
||||
|
||||
@@ -131,7 +131,6 @@ public:
|
||||
LanguageType GetLanguageType() const override { return m_pDlg->getLanguageType(); }
|
||||
bool IsDateConversionSet() const override { return m_pDlg->isDateConversionSet(); }
|
||||
bool IsScientificConversionSet() const override { return m_pDlg->isScientificConversionSet(); }
|
||||
bool IsKeepAskingSet() const override { return m_pDlg->isKeepAskingSet(); }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ ScTextImportOptionsDlg::ScTextImportOptionsDlg(weld::Window* pParent)
|
||||
, m_xRbCustom(m_xBuilder->weld_radio_button(u"custom"_ustr))
|
||||
, m_xCkbConvertDate(m_xBuilder->weld_check_button(u"convertdata"_ustr))
|
||||
, m_xCkbConvertScientific(m_xBuilder->weld_check_button(u"convertscientificnotation"_ustr))
|
||||
, m_xCkbKeepAsking(m_xBuilder->weld_check_button(u"keepasking"_ustr))
|
||||
, m_xLbCustomLang(new SvxLanguageBox(m_xBuilder->weld_combo_box(u"lang"_ustr)))
|
||||
{
|
||||
init();
|
||||
@@ -60,11 +59,6 @@ bool ScTextImportOptionsDlg::isScientificConversionSet() const
|
||||
return m_xCkbConvertScientific->get_active();
|
||||
}
|
||||
|
||||
bool ScTextImportOptionsDlg::isKeepAskingSet() const
|
||||
{
|
||||
return m_xCkbKeepAsking->get_active();
|
||||
}
|
||||
|
||||
void ScTextImportOptionsDlg::init()
|
||||
{
|
||||
m_xBtnOk->connect_clicked(LINK(this, ScTextImportOptionsDlg, OKHdl));
|
||||
|
||||
@@ -33,7 +33,6 @@ public:
|
||||
LanguageType getLanguageType() const;
|
||||
bool isDateConversionSet() const;
|
||||
bool isScientificConversionSet() const;
|
||||
bool isKeepAskingSet() const;
|
||||
|
||||
private:
|
||||
void init();
|
||||
@@ -44,7 +43,6 @@ private:
|
||||
std::unique_ptr<weld::RadioButton> m_xRbCustom;
|
||||
std::unique_ptr<weld::CheckButton> m_xCkbConvertDate;
|
||||
std::unique_ptr<weld::CheckButton> m_xCkbConvertScientific;
|
||||
std::unique_ptr<weld::CheckButton> m_xCkbKeepAsking;
|
||||
std::unique_ptr<SvxLanguageBox> m_xLbCustomLang;
|
||||
|
||||
DECL_LINK(OKHdl, weld::Button&, void);
|
||||
|
||||
@@ -127,8 +127,8 @@ public:
|
||||
|
||||
void FillTab( InsertDeleteFlags nFlags, ScPasteFunc nFunction, bool bSkipEmpty, bool bAsLink );
|
||||
|
||||
SC_DLLPUBLIC void PasteFromSystem();
|
||||
SC_DLLPUBLIC bool PasteFromSystem( SotClipboardFormatId nFormatId, bool bApi = false );
|
||||
SC_DLLPUBLIC void PasteFromSystem(bool useSavedPrefs = false);
|
||||
SC_DLLPUBLIC bool PasteFromSystem( SotClipboardFormatId nFormatId, bool bApi = false, bool useSavedPrefs = false );
|
||||
void PasteFromTransferable( const css::uno::Reference<
|
||||
css::datatransfer::XTransferable >& rxTransferable );
|
||||
|
||||
@@ -143,7 +143,7 @@ public:
|
||||
bool PasteDataFormat( SotClipboardFormatId nFormatId,
|
||||
const css::uno::Reference< css::datatransfer::XTransferable >& rxTransferable,
|
||||
SCCOL nPosX, SCROW nPosY, const Point* pLogicPos,
|
||||
bool bLink = false, bool bAllowDialogs = false );
|
||||
bool bLink = false, bool bAllowDialogs = false, bool useSavedPrefs = false );
|
||||
|
||||
bool PasteFile( const Point&, const OUString&, bool bLink );
|
||||
bool PasteObject( const Point&, const css::uno::Reference < css::embed::XEmbeddedObject >&, const Size*, const Graphic* = nullptr, const OUString& = OUString(), sal_Int64 nAspect = css::embed::Aspects::MSOLE_CONTENT );
|
||||
@@ -381,7 +381,7 @@ private:
|
||||
bool PasteDataFormatFormattedText( SotClipboardFormatId nFormatId,
|
||||
const css::uno::Reference< css::datatransfer::XTransferable >& rxTransferable,
|
||||
SCCOL nPosX, SCROW nPosY,
|
||||
bool bAllowDialogs, const TransferableDataHelper& rDataHelper );
|
||||
bool bAllowDialogs, const TransferableDataHelper& rDataHelper, bool useSavedPrefs = false );
|
||||
|
||||
sal_uInt16 GetOptimalColWidth( SCCOL nCol, SCTAB nTab, bool bFormula );
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ void ScClipUtil::PasteFromClipboard( ScViewData& rViewData, ScTabViewShell* pTab
|
||||
weld::WaitObject aWait( rViewData.GetDialogParent() );
|
||||
if (!pOwnClip)
|
||||
{
|
||||
pTabViewShell->PasteFromSystem();
|
||||
pTabViewShell->PasteFromSystem(true);
|
||||
// Anchor To Cell rather than To Page
|
||||
ScDrawView* pDrawView = pTabViewShell->GetScDrawView();
|
||||
if(pDrawView)
|
||||
|
||||
@@ -489,7 +489,7 @@ void ScViewFunc::PasteDraw()
|
||||
}
|
||||
}
|
||||
|
||||
void ScViewFunc::PasteFromSystem()
|
||||
void ScViewFunc::PasteFromSystem(bool useSavedPrefs)
|
||||
{
|
||||
UpdateInputLine();
|
||||
|
||||
@@ -605,7 +605,7 @@ void ScViewFunc::PasteFromSystem()
|
||||
else if (aDataHelper.HasFormat(SotClipboardFormatId::RICHTEXT))
|
||||
PasteFromSystem(SotClipboardFormatId::RICHTEXT);
|
||||
else if (aDataHelper.HasFormat(SotClipboardFormatId::HTML))
|
||||
PasteFromSystem(SotClipboardFormatId::HTML);
|
||||
PasteFromSystem(SotClipboardFormatId::HTML, false, useSavedPrefs);
|
||||
else if (aDataHelper.HasFormat(SotClipboardFormatId::BITMAP))
|
||||
PasteFromSystem(SotClipboardFormatId::BITMAP);
|
||||
else if (aDataHelper.HasFormat(SotClipboardFormatId::HTML_SIMPLE))
|
||||
@@ -717,7 +717,7 @@ void ScViewFunc::PasteFromTransferable( const uno::Reference<datatransfer::XTran
|
||||
}
|
||||
}
|
||||
|
||||
bool ScViewFunc::PasteFromSystem( SotClipboardFormatId nFormatId, bool bApi )
|
||||
bool ScViewFunc::PasteFromSystem( SotClipboardFormatId nFormatId, bool bApi, bool useSavedPrefs )
|
||||
{
|
||||
UpdateInputLine();
|
||||
|
||||
@@ -755,7 +755,7 @@ bool ScViewFunc::PasteFromSystem( SotClipboardFormatId nFormatId, bool bApi )
|
||||
|
||||
bRet = PasteDataFormat( nFormatId, aDataHelper.GetTransferable(),
|
||||
nPosX, nPosY,
|
||||
nullptr, false, !bApi ); // allow warning dialog
|
||||
nullptr, false, !bApi, useSavedPrefs ); // allow warning dialog
|
||||
|
||||
if ( !bRet && !bApi )
|
||||
{
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <i18nlangtag/lang.h>
|
||||
#include <officecfg/Office/Calc.hxx>
|
||||
#include <com/sun/star/embed/XEmbedObjectClipboardCreator.hpp>
|
||||
#include <com/sun/star/embed/Aspects.hpp>
|
||||
#include <com/sun/star/embed/MSOLEObjectSystemCreator.hpp>
|
||||
@@ -76,7 +78,7 @@ using namespace com::sun::star;
|
||||
|
||||
bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
|
||||
const uno::Reference<datatransfer::XTransferable>& rxTransferable,
|
||||
SCCOL nPosX, SCROW nPosY, const Point* pLogicPos, bool bLink, bool bAllowDialogs )
|
||||
SCCOL nPosX, SCROW nPosY, const Point* pLogicPos, bool bLink, bool bAllowDialogs, bool useSavedPrefs )
|
||||
{
|
||||
ScDocument& rDoc = GetViewData().GetDocument();
|
||||
rDoc.SetPastingDrawFromOtherDoc( true );
|
||||
@@ -126,7 +128,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
|
||||
nFormatId == SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT )
|
||||
{
|
||||
bRet = PasteDataFormatFormattedText(nFormatId, rxTransferable, nPosX, nPosY,
|
||||
bAllowDialogs, aDataHelper);
|
||||
bAllowDialogs, aDataHelper, useSavedPrefs);
|
||||
}
|
||||
else if (nFormatId == SotClipboardFormatId::SBA_DATAEXCHANGE)
|
||||
{
|
||||
@@ -658,7 +660,7 @@ bool ScViewFunc::PasteDataFormatSource( SotClipboardFormatId nFormatId,
|
||||
bool ScViewFunc::PasteDataFormatFormattedText( SotClipboardFormatId nFormatId,
|
||||
const uno::Reference<datatransfer::XTransferable>& rxTransferable,
|
||||
SCCOL nPosX, SCROW nPosY, bool bAllowDialogs,
|
||||
const TransferableDataHelper& rDataHelper )
|
||||
const TransferableDataHelper& rDataHelper, bool useSavedPrefs )
|
||||
{
|
||||
if ( nFormatId == SotClipboardFormatId::RTF && rDataHelper.HasFormat( SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT ) )
|
||||
{
|
||||
@@ -676,22 +678,15 @@ bool ScViewFunc::PasteDataFormatFormattedText( SotClipboardFormatId nFormatId,
|
||||
auto pStrBuffer = std::make_shared<OUString>();
|
||||
if (std::unique_ptr<SvStream> xStream = rDataHelper.GetSotStorageStream( nFormatId ) )
|
||||
{
|
||||
// Static variables for per-session storage. This could be
|
||||
// changed to longer-term storage in future.
|
||||
static bool bHaveSavedPreferences = false;
|
||||
static LanguageType eSavedLanguage;
|
||||
static bool bSavedDateConversion;
|
||||
static bool bSavedScientificConversion;
|
||||
|
||||
if (nFormatId == SotClipboardFormatId::HTML &&
|
||||
!comphelper::LibreOfficeKit::isActive())
|
||||
{
|
||||
if (bHaveSavedPreferences)
|
||||
if (useSavedPrefs)
|
||||
{
|
||||
ScAsciiOptions aOptions;
|
||||
aOptions.SetLanguage(eSavedLanguage);
|
||||
aOptions.SetDetectSpecialNumber(bSavedDateConversion);
|
||||
aOptions.SetDetectScientificNumber(bSavedScientificConversion);
|
||||
aOptions.SetLanguage(LanguageType(officecfg::Office::Calc::Dialogs::ClipboardHTMLImport::Language::get()));
|
||||
aOptions.SetDetectSpecialNumber(officecfg::Office::Calc::Dialogs::ClipboardHTMLImport::DetectSpecialNumbers::get());
|
||||
aOptions.SetDetectScientificNumber(officecfg::Office::Calc::Dialogs::ClipboardHTMLImport::DetectScientificNumbers::get());
|
||||
pObj->SetExtOptions(aOptions);
|
||||
}
|
||||
else
|
||||
@@ -710,13 +705,11 @@ bool ScViewFunc::PasteDataFormatFormattedText( SotClipboardFormatId nFormatId,
|
||||
aOptions.SetLanguage(pDlg->GetLanguageType());
|
||||
aOptions.SetDetectSpecialNumber(pDlg->IsDateConversionSet());
|
||||
aOptions.SetDetectScientificNumber(pDlg->IsScientificConversionSet());
|
||||
if (!pDlg->IsKeepAskingSet())
|
||||
{
|
||||
bHaveSavedPreferences = true;
|
||||
eSavedLanguage = pDlg->GetLanguageType();
|
||||
bSavedDateConversion = pDlg->IsDateConversionSet();
|
||||
bSavedScientificConversion = pDlg->IsScientificConversionSet();
|
||||
}
|
||||
auto pChange(comphelper::ConfigurationChanges::create());
|
||||
officecfg::Office::Calc::Dialogs::ClipboardHTMLImport::Language::set(pDlg->GetLanguageType().get(), pChange);
|
||||
officecfg::Office::Calc::Dialogs::ClipboardHTMLImport::DetectSpecialNumbers::set(pDlg->IsDateConversionSet(), pChange);
|
||||
officecfg::Office::Calc::Dialogs::ClipboardHTMLImport::DetectScientificNumbers::set(pDlg->IsScientificConversionSet(), pChange);
|
||||
pChange->commit();
|
||||
pObj->SetExtOptions(aOptions);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -49,22 +49,6 @@
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="keepasking">
|
||||
<property name="label" translatable="yes" context="textimportoptions|keepasking">Keep asking during this session</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw-indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
<property name="secondary">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
||||
Reference in New Issue
Block a user