summaryrefslogtreecommitdiff
path: root/svx/source/sidebar
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-08-19 09:31:35 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-08-19 11:25:18 +0000
commit396138a6bc7192abe0837b419283860d3331f607 (patch)
treef80818ba86220abb8db205b402429e3d45aa62d1 /svx/source/sidebar
parent8b4705e0e0c76503b1ca61cb567d222f49466fc5 (diff)
Resolves: coverity#705366 Mixing enum types
and coverity#705367 Mixing enum types coverity#705371 Mixing enum types coverity#982694 Mixing enum types coverity#1027717 Mixing enum types coverity#1371228 Mixing enum types coverity#1371242 Mixing enum types coverity#1371280 Mixing enum types coverity#1371310 Mixing enum types MapUnit and SfxMapUnit share the same values and are freely cast from one to the other. Now that commit d30a4298bdb5ba53cd1fe659f2b742f218a2e527 Date: Thu Aug 11 15:02:19 2016 +0200 loplugin:unusedenumconstants in package..svtools removed the SfxMapUnit entries that were directly unused, they don't match anymore and casting from one to the other is dangerous. Why there was two of these anyway escapes me, get rid of SfxMapUnit and just use MapUnit universally Change-Id: I4db5dcd04b59be2f85b62b728f96c90afe00c57e Reviewed-on: https://gerrit.libreoffice.org/28234 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx/source/sidebar')
-rw-r--r--svx/source/sidebar/line/LinePropertyPanelBase.cxx4
-rw-r--r--svx/source/sidebar/line/LineWidthPopup.cxx4
-rw-r--r--svx/source/sidebar/nbdtmg.cxx8
-rw-r--r--svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx6
-rw-r--r--svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx2
-rw-r--r--svx/source/sidebar/paragraph/ParaPropertyPanel.cxx24
-rw-r--r--svx/source/sidebar/paragraph/ParaPropertyPanel.hxx4
-rw-r--r--svx/source/sidebar/paragraph/ParaSpacingWindow.cxx4
-rw-r--r--svx/source/sidebar/paragraph/ParaSpacingWindow.hxx4
-rw-r--r--svx/source/sidebar/possize/PosSizePropertyPanel.hxx2
-rw-r--r--svx/source/sidebar/text/TextCharacterSpacingControl.cxx6
-rw-r--r--svx/source/sidebar/text/TextCharacterSpacingControl.hxx2
12 files changed, 35 insertions, 35 deletions
diff --git a/svx/source/sidebar/line/LinePropertyPanelBase.cxx b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
index b433529ac16d..fb197524517b 100644
--- a/svx/source/sidebar/line/LinePropertyPanelBase.cxx
+++ b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
@@ -167,7 +167,7 @@ LinePropertyPanelBase::LinePropertyPanelBase(
mpStyleItem(),
mpDashItem(),
mnTrans(0),
- meMapUnit(SFX_MAPUNIT_MM),
+ meMapUnit(MAP_MM),
mnWidthCoreValue(0),
mpStartItem(),
mpEndItem(),
@@ -905,7 +905,7 @@ void LinePropertyPanelBase::ActivateControls()
mpLBEnd->Enable( bLineStyle && mbArrowSupported );
}
-void LinePropertyPanelBase::setMapUnit(SfxMapUnit eMapUnit)
+void LinePropertyPanelBase::setMapUnit(MapUnit eMapUnit)
{
meMapUnit = eMapUnit;
}
diff --git a/svx/source/sidebar/line/LineWidthPopup.cxx b/svx/source/sidebar/line/LineWidthPopup.cxx
index 9112eb8d0473..1bc93919e2a4 100644
--- a/svx/source/sidebar/line/LineWidthPopup.cxx
+++ b/svx/source/sidebar/line/LineWidthPopup.cxx
@@ -32,7 +32,7 @@ LineWidthPopup::LineWidthPopup(LinePropertyPanelBase& rParent)
, m_rParent(rParent)
, m_pStr(nullptr)
, m_sPt(SVX_RESSTR(RID_SVXSTR_PT))
- , m_eMapUnit(SFX_MAPUNIT_TWIP)
+ , m_eMapUnit(MAP_TWIP)
, m_bVSFocus(true)
, m_bCustom(false)
, m_bCloseByEdit(false)
@@ -174,7 +174,7 @@ IMPL_LINK_TYPED(LineWidthPopup, MFModifyHdl, Edit&, /*rControl*/, void)
m_nTmpCustomWidth = nTmp;
}
-void LineWidthPopup::SetWidthSelect(long lValue, bool bValuable, SfxMapUnit eMapUnit)
+void LineWidthPopup::SetWidthSelect(long lValue, bool bValuable, MapUnit eMapUnit)
{
m_bVSFocus = true;
m_xVSWidth->SetSelItem(0);
diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx
index 04bb93c85325..11b957d2835f 100644
--- a/svx/source/sidebar/nbdtmg.cxx
+++ b/svx/source/sidebar/nbdtmg.cxx
@@ -154,8 +154,8 @@ void NBOTypeMgrBase::StoreBulCharFmtName_impl() {
void NBOTypeMgrBase::ImplLoad(const OUString& filename)
{
bIsLoading = true;
- SfxMapUnit eOldCoreUnit=eCoreUnit;
- eCoreUnit = SFX_MAPUNIT_100TH_MM;
+ MapUnit eOldCoreUnit=eCoreUnit;
+ eCoreUnit = MAP_100TH_MM;
INetURLObject aFile( SvtPathOptions().GetUserConfigPath() );
aFile.Append( filename);
std::unique_ptr<SvStream> xIStm(::utl::UcbStreamHelper::CreateStream( aFile.GetMainURL( INetURLObject::NO_DECODE ), StreamMode::READ ));
@@ -193,8 +193,8 @@ void NBOTypeMgrBase::ImplLoad(const OUString& filename)
void NBOTypeMgrBase::ImplStore(const OUString& filename)
{
if (bIsLoading) return;
- SfxMapUnit eOldCoreUnit=eCoreUnit;
- eCoreUnit = SFX_MAPUNIT_100TH_MM;
+ MapUnit eOldCoreUnit=eCoreUnit;
+ eCoreUnit = MAP_100TH_MM;
INetURLObject aFile( SvtPathOptions().GetUserConfigPath() );
aFile.Append( filename);
std::unique_ptr<SvStream> xOStm(::utl::UcbStreamHelper::CreateStream( aFile.GetMainURL( INetURLObject::NO_DECODE ), StreamMode::WRITE ));
diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
index 17bdd7e206de..6887e95d3e86 100644
--- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
+++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
@@ -62,7 +62,7 @@ ParaLineSpacingControl::ParaLineSpacingControl(sal_uInt16 nId)
mpActLineDistFld = mpLineDistAtPercentBox.get();
- meLNSpaceUnit = SFX_MAPUNIT_100TH_MM;
+ meLNSpaceUnit = MAP_100TH_MM;
Link<Button*,void> aLink = LINK(this, ParaLineSpacingControl, PredefinedValuesHandler);
mpSpacing1Button->SetClickHdl(aLink);
@@ -120,7 +120,7 @@ void ParaLineSpacingControl::Initialize()
if( eState >= SfxItemState::DEFAULT )
{
- SfxMapUnit eUnit = SFX_MAPUNIT_100TH_MM;
+ MapUnit eUnit = MAP_100TH_MM;
meLNSpaceUnit = eUnit;
switch( currSPItem->GetLineSpaceRule() )
@@ -309,7 +309,7 @@ void ParaLineSpacingControl::UpdateMetricFields()
mpLineDistAtMetricBox->SetMin(mpLineDistAtMetricBox->Normalize(MIN_FIXED_DISTANCE), FUNIT_TWIP);
if (mpLineDistAtMetricBox->GetValue() != nTemp)
- SetMetricValue(*mpLineDistAtMetricBox, FIX_DIST_DEF, SFX_MAPUNIT_TWIP);
+ SetMetricValue(*mpLineDistAtMetricBox, FIX_DIST_DEF, MAP_TWIP);
mpLineDistLabel->Enable();
mpActLineDistFld->Show();
diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx
index 1d27c40c69d1..c804cc92ea2f 100644
--- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx
+++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx
@@ -35,7 +35,7 @@ public:
virtual void dispose() override;
private:
- SfxMapUnit meLNSpaceUnit;
+ MapUnit meLNSpaceUnit;
VclPtr<Edit> mpActLineDistFld;
diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
index 98fb676e0f0f..b6b8c6f6ef6f 100644
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
@@ -225,7 +225,7 @@ IMPL_LINK_TYPED(ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl, ToolBox *, pCont
SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
maTxtLeft += INDENT_STEP;
- sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
+ sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(MAP_TWIP), MAP_100TH_MM );
nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
aMargin.SetTextLeft( (const long)nVal );
aMargin.SetRight( (const long)GetCoreValue( *mpRightIndent, m_eLRSpaceUnit ) );
@@ -258,7 +258,7 @@ IMPL_LINK_TYPED(ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl, ToolBox *, pCont
SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
- sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
+ sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(MAP_TWIP), MAP_100TH_MM );
nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
aMargin.SetTextLeft( (const long)nVal );
@@ -370,17 +370,17 @@ void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 /*nSID*/, SfxItemStat
const SvxLRSpaceItem* pSpace = static_cast<const SvxLRSpaceItem*>(pState);
maTxtLeft = pSpace->GetTextLeft();
maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM );
- maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
+ maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, MAP_100TH_MM, (MapUnit)(MAP_TWIP) );
long aTxtRight = pSpace->GetRight();
aTxtRight = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM );
- aTxtRight = OutputDevice::LogicToLogic( aTxtRight, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
+ aTxtRight = OutputDevice::LogicToLogic( aTxtRight, MAP_100TH_MM, (MapUnit)(MAP_TWIP) );
long aTxtFirstLineOfst = pSpace->GetTextFirstLineOfst();
aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM );
- aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
+ aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, MAP_100TH_MM, (MapUnit)(MAP_TWIP) );
- long nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
+ long nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(MAP_TWIP), MAP_100TH_MM );
nVal = (long)mpLeftIndent->Normalize( (long)nVal );
if ( maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Text)
@@ -390,7 +390,7 @@ void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 /*nSID*/, SfxItemStat
mpFLineIndent->SetMin( nVal*(-1), FUNIT_100TH_MM );
}
- long nrVal = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
+ long nrVal = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)(MAP_TWIP), MAP_100TH_MM );
nrVal = (long)mpRightIndent->Normalize( (long)nrVal );
switch (maContext.GetCombinedContext_DI())
@@ -421,7 +421,7 @@ void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 /*nSID*/, SfxItemStat
mpLeftIndent->SetValue( nVal, FUNIT_100TH_MM );
mpRightIndent->SetValue( nrVal, FUNIT_100TH_MM );
- long nfVal = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
+ long nfVal = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)(MAP_TWIP), MAP_100TH_MM );
nfVal = (long)mpFLineIndent->Normalize( (long)nfVal );
mpFLineIndent->SetValue( nfVal, FUNIT_100TH_MM );
@@ -476,17 +476,17 @@ void ParaPropertyPanel::StateChangedULImpl( sal_uInt16 /*nSID*/, SfxItemState eS
maUpper = pOldItem->GetUpper();
maUpper = OutputDevice::LogicToLogic( maUpper, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM );
- maUpper = OutputDevice::LogicToLogic( maUpper, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
+ maUpper = OutputDevice::LogicToLogic( maUpper, MAP_100TH_MM, (MapUnit)(MAP_TWIP) );
maLower = pOldItem->GetLower();
maLower = OutputDevice::LogicToLogic( maLower, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM );
- maLower = OutputDevice::LogicToLogic( maLower, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
+ maLower = OutputDevice::LogicToLogic( maLower, MAP_100TH_MM, (MapUnit)(MAP_TWIP) );
- sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
+ sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(MAP_TWIP), MAP_100TH_MM );
nVal = mpTopDist->Normalize( nVal );
mpTopDist->SetValue( nVal, FUNIT_100TH_MM );
- nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
+ nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(MAP_TWIP), MAP_100TH_MM );
nVal = mpBottomDist->Normalize( nVal );
mpBottomDist->SetValue( nVal, FUNIT_100TH_MM );
}
diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
index 4b204749efd3..90411f4e913b 100644
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
@@ -98,8 +98,8 @@ private:
FieldUnit m_eMetricUnit;
FieldUnit m_last_eMetricUnit;
- SfxMapUnit m_eLRSpaceUnit;
- SfxMapUnit m_eULSpaceUnit;
+ MapUnit m_eLRSpaceUnit;
+ MapUnit m_eULSpaceUnit;
// Control Items
::sfx2::sidebar::ControllerItem maLRSpaceControl;
::sfx2::sidebar::ControllerItem maULSpaceControl;
diff --git a/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx b/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx
index f26b59673df3..c534d4c13640 100644
--- a/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx
+++ b/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx
@@ -36,7 +36,7 @@ using namespace svx;
ParaULSpacingWindow::ParaULSpacingWindow(vcl::Window* pParent, css::uno::Reference<css::frame::XFrame>& xFrame)
: VclVBox(pParent)
- , m_eUnit(SFX_MAPUNIT_TWIP)
+ , m_eUnit(MAP_TWIP)
{
m_pUIBuilder = new VclBuilder(this, getUIRootDir(),
"svx/ui/paraulspacing.ui",
@@ -105,7 +105,7 @@ IMPL_LINK_NOARG_TYPED(ParaULSpacingWindow, ModifySpacingHdl, Edit&, void)
ParaLRSpacingWindow::ParaLRSpacingWindow(vcl::Window* pParent, css::uno::Reference<css::frame::XFrame>& xFrame)
: VclVBox(pParent)
- , m_eUnit(SFX_MAPUNIT_TWIP)
+ , m_eUnit(MAP_TWIP)
{
m_pUIBuilder = new VclBuilder(this, getUIRootDir(),
"svx/ui/paralrspacing.ui",
diff --git a/svx/source/sidebar/paragraph/ParaSpacingWindow.hxx b/svx/source/sidebar/paragraph/ParaSpacingWindow.hxx
index 61ccfca53445..d0a16d5701b9 100644
--- a/svx/source/sidebar/paragraph/ParaSpacingWindow.hxx
+++ b/svx/source/sidebar/paragraph/ParaSpacingWindow.hxx
@@ -49,7 +49,7 @@ private:
VclPtr<SvxRelativeField> m_pAboveSpacing;
VclPtr<SvxRelativeField> m_pBelowSpacing;
- SfxMapUnit m_eUnit;
+ MapUnit m_eUnit;
DECL_LINK_TYPED(ModifySpacingHdl, Edit&, void);
};
@@ -71,7 +71,7 @@ private:
VclPtr<SvxRelativeField> m_pAfterSpacing;
VclPtr<SvxRelativeField> m_pFLSpacing;
- SfxMapUnit m_eUnit;
+ MapUnit m_eUnit;
vcl::EnumContext m_aContext;
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
index 755c563d26f7..4aa94750efcc 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
@@ -117,7 +117,7 @@ private:
long mlRotX;
long mlRotY;
Fraction maUIScale;
- SfxMapUnit mePoolUnit;
+ MapUnit mePoolUnit;
FieldUnit meDlgUnit;
// Controller Items
diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
index a3ff10e634f7..30d83e647bf6 100644
--- a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
+++ b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
@@ -125,7 +125,7 @@ void TextCharacterSpacingControl::Initialize()
if(eState >= SfxItemState::DEFAULT)
{
- SfxMapUnit eUnit = GetCoreMetric();
+ MapUnit eUnit = GetCoreMetric();
MapUnit eOrgUnit = (MapUnit)eUnit;
MapUnit ePntUnit(MAP_POINT);
long nBig = maEditKerning->Normalize(nKerning);
@@ -146,7 +146,7 @@ void TextCharacterSpacingControl::Initialize()
void TextCharacterSpacingControl::ExecuteCharacterSpacing(long nValue, bool bClose)
{
- SfxMapUnit eUnit = GetCoreMetric();
+ MapUnit eUnit = GetCoreMetric();
long nSign = (nValue < 0) ? -1 : 1;
nValue = nValue * nSign;
@@ -201,7 +201,7 @@ IMPL_LINK_NOARG_TYPED(TextCharacterSpacingControl, KerningModifyHdl, Edit&, void
ExecuteCharacterSpacing(mnCustomKern, false);
}
-SfxMapUnit TextCharacterSpacingControl::GetCoreMetric() const
+MapUnit TextCharacterSpacingControl::GetCoreMetric() const
{
SfxItemPool &rPool = SfxGetpApp()->GetPool();
sal_uInt16 nWhich = rPool.GetWhich(mnId);
diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.hxx b/svx/source/sidebar/text/TextCharacterSpacingControl.hxx
index 866e011ee62b..76df39d9ca23 100644
--- a/svx/source/sidebar/text/TextCharacterSpacingControl.hxx
+++ b/svx/source/sidebar/text/TextCharacterSpacingControl.hxx
@@ -63,7 +63,7 @@ private:
DECL_LINK_TYPED(KerningSelectHdl, ListBox&, void);
DECL_LINK_TYPED(KerningModifyHdl, Edit&, void);
- SfxMapUnit GetCoreMetric() const;
+ MapUnit GetCoreMetric() const;
};
}