compilerplugins/clang/mergeclasses.results | 5 - include/svx/lboxctrl.hxx | 23 +----- sc/source/ui/inc/warnbox.hxx | 25 +------ sc/source/ui/miscdlgs/warnbox.cxx | 46 +++---------- svx/source/form/fmtextcontrolfeature.cxx | 3 svx/source/inc/fmslotinvalidator.hxx | 9 -- svx/source/inc/fmtextcontrolfeature.hxx | 5 - svx/source/inc/fmtextcontrolshell.hxx | 7 -- svx/source/tbxctrls/lboxctrl.cxx | 39 ++--------- sw/Library_sw.mk | 1 sw/inc/txatritr.hxx | 40 ++++------- sw/source/core/txtnode/txatritr.cxx | 16 ++-- sw/source/ui/config/optload.cxx | 69 +++++++++++++++++-- sw/source/uibase/cctrl/swlbox.cxx | 101 ----------------------------- sw/source/uibase/inc/bookmark.hxx | 1 sw/source/uibase/inc/cption.hxx | 12 --- sw/source/uibase/inc/optload.hxx | 21 ++++-- sw/source/uibase/inc/swlbox.hxx | 72 -------------------- 18 files changed, 140 insertions(+), 355 deletions(-)
New commits: commit db0cb39225c5f865c199f8aa0b3fa4aa6e721de1 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Fri Oct 14 08:08:01 2016 +0200 loplugin:mergeclasses merge SwTextAttrIterator with SwLanguageIterator Change-Id: Iaa9184f6145625c897fa5b919e9bf0c898b41102 diff --git a/compilerplugins/clang/mergeclasses.results b/compilerplugins/clang/mergeclasses.results index c81c018..68088b9 100644 --- a/compilerplugins/clang/mergeclasses.results +++ b/compilerplugins/clang/mergeclasses.results @@ -157,7 +157,6 @@ merge SwNumberTreeNode with SwNodeNum merge SwSelPaintRects with SwShellCursor merge SwSidebarItem with SwAnnotationItem merge SwTextAdjuster with SwTextCursor -merge SwTextAttrIterator with SwLanguageIterator merge SwUnoCursor with SwUnoTableCursor merge SwXParaFrameEnumeration with SwXParaFrameEnumerationImpl merge SwXParagraphEnumeration with SwXParagraphEnumerationImpl diff --git a/sw/inc/txatritr.hxx b/sw/inc/txatritr.hxx index dfb4474..9843094 100644 --- a/sw/inc/txatritr.hxx +++ b/sw/inc/txatritr.hxx @@ -48,38 +48,28 @@ public: const OUString& GetText() const { return m_rText; } }; -class SwTextAttrIterator +class SwLanguageIterator { - SwScriptIterator aSIter; - std::deque<const SwTextAttr*> aStack; - const SwTextNode& rTextNd; - const SfxPoolItem *pParaItem, *pCurItem; - size_t nAttrPos; - sal_Int32 nChgPos; - sal_uInt16 nWhichId; + SwScriptIterator aSIter; + std::deque<const SwTextAttr*> + aStack; + const SwTextNode& rTextNd; + const SfxPoolItem* pParaItem; + const SfxPoolItem* pCurItem; + size_t nAttrPos; + sal_Int32 nChgPos; + sal_uInt16 nWhichId; void AddToStack( const SwTextAttr& rAttr ); void SearchNextChg(); public: - SwTextAttrIterator( const SwTextNode& rTextNd, sal_uInt16 nWhichId, - sal_Int32 nStart ); + SwLanguageIterator( const SwTextNode& rTextNd, sal_Int32 nStart ); - bool Next(); - - const SfxPoolItem& GetAttr() const { return *pCurItem; } - sal_Int32 GetChgPos() const { return nChgPos; } -}; - -class SwLanguageIterator : public SwTextAttrIterator -{ -public: - SwLanguageIterator( const SwTextNode& rTextNode, sal_Int32 nStart ) - : SwTextAttrIterator( rTextNode, RES_CHRATR_LANGUAGE, nStart ) - {} - - sal_uInt16 GetLanguage() const - { return static_cast<const SvxLanguageItem&>(GetAttr()).GetValue(); } + bool Next(); + sal_Int32 GetChgPos() const { return nChgPos; } + sal_uInt16 GetLanguage() const + { return static_cast<const SvxLanguageItem&>(*pCurItem).GetValue(); } }; #endif diff --git a/sw/source/core/txtnode/txatritr.cxx b/sw/source/core/txtnode/txatritr.cxx index 1ae3458..d98607e 100644 --- a/sw/source/core/txtnode/txatritr.cxx +++ b/sw/source/core/txtnode/txatritr.cxx @@ -93,15 +93,19 @@ bool SwScriptIterator::Next() return bRet; } -SwTextAttrIterator::SwTextAttrIterator( const SwTextNode& rTNd, sal_uInt16 nWhchId, +SwLanguageIterator::SwLanguageIterator( const SwTextNode& rTNd, sal_Int32 nStt ) - : aSIter( rTNd.GetText(), nStt ), rTextNd( rTNd ), - pParaItem( nullptr ), nAttrPos( 0 ), nChgPos( nStt ), nWhichId( nWhchId ) + : aSIter( rTNd.GetText(), nStt ), + rTextNd( rTNd ), + pParaItem( nullptr ), + nAttrPos( 0 ), + nChgPos( nStt ), + nWhichId( RES_CHRATR_LANGUAGE ) { SearchNextChg(); } -bool SwTextAttrIterator::Next() +bool SwLanguageIterator::Next() { bool bRet = false; if (nChgPos < aSIter.GetText().getLength()) @@ -150,7 +154,7 @@ bool SwTextAttrIterator::Next() return bRet; } -void SwTextAttrIterator::AddToStack( const SwTextAttr& rAttr ) +void SwLanguageIterator::AddToStack( const SwTextAttr& rAttr ) { size_t nIns = 0; const sal_Int32 nEndPos = *rAttr.End(); @@ -161,7 +165,7 @@ void SwTextAttrIterator::AddToStack( const SwTextAttr& rAttr ) aStack.insert( aStack.begin() + nIns, &rAttr ); } -void SwTextAttrIterator::SearchNextChg() +void SwLanguageIterator::SearchNextChg() { sal_uInt16 nWh = 0; if( nChgPos == aSIter.GetScriptChgPos() ) commit 94ea3a18829914aa76b5534f8a551ad37d59cf07 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Thu Oct 13 16:29:42 2016 +0200 loplugin:mergeclasses merge SwComboBox with CaptionComboBox Change-Id: Ieef8f00cb1f6f8fb62ad385d1085e8a63161a710 diff --git a/compilerplugins/clang/mergeclasses.results b/compilerplugins/clang/mergeclasses.results index d630db1..c81c018 100644 --- a/compilerplugins/clang/mergeclasses.results +++ b/compilerplugins/clang/mergeclasses.results @@ -148,7 +148,6 @@ merge SvxCSS1Parser with SwCSS1Parser merge SvxRTFParser with EditRTFParser merge SvxShapeMaster with SdXShape merge SwAccessibleFrame with SwAccessibleContext -merge SwComboBox with CaptionComboBox merge SwCursorShell with SwEditShell merge SwEditShell with SwFEShell merge SwFEShell with SwWrtShell diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index 403e29b..59cadd9 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -572,7 +572,6 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ sw/source/uibase/app/swmodule \ sw/source/uibase/app/swwait \ sw/source/uibase/cctrl/actctrl \ - sw/source/uibase/cctrl/swlbox \ sw/source/uibase/chrdlg/ccoll \ sw/source/uibase/config/StoredChapterNumbering \ sw/source/uibase/config/barcfg \ diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx index 4577c53..81eebd4 100644 --- a/sw/source/ui/config/optload.cxx +++ b/sw/source/ui/config/optload.cxx @@ -714,15 +714,15 @@ IMPL_LINK_NOARG(SwCaptionOptPage, ShowEntryHdl, SvTreeListBox*, void) SwFieldType *pType = pMgr->GetFieldType( USHRT_MAX, i ); if( pType->Which() == RES_SETEXPFLD && static_cast<SwSetExpFieldType *>( pType)->GetType() & nsSwGetSetExpType::GSE_SEQ ) - m_pCategoryBox->InsertSwEntry(SwBoxEntry(pType->GetName())); + m_pCategoryBox->InsertSwEntry(pType->GetName()); } } else { - m_pCategoryBox->InsertSwEntry(SwBoxEntry(m_sIllustration)); - m_pCategoryBox->InsertSwEntry(SwBoxEntry(m_sTable)); - m_pCategoryBox->InsertSwEntry(SwBoxEntry(m_sText)); - m_pCategoryBox->InsertSwEntry(SwBoxEntry(m_sDrawing)); + m_pCategoryBox->InsertSwEntry(m_sIllustration); + m_pCategoryBox->InsertSwEntry(m_sTable); + m_pCategoryBox->InsertSwEntry(m_sText); + m_pCategoryBox->InsertSwEntry(m_sDrawing); } if(!pOpt->GetCategory().isEmpty()) @@ -742,7 +742,7 @@ IMPL_LINK_NOARG(SwCaptionOptPage, ShowEntryHdl, SvTreeListBox*, void) case TABLE_CAP: nPos = 2; break; case FRAME_CAP: nPos = 3; break; } - m_pCategoryBox->SetText(m_pCategoryBox->GetSwEntry(nPos).GetName()); + m_pCategoryBox->SetText(m_pCategoryBox->GetSwEntry(nPos)); } for (sal_Int32 i = 0; i < m_pFormatBox->GetEntryCount(); i++) @@ -930,11 +930,66 @@ void SwCaptionOptPage::InvalidatePreview() m_pPreview->SetPreviewText(aStr); } +CaptionComboBox::CaptionComboBox(vcl::Window* pParent, WinBits nStyle) + : ComboBox(pParent, nStyle) +{ + // create administration for the resource's Stringlist + sal_Int32 nSize = GetEntryCount(); + for( sal_Int32 i=0; i < nSize; ++i ) + { + m_EntryList.push_back(ComboBox::GetEntry(i)); + } +} + +CaptionComboBox::~CaptionComboBox() +{ +} + +sal_Int32 CaptionComboBox::InsertEntry(const OUString& rStr, sal_Int32) +{ + InsertSwEntry(rStr); + return 0; +} + +void CaptionComboBox::InsertSwEntry(const OUString& rEntry) +{ + InsertSorted(rEntry); +} + +void CaptionComboBox::InsertSorted(OUString const& rEntry) +{ + ComboBox::InsertEntry(rEntry); + sal_Int32 nPos = ComboBox::GetEntryPos(rEntry); + m_EntryList.insert(m_EntryList.begin() + nPos, rEntry); +} + +void CaptionComboBox::RemoveEntryAt(sal_Int32 const nPos) +{ + if (nPos < 0 || static_cast<size_t>(nPos) >= m_EntryList.size()) + return; + + // Remove old element + ComboBox::RemoveEntryAt(nPos); + + // Don't add new entries to the list + // add to DelEntryList + m_DelEntryList.push_back(m_EntryList[nPos]); + m_EntryList.erase(m_EntryList.begin() + nPos); +} + +const OUString& CaptionComboBox::GetSwEntry(sal_Int32 const nPos) const +{ + if (0 <= nPos && static_cast<size_t>(nPos) < m_EntryList.size()) + return m_EntryList[nPos]; + + return aDefault; +} + // Description: ComboBox without Spaces void CaptionComboBox::KeyInput(const KeyEvent& rEvt) { if (rEvt.GetKeyCode().GetCode() != KEY_SPACE) - SwComboBox::KeyInput(rEvt); + ComboBox::KeyInput(rEvt); } VCL_BUILDER_DECL_FACTORY(CaptionComboBox) diff --git a/sw/source/uibase/cctrl/swlbox.cxx b/sw/source/uibase/cctrl/swlbox.cxx deleted file mode 100644 index 6db094e..0000000 --- a/sw/source/uibase/cctrl/swlbox.cxx +++ /dev/null @@ -1,101 +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 <osl/diagnose.h> -#include <unotools/charclass.hxx> -#include <swtypes.hxx> -#include <swlbox.hxx> - -// Description: ListboxElement -SwBoxEntry::SwBoxEntry() -{ -} - -SwBoxEntry::SwBoxEntry(const OUString& aNam) : - aName(aNam) -{ -} - -SwBoxEntry::SwBoxEntry(const SwBoxEntry& rOld) : - aName(rOld.aName) -{ -} - -SwComboBox::SwComboBox(vcl::Window* pParent, WinBits nStyle) - : ComboBox(pParent, nStyle) -{ - Init(); -} - -void SwComboBox::Init() -{ - // create administration for the resource's Stringlist - sal_Int32 nSize = GetEntryCount(); - for( sal_Int32 i=0; i < nSize; ++i ) - { - m_EntryList.push_back(SwBoxEntry(ComboBox::GetEntry(i))); - } -} - -// Basic class Dtor -SwComboBox::~SwComboBox() -{ -} - -void SwComboBox::InsertSwEntry(const SwBoxEntry& rEntry) -{ - InsertSorted(rEntry); -} - -sal_Int32 SwComboBox::InsertEntry(const OUString& rStr, sal_Int32) -{ - InsertSwEntry(SwBoxEntry(rStr)); - return 0; -} - -void SwComboBox::RemoveEntryAt(sal_Int32 const nPos) -{ - if (nPos < 0 || static_cast<size_t>(nPos) >= m_EntryList.size()) - return; - - // Remove old element - ComboBox::RemoveEntryAt(nPos); - - // Don't add new entries to the list - // add to DelEntryList - m_DelEntryList.push_back(m_EntryList[nPos]); - m_EntryList.erase(m_EntryList.begin() + nPos); -} - -const SwBoxEntry& SwComboBox::GetSwEntry(sal_Int32 const nPos) const -{ - if (0 <= nPos && static_cast<size_t>(nPos) < m_EntryList.size()) - return m_EntryList[nPos]; - - return aDefault; -} - -void SwComboBox::InsertSorted(SwBoxEntry const& rEntry) -{ - ComboBox::InsertEntry(rEntry.aName); - sal_Int32 nPos = ComboBox::GetEntryPos(rEntry.aName); - m_EntryList.insert(m_EntryList.begin() + nPos, rEntry); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/bookmark.hxx b/sw/source/uibase/inc/bookmark.hxx index 9d6d471..d1ea987 100644 --- a/sw/source/uibase/inc/bookmark.hxx +++ b/sw/source/uibase/inc/bookmark.hxx @@ -27,7 +27,6 @@ #include <svtools/simptabl.hxx> #include <pam.hxx> -#include "swlbox.hxx" #include "IMark.hxx" class SwWrtShell; diff --git a/sw/source/uibase/inc/cption.hxx b/sw/source/uibase/inc/cption.hxx index 75d664c..0a7e3d3 100644 --- a/sw/source/uibase/inc/cption.hxx +++ b/sw/source/uibase/inc/cption.hxx @@ -20,15 +20,10 @@ #define INCLUDED_SW_SOURCE_UIBASE_INC_CPTION_HXX #include <svx/stddlg.hxx> - #include <vcl/fixed.hxx> - #include <vcl/lstbox.hxx> - #include <vcl/edit.hxx> - #include <vcl/group.hxx> - #include <vcl/button.hxx> #include <actctrl.hxx> @@ -41,12 +36,11 @@ #include <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/container/XNamed.hpp> -class SwFieldMgr; -class SwView; - #include <wrtsh.hxx> #include "optload.hxx" -#include "swlbox.hxx" + +class SwFieldMgr; +class SwView; class TextFilterAutoConvert : public TextFilter { diff --git a/sw/source/uibase/inc/optload.hxx b/sw/source/uibase/inc/optload.hxx index 829008b..ddf8f2a 100644 --- a/sw/source/uibase/inc/optload.hxx +++ b/sw/source/uibase/inc/optload.hxx @@ -29,7 +29,6 @@ #include <svx/strarray.hxx> #include <sfx2/basedlgs.hxx> #include <svx/checklbx.hxx> -#include <swlbox.hxx> #include <caption.hxx> class SwFieldMgr; @@ -80,15 +79,27 @@ public: SwCaptionOptDlg(vcl::Window* pParent, const SfxItemSet& rSet); }; -class CaptionComboBox : public SwComboBox +class CaptionComboBox : public ComboBox { + std::vector<OUString> m_EntryList; + std::vector<OUString> m_DelEntryList; + OUString aDefault; + + void InsertSorted(OUString const& rEntry); + protected: virtual void KeyInput( const KeyEvent& ) override; public: - CaptionComboBox(vcl::Window* pParent, WinBits nStyle) - : SwComboBox(pParent, nStyle) - {} + CaptionComboBox(vcl::Window* pParent, WinBits nStyle); + virtual ~CaptionComboBox() override; + + void InsertSwEntry(const OUString&); + virtual sal_Int32 InsertEntry(const OUString& rStr, sal_Int32 = COMBOBOX_APPEND) override; + + virtual void RemoveEntryAt(sal_Int32 nPos) override; + + const OUString& GetSwEntry(sal_Int32) const; }; class SwCaptionPreview : public vcl::Window diff --git a/sw/source/uibase/inc/swlbox.hxx b/sw/source/uibase/inc/swlbox.hxx deleted file mode 100644 index a8984bb..0000000 --- a/sw/source/uibase/inc/swlbox.hxx +++ /dev/null @@ -1,72 +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 . - */ -#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_SWLBOX_HXX -#define INCLUDED_SW_SOURCE_UIBASE_INC_SWLBOX_HXX - -#include <vcl/lstbox.hxx> -#include <vcl/combobox.hxx> -#include "swdllapi.h" - -#include <vector> - -class SwBoxEntry; -namespace vcl { class Window; } - -typedef std::vector<SwBoxEntry> SwEntryList; - -class SW_DLLPUBLIC SwBoxEntry -{ - friend class SwComboBox; - - OUString aName; - -public: - SwBoxEntry(const OUString& aName); - SwBoxEntry(const SwBoxEntry& rOrg); - SwBoxEntry(); - - const OUString& GetName() const { return aName;} -}; - -// for combo boxes -class SW_DLLPUBLIC SwComboBox : public ComboBox -{ - SwEntryList m_EntryList; - SwEntryList m_DelEntryList; - SwBoxEntry aDefault; - - SAL_DLLPRIVATE void InsertSorted(SwBoxEntry const& rEntry); - SAL_DLLPRIVATE void Init(); - -public: - - SwComboBox(vcl::Window* pParent, WinBits nStyle); - virtual ~SwComboBox() override; - - void InsertSwEntry(const SwBoxEntry&); - virtual sal_Int32 InsertEntry(const OUString& rStr, sal_Int32 = COMBOBOX_APPEND) override; - - virtual void RemoveEntryAt(sal_Int32 nPos) override; - - const SwBoxEntry& GetSwEntry(sal_Int32) const; -}; - -#endif // INCLUDED_SW_SOURCE_UIBASE_INC_SWLBOX_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 0927bdaf6e9aa58fc443f1c011aa1cc53c8d7cad Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Thu Oct 13 16:06:54 2016 +0200 loplugin:mergeclasses merge SvxListBoxControl with SvxUndoRedoControl Change-Id: I5ba9c9d970246d80bb60e27e3b703ec03376c35c diff --git a/compilerplugins/clang/mergeclasses.results b/compilerplugins/clang/mergeclasses.results index 47a802b..d630db1 100644 --- a/compilerplugins/clang/mergeclasses.results +++ b/compilerplugins/clang/mergeclasses.results @@ -145,7 +145,6 @@ merge SvXMLExportItemMapper with SwXMLTableItemMapper_Impl merge SvXMLImportItemMapper with SwXMLImportTableItemMapper_Impl merge SvXMLItemSetContext with SwXMLItemSetContext_Impl merge SvxCSS1Parser with SwCSS1Parser -merge SvxListBoxControl with SvxUndoRedoControl merge SvxRTFParser with EditRTFParser merge SvxShapeMaster with SdXShape merge SwAccessibleFrame with SwAccessibleContext diff --git a/include/svx/lboxctrl.hxx b/include/svx/lboxctrl.hxx index 44cc61f..eaa9a2f 100644 --- a/include/svx/lboxctrl.hxx +++ b/include/svx/lboxctrl.hxx @@ -29,11 +29,12 @@ class ToolBox; class SvxPopupWindowListBox; -class SvxListBoxControl : public SfxToolBoxControl +class SVX_DLLPUBLIC SvxUndoRedoControl : public SfxToolBoxControl { -protected: OUString aActionStr; VclPtr<SvxPopupWindowListBox> pPopupWin; + std::vector< OUString > aUndoRedoList; + OUString aDefaultTooltip; void Impl_SetInfo( sal_Int32 nCount ); @@ -41,27 +42,11 @@ protected: DECL_LINK( SelectHdl, ListBox&, void ); public: - SvxListBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); - virtual ~SvxListBoxControl() override; - - virtual VclPtr<SfxPopupWindow> CreatePopupWindow() override; - virtual void StateChanged( sal_uInt16 nSID, - SfxItemState eState, - const SfxPoolItem* pState ) override; -}; - - -class SVX_DLLPUBLIC SvxUndoRedoControl : public SvxListBoxControl -{ - std::vector< OUString > aUndoRedoList; - OUString aDefaultTooltip; - -public: SFX_DECL_TOOLBOX_CONTROL(); SvxUndoRedoControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); - virtual ~SvxUndoRedoControl() override; + virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override; diff --git a/svx/source/tbxctrls/lboxctrl.cxx b/svx/source/tbxctrls/lboxctrl.cxx index 1aab1bf..3c1c504 100644 --- a/svx/source/tbxctrls/lboxctrl.cxx +++ b/svx/source/tbxctrls/lboxctrl.cxx @@ -121,34 +121,7 @@ void SvxPopupWindowListBox::statusChanged( const css::frame::FeatureStateEvent& SfxPopupWindow::statusChanged( rEvent ); } -SvxListBoxControl::SvxListBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) - :SfxToolBoxControl( nSlotId, nId, rTbx ), - pPopupWin ( nullptr ) -{ - rTbx.SetItemBits( nId, ToolBoxItemBits::DROPDOWN | rTbx.GetItemBits( nId ) ); - rTbx.Invalidate(); -} - - -SvxListBoxControl::~SvxListBoxControl() -{} - -VclPtr<SfxPopupWindow> SvxListBoxControl::CreatePopupWindow() -{ - OSL_FAIL( "not implemented" ); - return nullptr; -} - - -void SvxListBoxControl::StateChanged( - sal_uInt16, SfxItemState, const SfxPoolItem* pState ) -{ - GetToolBox().EnableItem( GetId(), - SfxItemState::DISABLED != GetItemState(pState) ); -} - - -IMPL_LINK_NOARG(SvxListBoxControl, PopupModeEndHdl, FloatingWindow*, void) +IMPL_LINK_NOARG(SvxUndoRedoControl, PopupModeEndHdl, FloatingWindow*, void) { if( pPopupWin && FloatWinPopupFlags::NONE == pPopupWin->GetPopupModeFlags() && pPopupWin->IsUserSelected() ) @@ -165,7 +138,7 @@ IMPL_LINK_NOARG(SvxListBoxControl, PopupModeEndHdl, FloatingWindow*, void) } -void SvxListBoxControl::Impl_SetInfo( sal_Int32 nCount ) +void SvxUndoRedoControl::Impl_SetInfo( sal_Int32 nCount ) { DBG_ASSERT( pPopupWin, "NULL pointer, PopupWindow missing" ); @@ -184,7 +157,7 @@ void SvxListBoxControl::Impl_SetInfo( sal_Int32 nCount ) } -IMPL_LINK_NOARG(SvxListBoxControl, SelectHdl, ListBox&, void) +IMPL_LINK_NOARG(SvxUndoRedoControl, SelectHdl, ListBox&, void) { if (pPopupWin) { @@ -205,7 +178,8 @@ IMPL_LINK_NOARG(SvxListBoxControl, SelectHdl, ListBox&, void) SFX_IMPL_TOOLBOX_CONTROL( SvxUndoRedoControl, SfxStringItem ); SvxUndoRedoControl::SvxUndoRedoControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) - : SvxListBoxControl( nSlotId, nId, rTbx ) + :SfxToolBoxControl( nSlotId, nId, rTbx ), + pPopupWin ( nullptr ) { rTbx.SetItemBits( nId, ToolBoxItemBits::DROPDOWN | rTbx.GetItemBits( nId ) ); rTbx.Invalidate(); @@ -233,7 +207,8 @@ void SvxUndoRedoControl::StateChanged( const OUString& aQuickHelpText = rItem.GetValue(); rBox.SetQuickHelpText( GetId(), aQuickHelpText ); } - SvxListBoxControl::StateChanged( nSID, eState, pState ); + GetToolBox().EnableItem( GetId(), + SfxItemState::DISABLED != GetItemState(pState) ); } else { commit 6bdfb757338118778b622b401d16606cf96caca6 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Thu Oct 13 15:31:05 2016 +0200 loplugin:mergeclasses merge svx::ISlotInvalidator with svx::FmTextControlShell Change-Id: I828ef52bc093d3fa2946f813a2dd09ac6b34e94c diff --git a/compilerplugins/clang/mergeclasses.results b/compilerplugins/clang/mergeclasses.results index 75c033b..47a802b 100644 --- a/compilerplugins/clang/mergeclasses.results +++ b/compilerplugins/clang/mergeclasses.results @@ -351,7 +351,6 @@ merge svx::IContextRequestObserver with svx::FmTextControlShell merge svx::IControllerFeatureInvalidation with FmXFormShell merge svx::IFocusObserver with svx::FmTextControlShell merge svx::IPropertyValueProvider with svx::PropertyValueProvider -merge svx::ISlotInvalidator with svx::FmTextControlShell merge svx::RegistrationItemSetHolder with svx::DatabaseRegistrationDialog merge svx::sidebar::SvxShapeCommandsMap with svx::sidebar::DefaultShapesPanel merge svxform::(anonymous namespace)::IScript with svxform::(anonymous namespace)::NewStyleUNOScript diff --git a/svx/source/form/fmtextcontrolfeature.cxx b/svx/source/form/fmtextcontrolfeature.cxx index 75ff575..feea005 100644 --- a/svx/source/form/fmtextcontrolfeature.cxx +++ b/svx/source/form/fmtextcontrolfeature.cxx @@ -18,6 +18,7 @@ */ #include "fmtextcontrolfeature.hxx" +#include "fmtextcontrolshell.hxx" #include <osl/diagnose.h> @@ -31,7 +32,7 @@ namespace svx using namespace ::com::sun::star::beans; using namespace ::com::sun::star::util; - FmTextControlFeature::FmTextControlFeature( const Reference< XDispatch >& _rxDispatcher, const URL& _rFeatureURL, SfxSlotId _nSlotId, ISlotInvalidator* _pInvalidator ) + FmTextControlFeature::FmTextControlFeature( const Reference< XDispatch >& _rxDispatcher, const URL& _rFeatureURL, SfxSlotId _nSlotId, FmTextControlShell* _pInvalidator ) :m_xDispatcher ( _rxDispatcher ) ,m_aFeatureURL ( _rFeatureURL ) ,m_nSlotId ( _nSlotId ) diff --git a/svx/source/inc/fmslotinvalidator.hxx b/svx/source/inc/fmslotinvalidator.hxx index 783e726..024c4b8 100644 --- a/svx/source/inc/fmslotinvalidator.hxx +++ b/svx/source/inc/fmslotinvalidator.hxx @@ -23,15 +23,6 @@ namespace svx { typedef sal_uInt16 SfxSlotId; - - class ISlotInvalidator - { - public: - virtual void Invalidate( SfxSlotId _nSlot ) = 0; - - protected: - ~ISlotInvalidator() {} - }; } #endif // INCLUDED_SVX_SOURCE_INC_FMSLOTINVALIDATOR_HXX diff --git a/svx/source/inc/fmtextcontrolfeature.hxx b/svx/source/inc/fmtextcontrolfeature.hxx index 6c208f6..a0d465c4 100644 --- a/svx/source/inc/fmtextcontrolfeature.hxx +++ b/svx/source/inc/fmtextcontrolfeature.hxx @@ -30,6 +30,7 @@ namespace svx { + class FmTextControlShell; typedef ::cppu::WeakImplHelper < css::frame::XStatusListener > FmTextControlFeature_Base; @@ -42,7 +43,7 @@ namespace svx css::util::URL m_aFeatureURL; css::uno::Any m_aFeatureState; SfxSlotId m_nSlotId; - ISlotInvalidator* m_pInvalidator; + FmTextControlShell* m_pInvalidator; bool m_bFeatureEnabled; public: @@ -56,7 +57,7 @@ namespace svx const css::uno::Reference< css::frame::XDispatch >& _rxDispatcher, const css::util::URL& _rFeatureURL, SfxSlotId _nId, - ISlotInvalidator* _pInvalidator + FmTextControlShell* _pInvalidator ); /// determines whether the feature we're responsible for is currently enabled diff --git a/svx/source/inc/fmtextcontrolshell.hxx b/svx/source/inc/fmtextcontrolshell.hxx index 9b8801e..6a7fccb 100644 --- a/svx/source/inc/fmtextcontrolshell.hxx +++ b/svx/source/inc/fmtextcontrolshell.hxx @@ -74,7 +74,6 @@ namespace svx }; class FmTextControlShell :public IFocusObserver - ,public ISlotInvalidator ,public IContextRequestObserver { private: @@ -136,6 +135,8 @@ namespace svx */ void designModeChanged( bool _bNewDesignMode ); + void Invalidate( SfxSlotId _nSlot ); + protected: // IFocusObserver virtual void focusGained( const css::awt::FocusEvent& _rEvent ) override; @@ -144,10 +145,6 @@ namespace svx // IContextRequestObserver virtual void contextMenuRequested( const css::awt::MouseEvent& _rEvent ) override; - // ISlotInvalidator - virtual void Invalidate( SfxSlotId _nSlot ) override; - - protected: enum AttributeSet { eCharAttribs, eParaAttribs }; void executeAttributeDialog( AttributeSet _eSet, SfxRequest& _rReq ); void executeSelectAll( ); commit 2a504a24e4af5eb79bbd15773d27baedd30bdd8e Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Thu Oct 13 15:08:52 2016 +0200 loplugin:mergeclasse merge ScCbWarningBox with ScReplaceWarnBo Change-Id: I7b55b036c1992b88b01b51053a3560e9f97986c9 diff --git a/compilerplugins/clang/mergeclasses.results b/compilerplugins/clang/mergeclasses.results index 428bd40..75c033b 100644 --- a/compilerplugins/clang/mergeclasses.results +++ b/compilerplugins/clang/mergeclasses.results @@ -92,7 +92,6 @@ merge SalPrinter with PspSalPrinter merge SalSession with (anonymous namespace)::IceSalSession merge SalSystem with SalGenericSystem merge ScBiffReader with ScQProReader -merge ScCbWarningBox with ScReplaceWarnBox merge ScDBFunc with ScTabViewShell merge ScDPCache::DBConnector with (anonymous namespace)::DBConnector merge ScDocFunc with ScDocFuncDirect diff --git a/sc/source/ui/inc/warnbox.hxx b/sc/source/ui/inc/warnbox.hxx index d8a49cf..c211a46 100644 --- a/sc/source/ui/inc/warnbox.hxx +++ b/sc/source/ui/inc/warnbox.hxx @@ -22,34 +22,17 @@ #include <vcl/msgbox.hxx> -/** Message box with warning image and "Do not show again" checkbox. */ -class ScCbWarningBox : public WarningBox +/** Warning box for "Replace cell contents?". + With warning image and "Do not show again" checkbox. */ +class ScReplaceWarnBox : public WarningBox { public: - /** @param rMsgStr Resource ID for the message text. */ - ScCbWarningBox( vcl::Window* pParent, const OUString& rMsgStr ); + ScReplaceWarnBox( vcl::Window* pParent ); /** Opens dialog if IsDialogEnabled() returns true. @descr If after executing the dialog the checkbox "Do not show again" is set, the method DisableDialog() will be called. */ virtual sal_Int16 Execute() override; - - /** Called before executing the dialog. If this method returns false, the dialog will not be opened. */ - virtual bool IsDialogEnabled(); - /** Called, when dialog is exited and the option "Do not show again" is set. */ - virtual void DisableDialog(); -}; - -/** Warning box for "Replace cell contents?". */ -class ScReplaceWarnBox : public ScCbWarningBox -{ -public: - ScReplaceWarnBox( vcl::Window* pParent ); - - /** Reads the configuration key "ReplaceCellsWarning". */ - virtual bool IsDialogEnabled() override; - /** Sets the configuration key "ReplaceCellsWarning" to false. */ - virtual void DisableDialog() override; }; #endif diff --git a/sc/source/ui/miscdlgs/warnbox.cxx b/sc/source/ui/miscdlgs/warnbox.cxx index 8d50049..da64e32 100644 --- a/sc/source/ui/miscdlgs/warnbox.cxx +++ b/sc/source/ui/miscdlgs/warnbox.cxx @@ -24,53 +24,31 @@ #include "scresid.hxx" #include "sc.hrc" -ScCbWarningBox::ScCbWarningBox( vcl::Window* pParent, const OUString& rMsgStr ) : - WarningBox( pParent, WB_YES_NO | WB_DEF_YES, rMsgStr ) +ScReplaceWarnBox::ScReplaceWarnBox( vcl::Window* pParent ) : + WarningBox( pParent, WB_YES_NO | WB_DEF_YES, OUString( ScResId( STR_REPLCELLSWARN ) ) ) { // By default, the check box is ON, and the user needs to un-check it to // disable all future warnings. SetCheckBoxState(true); SetCheckBoxText(ScResId(SCSTR_WARN_ME_IN_FUTURE_CHECK)); + SetHelpId( HID_SC_REPLCELLSWARN ); } -sal_Int16 ScCbWarningBox::Execute() +sal_Int16 ScReplaceWarnBox::Execute() { - sal_Int16 nRet = (GetStyle() & WB_DEF_YES) ? RET_YES : RET_NO; - if( IsDialogEnabled() ) + sal_Int16 nRet = RET_YES; + if( (bool) SC_MOD()->GetInputOptions().GetReplaceCellsWarn() ) { nRet = WarningBox::Execute(); if (!GetCheckBoxState()) - DisableDialog(); + { + ScModule* pScMod = SC_MOD(); + ScInputOptions aInputOpt( pScMod->GetInputOptions() ); + aInputOpt.SetReplaceCellsWarn( false ); + pScMod->SetInputOptions( aInputOpt ); + } } return nRet; } -bool ScCbWarningBox::IsDialogEnabled() -{ - return true; -} - -void ScCbWarningBox::DisableDialog() -{ -} - -ScReplaceWarnBox::ScReplaceWarnBox( vcl::Window* pParent ) : - ScCbWarningBox( pParent, OUString( ScResId( STR_REPLCELLSWARN ) ) ) -{ - SetHelpId( HID_SC_REPLCELLSWARN ); -} - -bool ScReplaceWarnBox::IsDialogEnabled() -{ - return (bool) SC_MOD()->GetInputOptions().GetReplaceCellsWarn(); -} - -void ScReplaceWarnBox::DisableDialog() -{ - ScModule* pScMod = SC_MOD(); - ScInputOptions aInputOpt( pScMod->GetInputOptions() ); - aInputOpt.SetReplaceCellsWarn( false ); - pScMod->SetInputOptions( aInputOpt ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits