include/vcl/builder.hxx | 3 + sc/inc/helpids.h | 8 --- sc/inc/scres.hrc | 2 sc/source/ui/inc/acredlin.hrc | 30 ----------- sc/source/ui/inc/acredlin.hxx | 2 sc/source/ui/miscdlgs/acredlin.cxx | 55 +++++++++------------ sc/source/ui/miscdlgs/acredlin.src | 62 ------------------------ svx/uiconfig/ui/acceptrejectchangesdialog.ui | 68 ++++++++++++++++++++++++++- vcl/source/window/builder.cxx | 24 ++++----- 9 files changed, 108 insertions(+), 146 deletions(-)
New commits: commit 7660d45dc3884e910d619d0e7551f5f58346ab04 Author: Caolán McNamara <caol...@redhat.com> Date: Tue Feb 21 14:22:13 2017 +0000 convert calc changes menu to .ui Change-Id: I65c07995ab7a63bcefeb1612e86bf3fedc33f4a5 diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h index 6298137..aff92df 100644 --- a/sc/inc/helpids.h +++ b/sc/inc/helpids.h @@ -64,13 +64,7 @@ #define HID_SC_REN_AFMT_DLG "SC_HID_SC_REN_AFMT_DLG" -// Hilfe IDs fuer Submenus (max.50) ------------------------------------------ -#define HID_SC_SORT_ACTION "SC_HID_SC_SORT_ACTION" -#define HID_SC_SORT_AUTHOR "SC_HID_SC_SORT_AUTHOR" -#define HID_SC_SORT_DATE "SC_HID_SC_SORT_DATE" -#define HID_SC_SORT_COMMENT "SC_HID_SC_SORT_COMMENT" -#define HID_SORT_POSITION "SC_HID_SORT_POSITION" -#define HID_SC_CHANGES_COMMENT "SC_HID_SC_CHANGES_COMMENT" +// Help IDs for Submenus (max.50) -------------------------------------------- #define HID_PASSWD_TABLE "SC_HID_PASSWD_TABLE" #define HID_PASSWD_DOC "SC_HID_PASSWD_DOC" diff --git a/sc/inc/scres.hrc b/sc/inc/scres.hrc index 51fd648..af981ae 100644 --- a/sc/inc/scres.hrc +++ b/sc/inc/scres.hrc @@ -530,8 +530,6 @@ #define RID_NAVIPI_SCENARIO_DELETE (SC_DIALOGS_START + 121) #define RID_NAVIPI_SCENARIO_EDIT (SC_DIALOGS_START + 122) -#define RID_POPUP_CHANGES (SC_DIALOGS_START + 127) - #define RID_CELLSTYLEFAMILY (SC_DIALOGS_START + 138) #define RID_PAGESTYLEFAMILY (SC_DIALOGS_START + 139) #define BMP_STYLES_FAMILY_CELL (SC_DIALOGS_START + 140) diff --git a/sc/source/ui/inc/acredlin.hrc b/sc/source/ui/inc/acredlin.hrc deleted file mode 100644 index 9813c19..0000000 --- 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 10f50fd..f4bead0 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 ae78758..0dea04e 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 42967be..3c0dbca 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: */ diff --git a/svx/uiconfig/ui/acceptrejectchangesdialog.ui b/svx/uiconfig/ui/acceptrejectchangesdialog.ui index d1ccf11..af4ddf2 100644 --- a/svx/uiconfig/ui/acceptrejectchangesdialog.ui +++ b/svx/uiconfig/ui/acceptrejectchangesdialog.ui @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.20.0 --> <interface> - <!-- interface-requires gtk+ 3.0 --> + <requires lib="gtk+" version="3.0"/> <object class="GtkDialog" id="AcceptRejectChangesDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> @@ -123,4 +124,69 @@ <action-widget response="0">close</action-widget> </action-widgets> </object> + <object class="GtkMenu" id="calcmenu"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkMenuItem" id="edit"> + <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"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Sorting</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="action"> + <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="position"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Position</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkRadioMenuItem" id="author"> + <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="date"> + <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="desc"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Description</property> + <property name="use_underline">True</property> + </object> + </child> + </object> + </child> + </object> + </child> + </object> </interface> commit 342c612086e6bdd56cbf9ed45a83965b6c7f24fd Author: Caolán McNamara <caol...@redhat.com> Date: Tue Feb 21 16:06:34 2017 +0000 we want selected radio entries to default unselect the others Change-Id: Ib208797fc5c876c5646df33c4682d4a9e795912e diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 5e7daaf..82e42da 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -2762,7 +2762,7 @@ void VclBuilder::insertMenuObject(PopupMenu *pParent, PopupMenu *pSubMenu, const { OUString sLabel(OStringToOUString(convertMnemonicMarkup(extractLabel(rProps)), RTL_TEXTENCODING_UTF8)); OUString aCommand(OStringToOUString(extractActionName(rProps), RTL_TEXTENCODING_UTF8)); - pParent->InsertItem(nNewId, sLabel, MenuItemBits::CHECKABLE | MenuItemBits::RADIOCHECK, rID); + pParent->InsertItem(nNewId, sLabel, MenuItemBits::AUTOCHECK | MenuItemBits::RADIOCHECK, rID); pParent->SetItemCommand(nNewId, aCommand); } else if (rClass == "GtkSeparatorMenuItem") commit ff30fa30edd2562594b9b71de2a6dd1d20fabc8f Author: Caolán McNamara <caol...@redhat.com> Date: Tue Feb 21 15:04:15 2017 +0000 make every menu id unique instead of every id within each menu so submenu ids are not shared by an id in the parent Change-Id: Ic94794b5c461307b79969472e9fb24d11c96ca53 diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx index d8de474..aaf42e7 100644 --- a/include/vcl/builder.hxx +++ b/include/vcl/builder.hxx @@ -295,6 +295,8 @@ private: sal_uInt16 m_nLastToolbarId; + sal_uInt16 m_nLastMenuItemId; + ParserState(); }; diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index d6f2d123..5e7daaf 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -2740,7 +2740,7 @@ void VclBuilder::insertMenuObject(PopupMenu *pParent, PopupMenu *pSubMenu, const stringmap &rProps, accelmap &rAccels) { sal_uInt16 nOldCount = pParent->GetItemCount(); - sal_uInt16 nNewId = nOldCount + 1; + sal_uInt16 nNewId = ++m_pParserState->m_nLastMenuItemId; if (rClass == "GtkMenuItem") { @@ -3630,6 +3630,7 @@ void VclBuilder::mungeTextBuffer(VclMultiLineEdit &rTarget, const TextBuffer &rT VclBuilder::ParserState::ParserState() : m_nLastToolbarId(0) + , m_nLastMenuItemId(0) {} VclBuilder::MenuAndId::MenuAndId(const OString &rId, PopupMenu *pMenu) commit 342238a320b057d2aab401e29a44fc8f96a3da6a Author: Caolán McNamara <caol...@redhat.com> Date: Tue Feb 21 14:21:31 2017 +0000 improve loading submenus from .ui Change-Id: Ida5382bffa3cee55ffa64fd50d3733a178afa639 diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx index 0577372..d8de474 100644 --- a/include/vcl/builder.hxx +++ b/include/vcl/builder.hxx @@ -366,6 +366,7 @@ private: void insertMenuObject( PopupMenu *pParent, + PopupMenu *pSubMenu, const OString &rClass, const OString &rID, stringmap &rProps, diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index f24029d..d6f2d123 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -2561,6 +2561,7 @@ void VclBuilder::handleMenuObject(PopupMenu *pParent, xmlreader::XmlReader &read OString sClass; OString sID; OString sCustomProperty; + PopupMenu *pSubMenu = nullptr; xmlreader::Span name; int nsId; @@ -2607,11 +2608,10 @@ void VclBuilder::handleMenuObject(PopupMenu *pParent, xmlreader::XmlReader &read { if (name.equals("child")) { - insertMenuObject(pParent, sClass, sID, aProperties, aAccelerators); - VclPtr<PopupMenu> xSubMenu = VclPtr<PopupMenu>::Create(); - pParent->SetPopupMenu(pParent->GetItemCount(), xSubMenu); - handleMenuChild(xSubMenu, reader); - bInserted = true; + size_t nChildMenuIdx = m_aMenus.size(); + handleChild(nullptr, reader); + assert(m_aMenus.size() > nChildMenuIdx && "menu not inserted"); + pSubMenu = m_aMenus[nChildMenuIdx].m_pMenu; } else { @@ -2635,7 +2635,7 @@ void VclBuilder::handleMenuObject(PopupMenu *pParent, xmlreader::XmlReader &read if (bInserted) return; - insertMenuObject(pParent, sClass, sID, aProperties, aAccelerators); + insertMenuObject(pParent, pSubMenu, sClass, sID, aProperties, aAccelerators); } void VclBuilder::handleSizeGroup(xmlreader::XmlReader &reader, const OString &rID) @@ -2736,12 +2736,9 @@ namespace } } -void VclBuilder::insertMenuObject(PopupMenu *pParent, const OString &rClass, const OString &rID, +void VclBuilder::insertMenuObject(PopupMenu *pParent, PopupMenu *pSubMenu, const OString &rClass, const OString &rID, stringmap &rProps, accelmap &rAccels) { - if (rClass == "GtkMenu") - return; - sal_uInt16 nOldCount = pParent->GetItemCount(); sal_uInt16 nNewId = nOldCount + 1; @@ -2751,6 +2748,8 @@ void VclBuilder::insertMenuObject(PopupMenu *pParent, const OString &rClass, con OUString aCommand(OStringToOUString(extractActionName(rProps), RTL_TEXTENCODING_UTF8)); pParent->InsertItem(nNewId, sLabel, MenuItemBits::TEXT, rID); pParent->SetItemCommand(nNewId, aCommand); + if (pSubMenu) + pParent->SetPopupMenu(nNewId, pSubMenu); } else if (rClass == "GtkCheckMenuItem") { commit 1d8fe6a7c6bbaa7d3a5eff8a7a6b5e613bb61b28 Author: Caolán McNamara <caol...@redhat.com> Date: Tue Feb 21 16:08:50 2017 +0000 stl debugging points out that a < a when using right click menu in calc redline dialog to sort changes Change-Id: Ib79028168470b7a556bdc37cd65ce99b4dce5152 diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx index 84d2d3d..ae78758 100644 --- a/sc/source/ui/miscdlgs/acredlin.cxx +++ b/sc/source/ui/miscdlgs/acredlin.cxx @@ -1873,9 +1873,6 @@ IMPL_LINK( ScAcceptChgDlg, ColCompareHdl, const SvSortData*, pSortData, sal_Int3 nCompare = ScGlobal::GetCaseCollator()->compareString( static_cast<SvLBoxString*>(pLeftItem)->GetText(), static_cast<SvLBoxString*>(pRightItem)->GetText()); - - if (nCompare == 0) - nCompare = -1; } }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits