From 8655095a4910ca795dfd182e6796d9375727a694 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 21 Feb 2013 17:17:52 +0000 Subject: 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 --- svx/UI_svx.mk | 2 + svx/inc/svx/ctredlin.hxx | 22 ++-- svx/source/dialog/ctredlin.cxx | 120 +++++++----------- svx/uiconfig/ui/acceptrejectchangesdialog.ui | 126 +++++++++++++++++++ svx/uiconfig/ui/redlinecontrol.ui | 8 +- svx/uiconfig/ui/redlineviewpage.ui | 180 +++++++-------------------- 6 files changed, 227 insertions(+), 231 deletions(-) create mode 100644 svx/uiconfig/ui/acceptrejectchangesdialog.ui (limited to 'svx') 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 #include #include #include @@ -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("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 @@ + + + + + False + 6 + Accept or Reject Changes + dialog + + + False + vertical + 12 + + + False + end + + + _Accept + True + True + True + True + + + False + True + 0 + + + + + _Reject + True + True + True + True + + + False + True + 1 + + + + + A_ccept All + True + True + True + True + + + False + True + 2 + + + + + R_eject All + True + True + True + True + + + False + True + 3 + + + + + gtk-undo + True + True + True + True + + + False + True + 4 + + + + + gtk-close + True + True + True + True + True + True + + + False + True + 5 + + + + + False + True + end + 0 + + + + + + + + + accept + reject + acceptall + rejectall + undo + close + + + 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 @@ - + True True + True + True - + True False List @@ -21,7 +23,7 @@ - + True False Filter 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 @@ True False + True + True 6 vertical - 6 - - True + False - True - True - vertical - - - False - True - True - - - True - False - Action - - - False - True - 0 - - - - - True - False - Postion - - - False - True - 1 - - - - - True - False - Author - - - False - True - 2 - - - - - True - False - Date - - - False - True - 3 - - - - - True - False - Comment - - - False - True - 4 - - - - - False - True - 0 - - + True + True - + True False - True - True - - - Changes - - - - - - - - True - True - 1 - - - - - False - True - 0 - - - - - True - False - 12 - spread - - - _Accept - True - True - True - True + Action False @@ -136,12 +27,10 @@ - - _Reject + True - True - True - True + False + Postion False @@ -150,12 +39,10 @@ - - A_ccept All + True - True - True - True + False + Author False @@ -164,12 +51,10 @@ - - R_eject All + True - True - True - True + False + Date False @@ -178,12 +63,10 @@ - - gtk-undo - True - True - True - True + + True + False + Comment False @@ -195,7 +78,28 @@ False True - 2 + 0 + + + + + True + True + True + True + + + Changes + + + + + + + + True + True + 1 -- cgit