diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-02-21 16:25:41 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-02-21 20:27:25 +0000 |
commit | e834354ff3dbf38b1d3834f6980fffaed7b4074c (patch) | |
tree | 17c66763c19119ae58b97646b898fbd4a4aaa587 /sw | |
parent | eb38069490b7eb3ec286cdb0309fc8f49f192843 (diff) |
convert writer changes menu to .ui
Change-Id: I30a957f91c3faca5e16a70efce08579ac3368bdf
Diffstat (limited to 'sw')
-rw-r--r-- | sw/AllLangResTarget_sw.mk | 1 | ||||
-rw-r--r-- | sw/inc/helpid.h | 9 | ||||
-rw-r--r-- | sw/source/uibase/inc/misc.hrc | 1 | ||||
-rw-r--r-- | sw/source/uibase/inc/redlndlg.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/misc/redlndlg.cxx | 248 | ||||
-rw-r--r-- | sw/source/uibase/misc/redlndlg.hrc | 28 | ||||
-rw-r--r-- | sw/source/uibase/misc/redlndlg.src | 85 |
7 files changed, 115 insertions, 259 deletions
diff --git a/sw/AllLangResTarget_sw.mk b/sw/AllLangResTarget_sw.mk index 536821e9fb7b..925c5abc2d0e 100644 --- a/sw/AllLangResTarget_sw.mk +++ b/sw/AllLangResTarget_sw.mk @@ -66,7 +66,6 @@ $(eval $(call gb_SrsTarget_add_files,sw/res,\ sw/source/uibase/dialog/regionsw.src \ sw/source/uibase/docvw/docvw.src \ sw/source/uibase/lingu/olmenu.src \ - sw/source/uibase/misc/redlndlg.src \ sw/source/uibase/ribbar/inputwin.src \ sw/source/uibase/ribbar/workctrl.src \ sw/source/uibase/uiview/view.src \ diff --git a/sw/inc/helpid.h b/sw/inc/helpid.h index 3319a904f7c5..2a780a4dbca4 100644 --- a/sw/inc/helpid.h +++ b/sw/inc/helpid.h @@ -58,13 +58,6 @@ #define HID_GLBLTREE_UPD_IDX "SW_HID_GLBLTREE_UPD_IDX" #define HID_GLBLTREE_UPD_LINK "SW_HID_GLBLTREE_UPD_LINK" #define HID_GLBLTREEUPD_ALL "SW_HID_GLBLTREEUPD_ALL" -#define HID_SORT_ACTION "SW_HID_SORT_ACTION" -#define HID_SORT_AUTHOR "SW_HID_SORT_AUTHOR" -#define HID_SORT_DATE "SW_HID_SORT_DATE" -#define HID_SORT_COMMENT "SW_HID_SORT_COMMENT" -#define HID_SW_SORT_POSITION "SW_HID_SW_SORT_POSITION" -#define HID_EDIT_COMMENT "SW_HID_EDIT_COMMENT" - #define HID_GLBLTREE_EDIT_LINK "SW_HID_GLBLTREE_EDIT_LINK" @@ -73,8 +66,6 @@ #define HID_REDLINE_CTRL "SW_HID_REDLINE_CTRL" - - // sw::sidebar::PagePropertyPanel #define HID_SWPAGE_LEFT_MARGIN "HID_SWPAGE_LEFT_MARGIN" #define HID_SWPAGE_RIGHT_MARGIN "HID_SWPAGE_RIGHT_MARGIN" diff --git a/sw/source/uibase/inc/misc.hrc b/sw/source/uibase/inc/misc.hrc index f7a0db9b0f7b..2c29900a3f08 100644 --- a/sw/source/uibase/inc/misc.hrc +++ b/sw/source/uibase/inc/misc.hrc @@ -39,7 +39,6 @@ #define STR_CHANGE_END (RC_MISC_BEGIN + 45) #define STR_SAVE_GLOSSARY (RC_MISC_BEGIN + 46) -#define MN_REDLINE_POPUP (RC_MISC_BEGIN + 61) #define STR_MY_AUTOTEXT (RC_MISC_BEGIN + 64) #define STR_COMMENTS_LABEL (RC_MISC_BEGIN + 65) diff --git a/sw/source/uibase/inc/redlndlg.hxx b/sw/source/uibase/inc/redlndlg.hxx index 328ac4518885..fd5d59442eef 100644 --- a/sw/source/uibase/inc/redlndlg.hxx +++ b/sw/source/uibase/inc/redlndlg.hxx @@ -66,7 +66,7 @@ class SW_DLLPUBLIC SwRedlineAcceptDlg final SwRedlineDataChildArr m_RedlineChildren; SwRedlineDataParentSortArr m_aUsedSeqNo; VclPtr<SvxAcceptChgCtr> m_aTabPagesCTRL; - ScopedVclPtrInstance<PopupMenu> m_aPopup; + VclPtr<PopupMenu> m_xPopup; Timer m_aDeselectTimer; Timer m_aSelectTimer; OUString m_sInserted; diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 746ccd9c745d..2d96ad884bdc 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -36,7 +36,6 @@ #include <helpid.h> #include <cmdid.h> #include <misc.hrc> -#include <redlndlg.hrc> #include <shells.hrc> // -> #111827# @@ -150,7 +149,7 @@ SwRedlineAcceptDlg::SwRedlineAcceptDlg(vcl::Window *pParent, VclBuilderContainer vcl::Window *pContentArea, bool bAutoFormat) : m_pParentDlg (pParent), m_aTabPagesCTRL (VclPtr<SvxAcceptChgCtr>::Create(pContentArea, pBuilder)), - m_aPopup (SW_RES(MN_REDLINE_POPUP)), + m_xPopup(pBuilder->get_menu("writermenu")), m_sInserted (SW_RES(STR_REDLINE_INSERTED)), m_sDeleted (SW_RES(STR_REDLINE_DELETED)), m_sFormated (SW_RES(STR_REDLINE_FORMATED)), @@ -1012,166 +1011,147 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, CommandHdl, SvSimpleTable*, void) { const CommandEvent aCEvt(m_pTable->GetCommandEvent()); - switch ( aCEvt.GetCommand() ) - { - case CommandEventId::ContextMenu: - { - SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr(); - SvTreeListEntry* pEntry = m_pTable->FirstSelected(); - const SwRangeRedline *pRed = nullptr; - - if (pEntry) - { - SvTreeListEntry* pTopEntry = pEntry; + if (aCEvt.GetCommand() != CommandEventId::ContextMenu) + return; - if (m_pTable->GetParent(pEntry)) - pTopEntry = m_pTable->GetParent(pEntry); + SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr(); + SvTreeListEntry* pEntry = m_pTable->FirstSelected(); + const SwRangeRedline *pRed = nullptr; - sal_uInt16 nPos = GetRedlinePos(*pTopEntry); + if (pEntry) + { + SvTreeListEntry* pTopEntry = pEntry; - // disable commenting for protected areas - if (nPos != USHRT_MAX && (pRed = pSh->GotoRedline(nPos, true)) != nullptr) - { - if( pSh->IsCursorPtAtEnd() ) - pSh->SwapPam(); - pSh->SetInSelect(); - } - } + if (m_pTable->GetParent(pEntry)) + pTopEntry = m_pTable->GetParent(pEntry); - m_aPopup->EnableItem( MN_EDIT_COMMENT, pEntry && pRed && - !m_pTable->GetParent(pEntry) && - !m_pTable->NextSelected(pEntry) -//JP 27.9.2001: make no sense if we handle readonly sections -// && pRed->HasReadonlySel() - ); + sal_uInt16 nPos = GetRedlinePos(*pTopEntry); - m_aPopup->EnableItem( MN_SUB_SORT, m_pTable->First() != nullptr ); - sal_uInt16 nColumn = m_pTable->GetSortedCol(); - if (nColumn == 0xffff) - nColumn = 4; + // disable commenting for protected areas + if (nPos != USHRT_MAX && (pRed = pSh->GotoRedline(nPos, true)) != nullptr) + { + if( pSh->IsCursorPtAtEnd() ) + pSh->SwapPam(); + pSh->SetInSelect(); + } + } - PopupMenu *pSubMenu = m_aPopup->GetPopupMenu(MN_SUB_SORT); - if (pSubMenu) - { - for (sal_uInt16 i = MN_SORT_ACTION; i < MN_SORT_ACTION + 5; i++) - pSubMenu->CheckItem(i, false); + const sal_uInt16 nEditId = m_xPopup->GetItemId("writeredit"); - pSubMenu->CheckItem(nColumn + MN_SORT_ACTION); - } + m_xPopup->EnableItem(nEditId, pEntry && pRed && + !m_pTable->GetParent(pEntry) && + !m_pTable->NextSelected(pEntry)); - sal_uInt16 nRet = m_aPopup->Execute(m_pTable, aCEvt.GetMousePosPixel()); + sal_uInt16 nColumn = m_pTable->GetSortedCol(); + if (nColumn == 0xffff) + nColumn = 4; - switch( nRet ) - { - case MN_EDIT_COMMENT: - { - if (pEntry) - { - if (m_pTable->GetParent(pEntry)) - pEntry = m_pTable->GetParent(pEntry); + const sal_uInt16 nSubSortId = m_xPopup->GetItemId("writersort"); + m_xPopup->EnableItem(nSubSortId, m_pTable->First() != nullptr); + PopupMenu *pSubMenu = m_xPopup->GetPopupMenu(nSubSortId); + const sal_uInt16 nActionId = pSubMenu->GetItemId("writeraction"); + for (sal_uInt16 i = nActionId; i < nActionId + 5; ++i) + pSubMenu->CheckItem(i, false); + pSubMenu->CheckItem(nActionId + nColumn); - sal_uInt16 nPos = GetRedlinePos(*pEntry); + sal_uInt16 nRet = m_xPopup->Execute(m_pTable, aCEvt.GetMousePosPixel()); - if (nPos == USHRT_MAX) - break; + if (nRet == nEditId) + { + if (pEntry) + { + if (m_pTable->GetParent(pEntry)) + pEntry = m_pTable->GetParent(pEntry); - const SwRangeRedline &rRedline = pSh->GetRedline(nPos); + sal_uInt16 nPos = GetRedlinePos(*pEntry); - /* enable again once we have redline comments in the margin - sComment = rRedline.GetComment(); - if ( !sComment.Len() ) - GetActiveView()->GetDocShell()->Broadcast(SwRedlineHint(&rRedline,SWREDLINE_INSERTED)); - const_cast<SwRangeRedline&>(rRedline).Broadcast(SwRedlineHint(&rRedline,SWREDLINE_FOCUS)); - */ + if (nPos == USHRT_MAX) + return; - OUString sComment = convertLineEnd(rRedline.GetComment(), GetSystemLineEnd()); - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "Dialog creation failed!"); - ::DialogGetRanges fnGetRange = pFact->GetDialogGetRangesFunc(); - OSL_ENSURE(fnGetRange, "Dialog creation failed! GetRanges()"); - SfxItemSet aSet( pSh->GetAttrPool(), fnGetRange() ); + const SwRangeRedline &rRedline = pSh->GetRedline(nPos); - aSet.Put(SvxPostItTextItem(sComment, SID_ATTR_POSTIT_TEXT)); - aSet.Put(SvxPostItAuthorItem(rRedline.GetAuthorString(), SID_ATTR_POSTIT_AUTHOR)); + /* enable again once we have redline comments in the margin + sComment = rRedline.GetComment(); + if ( !sComment.Len() ) + GetActiveView()->GetDocShell()->Broadcast(SwRedlineHint(&rRedline,SWREDLINE_INSERTED)); + const_cast<SwRangeRedline&>(rRedline).Broadcast(SwRedlineHint(&rRedline,SWREDLINE_FOCUS)); + */ - aSet.Put(SvxPostItDateItem( GetAppLangDateTimeString( - rRedline.GetRedlineData().GetTimeStamp() ), - SID_ATTR_POSTIT_DATE )); + OUString sComment = convertLineEnd(rRedline.GetComment(), GetSystemLineEnd()); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + OSL_ENSURE(pFact, "Dialog creation failed!"); + ::DialogGetRanges fnGetRange = pFact->GetDialogGetRangesFunc(); + OSL_ENSURE(fnGetRange, "Dialog creation failed! GetRanges()"); + SfxItemSet aSet( pSh->GetAttrPool(), fnGetRange() ); - ScopedVclPtr<AbstractSvxPostItDialog> pDlg(pFact->CreateSvxPostItDialog( m_pParentDlg, aSet )); - OSL_ENSURE(pDlg, "Dialog creation failed!"); + aSet.Put(SvxPostItTextItem(sComment, SID_ATTR_POSTIT_TEXT)); + aSet.Put(SvxPostItAuthorItem(rRedline.GetAuthorString(), SID_ATTR_POSTIT_AUTHOR)); - pDlg->HideAuthor(); + aSet.Put(SvxPostItDateItem( GetAppLangDateTimeString( + rRedline.GetRedlineData().GetTimeStamp() ), + SID_ATTR_POSTIT_DATE )); - sal_uInt16 nResId = 0; - switch( rRedline.GetType() ) - { - case nsRedlineType_t::REDLINE_INSERT: - nResId = STR_REDLINE_INSERTED; - break; - case nsRedlineType_t::REDLINE_DELETE: - nResId = STR_REDLINE_DELETED; - break; - case nsRedlineType_t::REDLINE_FORMAT: - case nsRedlineType_t::REDLINE_PARAGRAPH_FORMAT: - nResId = STR_REDLINE_FORMATED; - break; - case nsRedlineType_t::REDLINE_TABLE: - nResId = STR_REDLINE_TABLECHG; - break; - default:;//prevent warning - } - OUString sTitle(SW_RES(STR_REDLINE_COMMENT)); - if( nResId ) - sTitle += SW_RESSTR( nResId ); - pDlg->SetText(sTitle); + ScopedVclPtr<AbstractSvxPostItDialog> pDlg(pFact->CreateSvxPostItDialog( m_pParentDlg, aSet )); + OSL_ENSURE(pDlg, "Dialog creation failed!"); - SwViewShell::SetCareWin(pDlg->GetWindow()); + pDlg->HideAuthor(); - if ( pDlg->Execute() == RET_OK ) - { - const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); - OUString sMsg(static_cast<const SvxPostItTextItem&>(pOutSet->Get(SID_ATTR_POSTIT_TEXT)).GetValue()); + sal_uInt16 nResId = 0; + switch( rRedline.GetType() ) + { + case nsRedlineType_t::REDLINE_INSERT: + nResId = STR_REDLINE_INSERTED; + break; + case nsRedlineType_t::REDLINE_DELETE: + nResId = STR_REDLINE_DELETED; + break; + case nsRedlineType_t::REDLINE_FORMAT: + case nsRedlineType_t::REDLINE_PARAGRAPH_FORMAT: + nResId = STR_REDLINE_FORMATED; + break; + case nsRedlineType_t::REDLINE_TABLE: + nResId = STR_REDLINE_TABLECHG; + break; + default:;//prevent warning + } + OUString sTitle(SW_RES(STR_REDLINE_COMMENT)); + if( nResId ) + sTitle += SW_RESSTR( nResId ); + pDlg->SetText(sTitle); - // insert / change comment - pSh->SetRedlineComment(sMsg); - m_pTable->SetEntryText(sMsg.replace('\n', ' '), pEntry, 3); - } + SwViewShell::SetCareWin(pDlg->GetWindow()); - pDlg.disposeAndClear(); - SwViewShell::SetCareWin(nullptr); - } + if ( pDlg->Execute() == RET_OK ) + { + const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); + OUString sMsg(static_cast<const SvxPostItTextItem&>(pOutSet->Get(SID_ATTR_POSTIT_TEXT)).GetValue()); - } - break; + // insert / change comment + pSh->SetRedlineComment(sMsg); + m_pTable->SetEntryText(sMsg.replace('\n', ' '), pEntry, 3); + } - case MN_SORT_ACTION: - case MN_SORT_AUTHOR: - case MN_SORT_DATE: - case MN_SORT_COMMENT: - case MN_SORT_POSITION: - { - bSortDir = true; - if (nRet - MN_SORT_ACTION == 4 && m_pTable->GetSortedCol() == 0xffff) - break; // we already have it + pDlg.disposeAndClear(); + SwViewShell::SetCareWin(nullptr); + } + } + else if (nRet) + { + bSortDir = true; + if (nRet - nActionId == 4 && m_pTable->GetSortedCol() == 0xffff) + return; // we already have it - nSortMode = nRet - MN_SORT_ACTION; - if (nSortMode == 4) - nSortMode = 0xffff; // unsorted / sorted by position + nSortMode = nRet - nActionId; + if (nSortMode == 4) + nSortMode = 0xffff; // unsorted / sorted by position - if (m_pTable->GetSortedCol() == nSortMode) - bSortDir = !m_pTable->GetSortDirection(); + if (m_pTable->GetSortedCol() == nSortMode) + bSortDir = !m_pTable->GetSortDirection(); - SwWait aWait( *::GetActiveView()->GetDocShell(), false ); - m_pTable->SortByCol(nSortMode, bSortDir); - if (nSortMode == 0xffff) - Init(); // newly fill everything - } - break; - } - } - break; - default: break; + SwWait aWait( *::GetActiveView()->GetDocShell(), false ); + m_pTable->SortByCol(nSortMode, bSortDir); + if (nSortMode == 0xffff) + Init(); // newly fill everything } } diff --git a/sw/source/uibase/misc/redlndlg.hrc b/sw/source/uibase/misc/redlndlg.hrc deleted file mode 100644 index e3d0464faca6..000000000000 --- a/sw/source/uibase/misc/redlndlg.hrc +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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 . - */ - -#define MN_EDIT_COMMENT 1 -#define MN_SUB_SORT 2 -#define MN_SORT_ACTION 3 -#define MN_SORT_AUTHOR 4 -#define MN_SORT_DATE 5 -#define MN_SORT_COMMENT 6 -#define MN_SORT_POSITION 7 - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/misc/redlndlg.src b/sw/source/uibase/misc/redlndlg.src deleted file mode 100644 index e3b9aadb3a0f..000000000000 --- a/sw/source/uibase/misc/redlndlg.src +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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 . - */ -/* StarView resource file */ - -#include "redlndlg.hrc" -#include "misc.hrc" -#include "helpid.h" - -Menu MN_REDLINE_POPUP -{ - ItemList = - { - MenuItem - { - Identifier = MN_EDIT_COMMENT ; - HelpID = HID_EDIT_COMMENT ; - Text [ en-US ] = "Edit Comment..." ; - }; - MenuItem - { - Identifier = MN_SUB_SORT ; - RadioCheck = TRUE ; - SubMenu = Menu - { - ItemList = - { - MenuItem - { - Identifier = MN_SORT_ACTION ; - HelpID = HID_SORT_ACTION ; - RadioCheck = TRUE ; - Text [ en-US ] = "Action" ; - }; - MenuItem - { - Identifier = MN_SORT_AUTHOR ; - HelpID = HID_SORT_AUTHOR ; - RadioCheck = TRUE ; - Text [ en-US ] = "Author" ; - }; - MenuItem - { - Identifier = MN_SORT_DATE ; - HelpID = HID_SORT_DATE ; - RadioCheck = TRUE ; - Text [ en-US ] = "Date" ; - }; - MenuItem - { - Identifier = MN_SORT_COMMENT ; - HelpID = HID_SORT_COMMENT ; - RadioCheck = TRUE ; - Text [ en-US ] = "Comment" ; - }; - MenuItem - { - Identifier = MN_SORT_POSITION ; - HelpID = HID_SW_SORT_POSITION ; - RadioCheck = TRUE ; - Text [ en-US ] = "Document position" ; - }; - }; - }; - Text [ en-US ] = "Sort By" ; - }; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |