drop unused SfxSpellCheckItem
last getter went with
commit 215207f480258b37864a88e1b831055e148adf65
Date: Thu Mar 6 16:42:24 2014 +0000
coverity#708784 Unused pointer value
don't put the item in any item sets anymore.
delete SID_ATTR_SPELL and adjust SfxItemSet ranges.
narrow ranges in OfaTreeOptionsDialog::CreateItemSet to actually
used items.
Change-Id: Ia5cc91fc62a0fccf87b2fd380e6bb2bef1f6f3e7
Reviewed-on: https://gerrit.libreoffice.org/41335
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index fc6d808..1939e2c 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -488,14 +488,7 @@ IMPL_LINK( SpellDialog, CheckGrammarHdl, Button*, pBox, void )
void SpellDialog::StartSpellOptDlg_Impl()
{
sal_uInt16 const aSpellInfos[] =
{
SID_ATTR_SPELL,SID_ATTR_SPELL,
SID_AUTOSPELL_CHECK, SID_AUTOSPELL_CHECK,
0
};
SfxItemSet aSet( SfxGetpApp()->GetPool(), aSpellInfos);
aSet.Put(SfxSpellCheckItem( xSpell, SID_ATTR_SPELL ));
SfxItemSet aSet( SfxGetpApp()->GetPool(), svl::Items<SID_AUTOSPELL_CHECK,SID_AUTOSPELL_CHECK>{});
VclPtr<SfxSingleTabDialog> pDlg(
VclPtr<SfxSingleTabDialog>::Create(this, aSet, "SpellOptionsDialog", "cui/ui/spelloptionsdialog.ui"));
VclPtr<SfxTabPage> pPage = SvxLinguTabPage::Create( pDlg->get_content_area(), &aSet );
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 6efd3ae..0cdfcbd 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -1103,7 +1103,7 @@ std::unique_ptr<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId
SfxGetpApp()->GetPool(),
svl::Items<
SID_HTML_MODE, SID_HTML_MODE,
SID_ATTR_METRIC, SID_ATTR_SPELL,
SID_ATTR_METRIC, SID_ATTR_METRIC,
SID_AUTOSPELL_CHECK, SID_AUTOSPELL_CHECK,
SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER,
SID_ATTR_YEAR2000, SID_ATTR_YEAR2000>{} );
@@ -1143,15 +1143,14 @@ std::unique_ptr<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId
pRet = o3tl::make_unique<SfxItemSet>(
SfxGetpApp()->GetPool(),
svl::Items<
SID_ATTR_CHAR_CJK_LANGUAGE, SID_ATTR_CHAR_CTL_LANGUAGE,
SID_ATTR_CHAR_CJK_LANGUAGE, SID_ATTR_CHAR_CJK_LANGUAGE,
SID_ATTR_CHAR_CTL_LANGUAGE, SID_ATTR_CHAR_CTL_LANGUAGE,
SID_SET_DOCUMENT_LANGUAGE, SID_SET_DOCUMENT_LANGUAGE,
SID_ATTR_LANGUAGE, SID_AUTOSPELL_CHECK,
SID_ATTR_LANGUAGE, SID_ATTR_LANGUAGE,
SID_AUTOSPELL_CHECK, SID_AUTOSPELL_CHECK,
SID_OPT_LOCALE_CHANGED, SID_OPT_LOCALE_CHANGED>{});
// for linguistic
Reference< XSpellChecker1 > xSpell = LinguMgr::GetSpellChecker();
pRet->Put(SfxSpellCheckItem( xSpell, SID_ATTR_SPELL ));
SfxHyphenRegionItem aHyphen( SID_ATTR_HYPHENREGION );
sal_Int16 nMinLead = 2,
diff --git a/editeng/source/items/optitems.cxx b/editeng/source/items/optitems.cxx
index 913bb67..fea69e0 100644
--- a/editeng/source/items/optitems.cxx
+++ b/editeng/source/items/optitems.cxx
@@ -17,62 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <tools/stream.hxx>
#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
#include <editeng/optitems.hxx>
#include <editeng/eerdll.hxx>
#include <editeng/editrids.hrc>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::linguistic2;
// class SfxSpellCheckItem -----------------------------------------------
SfxSpellCheckItem::SfxSpellCheckItem
(
Reference< XSpellChecker1 > const &xChecker,
sal_uInt16 _nWhich
) :
SfxPoolItem( _nWhich )
{
xSpellCheck = xChecker;
}
SfxSpellCheckItem::SfxSpellCheckItem( const SfxSpellCheckItem& rItem ) :
SfxPoolItem( rItem ),
xSpellCheck( rItem.GetXSpellChecker() )
{
}
bool SfxSpellCheckItem::GetPresentation
(
SfxItemPresentation ,
MapUnit ,
MapUnit ,
OUString& ,
const IntlWrapper&
) const
{
return true;
}
SfxPoolItem* SfxSpellCheckItem::Clone( SfxItemPool* ) const
{
return new SfxSpellCheckItem( *this );
}
bool SfxSpellCheckItem::operator==( const SfxPoolItem& rItem ) const
{
assert(SfxPoolItem::operator==(rItem));
return ( xSpellCheck == static_cast<const SfxSpellCheckItem&>( rItem ).GetXSpellChecker() );
}
// class SfxHyphenRegionItem -----------------------------------------------
diff --git a/include/editeng/optitems.hxx b/include/editeng/optitems.hxx
index 7d9dbef..2ecf91e 100644
--- a/include/editeng/optitems.hxx
+++ b/include/editeng/optitems.hxx
@@ -20,42 +20,8 @@
#define INCLUDED_EDITENG_OPTITEMS_HXX
#include <svl/poolitem.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include <editeng/editengdllapi.h>
// forward ---------------------------------------------------------------
namespace com { namespace sun { namespace star {
namespace linguistic2{
class XSpellChecker1;
}}}}
// class SfxSpellCheckItem -----------------------------------------------
class EDITENG_DLLPUBLIC SfxSpellCheckItem: public SfxPoolItem
{
public:
SfxSpellCheckItem( css::uno::Reference<
css::linguistic2::XSpellChecker1 > const &xChecker,
sal_uInt16 nWhich );
SfxSpellCheckItem( const SfxSpellCheckItem& rItem );
virtual bool GetPresentation( SfxItemPresentation ePres,
MapUnit eCoreMetric,
MapUnit ePresMetric,
OUString &rText, const IntlWrapper& ) const override;
virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override;
virtual bool operator==( const SfxPoolItem& ) const override;
const css::uno::Reference< css::linguistic2::XSpellChecker1 >&
GetXSpellChecker() const { return xSpellCheck; }
private:
css::uno::Reference< css::linguistic2::XSpellChecker1 > xSpellCheck;
};
// class SfxHyphenRegionItem ---------------------------------------------
diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index ea38db1..6fdd02c 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -476,7 +476,6 @@
// LinguTabPage
#define SID_ATTR_LANGUAGE (SID_OPTIONS_START + 7)
#define SID_ATTR_SPELL (SID_OPTIONS_START + 9)
#define SID_ATTR_HYPHENREGION (SID_OPTIONS_START + 12)
#define SID_AUTOSPELL_CHECK (SID_OPTIONS_START + 21)