From 38302b308559b8e34916a07ea3a160085c596c2e Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 21 Feb 2013 15:54:57 +0000 Subject: split up redline dialog and adapt redline view code Change-Id: Ib185eacbd0b4123ec947d116076358794bf42d46 --- svx/AllLangResTarget_svx.mk | 1 - svx/UI_svx.mk | 1 + svx/inc/helpid.hrc | 9 -- svx/inc/svx/ctredlin.hxx | 30 ++---- svx/inc/svx/svxids.hrc | 1 - svx/source/dialog/ctredlin.cxx | 169 +++++++++++-------------------- svx/source/dialog/ctredlin.hrc | 22 ---- svx/source/dialog/ctredlin.src | 99 ------------------ svx/uiconfig/ui/redlinecontrol.ui | 173 +------------------------------ svx/uiconfig/ui/redlineviewpage.ui | 202 +++++++++++++++++++++++++++++++++++++ 10 files changed, 273 insertions(+), 434 deletions(-) delete mode 100644 svx/source/dialog/ctredlin.src create mode 100644 svx/uiconfig/ui/redlineviewpage.ui (limited to 'svx') diff --git a/svx/AllLangResTarget_svx.mk b/svx/AllLangResTarget_svx.mk index c4f66e6c79d8..4e139e1704ac 100644 --- a/svx/AllLangResTarget_svx.mk +++ b/svx/AllLangResTarget_svx.mk @@ -50,7 +50,6 @@ $(eval $(call gb_SrsTarget_add_files,svx/res,\ svx/source/core/graphichelper.src \ svx/source/dialog/bmpmask.src \ svx/source/dialog/contdlg.src \ - svx/source/dialog/ctredlin.src \ svx/source/dialog/dlgctrl.src \ svx/source/dialog/docrecovery.src \ svx/source/dialog/fontwork.src \ diff --git a/svx/UI_svx.mk b/svx/UI_svx.mk index df3d0b49c7d3..38945e83f69c 100644 --- a/svx/UI_svx.mk +++ b/svx/UI_svx.mk @@ -14,6 +14,7 @@ $(eval $(call gb_UI_add_uifiles,svx,\ svx/uiconfig/ui/chineseconversiondialog \ svx/uiconfig/ui/compressgraphicdialog \ svx/uiconfig/ui/redlinefilterpage \ + svx/uiconfig/ui/redlineviewpage \ )) # vim: set noet sw=4 ts=4: diff --git a/svx/inc/helpid.hrc b/svx/inc/helpid.hrc index afd948425edf..dab6dc899ce5 100644 --- a/svx/inc/helpid.hrc +++ b/svx/inc/helpid.hrc @@ -154,15 +154,6 @@ #define HID_POPUP_LINEEND "SVX_HID_POPUP_LINEEND" #define HID_POPUP_LINEEND_CTRL "SVX_HID_POPUP_LINEEND_CTRL" #define HID_REDLINING_TABCONTROL "SVX_HID_REDLINING_TABCONTROL" -#define HID_REDLINING_VIEW_DG_VIEW "SVX_HID_REDLINING_VIEW_DG_VIEW" -#define HID_REDLINING_VIEW_DG_VIEW_HEADER "SVX_HID_REDLINING_VIEW_DG_VIEW_HEADER" -#define HID_REDLINING_VIEW_DG_VIEW_TABLE "SVX_HID_REDLINING_VIEW_DG_VIEW_TABLE" -#define HID_REDLINING_VIEW_PAGE "SVX_HID_REDLINING_VIEW_PAGE" -#define HID_REDLINING_VIEW_PB_ACCEPT "SVX_HID_REDLINING_VIEW_PB_ACCEPT" -#define HID_REDLINING_VIEW_PB_ACCEPTALL "SVX_HID_REDLINING_VIEW_PB_ACCEPTALL" -#define HID_REDLINING_VIEW_PB_REJECT "SVX_HID_REDLINING_VIEW_PB_REJECT" -#define HID_REDLINING_VIEW_PB_REJECTALL "SVX_HID_REDLINING_VIEW_PB_REJECTALL" -#define HID_REDLINING_VIEW_PB_UNDO "SVX_HID_REDLINING_VIEW_PB_UNDO" #define HID_STYLE_LISTBOX "SVX_HID_STYLE_LISTBOX" #define HID_SVXTBX_UNDO_REDO_CTRL "SVX_HID_SVXTBX_UNDO_REDO_CTRL" #define HID_SVX_CHINESE_DICTIONARY_CB_REVERSE "SVX_HID_SVX_CHINESE_DICTIONARY_CB_REVERSE" diff --git a/svx/inc/svx/ctredlin.hxx b/svx/inc/svx/ctredlin.hxx index 2ce91fc95709..d6d5f7b27243 100644 --- a/svx/inc/svx/ctredlin.hxx +++ b/svx/inc/svx/ctredlin.hxx @@ -304,30 +304,18 @@ private: Link RejectAllClickLk; Link UndoClickLk; - SvxSimpleTableContainer m_aViewDataContainer; - SvxRedlinTable aViewData; - PushButton PbAccept; - PushButton PbReject; - PushButton PbAcceptAll; - PushButton PbRejectAll; - PushButton PbUndo; - String aTitle1; - String aTitle2; - String aTitle3; - String aTitle4; - String aTitle5; - long nDistance; - Size aMinSize; + SvxRedlinTable* m_pViewData; + PushButton* m_pAccept; + PushButton* m_pReject; + PushButton* m_pAcceptAll; + PushButton* m_pRejectAll; + PushButton* m_pUndo; DECL_LINK( PbClickHdl, PushButton* ); - -protected: - - void Resize(); - public: - SvxTPView( Window * pParent); + SvxTPView(Window * pParent); + ~SvxTPView(); void InsertWriterHeader(); void InsertCalcHeader(); @@ -349,8 +337,6 @@ public: void HideUndo() {ShowUndo(sal_False);} sal_Bool IsUndoVisible(); - Size GetMinSizePixel(); - void SetAcceptClickHdl( const Link& rLink ) { AcceptClickLk = rLink; } const Link& GetAcceptClickHdl() const { return AcceptClickLk; } diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc index d18dfcfa8ab9..10275b45f4f8 100644 --- a/svx/inc/svx/svxids.hrc +++ b/svx/inc/svx/svxids.hrc @@ -620,7 +620,6 @@ #define SID_FM_NEW ( SID_SVX_START + 638 ) #define SID_FM_DELETE ( SID_SVX_START + 639 ) #define SID_FM_NEW_FORM ( SID_SVX_START + 640 ) -#define SID_REDLIN_VIEW_PAGE ( SID_SVX_START + 643 ) #define SID_3D_WIN ( SID_SVX_START + 644 ) #define SID_3D_STATE ( SID_SVX_START + 645 ) #define SID_3D_INIT ( SID_SVX_START + 646 ) diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx index b9f5faf6a1d9..1c2fe8211aae 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,170 +487,121 @@ void SvxRedlinTable::InitEntry(SvTreeListEntry* pEntry, const OUString& rStr, //---------------------------------------------------------------------------- SvxTPView::SvxTPView( Window * pParent) - : TabPage( pParent, SVX_RES(SID_REDLIN_VIEW_PAGE)), - m_aViewDataContainer(this, SVX_RES(DG_VIEW)), - aViewData(m_aViewDataContainer), - PbAccept ( this, SVX_RES(PB_ACCEPT ) ), - PbReject ( this, SVX_RES(PB_REJECT ) ), - PbAcceptAll ( this, SVX_RES(PB_ACCEPTALL ) ), - PbRejectAll ( this, SVX_RES(PB_REJECTALL ) ), - PbUndo ( this, SVX_RES(PB_UNDO ) ), - aTitle1 ( SVX_RES( STR_TITLE1 ) ), // local resource - aTitle2 ( SVX_RES( STR_TITLE2 ) ), - aTitle3 ( SVX_RES( STR_TITLE3 ) ), - aTitle4 ( SVX_RES( STR_TITLE4 ) ), - aTitle5 ( SVX_RES( STR_TITLE5 ) ) -{ - aViewData.SetAccessibleName(String(SVX_RES(STR_TREE))); - FreeResource(); - - aViewData.SetHelpId(HID_REDLINING_VIEW_DG_VIEW_TABLE); - aViewData.SetHeaderBarHelpId(HID_REDLINING_VIEW_DG_VIEW_HEADER); - - aMinSize=GetSizePixel(); + : 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"); + + SvxSimpleTableContainer* pTable = get("changes"); + Size aControlSize(221, 130); + aControlSize = LogicToPixel(aControlSize, MAP_APPFONT); + pTable->set_width_request(aControlSize.Width()); + pTable->set_height_request(aControlSize.Height()); + m_pViewData = new SvxRedlinTable(*pTable, 0); Link aLink=LINK( this, SvxTPView, PbClickHdl); - PbAccept.SetClickHdl(aLink); - PbAcceptAll.SetClickHdl(aLink); - PbReject.SetClickHdl(aLink); - PbRejectAll.SetClickHdl(aLink); - PbUndo.SetClickHdl(aLink); + m_pAccept->SetClickHdl(aLink); + m_pAcceptAll->SetClickHdl(aLink); + m_pReject->SetClickHdl(aLink); + m_pRejectAll->SetClickHdl(aLink); + m_pUndo->SetClickHdl(aLink); - nDistance=PbAccept.GetSizePixel().Height()+2*MIN_DISTANCE; - aViewData.SetTabs(nStaticTabs); + m_pViewData->SetTabs(nStaticTabs); } -void SvxTPView::Resize() +SvxTPView::~SvxTPView() { - Size aSize=GetOutputSizePixel(); - Point aPos = m_aViewDataContainer.GetPosPixel(); - aSize.Height()-=aPos.Y()+nDistance; - aSize.Width()-=2*aPos.X(); - - long newY=aPos.Y()+aSize.Height()+MIN_DISTANCE; - aPos=PbAccept.GetPosPixel(); - aPos.Y()=newY; - PbAccept.SetPosPixel(aPos); - aPos=PbAcceptAll.GetPosPixel(); - aPos.Y()=newY; - PbAcceptAll.SetPosPixel(aPos); - aPos=PbReject.GetPosPixel(); - aPos.Y()=newY; - PbReject.SetPosPixel(aPos); - aPos=PbRejectAll.GetPosPixel(); - aPos.Y()=newY; - PbRejectAll.SetPosPixel(aPos); - - if(PbUndo.IsVisible()) - { - aPos=PbUndo.GetPosPixel(); - aPos.Y()=newY; - PbUndo.SetPosPixel(aPos); - } - m_aViewDataContainer.SetSizePixel(aSize); + delete m_pViewData; } void SvxTPView::InsertWriterHeader() { - rtl::OUString aStrTab('\t'); - String aString(aTitle1); - aString+=aStrTab; - aString+=aTitle3; - aString+=aStrTab; - aString+=aTitle4; - aString+=aStrTab; - aString+=aTitle5; - aViewData.ClearHeader(); - aViewData.InsertHeaderEntry(aString); + OUString aStrTab('\t'); + OUString aString(get("action")->GetText()); + aString += aStrTab; + aString += get("author")->GetText(); + aString += aStrTab; + aString += get("date")->GetText(); + aString += aStrTab; + aString += get("comment")->GetText(); + m_pViewData->ClearHeader(); + m_pViewData->InsertHeaderEntry(aString); } void SvxTPView::InsertCalcHeader() { - rtl::OUString aStrTab('\t'); - String aString(aTitle1); - aString+=aStrTab; - aString+=aTitle2; - aString+=aStrTab; - aString+=aTitle3; - aString+=aStrTab; - aString+=aTitle4; - aString+=aStrTab; - aString+=aTitle5; - aViewData.ClearHeader(); - aViewData.InsertHeaderEntry(aString); + OUString aStrTab('\t'); + OUString aString(get("action")->GetText()); + aString += aStrTab; + aString += get("position")->GetText(); + aString += aStrTab; + aString += get("author")->GetText(); + aString += aStrTab; + aString += get("date")->GetText(); + aString += aStrTab; + aString += get("comment")->GetText(); + m_pViewData->ClearHeader(); + m_pViewData->InsertHeaderEntry(aString); } void SvxTPView::EnableAccept(sal_Bool nFlag) { - PbAccept.Enable(nFlag); + m_pAccept->Enable(nFlag); } void SvxTPView::EnableAcceptAll(sal_Bool nFlag) { - PbAcceptAll.Enable(nFlag); + m_pAcceptAll->Enable(nFlag); } void SvxTPView::EnableReject(sal_Bool nFlag) { - PbReject.Enable(nFlag); + m_pReject->Enable(nFlag); } void SvxTPView::EnableRejectAll(sal_Bool nFlag) { - PbRejectAll.Enable(nFlag); + m_pRejectAll->Enable(nFlag); } void SvxTPView::ShowUndo(sal_Bool nFlag) { - PbUndo.Show(nFlag); + m_pUndo->Show(nFlag); } void SvxTPView::EnableUndo(sal_Bool nFlag) { - PbUndo.Enable(nFlag); + m_pUndo->Enable(nFlag); } -Size SvxTPView::GetMinSizePixel() -{ - Size aSize=aMinSize; - if(PbUndo.IsVisible()) - { - sal_uIntPtr nSize=PbUndo.GetSizePixel().Width() - +PbUndo.GetPosPixel().X() - +PbAccept.GetPosPixel().X(); - - aSize.Width()=nSize; - } - - return aSize; -} - - SvxRedlinTable* SvxTPView::GetTableControl() { - return &aViewData; + return m_pViewData; } IMPL_LINK( SvxTPView, PbClickHdl, PushButton*, pPushB ) { - if(pPushB==&PbAccept) + if (pPushB == m_pAccept) { AcceptClickLk.Call(this); } - else if(pPushB==&PbAcceptAll) + else if (pPushB == m_pAcceptAll) { AcceptAllClickLk.Call(this); } - else if(pPushB==&PbReject) + else if (pPushB == m_pReject) { RejectClickLk.Call(this); } - else if(pPushB==&PbRejectAll) + else if (pPushB == m_pRejectAll) { RejectAllClickLk.Call(this); } - else if(pPushB==&PbUndo) + else if (pPushB == m_pUndo) { UndoClickLk.Call(this); } @@ -1212,7 +1164,8 @@ SvxAcceptChgCtr::SvxAcceptChgCtr( Window* pParent, const ResId& rResId ) { pTPFilter=new SvxTPFilter(&aTCAccept); pTPView=new SvxTPView(&aTCAccept); - aMinSize=pTPView->GetMinSizePixel(); + + aMinSize = VclContainer::getLayoutRequisition(*pTPView); aTCAccept.InsertPage( TP_VIEW, SVX_RESSTR(RID_SVXSTR_VIEW)); aTCAccept.InsertPage( TP_FILTER, SVX_RESSTR(RID_SVXSTR_FILTER)); @@ -1244,7 +1197,7 @@ SvxAcceptChgCtr::~SvxAcceptChgCtr() void SvxAcceptChgCtr::Resize() { - aMinSize=pTPView->GetMinSizePixel(); + aMinSize = VclContainer::getLayoutRequisition(*pTPView); Size aSize=GetOutputSizePixel(); sal_Bool bFlag=sal_False; @@ -1272,7 +1225,7 @@ void SvxAcceptChgCtr::Resize() Size SvxAcceptChgCtr::GetMinSizePixel() const { - Size aSize=pTPView->GetMinSizePixel(); + Size aSize = VclContainer::getLayoutRequisition(*pTPView); aSize.Height()+=gDiffSize.Height(); aSize.Width()+=gDiffSize.Width(); return aSize; diff --git a/svx/source/dialog/ctredlin.hrc b/svx/source/dialog/ctredlin.hrc index 603c52cd1edd..f71c10ec9fa4 100644 --- a/svx/source/dialog/ctredlin.hrc +++ b/svx/source/dialog/ctredlin.hrc @@ -16,27 +16,5 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include // ->SID_REDLIN_VIEW_PAGE - #define TP_FILTER 11 #define TP_VIEW 12 - -#define DG_VIEW 2 -#define PB_ACCEPT 3 -#define PB_ACCEPTALL 4 -#define PB_REJECT 5 -#define PB_REJECTALL 6 -#define PB_UNDO 7 -#define STR_VIEW 8 - -#define STR_TITLE1 1 -#define STR_TITLE2 2 -#define STR_TITLE3 3 -#define STR_TITLE4 4 -#define STR_TITLE5 5 -#define STR_DATE_COMBOX 6 -#define STR_DATE_SPIN 7 -#define STR_DATE_SPIN1 8 -#define STR_DATE_TIME_SPIN 9 -#define STR_DATE_TIME_SPIN1 10 -#define STR_TREE 11 diff --git a/svx/source/dialog/ctredlin.src b/svx/source/dialog/ctredlin.src deleted file mode 100644 index 57035a9072e2..000000000000 --- a/svx/source/dialog/ctredlin.src +++ /dev/null @@ -1,99 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "ctredlin.hrc" -#include "helpid.hrc" - -#define MASKCOLOR MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; } ; - -TabPage SID_REDLIN_VIEW_PAGE -{ - HelpId = HID_REDLINING_VIEW_PAGE ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 270 , 126 ) ; - Hide = TRUE ; - Control DG_VIEW - { - HelpId = HID_REDLINING_VIEW_DG_VIEW ; - Pos = MAP_APPFONT ( 3 , 1 ) ; - Size = MAP_APPFONT ( 221 , 65 ) ; - Border = TRUE ; - }; - PushButton PB_ACCEPT - { - HelpId = HID_REDLINING_VIEW_PB_ACCEPT ; - Pos = MAP_APPFONT ( 3 , 69 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Accept" ; - }; - PushButton PB_REJECT - { - HelpId = HID_REDLINING_VIEW_PB_REJECT ; - Pos = MAP_APPFONT ( 69 , 69 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Reject" ; - }; - PushButton PB_ACCEPTALL - { - HelpId = HID_REDLINING_VIEW_PB_ACCEPTALL ; - Pos = MAP_APPFONT ( 141 , 69 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "A~ccept All" ; - }; - PushButton PB_REJECTALL - { - HelpId = HID_REDLINING_VIEW_PB_REJECTALL ; - Pos = MAP_APPFONT ( 207 , 69 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "R~eject All" ; - }; - - PushButton PB_UNDO - { - HelpId = HID_REDLINING_VIEW_PB_UNDO ; - Hide = TRUE; - Pos = MAP_APPFONT ( 279 , 69 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "Undo"; - }; - String STR_TITLE1 - { - Text [ en-US ] = "Action" ; - }; - String STR_TITLE2 - { - Text [ en-US ] = "Position" ; - }; - String STR_TITLE3 - { - Text [ en-US ] = "Author" ; - }; - String STR_TITLE4 - { - Text [ en-US ] = "Date" ; - }; - String STR_TITLE5 - { - Text [ en-US ] = "Comment" ; - }; - String STR_TREE - { - Text [ en-US ] = "Changes" ; - }; -}; diff --git a/svx/uiconfig/ui/redlinecontrol.ui b/svx/uiconfig/ui/redlinecontrol.ui index 50a8f5b64e7b..457b4ee6e48d 100644 --- a/svx/uiconfig/ui/redlinecontrol.ui +++ b/svx/uiconfig/ui/redlinecontrol.ui @@ -5,178 +5,7 @@ True True - - True - False - 6 - vertical - 6 - - - True - False - True - True - vertical - - - True - False - 30 - - - True - False - 0 - Action - - - False - True - 0 - - - - - True - False - 0 - Author - - - False - True - 1 - - - - - True - False - 0 - Date - - - False - True - 2 - - - - - True - False - 0 - Comment - - - False - True - 3 - - - - - False - True - 0 - - - - - True - True - True - True - in - - - - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - 12 - spread - - - _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 - 0 - - - False - True - 3 - - - - - False - True - 2 - - - + diff --git a/svx/uiconfig/ui/redlineviewpage.ui b/svx/uiconfig/ui/redlineviewpage.ui new file mode 100644 index 000000000000..84c99cd4c3e0 --- /dev/null +++ b/svx/uiconfig/ui/redlineviewpage.ui @@ -0,0 +1,202 @@ + + + + + + True + False + 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 + False + True + True + + + Changes + + + + + + + + True + True + 1 + + + + + False + True + 0 + + + + + True + False + 12 + spread + + + _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 + + + + + False + True + 2 + + + + -- cgit v1.2.3