diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2019-02-15 18:34:56 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2019-02-17 11:02:19 +0100 |
commit | 421ebc945cb86a68b826b3c14b1cee6a21e46ef2 (patch) | |
tree | b1a2c1e3bf9b2ac3b06c377a561c52f93827a5a3 /sw | |
parent | 86909f49b053731fcad9e552d81b205099770866 (diff) |
MSForms: Introduce a new compatibility flag to enable MS compatible Forms menu
* It's a global option not a document level setting (like other compatibility
options) so I created a separate section on the GUI for this option on the
same tab page.
* In the configuration the option is placed under Compatibility/View since
the existing Compatibility/FormattingOptions seems related to document formating
and not the GUI.
* Since it was added with a new configuration root I needed to add also a new
ConfigItem derviative class to handle this option.
Reviewed-on: https://gerrit.libreoffice.org/67902
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
(cherry picked from commit 11669b9cf970d953d41b8dd2c5ce85d6fa7e31ef)
Change-Id: I54668ae9808a1ca3c3b7fe81f2f201720257b3fb
Reviewed-on: https://gerrit.libreoffice.org/67918
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/config/optcomp.cxx | 29 | ||||
-rw-r--r-- | sw/source/uibase/inc/optcomp.hxx | 7 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/optcompatpage.ui | 81 |
3 files changed, 116 insertions, 1 deletions
diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx index 7ed785f197e9..3d8bfcb1030c 100644 --- a/sw/source/ui/config/optcomp.cxx +++ b/sw/source/ui/config/optcomp.cxx @@ -53,10 +53,14 @@ SwCompatibilityOptPage::SwCompatibilityOptPage(vcl::Window* pParent, const SfxIt , m_pWrtShell(nullptr) , m_pImpl(new SwCompatibilityOptPage_Impl) , m_nSavedOptions(0) + , m_bSavedMSFormsMenuOption(false) { get(m_pMain, "compatframe"); + get(m_pGlobalOptionsFrame, "globalcompatframe"); get(m_pFormattingLB, "format"); + get(m_pGlobalOptionsLB, "globaloptions"); get(m_pOptionsLB, "options"); + get(m_pGlobalOptionsCLB, "globaloptioncheckboxs"); get(m_pDefaultPB, "default"); for ( int i = (static_cast<int>(SvtCompatibilityEntry::Index::Module) + 1); i < static_cast<int>(SvtCompatibilityEntry::Index::INVALID); ++i ) @@ -78,6 +82,16 @@ SwCompatibilityOptPage::SwCompatibilityOptPage(vcl::Window* pParent, const SfxIt m_pOptionsLB->SetStyle( m_pOptionsLB->GetStyle() | WB_HSCROLL | WB_HIDESELECTION ); m_pOptionsLB->SetHighlightRange(); + SvTreeListEntry* pEntry = m_pGlobalOptionsCLB->SvTreeListBox::InsertEntry( m_pGlobalOptionsLB->GetEntry( 0 ) ); + if ( pEntry ) + { + m_pGlobalOptionsCLB->SetCheckButtonState( pEntry, SvButtonState::Unchecked ); + } + m_pGlobalOptionsLB->Clear(); + + m_pGlobalOptionsCLB->SetStyle( m_pGlobalOptionsCLB->GetStyle() | WB_HSCROLL | WB_HIDESELECTION ); + m_pGlobalOptionsCLB->SetHighlightRange(); + InitControls( rSet ); // set handler @@ -94,8 +108,11 @@ void SwCompatibilityOptPage::dispose() { m_pImpl.reset(); m_pMain.clear(); + m_pGlobalOptionsFrame.clear(); m_pFormattingLB.clear(); + m_pGlobalOptionsLB.clear(); m_pOptionsLB.clear(); + m_pGlobalOptionsCLB.clear(); m_pDefaultPB.clear(); SfxTabPage::dispose(); } @@ -187,6 +204,7 @@ void SwCompatibilityOptPage::InitControls( const SfxItemSet& rSet ) else { m_pMain->Disable(); + m_pGlobalOptionsFrame->Disable(); } const OUString& rText = m_pMain->get_label(); m_pMain->set_label(rText.replaceAll("%DOCNAME", sDocTitle)); @@ -434,6 +452,14 @@ bool SwCompatibilityOptPage::FillItemSet( SfxItemSet* ) if ( bModified ) WriteOptions(); + bool bNewMSFormsMenuOption = m_pGlobalOptionsCLB->IsChecked(0); + if (m_bSavedMSFormsMenuOption != bNewMSFormsMenuOption) + { + m_aViewConfigItem.SetMSOCompatibleFormsMenu(bNewMSFormsMenuOption); + m_bSavedMSFormsMenuOption = bNewMSFormsMenuOption; + bModified = true; + } + return bModified; } @@ -444,6 +470,9 @@ void SwCompatibilityOptPage::Reset( const SfxItemSet* ) sal_uLong nOptions = GetDocumentOptions(); SetCurrentOptions( nOptions ); m_nSavedOptions = nOptions; + + m_pGlobalOptionsCLB->CheckEntryPos( 0, m_aViewConfigItem.HasMSOCompatibleFormsMenu() ); + m_bSavedMSFormsMenuOption = m_aViewConfigItem.HasMSOCompatibleFormsMenu(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/optcomp.hxx b/sw/source/uibase/inc/optcomp.hxx index 85c8b15dfa2b..e0c779da4b06 100644 --- a/sw/source/uibase/inc/optcomp.hxx +++ b/sw/source/uibase/inc/optcomp.hxx @@ -25,6 +25,7 @@ #include <vcl/layout.hxx> #include <vcl/lstbox.hxx> #include <unotools/compatibility.hxx> +#include <unotools/compatibilityviewoptions.hxx> #include <svx/checklbx.hxx> #include <rtl/ustring.hxx> @@ -36,11 +37,16 @@ class SwCompatibilityOptPage : public SfxTabPage private: // controls VclPtr<VclFrame> m_pMain; + VclPtr<VclFrame> m_pGlobalOptionsFrame; VclPtr<ListBox> m_pFormattingLB; + VclPtr<ListBox> m_pGlobalOptionsLB; VclPtr<SvxCheckListBox> m_pOptionsLB; + VclPtr<SvxCheckListBox> m_pGlobalOptionsCLB; VclPtr<PushButton> m_pDefaultPB; // config item SvtCompatibilityOptions m_aConfigItem; + // config item + SvtCompatibilityViewOptions m_aViewConfigItem; // text of the user entry OUString m_sUserEntry; // shell of the current document @@ -49,6 +55,7 @@ private: std::unique_ptr<SwCompatibilityOptPage_Impl> m_pImpl; // saved options after "Reset"; used in "FillItemSet" for comparison sal_uLong m_nSavedOptions; + bool m_bSavedMSFormsMenuOption; // handler DECL_LINK(SelectHdl, ListBox&, void); diff --git a/sw/uiconfig/swriter/ui/optcompatpage.ui b/sw/uiconfig/swriter/ui/optcompatpage.ui index 4b3e888d77e8..8efc370d46d0 100644 --- a/sw/uiconfig/swriter/ui/optcompatpage.ui +++ b/sw/uiconfig/swriter/ui/optcompatpage.ui @@ -2,12 +2,14 @@ <interface domain="sw"> <!-- interface-requires gtk+ 3.0 --> <!-- interface-requires LibreOffice 1.0 --> - <object class="GtkGrid" id="OptCompatPage"> + <object class="GtkBox" id="OptCompatPage"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="border_width">6</property> + <property name="orientation">vertical</property> + <property name="spacing">12</property> <child> <object class="GtkFrame" id="compatframe"> <property name="visible">True</property> @@ -116,5 +118,82 @@ <property name="height">1</property> </packing> </child> + <child> + <object class="GtkFrame" id="globalcompatframe"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkGrid" id="grid2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">5</property> + <child> + <object class="svxcorelo-SvxCheckListBox" id="globaloptioncheckboxs:border"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="Check List Box-selection1"/> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="globaloptions"> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + <property name="entry_text_column">0</property> + <property name="id_column">1</property> + <items> + <item translatable="yes" context="optcompatpage|globalcompatoptions">Reorganize Forms menu to have it MS compatible</item> + </items> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="optcompatpage|label2">Global compatibility options</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> </object> </interface> |