[Libreoffice-commits] core.git: sc/inc sc/source sc/uiconfig
George Bateman (via logerrit)
logerrit at kemper.freedesktop.org
Fri Feb 19 10:00:25 UTC 2021
sc/inc/scabstdlg.hxx | 1
sc/source/ui/attrdlg/scdlgfact.cxx | 5 +++
sc/source/ui/attrdlg/scdlgfact.hxx | 1
sc/source/ui/dbgui/textimportoptions.cxx | 6 +++
sc/source/ui/inc/textimportoptions.hxx | 2 +
sc/source/ui/view/viewfun5.cxx | 48 +++++++++++++++++++++---------
sc/uiconfig/scalc/ui/textimportoptions.ui | 16 +++++-----
7 files changed, 58 insertions(+), 21 deletions(-)
New commits:
commit 57dec020b9527d3dd472e33010381822d4ca306c
Author: George Bateman <george.bateman16 at gmail.com>
AuthorDate: Tue Dec 8 10:22:22 2020 +0000
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Fri Feb 19 10:59:44 2021 +0100
tdf#65872 [WIP] Allow prefered interpretation of pasted numbers to be saved
Change-Id: I065f1f8cff1b3c7d7198ce431df39a7b8cb7b593
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107402
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze at documentfoundation.org>
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index e6971503a051..0656ca16cc10 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -393,6 +393,7 @@ protected:
public:
virtual LanguageType GetLanguageType() const = 0;
virtual bool IsDateConversionSet() const = 0;
+ virtual bool IsKeepAskingSet() const = 0;
};
class ScAbstractDialogFactory
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 061db5614a66..b77f603540de 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -876,6 +876,11 @@ bool AbstractScTextImportOptionsDlg_Impl::IsDateConversionSet() const
return m_xDlg->isDateConversionSet();
}
+bool AbstractScTextImportOptionsDlg_Impl::IsKeepAskingSet() const
+{
+ return m_xDlg->isKeepAskingSet();
+}
+
BitmapEx AbstractScTextImportOptionsDlg_Impl::createScreenshot() const
{
VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 980b3f4270bc..be01347f495f 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -626,6 +626,7 @@ public:
virtual short Execute() override;
virtual LanguageType GetLanguageType() const override;
virtual bool IsDateConversionSet() const override;
+ virtual bool IsKeepAskingSet() const override;
// screenshotting
virtual BitmapEx createScreenshot() const override;
diff --git a/sc/source/ui/dbgui/textimportoptions.cxx b/sc/source/ui/dbgui/textimportoptions.cxx
index 63353d4b28a8..b8e99ca2e6df 100644
--- a/sc/source/ui/dbgui/textimportoptions.cxx
+++ b/sc/source/ui/dbgui/textimportoptions.cxx
@@ -31,6 +31,7 @@ ScTextImportOptionsDlg::ScTextImportOptionsDlg(weld::Window* pParent)
, m_xRbAutomatic(m_xBuilder->weld_radio_button("automatic"))
, m_xRbCustom(m_xBuilder->weld_radio_button("custom"))
, m_xBtnConvertDate(m_xBuilder->weld_check_button("convertdata"))
+ , m_xBtnKeepAsking(m_xBuilder->weld_check_button("keepasking"))
, m_xLbCustomLang(new SvxLanguageBox(m_xBuilder->weld_combo_box("lang")))
{
init();
@@ -53,6 +54,11 @@ bool ScTextImportOptionsDlg::isDateConversionSet() const
return m_xBtnConvertDate->get_active();
}
+bool ScTextImportOptionsDlg::isKeepAskingSet() const
+{
+ return m_xBtnKeepAsking->get_active();
+}
+
void ScTextImportOptionsDlg::init()
{
m_xBtnOk->connect_clicked(LINK(this, ScTextImportOptionsDlg, OKHdl));
diff --git a/sc/source/ui/inc/textimportoptions.hxx b/sc/source/ui/inc/textimportoptions.hxx
index 3b50655c7d72..78fd5cb88e01 100644
--- a/sc/source/ui/inc/textimportoptions.hxx
+++ b/sc/source/ui/inc/textimportoptions.hxx
@@ -33,6 +33,7 @@ public:
LanguageType getLanguageType() const;
bool isDateConversionSet() const;
+ bool isKeepAskingSet() const;
private:
void init();
@@ -42,6 +43,7 @@ private:
std::unique_ptr<weld::RadioButton> m_xRbAutomatic;
std::unique_ptr<weld::RadioButton> m_xRbCustom;
std::unique_ptr<weld::CheckButton> m_xBtnConvertDate;
+ std::unique_ptr<weld::CheckButton> m_xBtnKeepAsking;
std::unique_ptr<SvxLanguageBox> m_xLbCustomLang;
DECL_LINK(OKHdl, weld::Button&, void);
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index 1773c2fb4474..010febb22012 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -304,28 +304,50 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
tools::SvRef<SotTempStream> xStream;
if ( aDataHelper.GetSotStorageStream( nFormatId, xStream ) && xStream.is() )
{
+ // 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;
+
if (nFormatId == SotClipboardFormatId::HTML &&
!comphelper::LibreOfficeKit::isActive())
{
- // Launch the text import options dialog. For now, we do
- // this for html pasting only, but in the future it may
- // make sense to do it for other data types too.
- ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
- vcl::Window* pParent = GetActiveWin();
- ScopedVclPtr<AbstractScTextImportOptionsDlg> pDlg(
- pFact->CreateScTextImportOptionsDlg(pParent ? pParent->GetFrameWeld() : nullptr));
-
- if (pDlg->Execute() == RET_OK)
+ if (bHaveSavedPreferences)
{
ScAsciiOptions aOptions;
- aOptions.SetLanguage(pDlg->GetLanguageType());
- aOptions.SetDetectSpecialNumber(pDlg->IsDateConversionSet());
+ aOptions.SetLanguage(eSavedLanguage);
+ aOptions.SetDetectSpecialNumber(bSavedDateConversion);
pObj->SetExtOptions(aOptions);
}
else
{
- // prevent error dialog for user cancel action
- bRet = true;
+ // Launch the text import options dialog. For now, we do
+ // this for html pasting only, but in the future it may
+ // make sense to do it for other data types too.
+ ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
+ vcl::Window* pParent = GetActiveWin();
+ ScopedVclPtr<AbstractScTextImportOptionsDlg> pDlg(
+ pFact->CreateScTextImportOptionsDlg(pParent ? pParent->GetFrameWeld() : nullptr));
+
+ if (pDlg->Execute() == RET_OK)
+ {
+ ScAsciiOptions aOptions;
+ aOptions.SetLanguage(pDlg->GetLanguageType());
+ aOptions.SetDetectSpecialNumber(pDlg->IsDateConversionSet());
+ if (!pDlg->IsKeepAskingSet())
+ {
+ bHaveSavedPreferences = true;
+ eSavedLanguage = pDlg->GetLanguageType();
+ bSavedDateConversion = pDlg->IsDateConversionSet();
+ }
+ pObj->SetExtOptions(aOptions);
+ }
+ else
+ {
+ // prevent error dialog for user cancel action
+ bRet = true;
+ }
}
}
if(!bRet)
diff --git a/sc/uiconfig/scalc/ui/textimportoptions.ui b/sc/uiconfig/scalc/ui/textimportoptions.ui
index eead1426cb69..f09e0b052b4f 100644
--- a/sc/uiconfig/scalc/ui/textimportoptions.ui
+++ b/sc/uiconfig/scalc/ui/textimportoptions.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.1 -->
+<!-- Generated with glade 3.22.2 -->
<interface domain="sc">
<requires lib="gtk+" version="3.20"/>
<object class="GtkDialog" id="TextImportOptionsDialog">
@@ -10,7 +10,7 @@
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property>
- <child>
+ <child type="titlebar">
<placeholder/>
</child>
<child internal-child="vbox">
@@ -53,12 +53,13 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="help">
- <property name="label" translatable="yes" context="stock">_Help</property>
+ <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">True</property>
- <property name="use-underline">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>
@@ -204,7 +205,6 @@
<action-widgets>
<action-widget response="-5">ok</action-widget>
<action-widget response="-6">cancel</action-widget>
- <action-widget response="-11">help</action-widget>
</action-widgets>
</object>
</interface>
More information about the Libreoffice-commits
mailing list