convert writer changes menu to .ui

Change-Id: I30a957f91c3faca5e16a70efce08579ac3368bdf
This commit is contained in:
Caolán McNamara 2017-02-21 16:25:41 +00:00
parent eb38069490
commit e834354ff3
9 changed files with 215 additions and 294 deletions

View File

@ -1679,15 +1679,15 @@ IMPL_LINK_NOARG(ScAcceptChgDlg, CommandHdl, SvSimpleTable*, void)
m_xPopup->Deactivate();
}
const sal_uInt16 nSubSortId = m_xPopup->GetItemId("sort");
const sal_uInt16 nSubSortId = m_xPopup->GetItemId("calcsort");
PopupMenu *pSubMenu = m_xPopup->GetPopupMenu(nSubSortId);
const sal_uInt16 nActionId = pSubMenu->GetItemId("action");
const sal_uInt16 nActionId = pSubMenu->GetItemId("calcaction");
sal_uInt16 nSortedCol = pTheView->GetSortedCol();
if (nSortedCol != 0xFFFF)
pSubMenu->CheckItem(nActionId + nSortedCol);
const sal_uInt16 nEditId = m_xPopup->GetItemId("edit");
const sal_uInt16 nEditId = m_xPopup->GetItemId("calcedit");
m_xPopup->EnableItem(nEditId, false);

View File

@ -128,14 +128,14 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkMenuItem" id="edit">
<object class="GtkMenuItem" id="calcedit">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Edit Comment...</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="sort">
<object class="GtkMenuItem" id="calcsort">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Sorting</property>
@ -145,7 +145,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkRadioMenuItem" id="action">
<object class="GtkRadioMenuItem" id="calcaction">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Action</property>
@ -153,7 +153,7 @@
</object>
</child>
<child>
<object class="GtkRadioMenuItem" id="position">
<object class="GtkRadioMenuItem" id="calcposition">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Position</property>
@ -161,7 +161,7 @@
</object>
</child>
<child>
<object class="GtkRadioMenuItem" id="author">
<object class="GtkRadioMenuItem" id="calcauthor">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Author</property>
@ -169,7 +169,7 @@
</object>
</child>
<child>
<object class="GtkRadioMenuItem" id="date">
<object class="GtkRadioMenuItem" id="calcdate">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Date</property>
@ -177,7 +177,7 @@
</object>
</child>
<child>
<object class="GtkRadioMenuItem" id="desc">
<object class="GtkRadioMenuItem" id="calcdesc">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Description</property>
@ -189,4 +189,69 @@
</object>
</child>
</object>
<object class="GtkMenu" id="writermenu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkMenuItem" id="writeredit">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Edit Comment...</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="writersort">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Sort By</property>
<property name="use_underline">True</property>
<child type="submenu">
<object class="GtkMenu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkRadioMenuItem" id="writeraction">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Action</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkRadioMenuItem" id="writerauthor">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Author</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkRadioMenuItem" id="writerdate">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Date</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkRadioMenuItem" id="writerdesc">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Comment</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkRadioMenuItem" id="writerposition">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Document Position</property>
<property name="use_underline">True</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@ -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 \

View File

@ -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"

View File

@ -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)

View File

@ -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;

View File

