summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Common.xcs137
-rw-r--r--sc/source/ui/inc/inscodlg.hxx3
-rw-r--r--sc/source/ui/miscdlgs/inscodlg.cxx140
-rw-r--r--sc/uiconfig/scalc/ui/pastespecial.ui1
4 files changed, 278 insertions, 3 deletions
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 73b1acbe871d..8dd15b7ca8c7 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -6599,5 +6599,142 @@
<value>true</value>
</prop>
</group>
+ <group oor:name="PasteSpecial">
+ <info>
+ <desc>Stores properties related to the paste special feature in Calc.</desc>
+ </info>
+ <group oor:name="Paste">
+ <info>
+ <desc>Stores options under the "Paste" section.</desc>
+ </info>
+ <prop oor:name="All" oor:type="xs:boolean" oor:nillable="false">
+ <info>
+ <desc>Option to set all options.</desc>
+ </info>
+ <value>false</value>
+ </prop>
+ <prop oor:name="Numbers" oor:type="xs:boolean" oor:nillable="false">
+ <info>
+ <desc>Option for numbers.</desc>
+ </info>
+ <value>true</value>
+ </prop>
+ <prop oor:name="Text" oor:type="xs:boolean" oor:nillable="false">
+ <info>
+ <desc>Option for text.</desc>
+ </info>
+ <value>true</value>
+ </prop>
+ <prop oor:name="DateTime" oor:type="xs:boolean" oor:nillable="false">
+ <info>
+ <desc>Option for date and time.</desc>
+ </info>
+ <value>true</value>
+ </prop>
+ <prop oor:name="Formats" oor:type="xs:boolean" oor:nillable="false">
+ <info>
+ <desc>Option for formats.</desc>
+ </info>
+ <value>false</value>
+ </prop>
+ <prop oor:name="Comments" oor:type="xs:boolean" oor:nillable="false">
+ <info>
+ <desc>Option for comments.</desc>
+ </info>
+ <value>false</value>
+ </prop>
+ <prop oor:name="Objects" oor:type="xs:boolean" oor:nillable="false">
+ <info>
+ <desc>Option for objects.</desc>
+ </info>
+ <value>false</value>
+ </prop>
+ <prop oor:name="Formulas" oor:type="xs:boolean" oor:nillable="false">
+ <info>
+ <desc>Option for formulas.</desc>
+ </info>
+ <value>false</value>
+ </prop>
+ </group>
+ <prop oor:name="ShiftCells" oor:type="xs:int" oor:nillable="false">
+ <info>
+ <desc>Stores the option to be used for the "Shift Cells" section.</desc>
+ </info>
+ <constraints>
+ <enumeration oor:value="0">
+ <info>
+ <desc>Shift cells down (`InsCellCmd::INS_CELLSDOWN`).</desc>
+ </info>
+ </enumeration>
+ <enumeration oor:value="1">
+ <info>
+ <desc>Shift cells right (`InsCellCmd::INS_CELLSRIGHT`).</desc>
+ </info>
+ </enumeration>
+ <enumeration oor:value="4">
+ <info>
+ <desc>None (`InsCellCmd::INS_NONE`). This is the default value.</desc>
+ </info>
+ </enumeration>
+ </constraints>
+ <value>4</value>
+ </prop>
+ <group oor:name="Options">
+ <info>
+ <desc>Stores options under the "Options" section.</desc>
+ </info>
+ <prop oor:name="AsLink" oor:type="xs:boolean" oor:nillable="false">
+ <info>
+ <desc>Option for as link.</desc>
+ </info>
+ <value>false</value>
+ </prop>
+ <prop oor:name="Transpose" oor:type="xs:boolean" oor:nillable="false">
+ <info>
+ <desc>Option for transpose.</desc>
+ </info>
+ <value>false</value>
+ </prop>
+ <prop oor:name="SkipEmptyCells" oor:type="xs:boolean" oor:nillable="false">
+ <info>
+ <desc>Option for skipping empty cells.</desc>
+ </info>
+ <value>false</value>
+ </prop>
+ </group>
+ <prop oor:name="Operations" oor:type="xs:int" oor:nillable="false">
+ <info>
+ <desc>Stores the option to be used for the "Operations" section.</desc>
+ </info>
+ <constraints>
+ <enumeration oor:value="0">
+ <info>
+ <desc>No operation (`ScPasteFunc::NONE`). This is the default value.</desc>
+ </info>
+ </enumeration>
+ <enumeration oor:value="1">
+ <info>
+ <desc>Add (`ScPasteFunc::ADD`).</desc>
+ </info>
+ </enumeration>
+ <enumeration oor:value="2">
+ <info>
+ <desc>Subtract (`ScPasteFunc::SUB`).</desc>
+ </info>
+ </enumeration>
+ <enumeration oor:value="3">
+ <info>
+ <desc>Multiply (`ScPasteFunc::MUL`).</desc>
+ </info>
+ </enumeration>
+ <enumeration oor:value="4">
+ <info>
+ <desc>Divide (`ScPasteFunc::DIV`).</desc>
+ </info>
+ </enumeration>
+ </constraints>
+ <value>0</value>
+ </prop>
+ </group>
</component>
</oor:component-schema>
diff --git a/sc/source/ui/inc/inscodlg.hxx b/sc/source/ui/inc/inscodlg.hxx
index a30cffe0b355..31577f832eef 100644
--- a/sc/source/ui/inc/inscodlg.hxx
+++ b/sc/source/ui/inc/inscodlg.hxx
@@ -43,6 +43,7 @@ public:
void SetFillMode( bool bSet );
void SetChangeTrack( bool bSet );
void SetCellShiftDisabled( CellShiftDisabledFlags nDisable );
+ void storeFlagsInRegistry();
private:
bool bOtherDoc;
@@ -82,6 +83,7 @@ private:
std::unique_ptr<weld::Button> mxBtnShortCutPasteValuesFormats;
std::unique_ptr<weld::Button> mxBtnShortCutPasteTranspose;
std::unique_ptr<weld::Button> mxBtnShortCutPasteFormats;
+ std::unique_ptr<weld::Button> mxOKBtn;
std::unique_ptr<weld::CheckButton> mxImmediately;
@@ -97,6 +99,7 @@ private:
DECL_LINK( InsAllHdl, weld::Toggleable&, void );
DECL_LINK( LinkBtnHdl, weld::Toggleable&, void );
DECL_LINK( ShortCutHdl, weld::Button&, void );
+ DECL_LINK( ClickHdl, weld::Button&, void );
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/miscdlgs/inscodlg.cxx b/sc/source/ui/miscdlgs/inscodlg.cxx
index 879ed28354f3..ca4fd1cfa8bd 100644
--- a/sc/source/ui/miscdlgs/inscodlg.cxx
+++ b/sc/source/ui/miscdlgs/inscodlg.cxx
@@ -20,12 +20,59 @@
#undef SC_DLLIMPLEMENTATION
#include <inscodlg.hxx>
+#include <officecfg/Office/Common.hxx>
-InsertDeleteFlags ScInsertContentsDlg::nPreviousChecks = InsertDeleteFlags::VALUE | InsertDeleteFlags::DATETIME | InsertDeleteFlags::STRING;
+InsertDeleteFlags ScInsertContentsDlg::nPreviousChecks = InsertDeleteFlags::NONE;
ScPasteFunc ScInsertContentsDlg::nPreviousFormulaChecks = ScPasteFunc::NONE;
InsertContentsFlags ScInsertContentsDlg::nPreviousChecks2 = InsertContentsFlags::NONE;
InsCellCmd ScInsertContentsDlg::nPreviousMoveMode = InsCellCmd::INS_NONE;
+//whether the dialog has loaded for the first time
+static bool firstLoad = true;
+
+void ScInsertContentsDlg::storeFlagsInRegistry()
+{
+ //store the flags in the registry
+ std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
+
+ //InsertDeleteFlags
+ officecfg::Office::Common::PasteSpecial::Paste::All::set(ScInsertContentsDlg::mxBtnInsAll->get_active(), batch);
+ officecfg::Office::Common::PasteSpecial::Paste::Numbers::set(ScInsertContentsDlg::mxBtnInsNumbers->get_active(), batch);
+ officecfg::Office::Common::PasteSpecial::Paste::Text::set(ScInsertContentsDlg::mxBtnInsStrings->get_active(), batch);
+ officecfg::Office::Common::PasteSpecial::Paste::DateTime::set(ScInsertContentsDlg::mxBtnInsDateTime->get_active(), batch);
+ officecfg::Office::Common::PasteSpecial::Paste::Formats::set(ScInsertContentsDlg::mxBtnInsAttrs->get_active(), batch);
+ officecfg::Office::Common::PasteSpecial::Paste::Comments::set(ScInsertContentsDlg::mxBtnInsNotes->get_active(), batch);
+ officecfg::Office::Common::PasteSpecial::Paste::Objects::set(ScInsertContentsDlg::mxBtnInsObjects->get_active(), batch);
+ officecfg::Office::Common::PasteSpecial::Paste::Formulas::set(ScInsertContentsDlg::mxBtnInsFormulas->get_active(), batch);
+
+ //ScPasteFunc
+ if(ScInsertContentsDlg::mxRbNoOp->get_active())
+ officecfg::Office::Common::PasteSpecial::Operations::set(0, batch);
+ else if(ScInsertContentsDlg::mxRbAdd->get_active())
+ officecfg::Office::Common::PasteSpecial::Operations::set(1, batch);
+ else if(ScInsertContentsDlg::mxRbSub->get_active())
+ officecfg::Office::Common::PasteSpecial::Operations::set(2, batch);
+ else if(ScInsertContentsDlg::mxRbMul->get_active())
+ officecfg::Office::Common::PasteSpecial::Operations::set(3, batch);
+ else if(ScInsertContentsDlg::mxRbDiv->get_active())
+ officecfg::Office::Common::PasteSpecial::Operations::set(4, batch);
+
+ //InsertContentsFlags
+ officecfg::Office::Common::PasteSpecial::Options::AsLink::set(ScInsertContentsDlg::mxBtnLink->get_active(), batch);
+ officecfg::Office::Common::PasteSpecial::Options::Transpose::set(ScInsertContentsDlg::mxBtnTranspose->get_active(), batch);
+ officecfg::Office::Common::PasteSpecial::Options::SkipEmptyCells::set(ScInsertContentsDlg::mxBtnSkipEmptyCells->get_active(), batch);
+
+ //InsCellCmd
+ if(ScInsertContentsDlg::mxRbMoveNone->get_active())
+ officecfg::Office::Common::PasteSpecial::ShiftCells::set(4, batch);
+ else if(ScInsertContentsDlg::mxRbMoveDown->get_active())
+ officecfg::Office::Common::PasteSpecial::ShiftCells::set(0, batch);
+ else if(ScInsertContentsDlg::mxRbMoveRight->get_active())
+ officecfg::Office::Common::PasteSpecial::ShiftCells::set(1, batch);
+
+ batch->commit();
+}
+
ScInsertContentsDlg::ScInsertContentsDlg(weld::Window* pParent,
const OUString* pStrTitle )
: GenericDialogController(pParent, "modules/scalc/ui/pastespecial.ui", "PasteSpecial")
@@ -57,11 +104,88 @@ ScInsertContentsDlg::ScInsertContentsDlg(weld::Window* pParent,
, mxBtnShortCutPasteValuesFormats(m_xBuilder->weld_button("paste_values_formats"))
, mxBtnShortCutPasteTranspose(m_xBuilder->weld_button("paste_transpose"))
, mxBtnShortCutPasteFormats(m_xBuilder->weld_button("paste_formats"))
+ , mxOKBtn(m_xBuilder->weld_button("ok"))
, mxImmediately(m_xBuilder->weld_check_button("cbImmediately"))
{
if (pStrTitle)
m_xDialog->set_title(*pStrTitle);
+ if (firstLoad)
+ {
+ //unset firstLoad
+ firstLoad = false;
+
+ //set the flags from the registry
+
+ /*
+ * Flags for nPreviousChecks
+ */
+ if(officecfg::Office::Common::PasteSpecial::Paste::All::get())
+ nPreviousChecks |= InsertDeleteFlags::ALL;
+ if(officecfg::Office::Common::PasteSpecial::Paste::Numbers::get())
+ nPreviousChecks |= InsertDeleteFlags::VALUE;
+ if(officecfg::Office::Common::PasteSpecial::Paste::Text::get())
+ nPreviousChecks |= InsertDeleteFlags::STRING;
+ if(officecfg::Office::Common::PasteSpecial::Paste::DateTime::get())
+ nPreviousChecks |= InsertDeleteFlags::DATETIME;
+ if(officecfg::Office::Common::PasteSpecial::Paste::Formats::get())
+ nPreviousChecks |= InsertDeleteFlags::ATTRIB;
+ if(officecfg::Office::Common::PasteSpecial::Paste::Comments::get())
+ nPreviousChecks |= InsertDeleteFlags::NOTE;
+ if(officecfg::Office::Common::PasteSpecial::Paste::Objects::get())
+ nPreviousChecks |= InsertDeleteFlags::OBJECTS;
+ if(officecfg::Office::Common::PasteSpecial::Paste::Formulas::get())
+ nPreviousChecks |= InsertDeleteFlags::FORMULA;
+
+ /*
+ * Flags for nPreviousFormulaChecks
+ */
+ int optionFlagValue = officecfg::Office::Common::PasteSpecial::Operations::get();
+ switch(optionFlagValue)
+ {
+ case 0: nPreviousFormulaChecks = ScPasteFunc::NONE;
+ break;
+
+ case 1: nPreviousFormulaChecks = ScPasteFunc::ADD;
+ break;
+
+ case 2: nPreviousFormulaChecks = ScPasteFunc::SUB;
+ break;
+
+ case 3: nPreviousFormulaChecks = ScPasteFunc::MUL;
+ break;
+
+ case 4: nPreviousFormulaChecks = ScPasteFunc::DIV;
+ break;
+ }
+
+ /*
+ * Flags for nPreviousChecks2
+ */
+ if(officecfg::Office::Common::PasteSpecial::Options::AsLink::get())
+ nPreviousChecks2 |= InsertContentsFlags::Link;
+ if(officecfg::Office::Common::PasteSpecial::Options::Transpose::get())
+ nPreviousChecks2 |= InsertContentsFlags::Trans;
+ if(officecfg::Office::Common::PasteSpecial::Options::SkipEmptyCells::get())
+ nPreviousChecks2 |= InsertContentsFlags::NoEmpty;
+
+ /*
+ * Flags for nPreviousMoveMode
+ */
+ int shiftFlagValue = officecfg::Office::Common::PasteSpecial::ShiftCells::get();
+ switch(shiftFlagValue)
+ {
+ case 0: nPreviousMoveMode = InsCellCmd::INS_CELLSDOWN;
+ break;
+
+ case 1: nPreviousMoveMode = InsCellCmd::INS_CELLSRIGHT;
+ break;
+
+ case 4: nPreviousMoveMode = InsCellCmd::INS_NONE;
+ break;
+ }
+ }
+
SetInsContentsCmdBits( ScInsertContentsDlg::nPreviousChecks );
SetFormulaCmdBits( ScInsertContentsDlg::nPreviousFormulaChecks );
SetCellCmdFlags( ScInsertContentsDlg::nPreviousMoveMode );
@@ -74,6 +198,7 @@ ScInsertContentsDlg::ScInsertContentsDlg(weld::Window* pParent,
mxBtnShortCutPasteValuesFormats->connect_clicked( LINK( this, ScInsertContentsDlg, ShortCutHdl ) );
mxBtnShortCutPasteTranspose->connect_clicked( LINK( this, ScInsertContentsDlg, ShortCutHdl ) );
mxBtnShortCutPasteFormats->connect_clicked( LINK( this, ScInsertContentsDlg, ShortCutHdl ) );
+ mxOKBtn->connect_clicked( LINK( this, ScInsertContentsDlg, ClickHdl ) );
}
InsertDeleteFlags ScInsertContentsDlg::GetInsContentsCmdBits() const
@@ -316,7 +441,18 @@ IMPL_LINK(ScInsertContentsDlg, ShortCutHdl, weld::Button&, rBtn, void)
SetCellCmdFlags( InsCellCmd::INS_NONE );
SetFormulaCmdBits(ScPasteFunc::NONE);
- if (mxImmediately->get_active()) m_xDialog->response(RET_OK);
+
+ if (mxImmediately->get_active())
+ {
+ storeFlagsInRegistry();
+ m_xDialog->response(RET_OK);
+ }
+}
+
+IMPL_LINK_NOARG(ScInsertContentsDlg, ClickHdl, weld::Button&, void)
+{
+ storeFlagsInRegistry();
+ m_xDialog->response(RET_OK);
}
IMPL_LINK_NOARG(ScInsertContentsDlg, InsAllHdl, weld::Toggleable&, void)
diff --git a/sc/uiconfig/scalc/ui/pastespecial.ui b/sc/uiconfig/scalc/ui/pastespecial.ui
index 83290dbf5db1..ccdfcbc8a46a 100644
--- a/sc/uiconfig/scalc/ui/pastespecial.ui
+++ b/sc/uiconfig/scalc/ui/pastespecial.ui
@@ -816,7 +816,6 @@
</object>
</child>
<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>