summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-02-21 14:22:13 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-02-21 16:18:07 +0000
commit7660d45dc3884e910d619d0e7551f5f58346ab04 (patch)
tree82a77637e0e352f45bc9b519d84d8b20930671f3 /sc/source
parent342c612086e6bdd56cbf9ed45a83965b6c7f24fd (diff)
convert calc changes menu to .ui
Change-Id: I65c07995ab7a63bcefeb1612e86bf3fedc33f4a5
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/ui/inc/acredlin.hrc30
-rw-r--r--sc/source/ui/inc/acredlin.hxx2
-rw-r--r--sc/source/ui/miscdlgs/acredlin.cxx52
-rw-r--r--sc/source/ui/miscdlgs/acredlin.src62
4 files changed, 25 insertions, 121 deletions
diff --git a/sc/source/ui/inc/acredlin.hrc b/sc/source/ui/inc/acredlin.hrc
deleted file mode 100644
index 9813c19fabfb..000000000000
--- a/sc/source/ui/inc/acredlin.hrc
+++ /dev/null
@@ -1,30 +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 .
- */
-
-#include "scres.hrc"
-
-#define SC_CHANGES_COMMENT 49
-#define SC_SUB_SORT 50
-#define SC_SORT_ACTION 51
-#define SC_SORT_POSITION 52
-#define SC_SORT_AUTHOR 53
-#define SC_SORT_DATE 54
-#define SC_SORT_COMMENT 55
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/acredlin.hxx b/sc/source/ui/inc/acredlin.hxx
index 10f50fddccaf..f4bead09c04b 100644
--- a/sc/source/ui/inc/acredlin.hxx
+++ b/sc/source/ui/inc/acredlin.hxx
@@ -55,9 +55,9 @@ public:
class ScAcceptChgDlg : public SfxModelessDialog
{
private:
-
Idle aSelectionIdle;
Idle aReOpenIdle;
+ VclPtr<PopupMenu> m_xPopup;
VclPtr<SvxAcceptChgCtr> m_pAcceptChgCtr;
ScViewData* pViewData;
ScDocument* pDoc;
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx
index ae7875806f28..0dea04e32790 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -33,7 +33,7 @@
#include "docsh.hxx"
#include "scresid.hxx"
#include "globstr.hrc"
-#include "acredlin.hrc"
+#include "scres.hrc"
#include "simpref.hxx"
#include "scmod.hxx"
#include "popmenu.hxx"
@@ -79,6 +79,7 @@ ScAcceptChgDlg::ScAcceptChgDlg(SfxBindings* pB, SfxChildWindow* pCW, vcl::Window
"AcceptRejectChangesDialog", "svx/ui/acceptrejectchangesdialog.ui"),
aSelectionIdle("ScAcceptChgDlg SelectionIdle"),
aReOpenIdle("ScAcceptChgDlg ReOpenIdle"),
+ m_xPopup(get_menu("calcmenu")),
pViewData ( ptrViewData ),
pDoc ( ptrViewData->GetDocument() ),
aStrInsertCols (SC_RESSTR(STR_CHG_INSERT_COLS)),
@@ -162,6 +163,7 @@ void ScAcceptChgDlg::dispose()
pChanges->SetModifiedLink(aLink);
}
+ m_xPopup.clear();
m_pAcceptChgCtr.disposeAndClear();
pTPFilter.clear();
pTPView.clear();
@@ -1665,9 +1667,7 @@ IMPL_LINK_NOARG(ScAcceptChgDlg, CommandHdl, SvSimpleTable*, void)
if(aCEvt.GetCommand()==CommandEventId::ContextMenu)
{
- ScopedVclPtrInstance<PopupMenu> aPopup(ScResId(RID_POPUP_CHANGES));
-
- aPopup->SetMenuFlags(MenuFlags::HideDisabledEntries);
+ m_xPopup->SetMenuFlags(MenuFlags::HideDisabledEntries);
SvTreeListEntry* pEntry=pTheView->GetCurEntry();
if(pEntry!=nullptr)
@@ -1676,24 +1676,20 @@ IMPL_LINK_NOARG(ScAcceptChgDlg, CommandHdl, SvSimpleTable*, void)
}
else
{
- aPopup->Deactivate();
+ m_xPopup->Deactivate();
}
- sal_uInt16 nSortedCol= pTheView->GetSortedCol();
-
- if(nSortedCol!=0xFFFF)
- {
- sal_uInt16 nItemId=nSortedCol+SC_SUB_SORT+1;
+ const sal_uInt16 nSubSortId = m_xPopup->GetItemId("sort");
+ PopupMenu *pSubMenu = m_xPopup->GetPopupMenu(nSubSortId);
+ const sal_uInt16 nActionId = pSubMenu->GetItemId("action");
- aPopup->CheckItem(nItemId);
+ sal_uInt16 nSortedCol = pTheView->GetSortedCol();
+ if (nSortedCol != 0xFFFF)
+ pSubMenu->CheckItem(nActionId + nSortedCol);
- PopupMenu *pSubMenu = aPopup->GetPopupMenu(SC_SUB_SORT);
-
- if (pSubMenu)
- pSubMenu->CheckItem(nItemId);
- }
+ const sal_uInt16 nEditId = m_xPopup->GetItemId("edit");
- aPopup->EnableItem(SC_CHANGES_COMMENT,false);
+ m_xPopup->EnableItem(nEditId, false);
if(pDoc->IsDocEditable() && pEntry!=nullptr)
{
@@ -1702,16 +1698,16 @@ IMPL_LINK_NOARG(ScAcceptChgDlg, CommandHdl, SvSimpleTable*, void)
{
ScChangeAction* pScChangeAction=
static_cast<ScChangeAction*>(pEntryData->pData);
- if(pScChangeAction!=nullptr && !pTheView->GetParent(pEntry))
- aPopup->EnableItem(SC_CHANGES_COMMENT);
+ if (pScChangeAction!=nullptr && !pTheView->GetParent(pEntry))
+ m_xPopup->EnableItem(nEditId);
}
}
- sal_uInt16 nCommand = aPopup->Execute( this, GetPointerPosPixel() );
+ sal_uInt16 nCommand = m_xPopup->Execute(this, GetPointerPosPixel());
if(nCommand)
{
- if(nCommand==SC_CHANGES_COMMENT)
+ if (nCommand == nEditId)
{
if(pEntry!=nullptr)
{
@@ -1728,16 +1724,16 @@ IMPL_LINK_NOARG(ScAcceptChgDlg, CommandHdl, SvSimpleTable*, void)
else
{
bool bSortDir = pTheView->GetSortDirection();
- sal_uInt16 nDialogCol=nCommand-SC_SUB_SORT-1;
+ sal_uInt16 nDialogCol = nCommand - nActionId;
+ fprintf(stderr, "sort by %d\n", nDialogCol);
if(nSortedCol==nDialogCol) bSortDir=!bSortDir;
pTheView->SortByCol(nDialogCol,bSortDir);
/*
- SC_SUB_SORT
- SC_SORT_ACTION
- SC_SORT_POSITION
- SC_SORT_AUTHOR
- SC_SORT_DATE
- SC_SORT_COMMENT
+ 0, sort by action
+ 1, sort by position
+ 2, sort by author
+ 3, sort by date
+ 4, sort by comment
*/
}
}
diff --git a/sc/source/ui/miscdlgs/acredlin.src b/sc/source/ui/miscdlgs/acredlin.src
index 42967bea88f6..3c0dbcae18f2 100644
--- a/sc/source/ui/miscdlgs/acredlin.src
+++ b/sc/source/ui/miscdlgs/acredlin.src
@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "acredlin.hrc"
#include "globstr.hrc"
String STR_CHG_INSERT_COLS
@@ -84,65 +83,4 @@ String STR_CHG_EMPTY
{
Text [ en-US ] = "<empty>" ;
};
-
-Menu RID_POPUP_CHANGES
-{
- ItemList =
- {
- MenuItem
- {
- Identifier = SC_CHANGES_COMMENT ;
- HelpId = HID_SC_CHANGES_COMMENT ;
- Text [ en-US ] = "Edit Comment..." ;
-
- };
- MenuItem
- {
- Identifier = SC_SUB_SORT ;
- SubMenu = Menu
- {
- ItemList =
- {
- MenuItem
- {
- Identifier = SC_SORT_ACTION ;
- HelpID = HID_SC_SORT_ACTION ;
- RadioCheck = TRUE ;
- Text [ en-US ] = "Action" ;
- };
- MenuItem
- {
- Identifier = SC_SORT_POSITION ;
- HelpID = HID_SORT_POSITION ;
- RadioCheck = TRUE ;
- Text [ en-US ] = "Position" ;
- };
- MenuItem
- {
- Identifier = SC_SORT_AUTHOR ;
- HelpID = HID_SC_SORT_AUTHOR ;
- RadioCheck = TRUE ;
- Text [ en-US ] = "Author" ;
- };
- MenuItem
- {
- Identifier = SC_SORT_DATE ;
- HelpID = HID_SC_SORT_DATE ;
- RadioCheck = TRUE ;
- Text [ en-US ] = "Date" ;
- };
- MenuItem
- {
- Identifier = SC_SORT_COMMENT ;
- HelpID = HID_SC_SORT_COMMENT ;
- RadioCheck = TRUE ;
- Text [ en-US ] = "Description" ;
- };
- };
- };
- Text [ en-US ] = "Sorting" ;
- };
- };
-};
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */