diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-02-21 17:17:52 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-02-23 14:28:42 +0000 |
commit | 8655095a4910ca795dfd182e6796d9375727a694 (patch) | |
tree | 3472e1c3cea9539fc2785c8db99a421a10e93694 /svx | |
parent | 3c5c43cf2aa354a98f28a466647f4d463cdfdc85 (diff) |
try and beat this weird SvxAcceptChgCtr into something sanish
a) convert to .ui
b) The accept/reject changes dialogs now have a "close" button and the
accept/reject etc buttons are relocated into the main dialog button area rather
than as direct children of the view page. They now get disabled on switching to
the non-view page.
c) Merges the sc redline changes dialog, the sw redline changes dialog and the
sw autocorrect changes dialog
Change-Id: If0ba376c3f2d36709aeeed995fa9901741434c40
Diffstat (limited to 'svx')
-rw-r--r-- | svx/UI_svx.mk | 2 | ||||
-rw-r--r-- | svx/inc/svx/ctredlin.hxx | 22 | ||||
-rw-r--r-- | svx/source/dialog/ctredlin.cxx | 120 | ||||
-rw-r--r-- | svx/uiconfig/ui/acceptrejectchangesdialog.ui | 126 | ||||
-rw-r--r-- | svx/uiconfig/ui/redlinecontrol.ui | 8 | ||||
-rw-r--r-- | svx/uiconfig/ui/redlineviewpage.ui | 180 |
6 files changed, 227 insertions, 231 deletions
diff --git a/svx/UI_svx.mk b/svx/UI_svx.mk index 38945e83f69c..aee883f72fa8 100644 --- a/svx/UI_svx.mk +++ b/svx/UI_svx.mk @@ -10,9 +10,11 @@ $(eval $(call gb_UI_UI,svx)) $(eval $(call gb_UI_add_uifiles,svx,\ + svx/uiconfig/ui/acceptrejectchangesdialog \ svx/uiconfig/ui/asianphoneticguidedialog \ svx/uiconfig/ui/chineseconversiondialog \ svx/uiconfig/ui/compressgraphicdialog \ + svx/uiconfig/ui/redlinecontrol \ svx/uiconfig/ui/redlinefilterpage \ svx/uiconfig/ui/redlineviewpage \ )) diff --git a/svx/inc/svx/ctredlin.hxx b/svx/inc/svx/ctredlin.hxx index d6d5f7b27243..f7b71ec62ff4 100644 --- a/svx/inc/svx/ctredlin.hxx +++ b/svx/inc/svx/ctredlin.hxx @@ -351,42 +351,38 @@ public: void SetUndoClickHdl( const Link& rLink ) { UndoClickLk = rLink; } const Link& GetUndoAllClickHdl() const { return UndoClickLk; } + + virtual void ActivatePage(); + virtual void DeactivatePage(); }; //================================================================== // Redlining - Control (Accept- Changes) //================================================================== -class SVX_DLLPUBLIC SvxAcceptChgCtr : public Control +class SVX_DLLPUBLIC SvxAcceptChgCtr + : public TabControl + , public VclBuilderContainer { private: - Link aMinSizeLink; - TabControl aTCAccept; SvxTPFilter* pTPFilter; SvxTPView* pTPView; - Size aMinSize; - -protected: - virtual void Resize(); + sal_uInt16 m_nViewPageId; + sal_uInt16 m_nFilterPageId; public: - SvxAcceptChgCtr( Window* pParent, const ResId& rResId ); + SvxAcceptChgCtr(Window* pParent); ~SvxAcceptChgCtr(); - Size GetMinSizePixel() const; - void ShowFilterPage(); void ShowViewPage(); SvxTPFilter* GetFilterPage(); SvxTPView* GetViewPage(); SvxRedlinTable* GetViewTable(); - - void SetMinSizeHdl( const Link& rLink ) { aMinSizeLink= rLink; } - const Link& GetMinSizeHdl() const { return aMinSizeLink; } }; diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx index 1c2fe8211aae..6d47ea76d32f 100644 --- a/svx/source/dialog/ctredlin.cxx +++ b/svx/source/dialog/ctredlin.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <vcl/dialog.hxx> #include <vcl/layout.hxx> #include <vcl/svapp.hxx> #include <tools/shl.hxx> @@ -486,17 +487,18 @@ void SvxRedlinTable::InitEntry(SvTreeListEntry* pEntry, const OUString& rStr, // class SvxTPView //---------------------------------------------------------------------------- -SvxTPView::SvxTPView( Window * pParent) +SvxTPView::SvxTPView(Window * pParent) : TabPage(pParent, "RedlineViewPage", "svx/ui/redlineviewpage.ui") { - get(m_pAccept, "accept"); - get(m_pReject, "reject"); - get(m_pAcceptAll, "acceptall"); - get(m_pRejectAll, "rejectall"); - get(m_pUndo, "undo"); + Dialog *pTopLevel = GetParentDialog(); + pTopLevel->get(m_pAccept, "accept"); + pTopLevel->get(m_pReject, "reject"); + pTopLevel->get(m_pAcceptAll, "acceptall"); + pTopLevel->get(m_pRejectAll, "rejectall"); + pTopLevel->get(m_pUndo, "undo"); SvxSimpleTableContainer* pTable = get<SvxSimpleTableContainer>("changes"); - Size aControlSize(221, 130); + Size aControlSize(221, 65); aControlSize = LogicToPixel(aControlSize, MAP_APPFONT); pTable->set_width_request(aControlSize.Width()); pTable->set_height_request(aControlSize.Height()); @@ -513,6 +515,26 @@ SvxTPView::SvxTPView( Window * pParent) m_pViewData->SetTabs(nStaticTabs); } +void SvxTPView::ActivatePage() +{ + m_pAccept->Enable(); + m_pReject->Enable(); + m_pAcceptAll->Enable(); + m_pRejectAll->Enable(); + m_pUndo->Enable(); + TabPage::ActivatePage(); +} + +void SvxTPView::DeactivatePage() +{ + TabPage::DeactivatePage(); + m_pAccept->Disable(); + m_pReject->Disable(); + m_pAcceptAll->Disable(); + m_pRejectAll->Disable(); + m_pUndo->Disable(); +} + SvxTPView::~SvxTPView() { delete m_pViewData; @@ -1153,40 +1175,28 @@ IMPL_LINK( SvxTPFilter, RefHandle, PushButton*, pRef ) return 0; } -static Size gDiffSize; //============================================================================ // class SvxAcceptChgCtr //---------------------------------------------------------------------------- -SvxAcceptChgCtr::SvxAcceptChgCtr( Window* pParent, const ResId& rResId ) - : Control(pParent,rResId ), - aTCAccept(this,WB_TABSTOP |WB_DIALOGCONTROL) +SvxAcceptChgCtr::SvxAcceptChgCtr(Window* pParent) + : TabControl(pParent, WB_TABSTOP | WB_DIALOGCONTROL) { - pTPFilter=new SvxTPFilter(&aTCAccept); - pTPView=new SvxTPView(&aTCAccept); - - aMinSize = VclContainer::getLayoutRequisition(*pTPView); - - aTCAccept.InsertPage( TP_VIEW, SVX_RESSTR(RID_SVXSTR_VIEW)); - aTCAccept.InsertPage( TP_FILTER, SVX_RESSTR(RID_SVXSTR_FILTER)); - aTCAccept.SetTabPage( TP_VIEW, pTPView); - aTCAccept.SetTabPage( TP_FILTER, pTPFilter); - aTCAccept.SetHelpId(HID_REDLINING_TABCONTROL); + m_pUIBuilder = new VclBuilder(this, getUIRootDir(), "svx/ui/redlinecontrol.ui", "RedlineControl"); - aTCAccept.SetTabPageSizePixel(aMinSize); - Size aSize=aTCAccept.GetSizePixel(); - - gDiffSize.Height()=aSize.Height()-aMinSize.Height(); - gDiffSize.Width()=aSize.Width()-aMinSize.Width(); + pTPFilter = new SvxTPFilter(this); + pTPView = new SvxTPView(this); + m_nViewPageId = GetPageId("view"); + m_nFilterPageId = GetPageId("filter"); + SetTabPage(m_nViewPageId, pTPView); + SetTabPage(m_nFilterPageId, pTPFilter); pTPFilter->SetRedlinTable(GetViewTable()); - WinBits nWinStyle=GetStyle()|WB_DIALOGCONTROL; - SetStyle(nWinStyle); - aTCAccept.Show(); ShowViewPage(); - Resize(); + + Show(); } SvxAcceptChgCtr::~SvxAcceptChgCtr() @@ -1195,50 +1205,14 @@ SvxAcceptChgCtr::~SvxAcceptChgCtr() delete pTPFilter; } -void SvxAcceptChgCtr::Resize() -{ - aMinSize = VclContainer::getLayoutRequisition(*pTPView); - Size aSize=GetOutputSizePixel(); - sal_Bool bFlag=sal_False; - - if(aMinSize.Height()>aSize.Height()) - { - aSize.Height()=aMinSize.Height(); - bFlag=sal_True; - } - if(aMinSize.Width()>aSize.Width()) - { - aSize.Width()=aMinSize.Width(); - bFlag=sal_True; - } - - if(bFlag) - { - SetOutputSizePixel(aSize); - aMinSizeLink.Call(this); - } - - aSize.Height()-=2; - aSize.Width()-=2; - aTCAccept.SetSizePixel(aSize); -} - -Size SvxAcceptChgCtr::GetMinSizePixel() const -{ - Size aSize = VclContainer::getLayoutRequisition(*pTPView); - aSize.Height()+=gDiffSize.Height(); - aSize.Width()+=gDiffSize.Width(); - return aSize; -} - void SvxAcceptChgCtr::ShowFilterPage() { - aTCAccept.SetCurPageId(TP_FILTER); + SetCurPageId(m_nFilterPageId); } void SvxAcceptChgCtr::ShowViewPage() { - aTCAccept.SetCurPageId(TP_VIEW); + SetCurPageId(m_nViewPageId); } SvxTPFilter* SvxAcceptChgCtr::GetFilterPage() @@ -1253,15 +1227,7 @@ SvxTPView* SvxAcceptChgCtr::GetViewPage() SvxRedlinTable* SvxAcceptChgCtr::GetViewTable() { - if(pTPView!=NULL) - { - return pTPView->GetTableControl(); - } - else - { - return NULL; - } + return pTPView ? pTPView->GetTableControl() : NULL; } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/uiconfig/ui/acceptrejectchangesdialog.ui b/svx/uiconfig/ui/acceptrejectchangesdialog.ui new file mode 100644 index 000000000000..6377c6cd4fe7 --- /dev/null +++ b/svx/uiconfig/ui/acceptrejectchangesdialog.ui @@ -0,0 +1,126 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkDialog" id="AcceptRejectChangesDialog"> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <property name="title" translatable="yes">Accept or Reject Changes</property> + <property name="type_hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox1"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">12</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area1"> + <property name="can_focus">False</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="accept"> + <property name="label" translatable="yes">_Accept</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="reject"> + <property name="label" translatable="yes">_Reject</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="acceptall"> + <property name="label" translatable="yes">A_ccept All</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkButton" id="rejectall"> + <property name="label" translatable="yes">R_eject All</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> + <object class="GtkButton" id="undo"> + <property name="label">gtk-undo</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="no_show_all">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> + <child> + <object class="GtkButton" id="close"> + <property name="label">gtk-close</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">5</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <placeholder/> + </child> + </object> + </child> + <action-widgets> + <action-widget response="0">accept</action-widget> + <action-widget response="0">reject</action-widget> + <action-widget response="0">acceptall</action-widget> + <action-widget response="0">rejectall</action-widget> + <action-widget response="0">undo</action-widget> + <action-widget response="0">close</action-widget> + </action-widgets> + </object> +</interface> diff --git a/svx/uiconfig/ui/redlinecontrol.ui b/svx/uiconfig/ui/redlinecontrol.ui index 457b4ee6e48d..61a377bf1687 100644 --- a/svx/uiconfig/ui/redlinecontrol.ui +++ b/svx/uiconfig/ui/redlinecontrol.ui @@ -1,14 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <interface> <!-- interface-requires gtk+ 3.0 --> - <object class="GtkNotebook" id="notebook1"> + <object class="GtkNotebook" id="RedlineControl"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> <child> <placeholder/> </child> <child type="tab"> - <object class="GtkLabel" id="label1"> + <object class="GtkLabel" id="view"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="label" translatable="yes">List</property> @@ -21,7 +23,7 @@ <placeholder/> </child> <child type="tab"> - <object class="GtkLabel" id="label2"> + <object class="GtkLabel" id="filter"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="label" translatable="yes">Filter</property> diff --git a/svx/uiconfig/ui/redlineviewpage.ui b/svx/uiconfig/ui/redlineviewpage.ui index 84c99cd4c3e0..d5e538e60b1d 100644 --- a/svx/uiconfig/ui/redlineviewpage.ui +++ b/svx/uiconfig/ui/redlineviewpage.ui @@ -5,129 +5,20 @@ <object class="GtkBox" id="RedlineViewPage"> <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">6</property> <child> - <object class="GtkBox" id="box2"> - <property name="visible">True</property> + <object class="GtkBox" id="box3"> <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <property name="orientation">vertical</property> - <child> - <object class="GtkBox" id="box3"> - <property name="can_focus">False</property> - <property name="no_show_all">True</property> - <property name="homogeneous">True</property> - <child> - <object class="GtkLabel" id="action"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Action</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="position"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Postion</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="author"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Author</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="date"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Date</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="comment"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Comment</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">4</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> + <property name="no_show_all">True</property> + <property name="homogeneous">True</property> <child> - <object class="svxcorelo-SvxSimpleTableContainer" id="changes"> + <object class="GtkLabel" id="action"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="changes-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes">Changes</property> - </object> - </child> - <child internal-child="selection"> - <object class="GtkTreeSelection" id="Simple Table Container-selection1"/> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButtonBox" id="buttonbox1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">12</property> - <property name="layout_style">spread</property> - <child> - <object class="GtkButton" id="accept"> - <property name="label" translatable="yes">_Accept</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="label" translatable="yes">Action</property> </object> <packing> <property name="expand">False</property> @@ -136,12 +27,10 @@ </packing> </child> <child> - <object class="GtkButton" id="reject"> - <property name="label" translatable="yes">_Reject</property> + <object class="GtkLabel" id="position"> <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">False</property> + <property name="label" translatable="yes">Postion</property> </object> <packing> <property name="expand">False</property> @@ -150,12 +39,10 @@ </packing> </child> <child> - <object class="GtkButton" id="acceptall"> - <property name="label" translatable="yes">A_ccept All</property> + <object class="GtkLabel" id="author"> <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">False</property> + <property name="label" translatable="yes">Author</property> </object> <packing> <property name="expand">False</property> @@ -164,12 +51,10 @@ </packing> </child> <child> - <object class="GtkButton" id="rejectall"> - <property name="label" translatable="yes">R_eject All</property> + <object class="GtkLabel" id="date"> <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">False</property> + <property name="label" translatable="yes">Date</property> </object> <packing> <property name="expand">False</property> @@ -178,12 +63,10 @@ </packing> </child> <child> - <object class="GtkButton" id="undo"> - <property name="label">gtk-undo</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="no_show_all">True</property> - <property name="use_stock">True</property> + <object class="GtkLabel" id="comment"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Comment</property> </object> <packing> <property name="expand">False</property> @@ -195,7 +78,28 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">2</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="svxcorelo-SvxSimpleTableContainer" id="changes"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="changes-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes">Changes</property> + </object> + </child> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="Simple Table Container-selection"/> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> </packing> </child> </object> |