@ -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() )
if (aCEvt.GetCommand() != CommandEventId::ContextMenu)
return;
SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
SvTreeListEntry* pEntry = m_pTable->FirstSelected();
const SwRangeRedline *pRed = nullptr;
if (pEntry)
{
case CommandEventId::ContextMenu:
SvTreeListEntry* pTopEntry = pEntry;
if (m_pTable->GetParent(pEntry))
pTopEntry = m_pTable->GetParent(pEntry);
sal_uInt16 nPos = GetRedlinePos(*pTopEntry);
// disable commenting for protected areas
if (nPos != USHRT_MAX && (pRed = pSh->GotoRedline(nPos, true)) != nullptr)
{
SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
SvTreeListEntry* pEntry = m_pTable->FirstSelected();
const SwRangeRedline *pRed = nullptr;
if (pEntry)
{
SvTreeListEntry* pTopEntry = pEntry;
if (m_pTable->GetParent(pEntry))
pTopEntry = m_pTable->GetParent(pEntry);
sal_uInt16 nPos = GetRedlinePos(*pTopEntry);
// disable commenting for protected areas
if (nPos != USHRT_MAX && (pRed = pSh->GotoRedline(nPos, true)) != nullptr)
{
if( pSh->IsCursorPtAtEnd() )
pSh->SwapPam();
pSh->SetInSelect();
}
}
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()
);
m_aPopup->EnableItem( MN_SUB_SORT, m_pTable->First() != nullptr );
sal_uInt16 nColumn = m_pTable->GetSortedCol();
if (nColumn == 0xffff)
nColumn = 4;
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);
pSubMenu->CheckItem(nColumn + MN_SORT_ACTION);
}
sal_uInt16 nRet = m_aPopup->Execute(m_pTable, aCEvt.GetMousePosPixel());
switch( nRet )
{
case MN_EDIT_COMMENT:
{
if (pEntry)
{
if (m_pTable->GetParent(pEntry))
pEntry = m_pTable->GetParent(pEntry);
sal_uInt16 nPos = GetRedlinePos(*pEntry);
if (nPos == USHRT_MAX)
break;
const SwRangeRedline &rRedline = pSh->GetRedline(nPos);
/* 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));
*/
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() );
aSet.Put(SvxPostItTextItem(sComment, SID_ATTR_POSTIT_TEXT));
aSet.Put(SvxPostItAuthorItem(rRedline.GetAuthorString(), SID_ATTR_POSTIT_AUTHOR));
aSet.Put(SvxPostItDateItem( GetAppLangDateTimeString(
rRedline.GetRedlineData().GetTimeStamp() ),
SID_ATTR_POSTIT_DATE ));
ScopedVclPtr<AbstractSvxPostItDialog> pDlg(pFact->CreateSvxPostItDialog( m_pParentDlg, aSet ));
OSL_ENSURE(pDlg, "Dialog creation failed!");
pDlg->HideAuthor();
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);
SwViewShell::SetCareWin(pDlg->GetWindow());
if ( pDlg->Execute() == RET_OK )
{
const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
OUString sMsg(static_cast<const SvxPostItTextItem&>(pOutSet->Get(SID_ATTR_POSTIT_TEXT)).GetValue());
// insert / change comment
pSh->SetRedlineComment(sMsg);
m_pTable->SetEntryText(sMsg.replace('\n', ' '), pEntry, 3);
}
pDlg.disposeAndClear();
SwViewShell::SetCareWin(nullptr);
}
}
break;
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
nSortMode = nRet - MN_SORT_ACTION;
if (nSortMode == 4)
nSortMode = 0xffff; // unsorted / sorted by position
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;
}
if( pSh->IsCursorPtAtEnd() )
pSh->SwapPam();
pSh->SetInSelect();
}
break;
default: break;
}
const sal_uInt16 nEditId = m_xPopup->GetItemId("writeredit");
m_xPopup->EnableItem(nEditId, pEntry && pRed &&
!m_pTable->GetParent(pEntry) &&
!m_pTable->NextSelected(pEntry));
sal_uInt16 nColumn = m_pTable->GetSortedCol();
if (nColumn == 0xffff)
nColumn = 4;
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 nRet = m_xPopup->Execute(m_pTable, aCEvt.GetMousePosPixel());
if (nRet == nEditId)
{
if (pEntry)
{
if (m_pTable->GetParent(pEntry))
pEntry = m_pTable->GetParent(pEntry);
sal_uInt16 nPos = GetRedlinePos(*pEntry);
if (nPos == USHRT_MAX)
return;
const SwRangeRedline &rRedline = pSh->GetRedline(nPos);
/* 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));
*/
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() );
aSet.Put(SvxPostItTextItem(sComment, SID_ATTR_POSTIT_TEXT));
aSet.Put(SvxPostItAuthorItem(rRedline.GetAuthorString(), SID_ATTR_POSTIT_AUTHOR));
aSet.Put(SvxPostItDateItem( GetAppLangDateTimeString(
rRedline.GetRedlineData().GetTimeStamp() ),
SID_ATTR_POSTIT_DATE ));
ScopedVclPtr<AbstractSvxPostItDialog> pDlg(pFact->CreateSvxPostItDialog( m_pParentDlg, aSet ));
OSL_ENSURE(pDlg, "Dialog creation failed!");
pDlg->HideAuthor();
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);
SwViewShell::SetCareWin(pDlg->GetWindow());
if ( pDlg->Execute() == RET_OK )
{
const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
OUString sMsg(static_cast<const SvxPostItTextItem&>(pOutSet->Get(SID_ATTR_POSTIT_TEXT)).GetValue());
// insert / change comment
pSh->SetRedlineComment(sMsg);
m_pTable->SetEntryText(sMsg.replace('\n', ' '), pEntry, 3);
}
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 - nActionId;
if (nSortMode == 4)
nSortMode = 0xffff; // unsorted / sorted by position
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
}
}

View File

@ -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: */

View File

@ -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: */