[Libreoffice-commits] core.git: 6 commits - avmedia/source basctl/source basegfx/source cui/source dbaccess/source drawinglayer/source editeng/source include/avmedia include/basegfx include/editeng include/tools sd/source starmath/source svtools/source svx/source uui/source vcl/generic vcl/source
Noel Grandin
noel at peralex.com
Thu Mar 26 23:45:44 PDT 2015
avmedia/source/framework/mediacontrol.cxx | 4 -
avmedia/source/framework/mediaitem.cxx | 51 ++++++-------
avmedia/source/framework/mediatoolbox.cxx | 2
avmedia/source/viewer/mediawindow_impl.cxx | 16 ++--
basctl/source/basicide/baside3.cxx | 6 -
basegfx/source/polygon/b2dlinegeometry.cxx | 14 +--
basegfx/source/polygon/b2dpolygontools.cxx | 44 +++++------
basegfx/source/polygon/b2dtrapezoid.cxx | 4 -
cui/source/customize/cfg.cxx | 6 -
cui/source/dialogs/cuifmsearch.cxx | 2
cui/source/dialogs/hldocntp.cxx | 2
dbaccess/source/ui/dlg/sqlmessage.cxx | 36 ++++-----
dbaccess/source/ui/misc/datasourceconnector.cxx | 2
dbaccess/source/ui/relationdesign/RelationTableView.cxx | 2
drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx | 2
editeng/source/editeng/editeng.cxx | 2
editeng/source/editeng/impedit.hxx | 2
editeng/source/editeng/impedit5.cxx | 10 +-
editeng/source/uno/unoedhlp.cxx | 8 +-
editeng/source/uno/unofored.cxx | 8 +-
editeng/source/uno/unoforou.cxx | 8 +-
include/avmedia/mediaitem.hxx | 36 +++++----
include/basegfx/polygon/b2dpolygontools.hxx | 32 ++++----
include/editeng/editeng.hxx | 19 +++-
include/tools/wintypes.hxx | 34 ++++----
sd/source/ui/dlg/headerfooterdlg.cxx | 2
starmath/source/accessibility.cxx | 8 +-
svtools/source/control/ctrlbox.cxx | 2
svx/source/dialog/framelink.cxx | 2
svx/source/dialog/prtqry.cxx | 2
svx/source/svdraw/svdomedia.cxx | 14 +--
svx/source/tbxctrls/layctrl.cxx | 2
uui/source/alreadyopen.cxx | 4 -
uui/source/filechanged.cxx | 2
uui/source/lockfailed.cxx | 4 -
uui/source/openlocked.cxx | 2
uui/source/trylater.cxx | 2
vcl/generic/app/gensys.cxx | 33 ++++----
vcl/source/control/button.cxx | 14 +--
vcl/source/control/ilstbox.cxx | 4 -
vcl/source/control/morebtn.cxx | 6 -
vcl/source/window/btndlg.cxx | 12 +--
vcl/source/window/layout.cxx | 4 -
vcl/source/window/msgbox.cxx | 28 +++----
44 files changed, 263 insertions(+), 236 deletions(-)
New commits:
commit aff09b486f26fa58a4f26a52e2b26286811d2441
Author: Noel Grandin <noel at peralex.com>
Date: Thu Mar 26 16:03:06 2015 +0200
convert GETATTRIBS_ constants to enum class
Change-Id: I236caa9e2dc80455198b442e72e8d9df58f03adc
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index afed139..acc0b85 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -1728,7 +1728,7 @@ SfxItemSet EditEngine::GetAttribs( const ESelection& rSel, EditEngineAttribs nOn
return pImpEditEngine->GetAttribs( aSel, nOnlyHardAttrib );
}
-SfxItemSet EditEngine::GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt8 nFlags ) const
+SfxItemSet EditEngine::GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, GetAttribsFlags nFlags ) const
{
return pImpEditEngine->GetAttribs( nPara, nStart, nEnd, nFlags );
}
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index dd2f644..321bfbf 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -807,7 +807,7 @@ public:
sal_uInt16 GetLineHeight( sal_Int32 nParagraph, sal_Int32 nLine );
sal_uInt32 GetParaHeight( sal_Int32 nParagraph );
- SfxItemSet GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt8 nFlags = 0xFF ) const;
+ SfxItemSet GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, GetAttribsFlags nFlags = GetAttribsFlags::ALL ) const;
SfxItemSet GetAttribs( EditSelection aSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs_All );
void SetAttribs( EditSelection aSel, const SfxItemSet& rSet, sal_uInt8 nSpecial = 0 );
void RemoveCharAttribs( EditSelection aSel, bool bRemoveParaAttribs, sal_uInt16 nWhich = 0 );
diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx
index fa733cd..698346d 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -391,7 +391,7 @@ SfxItemSet ImpEditEngine::GetAttribs( EditSelection aSel, EditEngineAttribs nOnl
}
-SfxItemSet ImpEditEngine::GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt8 nFlags ) const
+SfxItemSet ImpEditEngine::GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, GetAttribsFlags nFlags ) const
{
// Optimized function with less Puts(), which cause unnecessary cloning from default items.
// If this works, change GetAttribs( EditSelection ) to use this for each paragraph and merge the results!
@@ -413,15 +413,15 @@ SfxItemSet ImpEditEngine::GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int
// StyleSheet / Parattribs...
- if ( pNode->GetStyleSheet() && ( nFlags & GETATTRIBS_STYLESHEET ) )
+ if ( pNode->GetStyleSheet() && ( nFlags & GetAttribsFlags::STYLESHEET ) )
aAttribs.Set(pNode->GetStyleSheet()->GetItemSet(), true);
- if ( nFlags & GETATTRIBS_PARAATTRIBS )
+ if ( nFlags & GetAttribsFlags::PARAATTRIBS )
aAttribs.Put( pNode->GetContentAttribs().GetItems() );
// CharAttribs...
- if ( nFlags & GETATTRIBS_CHARATTRIBS )
+ if ( nFlags & GetAttribsFlags::CHARATTRIBS )
{
// Make testing easier...
const SfxItemPool& rPool = GetEditDoc().GetItemPool();
@@ -461,7 +461,7 @@ SfxItemSet ImpEditEngine::GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int
{
// OptimizeRagnge() assures that not the same attr can follow for full coverage
// only partial, check with current, when using para/styhe, otherwise invalid.
- if ( !( nFlags & (GETATTRIBS_PARAATTRIBS|GETATTRIBS_STYLESHEET) ) ||
+ if ( !( nFlags & (GetAttribsFlags::PARAATTRIBS|GetAttribsFlags::STYLESHEET) ) ||
( *rAttr.GetItem() != aAttribs.Get( rAttr.Which() ) ) )
{
aAttribs.InvalidateItem( rAttr.Which() );
diff --git a/editeng/source/uno/unoedhlp.cxx b/editeng/source/uno/unoedhlp.cxx
index 6424892..c966a1a 100644
--- a/editeng/source/uno/unoedhlp.cxx
+++ b/editeng/source/uno/unoedhlp.cxx
@@ -181,7 +181,7 @@ bool SvxEditSourceHelper::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nE
//need to find closest index in front of nIndex in the previous paragraphs
if ( aStartPos.nIndex == 0 )
{
- SfxItemSet aCrrntSet = rEE.GetAttribs( nPara, 0, 1, GETATTRIBS_CHARATTRIBS );
+ SfxItemSet aCrrntSet = rEE.GetAttribs( nPara, 0, 1, GetAttribsFlags::CHARATTRIBS );
for ( sal_Int32 nParaIdx = nPara-1; nParaIdx >= 0; nParaIdx-- )
{
sal_uInt32 nLen = rEE.GetTextLen(nParaIdx);
@@ -189,7 +189,7 @@ bool SvxEditSourceHelper::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nE
{
sal_Int32 nStartIdx, nEndIdx;
GetAttributeRun( nStartIdx, nEndIdx, rEE, nParaIdx, nLen, false );
- SfxItemSet aSet = rEE.GetAttribs( nParaIdx, nLen-1, nLen, GETATTRIBS_CHARATTRIBS );
+ SfxItemSet aSet = rEE.GetAttribs( nParaIdx, nLen-1, nLen, GetAttribsFlags::CHARATTRIBS );
if ( aSet == aCrrntSet )
{
aStartPos.nPara = nParaIdx;
@@ -205,7 +205,7 @@ bool SvxEditSourceHelper::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nE
//need find closest index behind nIndex in the following paragrphs
if ( aEndPos.nIndex == nCrrntParaLen )
{
- SfxItemSet aCrrntSet = rEE.GetAttribs( nPara, nCrrntParaLen-1, nCrrntParaLen, GETATTRIBS_CHARATTRIBS );
+ SfxItemSet aCrrntSet = rEE.GetAttribs( nPara, nCrrntParaLen-1, nCrrntParaLen, GetAttribsFlags::CHARATTRIBS );
for ( sal_Int32 nParaIdx = nPara+1; nParaIdx < nParaCount; nParaIdx++ )
{
sal_Int32 nLen = rEE.GetTextLen( nParaIdx );
@@ -213,7 +213,7 @@ bool SvxEditSourceHelper::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nE
{
sal_Int32 nStartIdx, nEndIdx;
GetAttributeRun( nStartIdx, nEndIdx, rEE, nParaIdx, 0, false );
- SfxItemSet aSet = rEE.GetAttribs( nParaIdx, 0, 1, GETATTRIBS_CHARATTRIBS );
+ SfxItemSet aSet = rEE.GetAttribs( nParaIdx, 0, 1, GetAttribsFlags::CHARATTRIBS );
if ( aSet == aCrrntSet )
{
aEndPos.nPara = nParaIdx;
diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx
index 6b39f0a..163dc74 100644
--- a/editeng/source/uno/unofored.cxx
+++ b/editeng/source/uno/unofored.cxx
@@ -66,17 +66,17 @@ SfxItemSet SvxEditEngineForwarder::GetAttribs( const ESelection& rSel, EditEngin
{
if( rSel.nStartPara == rSel.nEndPara )
{
- sal_uInt8 nFlags = 0;
+ GetAttribsFlags nFlags = GetAttribsFlags::NONE;
switch( nOnlyHardAttrib )
{
case EditEngineAttribs_All:
- nFlags = GETATTRIBS_ALL;
+ nFlags = GetAttribsFlags::ALL;
break;
case EditEngineAttribs_HardAndPara:
- nFlags = GETATTRIBS_PARAATTRIBS|GETATTRIBS_CHARATTRIBS;
+ nFlags = GetAttribsFlags::PARAATTRIBS|GetAttribsFlags::CHARATTRIBS;
break;
case EditEngineAttribs_OnlyHard:
- nFlags = GETATTRIBS_CHARATTRIBS;
+ nFlags = GetAttribsFlags::CHARATTRIBS;
break;
default:
OSL_FAIL("unknown flags for SvxOutlinerForwarder::GetAttribs");
diff --git a/editeng/source/uno/unoforou.cxx b/editeng/source/uno/unoforou.cxx
index 5057f03..e0c863f 100644
--- a/editeng/source/uno/unoforou.cxx
+++ b/editeng/source/uno/unoforou.cxx
@@ -76,18 +76,18 @@ static SfxItemSet ImplOutlinerForwarderGetAttribs( const ESelection& rSel, EditE
{
if( rSel.nStartPara == rSel.nEndPara )
{
- sal_uInt8 nFlags = 0;
+ GetAttribsFlags nFlags = GetAttribsFlags::NONE;
switch( nOnlyHardAttrib )
{
case EditEngineAttribs_All:
- nFlags = GETATTRIBS_ALL;
+ nFlags = GetAttribsFlags::ALL;
break;
case EditEngineAttribs_HardAndPara:
- nFlags = GETATTRIBS_PARAATTRIBS|GETATTRIBS_CHARATTRIBS;
+ nFlags = GetAttribsFlags::PARAATTRIBS|GetAttribsFlags::CHARATTRIBS;
break;
case EditEngineAttribs_OnlyHard:
- nFlags = GETATTRIBS_CHARATTRIBS;
+ nFlags = GetAttribsFlags::CHARATTRIBS;
break;
default:
OSL_FAIL("unknown flags for SvxOutlinerForwarder::GetAttribs");
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index ba253f4..06d73f4 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -36,6 +36,7 @@
#include <tools/rtti.hxx>
#include <editeng/eedata.hxx>
+#include <o3tl/typed_flags_set.hxx>
namespace com { namespace sun { namespace star {
namespace linguistic2 {
@@ -122,10 +123,18 @@ enum EditEngineAttribs {
/** values for:
SfxItemSet GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt8 nFlags = 0xFF ) const;
*/
-#define GETATTRIBS_STYLESHEET (sal_uInt8)0x01
-#define GETATTRIBS_PARAATTRIBS (sal_uInt8)0x02
-#define GETATTRIBS_CHARATTRIBS (sal_uInt8)0x04
-#define GETATTRIBS_ALL (sal_uInt8)0xFF
+enum class GetAttribsFlags
+{
+ NONE = 0x00,
+ STYLESHEET = 0x01,
+ PARAATTRIBS = 0x02,
+ CHARATTRIBS = 0x04,
+ ALL = 0x07,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<GetAttribsFlags> : is_typed_flags<GetAttribsFlags, 0x07> {};
+}
class SdrObject;
class EDITENG_DLLPUBLIC EditEngine
@@ -303,7 +312,7 @@ public:
void GetCharAttribs( sal_Int32 nPara, std::vector<EECharAttrib>& rLst ) const;
- SfxItemSet GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt8 nFlags = 0xFF ) const;
+ SfxItemSet GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, GetAttribsFlags nFlags = GetAttribsFlags::ALL ) const;
SfxItemSet GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs_All );
bool HasParaAttrib( sal_Int32 nPara, sal_uInt16 nWhich ) const;
diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx
index 8b59c35..e759035 100644
--- a/sd/source/ui/dlg/headerfooterdlg.cxx
+++ b/sd/source/ui/dlg/headerfooterdlg.cxx
@@ -642,7 +642,7 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType &rLanguage, boo
{
if( bSet )
{
- SfxItemSet aSet( pEdit->GetAttribs( aFieldInfo.aPosition.nPara, aFieldInfo.aPosition.nIndex, aFieldInfo.aPosition.nIndex+1, GETATTRIBS_CHARATTRIBS ) );
+ SfxItemSet aSet( pEdit->GetAttribs( aFieldInfo.aPosition.nPara, aFieldInfo.aPosition.nIndex, aFieldInfo.aPosition.nIndex+1, GetAttribsFlags::CHARATTRIBS ) );
SvxLanguageItem aItem( rLanguage, EE_CHAR_LANGUAGE );
aSet.Put( aItem );
diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx
index cd6c587..f3a9b27 100644
--- a/starmath/source/accessibility.cxx
+++ b/starmath/source/accessibility.cxx
@@ -983,17 +983,17 @@ SfxItemSet SmTextForwarder::GetAttribs( const ESelection& rSel, EditEngineAttrib
OSL_ENSURE( pEditEngine, "EditEngine missing" );
if( rSel.nStartPara == rSel.nEndPara )
{
- sal_uInt8 nFlags = 0;
+ GetAttribsFlags nFlags = GetAttribsFlags::NONE;
switch( nOnlyHardAttrib )
{
case EditEngineAttribs_All:
- nFlags = GETATTRIBS_ALL;
+ nFlags = GetAttribsFlags::ALL;
break;
case EditEngineAttribs_HardAndPara:
- nFlags = GETATTRIBS_PARAATTRIBS|GETATTRIBS_CHARATTRIBS;
+ nFlags = GetAttribsFlags::PARAATTRIBS|GetAttribsFlags::CHARATTRIBS;
break;
case EditEngineAttribs_OnlyHard:
- nFlags = GETATTRIBS_CHARATTRIBS;
+ nFlags = GetAttribsFlags::CHARATTRIBS;
break;
default:
SAL_WARN("starmath", "unknown flags for SmTextForwarder::GetAttribs");
commit 9bccd26037188f20fec244bede3022900d1b96fa
Author: Noel Grandin <noel at peralex.com>
Date: Thu Mar 26 15:39:26 2015 +0200
convert CUTFLAG_ constants to enum class
Change-Id: I98dc5488954a4d46f7e0158790a4c3dabebfc1b3
diff --git a/basegfx/source/polygon/b2dlinegeometry.cxx b/basegfx/source/polygon/b2dlinegeometry.cxx
index 78a722b..860161d 100644
--- a/basegfx/source/polygon/b2dlinegeometry.cxx
+++ b/basegfx/source/polygon/b2dlinegeometry.cxx
@@ -359,21 +359,21 @@ namespace basegfx
const B2DVector aPerpendStartA(aNormalizedPerpendicularA * -fHalfLineWidth);
const B2DVector aPerpendEndA(aNormalizedPerpendicularB * -fHalfLineWidth);
double fCutA(0.0);
- const tools::CutFlagValue aCutA(tools::findCut(
+ const CutFlagValue aCutA(tools::findCut(
rEdge.getStartPoint(), aPerpendStartA,
rEdge.getEndPoint(), aPerpendEndA,
- CUTFLAG_ALL, &fCutA));
- const bool bCutA(CUTFLAG_NONE != aCutA);
+ CutFlagValue::ALL, &fCutA));
+ const bool bCutA(CutFlagValue::NONE != aCutA);
// create lower displacement vectors and check if they cut
const B2DVector aPerpendStartB(aNormalizedPerpendicularA * fHalfLineWidth);
const B2DVector aPerpendEndB(aNormalizedPerpendicularB * fHalfLineWidth);
double fCutB(0.0);
- const tools::CutFlagValue aCutB(tools::findCut(
+ const CutFlagValue aCutB(tools::findCut(
rEdge.getEndPoint(), aPerpendEndB,
rEdge.getStartPoint(), aPerpendStartB,
- CUTFLAG_ALL, &fCutB));
- const bool bCutB(CUTFLAG_NONE != aCutB);
+ CutFlagValue::ALL, &fCutB));
+ const bool bCutB(CutFlagValue::NONE != aCutB);
// check if cut happens
const bool bCut(bCutA || bCutB);
@@ -713,7 +713,7 @@ namespace basegfx
// is not needed since the same fCut will be found on the first edge.
// If it exists, insert it to complete the mitered fill polygon.
double fCutPos(0.0);
- tools::findCut(aStartPoint, rTangentPrev, aEndPoint, rTangentEdge, CUTFLAG_ALL, &fCutPos);
+ tools::findCut(aStartPoint, rTangentPrev, aEndPoint, rTangentEdge, CutFlagValue::ALL, &fCutPos);
if(0.0 != fCutPos)
{
diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx
index 09cb226..ba27b93 100644
--- a/basegfx/source/polygon/b2dpolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolygontools.cxx
@@ -947,28 +947,28 @@ namespace basegfx
CutFlagValue aCutFlags,
double* pCut1, double* pCut2)
{
- CutFlagValue aRetval(CUTFLAG_NONE);
+ CutFlagValue aRetval(CutFlagValue::NONE);
double fCut1(0.0);
double fCut2(0.0);
- bool bFinished(!((bool)(aCutFlags & CUTFLAG_ALL)));
+ bool bFinished(!((bool)(aCutFlags & CutFlagValue::ALL)));
// test for same points?
if(!bFinished
- && (aCutFlags & (CUTFLAG_START1|CUTFLAG_END1))
- && (aCutFlags & (CUTFLAG_START2|CUTFLAG_END2)))
+ && (aCutFlags & (CutFlagValue::START1|CutFlagValue::END1))
+ && (aCutFlags & (CutFlagValue::START2|CutFlagValue::END2)))
{
// same startpoint?
- if(!bFinished && (aCutFlags & (CUTFLAG_START1|CUTFLAG_START2)) == (CUTFLAG_START1|CUTFLAG_START2))
+ if(!bFinished && (aCutFlags & (CutFlagValue::START1|CutFlagValue::START2)) == (CutFlagValue::START1|CutFlagValue::START2))
{
if(rEdge1Start.equal(rEdge2Start))
{
bFinished = true;
- aRetval = (CUTFLAG_START1|CUTFLAG_START2);
+ aRetval = (CutFlagValue::START1|CutFlagValue::START2);
}
}
// same endpoint?
- if(!bFinished && (aCutFlags & (CUTFLAG_END1|CUTFLAG_END2)) == (CUTFLAG_END1|CUTFLAG_END2))
+ if(!bFinished && (aCutFlags & (CutFlagValue::END1|CutFlagValue::END2)) == (CutFlagValue::END1|CutFlagValue::END2))
{
const B2DPoint aEnd1(rEdge1Start + rEdge1Delta);
const B2DPoint aEnd2(rEdge2Start + rEdge2Delta);
@@ -976,63 +976,63 @@ namespace basegfx
if(aEnd1.equal(aEnd2))
{
bFinished = true;
- aRetval = (CUTFLAG_END1|CUTFLAG_END2);
+ aRetval = (CutFlagValue::END1|CutFlagValue::END2);
fCut1 = fCut2 = 1.0;
}
}
// startpoint1 == endpoint2?
- if(!bFinished && (aCutFlags & (CUTFLAG_START1|CUTFLAG_END2)) == (CUTFLAG_START1|CUTFLAG_END2))
+ if(!bFinished && (aCutFlags & (CutFlagValue::START1|CutFlagValue::END2)) == (CutFlagValue::START1|CutFlagValue::END2))
{
const B2DPoint aEnd2(rEdge2Start + rEdge2Delta);
if(rEdge1Start.equal(aEnd2))
{
bFinished = true;
- aRetval = (CUTFLAG_START1|CUTFLAG_END2);
+ aRetval = (CutFlagValue::START1|CutFlagValue::END2);
fCut1 = 0.0;
fCut2 = 1.0;
}
}
// startpoint2 == endpoint1?
- if(!bFinished&& (aCutFlags & (CUTFLAG_START2|CUTFLAG_END1)) == (CUTFLAG_START2|CUTFLAG_END1))
+ if(!bFinished&& (aCutFlags & (CutFlagValue::START2|CutFlagValue::END1)) == (CutFlagValue::START2|CutFlagValue::END1))
{
const B2DPoint aEnd1(rEdge1Start + rEdge1Delta);
if(rEdge2Start.equal(aEnd1))
{
bFinished = true;
- aRetval = (CUTFLAG_START2|CUTFLAG_END1);
+ aRetval = (CutFlagValue::START2|CutFlagValue::END1);
fCut1 = 1.0;
fCut2 = 0.0;
}
}
}
- if(!bFinished && (aCutFlags & CUTFLAG_LINE))
+ if(!bFinished && (aCutFlags & CutFlagValue::LINE))
{
- if(!bFinished && (aCutFlags & CUTFLAG_START1))
+ if(!bFinished && (aCutFlags & CutFlagValue::START1))
{
// start1 on line 2 ?
if(isPointOnEdge(rEdge1Start, rEdge2Start, rEdge2Delta, &fCut2))
{
bFinished = true;
- aRetval = (CUTFLAG_LINE|CUTFLAG_START1);
+ aRetval = (CutFlagValue::LINE|CutFlagValue::START1);
}
}
- if(!bFinished && (aCutFlags & CUTFLAG_START2))
+ if(!bFinished && (aCutFlags & CutFlagValue::START2))
{
// start2 on line 1 ?
if(isPointOnEdge(rEdge2Start, rEdge1Start, rEdge1Delta, &fCut1))
{
bFinished = true;
- aRetval = (CUTFLAG_LINE|CUTFLAG_START2);
+ aRetval = (CutFlagValue::LINE|CutFlagValue::START2);
}
}
- if(!bFinished && (aCutFlags & CUTFLAG_END1))
+ if(!bFinished && (aCutFlags & CutFlagValue::END1))
{
// end1 on line 2 ?
const B2DPoint aEnd1(rEdge1Start + rEdge1Delta);
@@ -1040,11 +1040,11 @@ namespace basegfx
if(isPointOnEdge(aEnd1, rEdge2Start, rEdge2Delta, &fCut2))
{
bFinished = true;
- aRetval = (CUTFLAG_LINE|CUTFLAG_END1);
+ aRetval = (CutFlagValue::LINE|CutFlagValue::END1);
}
}
- if(!bFinished && (aCutFlags & CUTFLAG_END2))
+ if(!bFinished && (aCutFlags & CutFlagValue::END2))
{
// end2 on line 1 ?
const B2DPoint aEnd2(rEdge2Start + rEdge2Delta);
@@ -1052,7 +1052,7 @@ namespace basegfx
if(isPointOnEdge(aEnd2, rEdge1Start, rEdge1Delta, &fCut1))
{
bFinished = true;
- aRetval = (CUTFLAG_LINE|CUTFLAG_END2);
+ aRetval = (CutFlagValue::LINE|CutFlagValue::END2);
}
}
@@ -1088,7 +1088,7 @@ namespace basegfx
// inside parameter range edge2, too
if(fTools::more(fCut2, fZero) && fTools::less(fCut2, fOne))
{
- aRetval = CUTFLAG_LINE;
+ aRetval = CutFlagValue::LINE;
}
}
}
diff --git a/basegfx/source/polygon/b2dtrapezoid.cxx b/basegfx/source/polygon/b2dtrapezoid.cxx
index a5ac050..b813e03 100644
--- a/basegfx/source/polygon/b2dtrapezoid.cxx
+++ b/basegfx/source/polygon/b2dtrapezoid.cxx
@@ -390,9 +390,9 @@ namespace basegfx
if(tools::findCut(
aEdgeA.getStart(), aDeltaA,
aEdgeB.getStart(), aDeltaB,
- CUTFLAG_LINE,
+ CutFlagValue::LINE,
&fCutA,
- &fCutB))
+ &fCutB) != CutFlagValue::NONE)
{
// use a simple metric (length criteria) for choosing the numerically
// better cut
diff --git a/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx b/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx
index 9d4813b..01e56db 100644
--- a/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx
@@ -332,7 +332,7 @@ namespace
if(basegfx::tools::findCut(
rStart, aVector,
- aCurrent, aEdgeVector))
+ aCurrent, aEdgeVector) != CutFlagValue::NONE)
{
return true;
}
diff --git a/include/basegfx/polygon/b2dpolygontools.hxx b/include/basegfx/polygon/b2dpolygontools.hxx
index 0fb90cb..dc0cf11 100644
--- a/include/basegfx/polygon/b2dpolygontools.hxx
+++ b/include/basegfx/polygon/b2dpolygontools.hxx
@@ -29,9 +29,27 @@
#include <com/sun/star/drawing/FlagSequence.hpp>
#include <vector>
#include <basegfx/basegfxdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+// Definitions for the cut flags used from the findCut methods
+enum class CutFlagValue
+{
+ NONE = 0x0000,
+ LINE = 0x0001,
+ START1 = 0x0002,
+ START2 = 0x0004,
+ END1 = 0x0008,
+ END2 = 0x0010,
+ ALL = LINE|START1|START2|END1|END2,
+ DEFAULT = LINE|START2|END2,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<CutFlagValue> : is_typed_flags<CutFlagValue, 0x1f> {};
+}
+
namespace basegfx
{
// predefinitions
@@ -123,24 +141,12 @@ namespace basegfx
// #i37443# Subdivide all contained curves.
BASEGFX_DLLPUBLIC B2DPolygon adaptiveSubdivideByCount(const B2DPolygon& rCandidate, sal_uInt32 nCount = 0L);
- // Definitions for the cut flags used from the findCut methods
- typedef sal_uInt16 CutFlagValue;
-
- #define CUTFLAG_NONE (0x0000)
- #define CUTFLAG_LINE (0x0001)
- #define CUTFLAG_START1 (0x0002)
- #define CUTFLAG_START2 (0x0004)
- #define CUTFLAG_END1 (0x0008)
- #define CUTFLAG_END2 (0x0010)
- #define CUTFLAG_ALL (CUTFLAG_LINE|CUTFLAG_START1|CUTFLAG_START2|CUTFLAG_END1|CUTFLAG_END2)
- #define CUTFLAG_DEFAULT (CUTFLAG_LINE|CUTFLAG_START2|CUTFLAG_END2)
-
// This version works with two points and vectors to define the
// edges for the cut test.
BASEGFX_DLLPUBLIC CutFlagValue findCut(
const B2DPoint& rEdge1Start, const B2DVector& rEdge1Delta,
const B2DPoint& rEdge2Start, const B2DVector& rEdge2Delta,
- CutFlagValue aCutFlags = CUTFLAG_DEFAULT,
+ CutFlagValue aCutFlags = CutFlagValue::DEFAULT,
double* pCut1 = 0L, double* pCut2 = 0L);
// test if point is on the given edge in range ]0.0..1.0[ without
diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx
index aa5b510..8510286 100644
--- a/svx/source/dialog/framelink.cxx
+++ b/svx/source/dialog/framelink.cxx
@@ -1395,7 +1395,7 @@ double lcl_GetExtent( const Style& rBorder, const Style& rSide, const Style& rOp
double nCut = 0.0;
basegfx::tools::findCut(
aBasePoint, aBaseVector, aOtherPoint, aOtherVector,
- CUTFLAG_ALL, &nCut );
+ CutFlagValue::ALL, &nCut );
return nCut;
}
commit a1d10eb8d7ee73d901041fdf550d2196a63c9d1d
Author: Noel Grandin <noel at peralex.com>
Date: Thu Mar 26 15:19:45 2015 +0200
convert AVMEDIA_ constants to enum class
Change-Id: Ic4918f57a1575a24cf0b9251cc7e7c6180ee25fd
diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx
index d41783ff..1359261 100644
--- a/avmedia/source/framework/mediacontrol.cxx
+++ b/avmedia/source/framework/mediacontrol.cxx
@@ -64,7 +64,7 @@ namespace avmedia
MediaControl::MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyle ) :
Control( pParent ),
maImageList( SvtMiscOptions().AreCurrentSymbolsLarge() ? AVMEDIA_RESID( AVMEDIA_IMGLST_L ) : AVMEDIA_RESID( AVMEDIA_IMGLST ) ),
- maItem( 0, AVMEDIA_SETMASK_ALL ),
+ maItem( 0, AVMediaSetMask::ALL ),
maPlayToolBox( this, WB_3DLOOK ),
maTimeSlider( this, WB_HORZ | WB_DRAG | WB_3DLOOK | WB_SLIDERSET ),
maMuteToolBox( this, WB_3DLOOK ),
@@ -549,7 +549,7 @@ IMPL_LINK( MediaControl, implSelectHdl, ToolBox*, p )
break;
}
- if( aExecItem.getMaskSet() != AVMEDIA_SETMASK_NONE )
+ if( aExecItem.getMaskSet() != AVMediaSetMask::NONE )
execute( aExecItem );
}
diff --git a/avmedia/source/framework/mediaitem.cxx b/avmedia/source/framework/mediaitem.cxx
index 3b33529..2543df5 100644
--- a/avmedia/source/framework/mediaitem.cxx
+++ b/avmedia/source/framework/mediaitem.cxx
@@ -52,7 +52,7 @@ struct MediaItem::Impl
OUString m_TempFileURL;
OUString m_Referer;
OUString m_sMimeType;
- sal_uInt32 m_nMaskSet;
+ AVMediaSetMask m_nMaskSet;
MediaState m_eState;
double m_fTime;
double m_fDuration;
@@ -61,7 +61,7 @@ struct MediaItem::Impl
bool m_bMute;
::com::sun::star::media::ZoomLevel m_eZoom;
- Impl(sal_uInt32 const nMaskSet)
+ Impl(AVMediaSetMask nMaskSet)
: m_nMaskSet( nMaskSet )
, m_eState( MEDIASTATE_STOP )
, m_fTime( 0.0 )
@@ -89,7 +89,7 @@ struct MediaItem::Impl
}
};
-MediaItem::MediaItem( sal_uInt16 const i_nWhich, sal_uInt32 const nMaskSet )
+MediaItem::MediaItem( sal_uInt16 i_nWhich, AVMediaSetMask nMaskSet )
: SfxPoolItem( i_nWhich )
, m_pImpl( new Impl(nMaskSet) )
{
@@ -142,7 +142,7 @@ bool MediaItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 ) const
uno::Sequence< uno::Any > aSeq( 10 );
aSeq[ 0 ] <<= m_pImpl->m_URL;
- aSeq[ 1 ] <<= m_pImpl->m_nMaskSet;
+ aSeq[ 1 ] <<= static_cast<sal_uInt32>(m_pImpl->m_nMaskSet);
aSeq[ 2 ] <<= static_cast< sal_Int32 >( m_pImpl->m_eState );
aSeq[ 3 ] <<= m_pImpl->m_fTime;
aSeq[ 4 ] <<= m_pImpl->m_fDuration;
@@ -167,7 +167,8 @@ bool MediaItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 )
sal_Int32 nInt32 = 0;
aSeq[ 0 ] >>= m_pImpl->m_URL;
- aSeq[ 1 ] >>= m_pImpl->m_nMaskSet;
+ aSeq[ 1 ] >>= nInt32;
+ m_pImpl->m_nMaskSet = static_cast<AVMediaSetMask>(nInt32);
aSeq[ 2 ] >>= nInt32;
m_pImpl->m_eState = static_cast< MediaState >( nInt32 );
aSeq[ 3 ] >>= m_pImpl->m_fTime;
@@ -186,44 +187,44 @@ bool MediaItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 )
void MediaItem::merge( const MediaItem& rMediaItem )
{
- const sal_uInt32 nMaskSet = rMediaItem.getMaskSet();
+ const AVMediaSetMask nMaskSet = rMediaItem.getMaskSet();
- if( AVMEDIA_SETMASK_URL & nMaskSet )
+ if( AVMediaSetMask::URL & nMaskSet )
setURL( rMediaItem.getURL(), rMediaItem.getTempURL(), rMediaItem.getReferer() );
- if( AVMEDIA_SETMASK_MIME_TYPE & nMaskSet )
+ if( AVMediaSetMask::MIME_TYPE & nMaskSet )
setMimeType( rMediaItem.getMimeType() );
- if( AVMEDIA_SETMASK_STATE & nMaskSet )
+ if( AVMediaSetMask::STATE & nMaskSet )
setState( rMediaItem.getState() );
- if( AVMEDIA_SETMASK_DURATION & nMaskSet )
+ if( AVMediaSetMask::DURATION & nMaskSet )
setDuration( rMediaItem.getDuration() );
- if( AVMEDIA_SETMASK_TIME & nMaskSet )
+ if( AVMediaSetMask::TIME & nMaskSet )
setTime( rMediaItem.getTime() );
- if( AVMEDIA_SETMASK_LOOP & nMaskSet )
+ if( AVMediaSetMask::LOOP & nMaskSet )
setLoop( rMediaItem.isLoop() );
- if( AVMEDIA_SETMASK_MUTE & nMaskSet )
+ if( AVMediaSetMask::MUTE & nMaskSet )
setMute( rMediaItem.isMute() );
- if( AVMEDIA_SETMASK_VOLUMEDB & nMaskSet )
+ if( AVMediaSetMask::VOLUMEDB & nMaskSet )
setVolumeDB( rMediaItem.getVolumeDB() );
- if( AVMEDIA_SETMASK_ZOOM & nMaskSet )
+ if( AVMediaSetMask::ZOOM & nMaskSet )
setZoom( rMediaItem.getZoom() );
}
-sal_uInt32 MediaItem::getMaskSet() const
+AVMediaSetMask MediaItem::getMaskSet() const
{
return m_pImpl->m_nMaskSet;
}
void MediaItem::setURL( const OUString& rURL, const OUString& rTempURL, const OUString& rReferer )
{
- m_pImpl->m_nMaskSet |= AVMEDIA_SETMASK_URL;
+ m_pImpl->m_nMaskSet |= AVMediaSetMask::URL;
m_pImpl->m_URL = rURL;
m_pImpl->m_TempFileURL = rTempURL;
m_pImpl->m_Referer = rReferer;
@@ -246,7 +247,7 @@ const OUString& MediaItem::getReferer() const
void MediaItem::setMimeType( const OUString& rMimeType )
{
- m_pImpl->m_nMaskSet |= AVMEDIA_SETMASK_MIME_TYPE;
+ m_pImpl->m_nMaskSet |= AVMediaSetMask::MIME_TYPE;
m_pImpl->m_sMimeType = rMimeType;
}
@@ -258,7 +259,7 @@ OUString MediaItem::getMimeType() const
void MediaItem::setState( MediaState eState )
{
m_pImpl->m_eState = eState;
- m_pImpl->m_nMaskSet |= AVMEDIA_SETMASK_STATE;
+ m_pImpl->m_nMaskSet |= AVMediaSetMask::STATE;
}
MediaState MediaItem::getState() const
@@ -269,7 +270,7 @@ MediaState MediaItem::getState() const
void MediaItem::setDuration( double fDuration )
{
m_pImpl->m_fDuration = fDuration;
- m_pImpl->m_nMaskSet |= AVMEDIA_SETMASK_DURATION;
+ m_pImpl->m_nMaskSet |= AVMediaSetMask::DURATION;
}
double MediaItem::getDuration() const
@@ -280,7 +281,7 @@ double MediaItem::getDuration() const
void MediaItem::setTime( double fTime )
{
m_pImpl->m_fTime = fTime;
- m_pImpl->m_nMaskSet |= AVMEDIA_SETMASK_TIME;
+ m_pImpl->m_nMaskSet |= AVMediaSetMask::TIME;
}
double MediaItem::getTime() const
@@ -291,7 +292,7 @@ double MediaItem::getTime() const
void MediaItem::setLoop( bool bLoop )
{
m_pImpl->m_bLoop = bLoop;
- m_pImpl->m_nMaskSet |= AVMEDIA_SETMASK_LOOP;
+ m_pImpl->m_nMaskSet |= AVMediaSetMask::LOOP;
}
bool MediaItem::isLoop() const
@@ -302,7 +303,7 @@ bool MediaItem::isLoop() const
void MediaItem::setMute( bool bMute )
{
m_pImpl->m_bMute = bMute;
- m_pImpl->m_nMaskSet |= AVMEDIA_SETMASK_MUTE;
+ m_pImpl->m_nMaskSet |= AVMediaSetMask::MUTE;
}
bool MediaItem::isMute() const
@@ -313,7 +314,7 @@ bool MediaItem::isMute() const
void MediaItem::setVolumeDB( sal_Int16 nDB )
{
m_pImpl->m_nVolumeDB = nDB;
- m_pImpl->m_nMaskSet |= AVMEDIA_SETMASK_VOLUMEDB;
+ m_pImpl->m_nMaskSet |= AVMediaSetMask::VOLUMEDB;
}
sal_Int16 MediaItem::getVolumeDB() const
@@ -324,7 +325,7 @@ sal_Int16 MediaItem::getVolumeDB() const
void MediaItem::setZoom( ::com::sun::star::media::ZoomLevel eZoom )
{
m_pImpl->m_eZoom = eZoom;
- m_pImpl->m_nMaskSet |= AVMEDIA_SETMASK_ZOOM;
+ m_pImpl->m_nMaskSet |= AVMediaSetMask::ZOOM;
}
::com::sun::star::media::ZoomLevel MediaItem::getZoom() const
diff --git a/avmedia/source/framework/mediatoolbox.cxx b/avmedia/source/framework/mediatoolbox.cxx
index 280cdb5..ea4131f 100644
--- a/avmedia/source/framework/mediatoolbox.cxx
+++ b/avmedia/source/framework/mediatoolbox.cxx
@@ -115,7 +115,7 @@ void MediaToolBoxControl::StateChanged( sal_uInt16 /* nSID */, SfxItemState eSta
pCtrl->Enable( false, false );
pCtrl->SetText( OUString() );
- const MediaItem aEmptyMediaItem( 0, AVMEDIA_SETMASK_ALL );
+ const MediaItem aEmptyMediaItem( 0, AVMediaSetMask::ALL );
pCtrl->setState( aEmptyMediaItem );
}
else
diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx
index e5fffff..26877f6 100644
--- a/avmedia/source/viewer/mediawindow_impl.cxx
+++ b/avmedia/source/viewer/mediawindow_impl.cxx
@@ -369,33 +369,33 @@ void MediaWindowImpl::updateMediaItem( MediaItem& rItem ) const
void MediaWindowImpl::executeMediaItem( const MediaItem& rItem )
{
- const sal_uInt32 nMaskSet = rItem.getMaskSet();
+ const AVMediaSetMask nMaskSet = rItem.getMaskSet();
// set URL first
- if( nMaskSet & AVMEDIA_SETMASK_URL )
+ if( nMaskSet & AVMediaSetMask::URL )
{
m_sMimeType = rItem.getMimeType();
setURL( rItem.getURL(), rItem.getTempURL(), rItem.getReferer() );
}
// set different states next
- if( nMaskSet & AVMEDIA_SETMASK_TIME )
+ if( nMaskSet & AVMediaSetMask::TIME )
setMediaTime( ::std::min( rItem.getTime(), getDuration() ) );
- if( nMaskSet & AVMEDIA_SETMASK_LOOP )
+ if( nMaskSet & AVMediaSetMask::LOOP )
setPlaybackLoop( rItem.isLoop() );
- if( nMaskSet & AVMEDIA_SETMASK_MUTE )
+ if( nMaskSet & AVMediaSetMask::MUTE )
setMute( rItem.isMute() );
- if( nMaskSet & AVMEDIA_SETMASK_VOLUMEDB )
+ if( nMaskSet & AVMediaSetMask::VOLUMEDB )
setVolumeDB( rItem.getVolumeDB() );
- if( nMaskSet & AVMEDIA_SETMASK_ZOOM )
+ if( nMaskSet & AVMediaSetMask::ZOOM )
setZoom( rItem.getZoom() );
// set play state at last
- if( nMaskSet & AVMEDIA_SETMASK_STATE )
+ if( nMaskSet & AVMediaSetMask::STATE )
{
switch( rItem.getState() )
{
diff --git a/include/avmedia/mediaitem.hxx b/include/avmedia/mediaitem.hxx
index 84cb424..fc424d5 100644
--- a/include/avmedia/mediaitem.hxx
+++ b/include/avmedia/mediaitem.hxx
@@ -27,18 +27,26 @@
#include <com/sun/star/embed/XStorage.hpp>
#include <avmedia/avmediadllapi.h>
#include <memory>
+#include <o3tl/typed_flags_set.hxx>
-#define AVMEDIA_SETMASK_NONE ((sal_uInt32)(0x00000000))
-#define AVMEDIA_SETMASK_STATE ((sal_uInt32)(0x00000001))
-#define AVMEDIA_SETMASK_DURATION ((sal_uInt32)(0x00000002))
-#define AVMEDIA_SETMASK_TIME ((sal_uInt32)(0x00000004))
-#define AVMEDIA_SETMASK_LOOP ((sal_uInt32)(0x00000008))
-#define AVMEDIA_SETMASK_MUTE ((sal_uInt32)(0x00000010))
-#define AVMEDIA_SETMASK_VOLUMEDB ((sal_uInt32)(0x00000020))
-#define AVMEDIA_SETMASK_ZOOM ((sal_uInt32)(0x00000040))
-#define AVMEDIA_SETMASK_URL ((sal_uInt32)(0x00000080))
-#define AVMEDIA_SETMASK_MIME_TYPE ((sal_uInt32)(0x00000100))
-#define AVMEDIA_SETMASK_ALL ((sal_uInt32)(0xffffffff))
+enum class AVMediaSetMask
+{
+ NONE = 0x000,
+ STATE = 0x001,
+ DURATION = 0x002,
+ TIME = 0x004,
+ LOOP = 0x008,
+ MUTE = 0x010,
+ VOLUMEDB = 0x020,
+ ZOOM = 0x040,
+ URL = 0x080,
+ MIME_TYPE = 0x100,
+ ALL = 0x1ff,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<AVMediaSetMask> : is_typed_flags<AVMediaSetMask, 0x1ff> {};
+}
class SvStream;
@@ -65,8 +73,8 @@ class AVMEDIA_DLLPUBLIC MediaItem : public SfxPoolItem
public:
TYPEINFO_OVERRIDE();
- explicit MediaItem( sal_uInt16 const i_nWhich = 0,
- sal_uInt32 const nMaskSet = AVMEDIA_SETMASK_NONE );
+ explicit MediaItem( sal_uInt16 i_nWhich = 0,
+ AVMediaSetMask nMaskSet = AVMediaSetMask::NONE );
MediaItem( const MediaItem& rMediaItem );
virtual ~MediaItem();
@@ -82,7 +90,7 @@ public:
void merge( const MediaItem& rMediaItem );
- sal_uInt32 getMaskSet() const;
+ AVMediaSetMask getMaskSet() const;
void setState( MediaState eState );
MediaState getState() const;
diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx
index 2bead84..05c5589 100644
--- a/svx/source/svdraw/svdomedia.cxx
+++ b/svx/source/svdraw/svdomedia.cxx
@@ -420,13 +420,13 @@ static bool lcl_HandlePackageURL(
void SdrMediaObj::mediaPropertiesChanged( const ::avmedia::MediaItem& rNewProperties )
{
bool bBroadcastChanged = false;
- const sal_uInt32 nMaskSet = rNewProperties.getMaskSet();
+ const AVMediaSetMask nMaskSet = rNewProperties.getMaskSet();
// use only a subset of MediaItem properties for own own properties
- if( AVMEDIA_SETMASK_MIME_TYPE & nMaskSet )
+ if( AVMediaSetMask::MIME_TYPE & nMaskSet )
m_xImpl->m_MediaProperties.setMimeType( rNewProperties.getMimeType() );
- if( ( AVMEDIA_SETMASK_URL & nMaskSet ) &&
+ if( ( AVMediaSetMask::URL & nMaskSet ) &&
( rNewProperties.getURL() != getURL() ))
{
m_xImpl->m_xCachedSnapshot.clear();
@@ -475,16 +475,16 @@ void SdrMediaObj::mediaPropertiesChanged( const ::avmedia::MediaItem& rNewProper
bBroadcastChanged = true;
}
- if( AVMEDIA_SETMASK_LOOP & nMaskSet )
+ if( AVMediaSetMask::LOOP & nMaskSet )
m_xImpl->m_MediaProperties.setLoop( rNewProperties.isLoop() );
- if( AVMEDIA_SETMASK_MUTE & nMaskSet )
+ if( AVMediaSetMask::MUTE & nMaskSet )
m_xImpl->m_MediaProperties.setMute( rNewProperties.isMute() );
- if( AVMEDIA_SETMASK_VOLUMEDB & nMaskSet )
+ if( AVMediaSetMask::VOLUMEDB & nMaskSet )
m_xImpl->m_MediaProperties.setVolumeDB( rNewProperties.getVolumeDB() );
- if( AVMEDIA_SETMASK_ZOOM & nMaskSet )
+ if( AVMediaSetMask::ZOOM & nMaskSet )
m_xImpl->m_MediaProperties.setZoom( rNewProperties.getZoom() );
if( bBroadcastChanged )
commit b3464e87ae2115e394d5a9f85b4aaf88d485d7f1
Author: Noel Grandin <noel at peralex.com>
Date: Thu Mar 26 13:32:44 2015 +0200
convert SymbolAlign to enum class
Change-Id: Iecc1400809212f56915cad56b739378cda49b90f
diff --git a/include/tools/wintypes.hxx b/include/tools/wintypes.hxx
index e9282da..6abb4b6 100644
--- a/include/tools/wintypes.hxx
+++ b/include/tools/wintypes.hxx
@@ -291,7 +291,7 @@ enum ImageAlign { IMAGEALIGN_LEFT, IMAGEALIGN_TOP, IMAGEALIGN_RIGHT, IMAGEALIGN_
IMAGEALIGN_LEFT_TOP, IMAGEALIGN_LEFT_BOTTOM, IMAGEALIGN_TOP_LEFT,
IMAGEALIGN_TOP_RIGHT, IMAGEALIGN_RIGHT_TOP, IMAGEALIGN_RIGHT_BOTTOM,
IMAGEALIGN_BOTTOM_LEFT, IMAGEALIGN_BOTTOM_RIGHT, IMAGEALIGN_CENTER };
-enum SymbolAlign { SYMBOLALIGN_LEFT, SYMBOLALIGN_RIGHT };
+enum class SymbolAlign { LEFT, RIGHT };
// ButtonDialog-Types
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index e6a1d34..542b54c 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -79,7 +79,7 @@ public:
};
ImplCommonButtonData::ImplCommonButtonData() : maFocusRect(), mnSeparatorX(0), mnButtonState(0),
-mbSmallSymbol(false), maImage(), meImageAlign(IMAGEALIGN_TOP), meSymbolAlign(SYMBOLALIGN_LEFT)
+mbSmallSymbol(false), maImage(), meImageAlign(IMAGEALIGN_TOP), meSymbolAlign(SymbolAlign::LEFT)
{
}
@@ -463,7 +463,7 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos,
if ( bHasSymbol )
{
- if ( mpButtonData->meSymbolAlign == SYMBOLALIGN_RIGHT )
+ if ( mpButtonData->meSymbolAlign == SymbolAlign::RIGHT )
{
Point aRightPos = Point( aTextPos.X() + aTextSize.Width() + aSymbolSize.Width()/2, aTextPos.Y() );
*pSymbolRect = Rectangle( aRightPos, aSymbolSize );
diff --git a/vcl/source/control/morebtn.cxx b/vcl/source/control/morebtn.cxx
index 8e5e9a6..9d3701c 100644
--- a/vcl/source/control/morebtn.cxx
+++ b/vcl/source/control/morebtn.cxx
@@ -47,7 +47,7 @@ void MoreButton::ImplInit( vcl::Window* pParent, WinBits nStyle )
ShowState();
- SetSymbolAlign(SYMBOLALIGN_RIGHT);
+ SetSymbolAlign(SymbolAlign::RIGHT);
SetImageAlign(IMAGEALIGN_RIGHT); //Resoves: fdo#31849 ensure button remains vertically centered
SetSmallSymbol(true);
commit 93ddb2cc0bedac9a97260826741f7dfcdca0947d
Author: Noel Grandin <noel at peralex.com>
Date: Thu Mar 26 12:54:04 2015 +0200
convert BUTTON_ constants to enum class
Change-Id: I0fd391a6b2850e5d7dcbf2cb95cfa39ee5561bd9
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index 34242c3..d4f6441a 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -913,7 +913,7 @@ NameClashQueryBox::NameClashQueryBox( vcl::Window* pParent,
AddButton( IDE_RESSTR(RID_STR_DLGIMP_CLASH_RENAME), RET_YES,
BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON );
AddButton( IDE_RESSTR(RID_STR_DLGIMP_CLASH_REPLACE), RET_NO, 0 );
- AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
+ AddButton( StandardButtonType::CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
SetImage( QueryBox::GetStandardImage() );
}
@@ -937,8 +937,8 @@ LanguageMismatchQueryBox::LanguageMismatchQueryBox( vcl::Window* pParent,
AddButton( IDE_RESSTR(RID_STR_DLGIMP_MISMATCH_ADD), RET_YES,
BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON );
AddButton( IDE_RESSTR(RID_STR_DLGIMP_MISMATCH_OMIT), RET_NO, 0 );
- AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
- AddButton( BUTTON_HELP, RET_HELP, BUTTONDIALOG_HELPBUTTON, 4 );
+ AddButton( StandardButtonType::CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
+ AddButton( StandardButtonType::HELP, RET_HELP, BUTTONDIALOG_HELPBUTTON, 4 );
SetImage( QueryBox::GetStandardImage() );
}
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index c7367eb..5132ae8 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -5309,10 +5309,10 @@ MessBox( pWindow, WB_DEF_YES, CUI_RES( RID_SVXSTR_REPLACE_ICON_CONFIRM ), CUI_R
SetImage( WarningBox::GetStandardImage() );
SetMessText( ReplaceIconName( aMessage ) );
RemoveButton( 1 );
- AddButton( BUTTON_YES, 2, 0 );
+ AddButton( StandardButtonType::YES, 2, 0 );
AddButton( CUI_RES( RID_SVXSTR_YESTOALL ), 5, 0 );
- AddButton( BUTTON_NO, 3, 0 );
- AddButton( BUTTON_CANCEL, 4, 0 );
+ AddButton( StandardButtonType::NO, 3, 0 );
+ AddButton( StandardButtonType::CANCEL, 4, 0 );
}
SvxIconReplacementDialog :: SvxIconReplacementDialog(
diff --git a/cui/source/dialogs/cuifmsearch.cxx b/cui/source/dialogs/cuifmsearch.cxx
index c4d3b3c..673b7de 100644
--- a/cui/source/dialogs/cuifmsearch.cxx
+++ b/cui/source/dialogs/cuifmsearch.cxx
@@ -77,7 +77,7 @@ void FmSearchDialog::initCommon( const Reference< XResultSet >& _rxCursor )
FmSearchDialog::FmSearchDialog(vcl::Window* pParent, const OUString& sInitialText, const ::std::vector< OUString >& _rContexts, sal_Int16 nInitialContext,
const Link& lnkContextSupplier)
:ModalDialog(pParent, "RecordSearchDialog", "cui/ui/fmsearchdialog.ui")
- ,m_sCancel ( Button::GetStandardText( BUTTON_CANCEL ) )
+ ,m_sCancel( Button::GetStandardText( StandardButtonType::CANCEL ) )
,m_pPreSearchFocus( NULL )
,m_lnkContextSupplier(lnkContextSupplier)
,m_pConfig( NULL )
diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx
index 996cb81..e981ea4 100644
--- a/cui/source/dialogs/hldocntp.cxx
+++ b/cui/source/dialogs/hldocntp.cxx
@@ -311,7 +311,7 @@ void SvxHyperlinkNewDocTp::DoApply ()
if( bOk )
{
WarningBox aWarning( this, WB_YES_NO, CUI_RESSTR(RID_SVXSTR_HYPERDLG_QUERYOVERWRITE) );
- bCreate = aWarning.Execute() == BUTTON_YES;
+ bCreate = aWarning.Execute() == RET_YES;
}
}
diff --git a/dbaccess/source/ui/dlg/sqlmessage.cxx b/dbaccess/source/ui/dlg/sqlmessage.cxx
index f6428a2..2fcc3bb 100644
--- a/dbaccess/source/ui/dlg/sqlmessage.cxx
+++ b/dbaccess/source/ui/dlg/sqlmessage.cxx
@@ -425,12 +425,12 @@ namespace
sal_uInt16 nButtonID = 0;
switch ( _eType )
{
- case BUTTON_YES: nButtonID = RET_YES; break;
- case BUTTON_NO: nButtonID = RET_NO; break;
- case BUTTON_OK: nButtonID = RET_OK; break;
- case BUTTON_CANCEL: nButtonID = RET_CANCEL; break;
- case BUTTON_RETRY: nButtonID = RET_RETRY; break;
- case BUTTON_HELP: nButtonID = RET_HELP; break;
+ case StandardButtonType::YES: nButtonID = RET_YES; break;
+ case StandardButtonType::NO: nButtonID = RET_NO; break;
+ case StandardButtonType::OK: nButtonID = RET_OK; break;
+ case StandardButtonType::CANCEL: nButtonID = RET_CANCEL; break;
+ case StandardButtonType::RETRY: nButtonID = RET_RETRY; break;
+ case StandardButtonType::HELP: nButtonID = RET_HELP; break;
default:
OSL_FAIL( "lcl_addButton: invalid button id!" );
break;
@@ -564,34 +564,34 @@ void OSQLMessageBox::impl_createStandardButtons( WinBits _nStyle )
{
if ( _nStyle & WB_YES_NO_CANCEL )
{
- lcl_addButton( *this, BUTTON_YES, ( _nStyle & WB_DEF_YES ) != 0 );
- lcl_addButton( *this, BUTTON_NO, ( _nStyle & WB_DEF_NO ) != 0 );
- lcl_addButton( *this, BUTTON_CANCEL, ( _nStyle & WB_DEF_CANCEL ) != 0 );
+ lcl_addButton( *this, StandardButtonType::YES, ( _nStyle & WB_DEF_YES ) != 0 );
+ lcl_addButton( *this, StandardButtonType::NO, ( _nStyle & WB_DEF_NO ) != 0 );
+ lcl_addButton( *this, StandardButtonType::CANCEL, ( _nStyle & WB_DEF_CANCEL ) != 0 );
}
else if ( _nStyle & WB_OK_CANCEL )
{
- lcl_addButton( *this, BUTTON_OK, ( _nStyle & WB_DEF_OK ) != 0 );
- lcl_addButton( *this, BUTTON_CANCEL, ( _nStyle & WB_DEF_CANCEL ) != 0 );
+ lcl_addButton( *this, StandardButtonType::OK, ( _nStyle & WB_DEF_OK ) != 0 );
+ lcl_addButton( *this, StandardButtonType::CANCEL, ( _nStyle & WB_DEF_CANCEL ) != 0 );
}
else if ( _nStyle & WB_YES_NO )
{
- lcl_addButton( *this, BUTTON_YES, ( _nStyle & WB_DEF_YES ) != 0 );
- lcl_addButton( *this, BUTTON_NO, ( _nStyle & WB_DEF_NO ) != 0 );
+ lcl_addButton( *this, StandardButtonType::YES, ( _nStyle & WB_DEF_YES ) != 0 );
+ lcl_addButton( *this, StandardButtonType::NO, ( _nStyle & WB_DEF_NO ) != 0 );
}
else if ( _nStyle & WB_RETRY_CANCEL )
{
- lcl_addButton( *this, BUTTON_RETRY, ( _nStyle & WB_DEF_RETRY ) != 0 );
- lcl_addButton( *this, BUTTON_CANCEL, ( _nStyle & WB_DEF_CANCEL ) != 0 );
+ lcl_addButton( *this, StandardButtonType::RETRY, ( _nStyle & WB_DEF_RETRY ) != 0 );
+ lcl_addButton( *this, StandardButtonType::CANCEL, ( _nStyle & WB_DEF_CANCEL ) != 0 );
}
else
{
OSL_ENSURE( WB_OK & _nStyle, "OSQLMessageBox::impl_createStandardButtons: unsupported dialog style requested!" );
- AddButton( BUTTON_OK, RET_OK, BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON );
+ AddButton( StandardButtonType::OK, RET_OK, BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON );
}
if ( !m_sHelpURL.isEmpty() )
{
- lcl_addButton( *this, BUTTON_HELP, false );
+ lcl_addButton( *this, StandardButtonType::HELP, false );
OUString aTmp;
INetURLObject aHID( m_sHelpURL );
@@ -628,7 +628,7 @@ void OSQLMessageBox::impl_addDetailsButton()
if ( bMoreDetailsAvailable )
{
- AddButton( BUTTON_MORE, RET_MORE, 0 );
+ AddButton( StandardButtonType::MORE, RET_MORE, 0 );
PushButton* pButton = GetPushButton( RET_MORE );
OSL_ENSURE( pButton, "OSQLMessageBox::impl_addDetailsButton: just added this button, why isn't it there?" );
pButton->SetClickHdl( LINK( this, OSQLMessageBox, ButtonClickHdl ) );
diff --git a/dbaccess/source/ui/misc/datasourceconnector.cxx b/dbaccess/source/ui/misc/datasourceconnector.cxx
index 24eca91..bc583fa 100644
--- a/dbaccess/source/ui/misc/datasourceconnector.cxx
+++ b/dbaccess/source/ui/misc/datasourceconnector.cxx
@@ -161,7 +161,7 @@ namespace dbaui
if ( aWarnings.hasValue() )
{
OUString sMessage( ModuleRes( STR_WARNINGS_DURING_CONNECT ) );
- sMessage = sMessage.replaceFirst( "$buttontext$", Button::GetStandardText( BUTTON_MORE ) );
+ sMessage = sMessage.replaceFirst( "$buttontext$", Button::GetStandardText( StandardButtonType::MORE ) );
sMessage = OutputDevice::GetNonMnemonicString( sMessage );
SQLWarning aContext;
diff --git a/dbaccess/source/ui/relationdesign/RelationTableView.cxx b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
index ccee138..dd3861b 100644
--- a/dbaccess/source/ui/relationdesign/RelationTableView.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
@@ -342,7 +342,7 @@ void ORelationTableView::lookForUiActivities()
aDlg.RemoveButton(aDlg.GetButtonId(0));
aDlg.AddButton( ModuleRes(STR_QUERY_REL_EDIT), RET_OK, BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON);
aDlg.AddButton( ModuleRes(STR_QUERY_REL_CREATE), RET_YES, 0);
- aDlg.AddButton(BUTTON_CANCEL,RET_CANCEL,0);
+ aDlg.AddButton( StandardButtonType::CANCEL,RET_CANCEL,0);
sal_uInt16 nRet = aDlg.Execute();
if( nRet == RET_CANCEL)
{
diff --git a/include/tools/wintypes.hxx b/include/tools/wintypes.hxx
index 995dcfe..e9282da 100644
--- a/include/tools/wintypes.hxx
+++ b/include/tools/wintypes.hxx
@@ -295,20 +295,22 @@ enum SymbolAlign { SYMBOLALIGN_LEFT, SYMBOLALIGN_RIGHT };
// ButtonDialog-Types
-typedef sal_uInt16 StandardButtonType;
-#define BUTTON_OK ((StandardButtonType)0)
-#define BUTTON_CANCEL ((StandardButtonType)1)
-#define BUTTON_YES ((StandardButtonType)2)
-#define BUTTON_NO ((StandardButtonType)3)
-#define BUTTON_RETRY ((StandardButtonType)4)
-#define BUTTON_HELP ((StandardButtonType)5)
-#define BUTTON_CLOSE ((StandardButtonType)6)
-#define BUTTON_MORE ((StandardButtonType)7)
-#define BUTTON_IGNORE ((StandardButtonType)8)
-#define BUTTON_ABORT ((StandardButtonType)9)
-#define BUTTON_LESS ((StandardButtonType)10)
-#define BUTTON_RESET ((StandardButtonType)11)
-#define BUTTON_COUNT 12
+enum class StandardButtonType
+{
+ OK = 0,
+ CANCEL = 1,
+ YES = 2,
+ NO = 3,
+ RETRY = 4,
+ HELP = 5,
+ CLOSE = 6,
+ MORE = 7,
+ IGNORE = 8,
+ ABORT = 9,
+ LESS = 10,
+ RESET = 11,
+ COUNT = 12,
+};
// prominent place for ListBox window types
diff --git a/svx/source/dialog/prtqry.cxx b/svx/source/dialog/prtqry.cxx
index 14a2c9a..6d65338 100644
--- a/svx/source/dialog/prtqry.cxx
+++ b/svx/source/dialog/prtqry.cxx
@@ -33,7 +33,7 @@ SvxPrtQryBox::SvxPrtQryBox(vcl::Window* pParent) :
BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON);
AddButton(SVX_RESSTR(RID_SVXSTR_QRY_PRINT_ALL), 2, 0);
- AddButton(BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON);
+ AddButton(StandardButtonType::CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON);
SetButtonHelpText( RET_OK, OUString() );
}
diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx
index 53ed61e..3f7cfb9 100644
--- a/svx/source/tbxctrls/layctrl.cxx
+++ b/svx/source/tbxctrls/layctrl.cxx
@@ -665,7 +665,7 @@ void ColumnsWindow::Paint( const Rectangle& )
if ( nCol )
aText = OUString::number(nCol);
else
- aText = comphelper::string::remove(Button::GetStandardText(BUTTON_CANCEL), '~');
+ aText = comphelper::string::remove(Button::GetStandardText(StandardButtonType::CANCEL), '~');
Size aTextSize(GetTextWidth( aText ), GetTextHeight());
DrawText( Point( ( aSize.Width() - aTextSize.Width() ) / 2, aSize.Height() - nTextHeight + 2 ), aText );
diff --git a/uui/source/alreadyopen.cxx b/uui/source/alreadyopen.cxx
index e53a9b3..d5cf01b 100644
--- a/uui/source/alreadyopen.cxx
+++ b/uui/source/alreadyopen.cxx
@@ -32,14 +32,14 @@ AlreadyOpenQueryBox::AlreadyOpenQueryBox( vcl::Window* pParent, ResMgr* pResMgr,
AddButton( ResId(STR_ALREADYOPEN_RETRY_SAVE_BTN, *pResMgr).toString(), RET_YES,
BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON );
AddButton( ResId(STR_ALREADYOPEN_SAVE_BTN, *pResMgr).toString(), RET_NO, 0 );
- AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
+ AddButton( StandardButtonType::CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
}
else
{
AddButton( ResId(STR_ALREADYOPEN_READONLY_BTN, *pResMgr).toString(), RET_YES,
BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON );
AddButton( ResId(STR_ALREADYOPEN_OPEN_BTN, *pResMgr).toString(), RET_NO, 0 );
- AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
+ AddButton( StandardButtonType::CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
}
SetButtonHelpText( RET_YES, OUString() );
diff --git a/uui/source/filechanged.cxx b/uui/source/filechanged.cxx
index 0a4bd33..5ab63f7 100644
--- a/uui/source/filechanged.cxx
+++ b/uui/source/filechanged.cxx
@@ -29,7 +29,7 @@ FileChangedQueryBox::FileChangedQueryBox( vcl::Window* pParent, ResMgr* pResMgr
AddButton(ResId(STR_FILECHANGED_SAVEANYWAY_BTN, *pResMgr).toString(), RET_YES,
BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON);
- AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
+ AddButton( StandardButtonType::CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
SetButtonHelpText( RET_YES, OUString() );
SetMessText(ResId(STR_FILECHANGED_MSG, *pResMgr).toString());
diff --git a/uui/source/lockfailed.cxx b/uui/source/lockfailed.cxx
index 48c4f23..aa75130 100644
--- a/uui/source/lockfailed.cxx
+++ b/uui/source/lockfailed.cxx
@@ -29,8 +29,8 @@ LockFailedQueryBox::LockFailedQueryBox( vcl::Window* pParent, ResMgr* pResMgr )
{
SetImage( ErrorBox::GetStandardImage() );
- AddButton( BUTTON_OK, RET_OK, BUTTONDIALOG_OKBUTTON );
- AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
+ AddButton( StandardButtonType::OK, RET_OK, BUTTONDIALOG_OKBUTTON );
+ AddButton( StandardButtonType::CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
SetMessText(ResId(STR_LOCKFAILED_MSG, *pResMgr ).toString());
SetCheckBoxText(ResId(STR_LOCKFAILED_DONTSHOWAGAIN, *pResMgr).toString());
diff --git a/uui/source/openlocked.cxx b/uui/source/openlocked.cxx
index b4f7ee5..a1618bb 100644
--- a/uui/source/openlocked.cxx
+++ b/uui/source/openlocked.cxx
@@ -32,7 +32,7 @@ OpenLockedQueryBox::OpenLockedQueryBox( vcl::Window* pParent, ResMgr* pResMgr, c
AddButton(ResId(STR_OPENLOCKED_OPENCOPY_BTN, *pResMgr).toString(), RET_NO, 0);
- AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
+ AddButton( StandardButtonType::CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
SetButtonHelpText( RET_YES, OUString() );
SetButtonHelpText( RET_NO, OUString() );
diff --git a/uui/source/trylater.cxx b/uui/source/trylater.cxx
index 8c1c570..1446397 100644
--- a/uui/source/trylater.cxx
+++ b/uui/source/trylater.cxx
@@ -30,7 +30,7 @@ TryLaterQueryBox::TryLaterQueryBox( vcl::Window* pParent, ResMgr* pResMgr, const
AddButton(ResId(STR_TRYLATER_RETRYSAVING_BTN, *pResMgr).toString(), RET_YES,
BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON);
AddButton(ResId(STR_TRYLATER_SAVEAS_BTN, *pResMgr).toString(), RET_NO, 0);
- AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
+ AddButton( StandardButtonType::CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
SetButtonHelpText( RET_YES, OUString() );
SetButtonHelpText( RET_NO, OUString() );
diff --git a/vcl/generic/app/gensys.cxx b/vcl/generic/app/gensys.cxx
index 9eda402..ea19ebb 100644
--- a/vcl/generic/app/gensys.cxx
+++ b/vcl/generic/app/gensys.cxx
@@ -42,7 +42,7 @@ using namespace com::sun::star;
namespace {
-OUString GetNativeMessageBoxButtonText( int nButtonId, bool bUseResources )
+OUString GetNativeMessageBoxButtonText( StandardButtonType nButtonId, bool bUseResources )
{
OUString aText;
if( bUseResources )
@@ -53,27 +53,28 @@ OUString GetNativeMessageBoxButtonText( int nButtonId, bool bUseResources )
{
switch( nButtonId )
{
- case BUTTON_OK:
+ case StandardButtonType::OK:
aText = "OK";
break;
- case BUTTON_CANCEL:
+ case StandardButtonType::CANCEL:
aText = "Cancel";
break;
- case BUTTON_ABORT:
+ case StandardButtonType::ABORT:
aText = "Abort";
break;
- case BUTTON_RETRY:
+ case StandardButtonType::RETRY:
aText = "Retry";
break;
- case BUTTON_IGNORE:
+ case StandardButtonType::IGNORE:
aText = "Ignore";
break;
- case BUTTON_YES:
+ case StandardButtonType::YES:
aText = "Yes";
break;
- case BUTTON_NO:
+ case StandardButtonType::NO:
aText = "No";
break;
+ default: break;
}
}
return aText;
@@ -102,15 +103,15 @@ int SalGenericSystem::ShowNativeMessageBox( const OUString& rTitle, const OUStri
if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK ||
nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL )
{
- aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_OK, bUseResources ) );
+ aButtons.push_back( GetNativeMessageBoxButtonText( StandardButtonType::OK, bUseResources ) );
nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK;
}
if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL ||
nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO )
{
- aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_YES, bUseResources ) );
+ aButtons.push_back( GetNativeMessageBoxButtonText( StandardButtonType::YES, bUseResources ) );
nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES;
- aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_NO, bUseResources ) );
+ aButtons.push_back( GetNativeMessageBoxButtonText( StandardButtonType::NO, bUseResources ) );
nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO;
if( nDefaultButton == SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO )
nDefButton = 1;
@@ -121,21 +122,21 @@ int SalGenericSystem::ShowNativeMessageBox( const OUString& rTitle, const OUStri
{
if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL )
{
- aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_RETRY, bUseResources ) );
+ aButtons.push_back( GetNativeMessageBoxButtonText( StandardButtonType::RETRY, bUseResources ) );
nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY;
}
- aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_CANCEL, bUseResources ) );
+ aButtons.push_back( GetNativeMessageBoxButtonText( StandardButtonType::CANCEL, bUseResources ) );
nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL;
if( nDefaultButton == SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL )
nDefButton = aButtons.size()-1;
}
if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE )
{
- aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_ABORT, bUseResources ) );
+ aButtons.push_back( GetNativeMessageBoxButtonText( StandardButtonType::ABORT, bUseResources ) );
nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_ABORT;
- aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_RETRY, bUseResources ) );
+ aButtons.push_back( GetNativeMessageBoxButtonText( StandardButtonType::RETRY, bUseResources ) );
nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY;
- aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_IGNORE, bUseResources ) );
+ aButtons.push_back( GetNativeMessageBoxButtonText( StandardButtonType::IGNORE, bUseResources ) );
nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_IGNORE;
switch( nDefaultButton )
{
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 83a248a..e6a1d34 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -115,7 +115,7 @@ OUString Button::GetStandardText( StandardButtonType eButton )
{
sal_uInt32 nResId;
const char* pDefText;
- } aResIdAry[BUTTON_COUNT] =
+ } aResIdAry[static_cast<int>(StandardButtonType::COUNT)] =
{
{ SV_BUTTONTEXT_OK, "~OK" },
{ SV_BUTTONTEXT_CANCEL, "~Cancel" },
@@ -1653,7 +1653,7 @@ void OKButton::ImplInit( vcl::Window* pParent, WinBits nStyle )
{
PushButton::ImplInit( pParent, nStyle );
- SetText( Button::GetStandardText( BUTTON_OK ) );
+ SetText( Button::GetStandardText( StandardButtonType::OK ) );
}
OKButton::OKButton( vcl::Window* pParent, WinBits nStyle ) :
@@ -1698,7 +1698,7 @@ void CancelButton::ImplInit( vcl::Window* pParent, WinBits nStyle )
{
PushButton::ImplInit( pParent, nStyle );
- SetText( Button::GetStandardText( BUTTON_CANCEL ) );
+ SetText( Button::GetStandardText( StandardButtonType::CANCEL ) );
}
CancelButton::CancelButton( vcl::Window* pParent, WinBits nStyle ) :
@@ -1742,14 +1742,14 @@ void CancelButton::Click()
CloseButton::CloseButton( vcl::Window* pParent, WinBits nStyle )
: CancelButton(pParent, nStyle)
{
- SetText( Button::GetStandardText( BUTTON_CLOSE ) );
+ SetText( Button::GetStandardText( StandardButtonType::CLOSE ) );
}
void HelpButton::ImplInit( vcl::Window* pParent, WinBits nStyle )
{
PushButton::ImplInit( pParent, nStyle | WB_NOPOINTERFOCUS );
- SetText( Button::GetStandardText( BUTTON_HELP ) );
+ SetText( Button::GetStandardText( StandardButtonType::HELP ) );
}
HelpButton::HelpButton( vcl::Window* pParent, WinBits nStyle ) :
diff --git a/vcl/source/control/morebtn.cxx b/vcl/source/control/morebtn.cxx
index 0b585a1..8e5e9a6 100644
--- a/vcl/source/control/morebtn.cxx
+++ b/vcl/source/control/morebtn.cxx
@@ -42,8 +42,8 @@ void MoreButton::ImplInit( vcl::Window* pParent, WinBits nStyle )
PushButton::ImplInit( pParent, nStyle );
- mpMBData->maMoreText = Button::GetStandardText( BUTTON_MORE );
- mpMBData->maLessText = Button::GetStandardText( BUTTON_LESS );
+ mpMBData->maMoreText = Button::GetStandardText( StandardButtonType::MORE );
+ mpMBData->maLessText = Button::GetStandardText( StandardButtonType::LESS );
ShowState();
diff --git a/vcl/source/window/btndlg.cxx b/vcl/source/window/btndlg.cxx
index 94862da..b211dcf 100644
--- a/vcl/source/window/btndlg.cxx
+++ b/vcl/source/window/btndlg.cxx
@@ -296,18 +296,18 @@ void ButtonDialog::AddButton( StandardButtonType eType, sal_uInt16 nId,
pItem->mbOwnButton = true;
pItem->mnSepSize = nSepPixel;
- if ( eType == BUTTON_OK )
+ if ( eType == StandardButtonType::OK )
nBtnFlags |= BUTTONDIALOG_OKBUTTON;
- else if ( eType == BUTTON_HELP )
+ else if ( eType == StandardButtonType::HELP )
nBtnFlags |= BUTTONDIALOG_HELPBUTTON;
- else if ( (eType == BUTTON_CANCEL) || (eType == BUTTON_CLOSE) )
+ else if ( (eType == StandardButtonType::CANCEL) || (eType == StandardButtonType::CLOSE) )
nBtnFlags |= BUTTONDIALOG_CANCELBUTTON;
pItem->mpPushButton = ImplCreatePushButton( nBtnFlags );
// Standard-Buttons have the right text already
- if ( !((eType == BUTTON_OK) && (pItem->mpPushButton->GetType() == WINDOW_OKBUTTON)) ||
- !((eType == BUTTON_CANCEL) && (pItem->mpPushButton->GetType() == WINDOW_CANCELBUTTON)) ||
- !((eType == BUTTON_HELP) && (pItem->mpPushButton->GetType() == WINDOW_HELPBUTTON)) )
+ if ( !((eType == StandardButtonType::OK) && (pItem->mpPushButton->GetType() == WINDOW_OKBUTTON)) ||
+ !((eType == StandardButtonType::CANCEL) && (pItem->mpPushButton->GetType() == WINDOW_CANCELBUTTON)) ||
+ !((eType == StandardButtonType::HELP) && (pItem->mpPushButton->GetType() == WINDOW_HELPBUTTON)) )
{
pItem->mpPushButton->SetText( Button::GetStandardText( eType ) );
}
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 5495e7c..8548eaf 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -2171,14 +2171,14 @@ short MessageDialog::Execute()
break;
case VCL_BUTTONS_YES_NO:
pBtn = new PushButton(pButtonBox);
- pBtn->SetText(Button::GetStandardText(BUTTON_YES));
+ pBtn->SetText(Button::GetStandardText(StandardButtonType::YES));
pBtn->Show();
m_aOwnedButtons.push_back(pBtn);
m_aResponses[pBtn] = RET_YES;
pBtn = new PushButton(pButtonBox);
pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
- pBtn->SetText(Button::GetStandardText(BUTTON_NO));
+ pBtn->SetText(Button::GetStandardText(StandardButtonType::NO));
pBtn->Show();
m_aOwnedButtons.push_back(pBtn);
m_aResponses[pBtn] = RET_NO;
diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx
index 035d97f..3fdb647 100644
--- a/vcl/source/window/msgbox.cxx
+++ b/vcl/source/window/msgbox.cxx
@@ -75,8 +75,8 @@ void MessBox::ImplInitButtons()
else // WB_DEF_OK
nOKFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
- AddButton( BUTTON_OK, RET_OK, nOKFlags );
- AddButton( BUTTON_CANCEL, RET_CANCEL, nCancelFlags );
+ AddButton( StandardButtonType::OK, RET_OK, nOKFlags );
+ AddButton( StandardButtonType::CANCEL, RET_CANCEL, nCancelFlags );
}
else if ( nStyle & WB_YES_NO )
{
@@ -86,8 +86,8 @@ void MessBox::ImplInitButtons()
nNoFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
nNoFlags |= BUTTONDIALOG_CANCELBUTTON;
- AddButton( BUTTON_YES, RET_YES, nYesFlags );
- AddButton( BUTTON_NO, RET_NO, nNoFlags );
+ AddButton( StandardButtonType::YES, RET_YES, nYesFlags );
+ AddButton( StandardButtonType::NO, RET_NO, nNoFlags );
}
else if ( nStyle & WB_YES_NO_CANCEL )
{
@@ -98,9 +98,9 @@ void MessBox::ImplInitButtons()
else
nCancelFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
- AddButton( BUTTON_YES, RET_YES, nYesFlags );
- AddButton( BUTTON_NO, RET_NO, nNoFlags );
- AddButton( BUTTON_CANCEL, RET_CANCEL, nCancelFlags );
+ AddButton( StandardButtonType::YES, RET_YES, nYesFlags );
+ AddButton( StandardButtonType::NO, RET_NO, nNoFlags );
+ AddButton( StandardButtonType::CANCEL, RET_CANCEL, nCancelFlags );
}
else if ( nStyle & WB_RETRY_CANCEL )
{
@@ -109,8 +109,8 @@ void MessBox::ImplInitButtons()
else // WB_DEF_RETRY
nRetryFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
- AddButton( BUTTON_RETRY, RET_RETRY, nRetryFlags );
- AddButton( BUTTON_CANCEL, RET_CANCEL, nCancelFlags );
+ AddButton( StandardButtonType::RETRY, RET_RETRY, nRetryFlags );
+ AddButton( StandardButtonType::CANCEL, RET_CANCEL, nCancelFlags );
}
else if ( nStyle & WB_ABORT_RETRY_IGNORE )
{
@@ -124,15 +124,15 @@ void MessBox::ImplInitButtons()
else if ( nStyle & WB_DEF_IGNORE )
nIgnoreFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
- AddButton( BUTTON_ABORT, RET_CANCEL, nAbortFlags );
- AddButton( BUTTON_RETRY, RET_RETRY, nRetryFlags );
- AddButton( BUTTON_IGNORE, RET_IGNORE, nIgnoreFlags );
+ AddButton( StandardButtonType::ABORT, RET_CANCEL, nAbortFlags );
+ AddButton( StandardButtonType::RETRY, RET_RETRY, nRetryFlags );
+ AddButton( StandardButtonType::IGNORE, RET_IGNORE, nIgnoreFlags );
}
else if ( nStyle & WB_OK )
{
nOKFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
- AddButton( BUTTON_OK, RET_OK, nOKFlags );
+ AddButton( StandardButtonType::OK, RET_OK, nOKFlags );
}
}
@@ -162,7 +162,7 @@ void MessBox::ImplPosControls()
{
if ( !mbHelpBtn )
{
- AddButton( BUTTON_HELP, RET_HELP, BUTTONDIALOG_HELPBUTTON, 3 );
+ AddButton( StandardButtonType::HELP, RET_HELP, BUTTONDIALOG_HELPBUTTON, 3 );
mbHelpBtn = true;
}
}
commit 402ae4c06c0935b0b2bfe9aeb6f961a65702e307
Author: Noel Grandin <noel at peralex.com>
Date: Thu Mar 26 11:09:26 2015 +0200
convert ProminentEntry to enum class
Change-Id: I51578e83a6a44beece174792c9e3e59f7f8c5fef
diff --git a/include/tools/wintypes.hxx b/include/tools/wintypes.hxx
index c26833e..995dcfe 100644
--- a/include/tools/wintypes.hxx
+++ b/include/tools/wintypes.hxx
@@ -312,7 +312,7 @@ typedef sal_uInt16 StandardButtonType;
// prominent place for ListBox window types
-enum ProminentEntry { PROMINENT_TOP, PROMINENT_MIDDLE };
+enum class ProminentEntry { TOP, MIDDLE };
#endif
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index e3576cb..60874a7 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -1530,7 +1530,7 @@ void FontSizeBox::ImplInit()
SetDecimalDigits( 1 );
SetMin( 20 );
SetMax( 9999 );
- SetProminentEntryType( PROMINENT_MIDDLE );
+ SetProminentEntryType( ProminentEntry::MIDDLE );
}
void FontSizeBox::Reformat()
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index 0121b61..2ec9233 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -524,7 +524,7 @@ ImplListBoxWindow::ImplListBoxWindow( vcl::Window* pParent, WinBits nWinStyle )
mnCurrentPos = LISTBOX_ENTRY_NOTFOUND;
mnTrackingSaveSelection = LISTBOX_ENTRY_NOTFOUND;
mnSeparatorPos = LISTBOX_ENTRY_NOTFOUND;
- meProminentType = PROMINENT_TOP;
+ meProminentType = ProminentEntry::TOP;
SetLineColor();
SetTextFillColor();
@@ -1992,7 +1992,7 @@ void ImplListBoxWindow::SetTopEntry( sal_Int32 nTop )
void ImplListBoxWindow::ShowProminentEntry( sal_Int32 nEntryPos )
{
- if( meProminentType == PROMINENT_MIDDLE )
+ if( meProminentType == ProminentEntry::MIDDLE )
{
sal_Int32 nPos = nEntryPos;
long nWHeight = PixelToLogic( GetSizePixel() ).Height();
More information about the Libreoffice-commits
mailing list