[Libreoffice-commits] core.git: 11 commits - include/svx l10ntools/inc l10ntools/source rsc/inc rsc/source sd/source svtools/source svx/source sw/inc sw/source
Noel Grandin
noel.grandin at collabora.co.uk
Fri Nov 25 07:08:23 UTC 2016
include/svx/srchdlg.hxx | 4
l10ntools/inc/export.hxx | 10 +-
l10ntools/source/cfgmerge.cxx | 2
l10ntools/source/export.cxx | 10 +-
l10ntools/source/helpmerge.cxx | 2
l10ntools/source/lngmerge.cxx | 4
l10ntools/source/merge.cxx | 8 -
l10ntools/source/propmerge.cxx | 2
l10ntools/source/treemerge.cxx | 2
l10ntools/source/uimerge.cxx | 2
l10ntools/source/xrmmerge.cxx | 4
rsc/inc/rscall.h | 27 +++---
rsc/inc/rscclass.hxx | 2
rsc/inc/rscdb.hxx | 8 -
rsc/inc/rscrsc.hxx | 4
rsc/inc/rsctop.hxx | 25 +++--
rsc/source/parser/rscdb.cxx | 2
rsc/source/parser/rscicpx.cxx | 48 +++++-----
rsc/source/parser/rscinit.cxx | 2
rsc/source/res/rscclass.cxx | 84 ++++++-------------
rsc/source/rsc/rsc.cxx | 36 ++++----
sd/source/ui/unoidl/unoobj.cxx | 87 ++++++++++---------
svtools/source/config/htmlcfg.cxx | 110 ++++++++++++------------
svx/source/dialog/srchdlg.cxx | 119 ++++++++++++++-------------
svx/source/tbxctrls/tbcontrl.cxx | 63 +++++++-------
sw/inc/swurl.hxx | 12 ++
sw/source/core/access/acchyperlink.cxx | 2
sw/source/core/access/accnotexthyperlink.cxx | 4
sw/source/core/inc/SwXMLTextBlocks.hxx | 13 ++
sw/source/core/swg/SwXMLTextBlocks.cxx | 14 +--
sw/source/core/swg/SwXMLTextBlocks1.cxx | 2
sw/source/filter/html/css1atr.cxx | 79 +++++++++--------
sw/source/uibase/docvw/SidebarTxtControl.cxx | 2
sw/source/uibase/docvw/edtwin.cxx | 4
sw/source/uibase/docvw/romenu.cxx | 9 +-
sw/source/uibase/inc/wrtsh.hxx | 4
sw/source/uibase/wrtsh/wrtsh2.cxx | 8 -
37 files changed, 425 insertions(+), 395 deletions(-)
New commits:
commit ca83b1fa13db6b3f038b5c4965f50caec90af364
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Nov 24 16:25:37 2016 +0200
convert CSS1_FRMSIZE constants to o3tl::typed_flags
Change-Id: I273166513253a2108c11a9cbae027bde7ca82b99
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index 42243cc..b3e3711 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -91,6 +91,7 @@
#include <IDocumentStylePoolAccess.hxx>
#include <numrule.hxx>
+#include <o3tl/typed_flags_set.hxx>
#include <rtl/strbuf.hxx>
@@ -107,12 +108,18 @@ enum class Css1Background {
Section = 5
};
-#define CSS1_FRMSIZE_WIDTH 0x01
-#define CSS1_FRMSIZE_VARHEIGHT 0x02
-#define CSS1_FRMSIZE_MINHEIGHT 0x04
-#define CSS1_FRMSIZE_FIXHEIGHT 0x08
-#define CSS1_FRMSIZE_ANYHEIGHT 0x0e
-#define CSS1_FRMSIZE_PIXEL 0x10
+enum class Css1FrameSize {
+ NONE = 0x00,
+ Width = 0x01,
+ VarHeight = 0x02,
+ MinHeight = 0x04,
+ FixHeight = 0x08,
+ AnyHeight = 0x0e,
+ Pixel = 0x10,
+};
+namespace o3tl {
+ template<> struct typed_flags<Css1FrameSize> : is_typed_flags<Css1FrameSize, 0x1f> {};
+}
#define DOT_LEADERS_MAX_WIDTH 18
@@ -149,7 +156,7 @@ static Writer& OutCSS1_SvxBrush( Writer& rWrt, const SfxPoolItem& rHt,
const OUString *pGraphicName );
static Writer& OutCSS1_SvxBrush( Writer& rWrt, const SfxPoolItem& rHt );
static Writer& OutCSS1_SwFormatFrameSize( Writer& rWrt, const SfxPoolItem& rHt,
- sal_uInt16 nMode );
+ Css1FrameSize nMode );
static Writer& OutCSS1_SvxFormatBreak_SwFormatPDesc_SvxFormatKeep( Writer& rWrt,
const SfxItemSet& rItemSet,
bool bDeep );
@@ -2110,13 +2117,13 @@ void SwHTMLWriter::OutCSS1_FrameFormatOptions( const SwFrameFormat& rFrameFormat
"Export absolute size" );
OSL_ENSURE( HTML_FRMOPT_ANYSIZE & nFrameOpts,
"Export every size" );
- sal_uInt16 nMode = 0;
+ Css1FrameSize nMode = Css1FrameSize::NONE;
if( nFrameOpts & HTML_FRMOPT_S_WIDTH )
- nMode |= CSS1_FRMSIZE_WIDTH;
+ nMode |= Css1FrameSize::Width;
if( nFrameOpts & HTML_FRMOPT_S_HEIGHT )
- nMode |= (CSS1_FRMSIZE_MINHEIGHT|CSS1_FRMSIZE_FIXHEIGHT);
+ nMode |= (Css1FrameSize::MinHeight|Css1FrameSize::FixHeight);
if( nFrameOpts & HTML_FRMOPT_S_PIXSIZE )
- nMode |= CSS1_FRMSIZE_PIXEL;
+ nMode |= Css1FrameSize::Pixel;
OutCSS1_SwFormatFrameSize( *this, rFrameFormat.GetFrameSize(), nMode );
}
@@ -2923,13 +2930,13 @@ static Writer& OutCSS1_SwFormatDrop( Writer& rWrt, const SfxPoolItem& rHt )
}
static Writer& OutCSS1_SwFormatFrameSize( Writer& rWrt, const SfxPoolItem& rHt,
- sal_uInt16 nMode )
+ Css1FrameSize nMode )
{
SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
const SwFormatFrameSize& rFSItem = static_cast<const SwFormatFrameSize&>(rHt);
- if( nMode & CSS1_FRMSIZE_WIDTH )
+ if( nMode & Css1FrameSize::Width )
{
sal_uInt8 nPrcWidth = rFSItem.GetWidthPercent();
if( nPrcWidth )
@@ -2937,7 +2944,7 @@ static Writer& OutCSS1_SwFormatFrameSize( Writer& rWrt, const SfxPoolItem& rHt,
OString sOut(OString::number(nPrcWidth) + "%");
rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_width, sOut);
}
- else if( nMode & CSS1_FRMSIZE_PIXEL )
+ else if( nMode & Css1FrameSize::Pixel )
{
rHTMLWrt.OutCSS1_PixelProperty( sCSS1_P_width,
rFSItem.GetSize().Width(), false );
@@ -2949,19 +2956,19 @@ static Writer& OutCSS1_SwFormatFrameSize( Writer& rWrt, const SfxPoolItem& rHt,
}
}
- if( nMode & CSS1_FRMSIZE_ANYHEIGHT )
+ if( nMode & Css1FrameSize::AnyHeight )
{
bool bOutHeight = false;
switch( rFSItem.GetHeightSizeType() )
{
case ATT_FIX_SIZE:
- bOutHeight = (nMode & CSS1_FRMSIZE_FIXHEIGHT) != 0;
+ bOutHeight = bool(nMode & Css1FrameSize::FixHeight);
break;
case ATT_MIN_SIZE:
- bOutHeight = (nMode & CSS1_FRMSIZE_MINHEIGHT) != 0;
+ bOutHeight = bool(nMode & Css1FrameSize::MinHeight);
break;
case ATT_VAR_SIZE:
- bOutHeight = (nMode & CSS1_FRMSIZE_VARHEIGHT) != 0;
+ bOutHeight = bool(nMode & Css1FrameSize::VarHeight);
break;
default:
OSL_ENSURE( bOutHeight, "Hoehe wird nicht exportiert" );
@@ -2976,7 +2983,7 @@ static Writer& OutCSS1_SwFormatFrameSize( Writer& rWrt, const SfxPoolItem& rHt,
OString sOut(OString::number(nPrcHeight) + "%");
rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_height, sOut);
}
- else if( nMode & CSS1_FRMSIZE_PIXEL )
+ else if( nMode & Css1FrameSize::Pixel )
{
rHTMLWrt.OutCSS1_PixelProperty( sCSS1_P_height,
rFSItem.GetSize().Height(),
commit 1f03d97e1dd9e41f91006594baa4a61e74a32586
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Nov 24 16:21:59 2016 +0200
convert CSS1_BACKGROUND constants to scoped enum
Change-Id: Ice20f26e9104126b572446250c94b90ab9dd3da7
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index 40b7a98..42243cc 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -99,11 +99,13 @@ using editeng::SvxBorderLine;
#define HTML_HEADSPACE (12*20)
-#define CSS1_BACKGROUND_ATTR 1
-#define CSS1_BACKGROUND_PAGE 2
-#define CSS1_BACKGROUND_TABLE 3
-#define CSS1_BACKGROUND_FLY 4
-#define CSS1_BACKGROUND_SECTION 5
+enum class Css1Background {
+ Attr = 1,
+ Page = 2,
+ Table = 3,
+ Fly = 4,
+ Section = 5
+};
#define CSS1_FRMSIZE_WIDTH 0x01
#define CSS1_FRMSIZE_VARHEIGHT 0x02
@@ -143,7 +145,7 @@ static Writer& OutCSS1_SvxULSpace_SvxLRSpace( Writer& rWrt,
const SfxItemSet& rItemSet,
bool bDeep );
static Writer& OutCSS1_SvxBrush( Writer& rWrt, const SfxPoolItem& rHt,
- sal_uInt16 nMode,
+ Css1Background nMode,
const OUString *pGraphicName );
static Writer& OutCSS1_SvxBrush( Writer& rWrt, const SfxPoolItem& rHt );
static Writer& OutCSS1_SwFormatFrameSize( Writer& rWrt, const SfxPoolItem& rHt,
@@ -1848,7 +1850,7 @@ Writer& OutCSS1_BodyTagStyleOpt( Writer& rWrt, const SfxItemSet& rItemSet,
if( SfxItemState::SET == rItemSet.GetItemState( RES_BACKGROUND, false,
&pItem ) )
{
- OutCSS1_SvxBrush( rWrt, *pItem, CSS1_BACKGROUND_PAGE, &rEmbeddedGraphicName );
+ OutCSS1_SvxBrush( rWrt, *pItem, Css1Background::Page, &rEmbeddedGraphicName );
}
if( SfxItemState::SET == rItemSet.GetItemState( RES_BOX, false,
@@ -1917,7 +1919,7 @@ Writer& OutCSS1_TableBGStyleOpt( Writer& rWrt, const SfxPoolItem& rHt )
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_STYLE_OPT_ON |
CSS1_OUTMODE_ENCODE|
CSS1_OUTMODE_TABLEBOX, nullptr );
- OutCSS1_SvxBrush( rWrt, rHt, CSS1_BACKGROUND_TABLE, nullptr );
+ OutCSS1_SvxBrush( rWrt, rHt, Css1Background::Table, nullptr );
if( !rHTMLWrt.m_bFirstCSS1Property )
rWrt.Strm().WriteChar( '\"' );
@@ -2165,7 +2167,7 @@ void SwHTMLWriter::OutCSS1_TableFrameFormatOptions( const SwFrameFormat& rFrameF
const SfxPoolItem *pItem;
const SfxItemSet& rItemSet = rFrameFormat.GetAttrSet();
if( SfxItemState::SET==rItemSet.GetItemState( RES_BACKGROUND, false, &pItem ) )
- OutCSS1_SvxBrush( *this, *pItem, CSS1_BACKGROUND_TABLE, nullptr );
+ OutCSS1_SvxBrush( *this, *pItem, Css1Background::Table, nullptr );
if( IsHTMLMode( HTMLMODE_PRINT_EXT ) )
OutCSS1_SvxFormatBreak_SwFormatPDesc_SvxFormatKeep( *this, rItemSet, false );
@@ -2197,7 +2199,7 @@ void SwHTMLWriter::OutCSS1_SectionFormatOptions( const SwFrameFormat& rFrameForm
const SfxPoolItem *pItem;
const SfxItemSet& rItemSet = rFrameFormat.GetAttrSet();
if( SfxItemState::SET==rItemSet.GetItemState( RES_BACKGROUND, false, &pItem ) )
- OutCSS1_SvxBrush( *this, *pItem, CSS1_BACKGROUND_SECTION, nullptr );
+ OutCSS1_SvxBrush( *this, *pItem, Css1Background::Section, nullptr );
if (pCol)
{
@@ -2219,7 +2221,7 @@ static bool OutCSS1_FrameFormatBrush( SwHTMLWriter& rWrt,
!rBrushItem.GetGraphicLink().isEmpty() ||
0 != rBrushItem.GetGraphicPos() )
{
- OutCSS1_SvxBrush( rWrt, rBrushItem, CSS1_BACKGROUND_FLY, nullptr );
+ OutCSS1_SvxBrush( rWrt, rBrushItem, Css1Background::Fly, nullptr );
bWritten = true;
}
return bWritten;
@@ -3197,12 +3199,12 @@ static Writer& OutCSS1_SvxFormatBreak_SwFormatPDesc_SvxFormatKeep( Writer& rWrt,
// Wrapper for OutCSS1_SfxItemSet etc.
static Writer& OutCSS1_SvxBrush( Writer& rWrt, const SfxPoolItem& rHt )
{
- OutCSS1_SvxBrush( rWrt, rHt, CSS1_BACKGROUND_ATTR, nullptr );
+ OutCSS1_SvxBrush( rWrt, rHt, Css1Background::Attr, nullptr );
return rWrt;
}
static Writer& OutCSS1_SvxBrush( Writer& rWrt, const SfxPoolItem& rHt,
- sal_uInt16 nMode,
+ Css1Background nMode,
const OUString* pGraphicName)
{
SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
@@ -3219,7 +3221,7 @@ static Writer& OutCSS1_SvxBrush( Writer& rWrt, const SfxPoolItem& rHt,
OUString aLink = pGraphicName ? *pGraphicName
: static_cast<const SvxBrushItem &>(rHt).GetGraphicLink();
SvxGraphicPosition ePos = static_cast<const SvxBrushItem &>(rHt).GetGraphicPos();
- if( CSS1_BACKGROUND_PAGE==nMode && !rHTMLWrt.mbEmbedImages )
+ if( Css1Background::Page == nMode && !rHTMLWrt.mbEmbedImages )
{
// page style images are exported if not tiled
if( aLink.isEmpty() || GPOS_TILED==ePos )
@@ -3262,7 +3264,7 @@ static Writer& OutCSS1_SvxBrush( Writer& rWrt, const SfxPoolItem& rHt,
aLink = aGraphicAsLink;
}
// In tables we only export something if there is a Graphic
- if( CSS1_BACKGROUND_TABLE==nMode && !pGrf && !aLink.isEmpty())
+ if( Css1Background::Table==nMode && !pGrf && !aLink.isEmpty())
return rWrt;
// if necessary, add the orientation of the Graphic
@@ -3333,7 +3335,7 @@ static Writer& OutCSS1_SvxBrush( Writer& rWrt, const SfxPoolItem& rHt,
if( !pGrf && aLink.isEmpty() && !bColor )
{
// no color and no Link, but a transparent Brush
- if( bTransparent && CSS1_BACKGROUND_FLY != nMode )
+ if( bTransparent && Css1Background::Fly != nMode )
sOut += OStringToOUString(sCSS1_PV_transparent, RTL_TEXTENCODING_ASCII_US);
}
else
commit 9b1fdb2e46ead75d6d190b2d091f1e7d948a82c2
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Nov 24 16:10:49 2016 +0200
convert SWXML constants to o3tl::typed_flags
and remove some dead code
Change-Id: Ibda8c4a93e2f1d58b57bfa506eabb6bd29643f74
diff --git a/sw/source/core/inc/SwXMLTextBlocks.hxx b/sw/source/core/inc/SwXMLTextBlocks.hxx
index 8cf9d80..d766e25 100644
--- a/sw/source/core/inc/SwXMLTextBlocks.hxx
+++ b/sw/source/core/inc/SwXMLTextBlocks.hxx
@@ -23,19 +23,26 @@
#include <sfx2/objsh.hxx>
#include <sfx2/docfile.hxx>
#include <swblocks.hxx>
+#include <o3tl/typed_flags_set.hxx>
class SwPaM;
class SwDoc;
class SvxMacroTableDtor;
-#define SWXML_CONVBLOCK 0x0001
-#define SWXML_NOROOTCOMMIT 0x0002
+enum class SwXmlFlags {
+ NONE = 0x0000,
+ ConvBlock = 0x0001,
+ NoRootCommit = 0x0002,
+};
+namespace o3tl {
+ template<> struct typed_flags<SwXmlFlags> : is_typed_flags<SwXmlFlags, 0x0003> {};
+}
class SwXMLTextBlocks : public SwImpBlocks
{
protected:
SfxObjectShellRef xDocShellRef;
- sal_uInt16 nFlags;
+ SwXmlFlags nFlags;
OUString aPackageName;
tools::SvRef<SfxMedium> xMedium;
diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx
index ef21814..1c2ed67 100644
--- a/sw/source/core/swg/SwXMLTextBlocks.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks.cxx
@@ -57,7 +57,7 @@ void SwXMLTextBlocks::ResetBlockMode ( )
SwXMLTextBlocks::SwXMLTextBlocks( const OUString& rFile )
: SwImpBlocks(rFile)
- , nFlags(0)
+ , nFlags(SwXmlFlags::NONE)
{
SwDocShell* pDocSh = new SwDocShell ( SfxObjectCreateMode::INTERNAL );
if( !pDocSh->DoInitNew() )
@@ -100,7 +100,7 @@ SwXMLTextBlocks::SwXMLTextBlocks( const OUString& rFile )
SwXMLTextBlocks::SwXMLTextBlocks( const uno::Reference < embed::XStorage >& rStg, const OUString& rName )
: SwImpBlocks( rName )
- , nFlags(0)
+ , nFlags(SwXmlFlags::NONE)
{
SwDocShell* pDocSh = new SwDocShell ( SfxObjectCreateMode::INTERNAL );
if( !pDocSh->DoInitNew() )
@@ -319,9 +319,7 @@ sal_uLong SwXMLTextBlocks::BeginPutDoc( const OUString& rShort, const OUString&
sal_uLong SwXMLTextBlocks::PutBlock( SwPaM& , const OUString& )
{
sal_uLong nRes = 0; // dead variable, this always returns 0
- sal_uInt16 nCommitFlags = nFlags & (SWXML_CONVBLOCK|SWXML_NOROOTCOMMIT);
-
- nFlags |= nCommitFlags;
+ SwXmlFlags nCommitFlags = nFlags;
WriterRef xWrt;
::GetXMLWriter ( OUString(), GetBaseURL(), xWrt);
@@ -379,7 +377,7 @@ sal_uLong SwXMLTextBlocks::PutBlock( SwPaM& , const OUString& )
if ( xTrans.is() )
xTrans->commit();
xRoot = nullptr;
- if ( !nCommitFlags )
+ if ( nCommitFlags == SwXmlFlags::NONE )
{
uno::Reference < embed::XTransactedObject > xTmpTrans( xBlkRoot, uno::UNO_QUERY );
if ( xTmpTrans.is() )
@@ -427,14 +425,14 @@ bool SwXMLTextBlocks::PutMuchEntries( bool bOn )
bRet = 0 == OpenFile( false );
if( bRet )
{
- nFlags |= SWXML_NOROOTCOMMIT;
+ nFlags |= SwXmlFlags::NoRootCommit;
bInPutMuchBlocks = true;
}
}
}
else if( bInPutMuchBlocks )
{
- nFlags &= ~SWXML_NOROOTCOMMIT;
+ nFlags &= ~SwXmlFlags::NoRootCommit;
if( xBlkRoot.is() )
{
try
diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx
index 0112748..998f45b 100644
--- a/sw/source/core/swg/SwXMLTextBlocks1.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx
@@ -377,7 +377,7 @@ sal_uLong SwXMLTextBlocks::PutBlockText( const OUString& rShort, const OUString&
if ( xTrans.is() )
xTrans->commit();
- if (! (nFlags & SWXML_NOROOTCOMMIT) )
+ if (! (nFlags & SwXmlFlags::NoRootCommit) )
{
uno::Reference < embed::XTransactedObject > xTmpTrans( xBlkRoot, uno::UNO_QUERY );
if ( xTmpTrans.is() )
commit 025604bbfa093ec4c29280793d2230e3cc3534d7
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Nov 24 16:05:22 2016 +0200
replace URLLOAD constants with o3tl::typed_flags
Change-Id: Ief6cb3dfc53da8cbae0feded9e215905c7a8459c
diff --git a/sw/inc/swurl.hxx b/sw/inc/swurl.hxx
index 875ca28..87375f3 100644
--- a/sw/inc/swurl.hxx
+++ b/sw/inc/swurl.hxx
@@ -20,14 +20,20 @@
#define INCLUDED_SW_INC_SWURL_HXX
#include <rtl/ustring.hxx>
+#include <o3tl/typed_flags_set.hxx>
class SwViewShell;
-#define URLLOAD_NOFILTER 0x0000
-#define URLLOAD_NEWVIEW 0x8000
+enum class LoadUrlFlags {
+ NONE = 0x00,
+ NewView = 0x01
+};
+namespace o3tl {
+ template<> struct typed_flags<LoadUrlFlags> : is_typed_flags<LoadUrlFlags, 0x01> {};
+}
void LoadURL( SwViewShell& rSh, const OUString& rName,
- sal_uInt16 nFilter, const OUString& rTargetFrameName );
+ LoadUrlFlags nFilter, const OUString& rTargetFrameName );
#endif
diff --git a/sw/source/core/access/acchyperlink.cxx b/sw/source/core/access/acchyperlink.cxx
index 6a330c7..a620752 100644
--- a/sw/source/core/access/acchyperlink.cxx
+++ b/sw/source/core/access/acchyperlink.cxx
@@ -86,7 +86,7 @@ sal_Bool SAL_CALL SwAccessibleHyperlink::doAccessibleAction( sal_Int32 nIndex )
SwViewShell *pVSh = xPara->GetShell();
if( pVSh )
{
- LoadURL(*pVSh, rINetFormat.GetValue(), URLLOAD_NOFILTER,
+ LoadURL(*pVSh, rINetFormat.GetValue(), LoadUrlFlags::NONE,
rINetFormat.GetTargetFrame());
OSL_ENSURE( pTextAttr == rINetFormat.GetTextINetFormat(),
"lost my txt attr" );
diff --git a/sw/source/core/access/accnotexthyperlink.cxx b/sw/source/core/access/accnotexthyperlink.cxx
index 161fac1..d1aebb9 100644
--- a/sw/source/core/access/accnotexthyperlink.cxx
+++ b/sw/source/core/access/accnotexthyperlink.cxx
@@ -82,7 +82,7 @@ sal_Bool SAL_CALL SwAccessibleNoTextHyperlink::doAccessibleAction( sal_Int32 nIn
SwViewShell *pVSh = xFrame->GetShell();
if( pVSh )
{
- LoadURL( *pVSh, pMapObj->GetURL(), URLLOAD_NOFILTER,
+ LoadURL( *pVSh, pMapObj->GetURL(), LoadUrlFlags::NONE,
pMapObj->GetTarget() );
bRet = true;
}
@@ -93,7 +93,7 @@ sal_Bool SAL_CALL SwAccessibleNoTextHyperlink::doAccessibleAction( sal_Int32 nIn
SwViewShell *pVSh = xFrame->GetShell();
if( pVSh )
{
- LoadURL( *pVSh, aURL.GetURL(), URLLOAD_NOFILTER,
+ LoadURL( *pVSh, aURL.GetURL(), LoadUrlFlags::NONE,
aURL.GetTargetFrameName() );
bRet = true;
}
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index 5ec2a05..8609b54 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
@@ -341,7 +341,7 @@ void SidebarTextControl::MouseButtonDown( const MouseEvent& rMEvt )
SwWrtShell &rSh = mrDocView.GetWrtShell();
OUString sURL( pURL->GetURL() );
OUString sTarget( pURL->GetTargetFrame() );
- ::LoadURL(rSh, sURL, URLLOAD_NOFILTER, sTarget);
+ ::LoadURL(rSh, sURL, LoadUrlFlags::NONE, sTarget);
return;
}
}
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index e8665d2..8899e5b 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -4613,9 +4613,9 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
// Internetfield? --> call link (load doc!!)
if( !bInSel )
{
- sal_uInt16 nFilter = URLLOAD_NOFILTER;
+ LoadUrlFlags nFilter = LoadUrlFlags::NONE;
if( KEY_MOD1 == rMEvt.GetModifier() )
- nFilter |= URLLOAD_NEWVIEW;
+ nFilter |= LoadUrlFlags::NewView;
bool bExecHyperlinks = m_rView.GetDocShell()->IsReadOnly();
if ( !bExecHyperlinks )
diff --git a/sw/source/uibase/docvw/romenu.cxx b/sw/source/uibase/docvw/romenu.cxx
index 11a4e30..482d794 100644
--- a/sw/source/uibase/docvw/romenu.cxx
+++ b/sw/source/uibase/docvw/romenu.cxx
@@ -265,12 +265,13 @@ void SwReadOnlyPopup::Execute( vcl::Window* pWin, sal_uInt16 nId )
TransferDataContainer* pClipCntnr = nullptr;
sal_uInt16 nExecId = USHRT_MAX;
- sal_uInt16 nFilter = USHRT_MAX;
+ bool bFilterSet = false;
+ LoadUrlFlags nFilter;
switch( nId )
{
case SID_WIN_FULLSCREEN : nExecId = SID_WIN_FULLSCREEN; break;
- case MN_READONLY_OPENURL: nFilter = URLLOAD_NOFILTER; break;
- case MN_READONLY_OPENURLNEW: nFilter = URLLOAD_NEWVIEW; break;
+ case MN_READONLY_OPENURL: nFilter = LoadUrlFlags::NONE; bFilterSet = true; break;
+ case MN_READONLY_OPENURLNEW: nFilter = LoadUrlFlags::NewView; bFilterSet = true; break;
case MN_READONLY_COPY: nExecId = SID_COPY; break;
case MN_READONLY_EDITDOC: nExecId = SID_EDITDOC; break;
@@ -327,7 +328,7 @@ void SwReadOnlyPopup::Execute( vcl::Window* pWin, sal_uInt16 nId )
}
if( USHRT_MAX != nExecId )
rDis.GetBindings()->Execute( nExecId );
- if( USHRT_MAX != nFilter )
+ if( bFilterSet )
::LoadURL(rSh, sURL, nFilter, sTargetFrameName);
if( pClipCntnr )
diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx
index f3aaaac..c3b63ef 100644
--- a/sw/source/uibase/inc/wrtsh.hxx
+++ b/sw/source/uibase/inc/wrtsh.hxx
@@ -420,8 +420,8 @@ typedef bool (SwWrtShell:: *FNSimpleMove)();
// a click at the given field. the cursor is on it.
// execute the predefined actions.
void ClickToField( const SwField& rField );
- void ClickToINetAttr( const SwFormatINetFormat& rItem, sal_uInt16 nFilter = URLLOAD_NOFILTER );
- bool ClickToINetGrf( const Point& rDocPt, sal_uInt16 nFilter );
+ void ClickToINetAttr( const SwFormatINetFormat& rItem, LoadUrlFlags nFilter = LoadUrlFlags::NONE );
+ bool ClickToINetGrf( const Point& rDocPt, LoadUrlFlags nFilter );
inline bool IsInClickToEdit() const ;
// if a URL-Button is selected, return its URL; otherwise an empty string
diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx
index ac17db2..a8c22d3 100644
--- a/sw/source/uibase/wrtsh/wrtsh2.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh2.cxx
@@ -408,7 +408,7 @@ void SwWrtShell::ClickToField( const SwField& rField )
m_bIsInClickToEdit = false;
}
-void SwWrtShell::ClickToINetAttr( const SwFormatINetFormat& rItem, sal_uInt16 nFilter )
+void SwWrtShell::ClickToINetAttr( const SwFormatINetFormat& rItem, LoadUrlFlags nFilter )
{
if( rItem.GetValue().isEmpty() )
return ;
@@ -436,7 +436,7 @@ void SwWrtShell::ClickToINetAttr( const SwFormatINetFormat& rItem, sal_uInt16 nF
m_bIsInClickToEdit = false;
}
-bool SwWrtShell::ClickToINetGrf( const Point& rDocPt, sal_uInt16 nFilter )
+bool SwWrtShell::ClickToINetGrf( const Point& rDocPt, LoadUrlFlags nFilter )
{
bool bRet = false;
OUString sURL;
@@ -459,7 +459,7 @@ bool SwWrtShell::ClickToINetGrf( const Point& rDocPt, sal_uInt16 nFilter )
return bRet;
}
-void LoadURL( SwViewShell& rVSh, const OUString& rURL, sal_uInt16 nFilter,
+void LoadURL( SwViewShell& rVSh, const OUString& rURL, LoadUrlFlags nFilter,
const OUString& rTargetFrameName )
{
OSL_ENSURE( !rURL.isEmpty(), "what should be loaded here?" );
@@ -506,7 +506,7 @@ void LoadURL( SwViewShell& rVSh, const OUString& rURL, sal_uInt16 nFilter,
//#39076# Silent can be removed accordingly to SFX.
SfxBoolItem aBrowse( SID_BROWSE, true );
- if( nFilter & URLLOAD_NEWVIEW )
+ if( nFilter & LoadUrlFlags::NewView )
aTargetFrameName.SetValue( "_blank" );
const SfxPoolItem* aArr[] = {
commit 11980815c782ebfa4003225fc5208e9f05225ba8
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Nov 24 14:30:18 2016 +0200
convert FRM_VALID constants to o3tl::typed_flags
Change-Id: I9a84e0ec9c4319ca2edc8dfcc72bfdb08229ecef
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index d704135..4855159 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -103,6 +103,8 @@
#include <svtools/langtab.hxx>
#include <cppu/unotype.hxx>
#include <officecfg/Office/Common.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
#define MAX_MRU_FONTNAME_ENTRIES 5
@@ -1796,14 +1798,19 @@ void SvxFrameWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt )
}
}
-#define FRM_VALID_LEFT 0x01
-#define FRM_VALID_RIGHT 0x02
-#define FRM_VALID_TOP 0x04
-#define FRM_VALID_BOTTOM 0x08
-#define FRM_VALID_HINNER 0x10
-#define FRM_VALID_VINNER 0x20
-#define FRM_VALID_OUTER 0x0f
-#define FRM_VALID_ALL 0xff
+enum class FrmValidFlags {
+ NONE = 0x00,
+ Left = 0x01,
+ Right = 0x02,
+ Top = 0x04,
+ Bottom = 0x08,
+ HInner = 0x10,
+ VInner = 0x20,
+ AllMask = 0x3f,
+};
+namespace o3tl {
+ template<> struct typed_flags<FrmValidFlags> : is_typed_flags<FrmValidFlags, 0x3f> {};
+}
// By default unset lines remain unchanged.
// Via Shift unset lines are reset
@@ -1821,34 +1828,34 @@ IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl, ValueSet*, void)
*pBottom = nullptr;
sal_uInt16 nSel = aFrameSet->GetSelectItemId();
sal_uInt16 nModifier = aFrameSet->GetModifier();
- sal_uInt8 nValidFlags = 0;
+ FrmValidFlags nValidFlags = FrmValidFlags::NONE;
theDefLine.GuessLinesWidths(theDefLine.GetBorderLineStyle(),
DEF_LINE_WIDTH_0);
switch ( nSel )
{
- case 1: nValidFlags |= FRM_VALID_ALL;
+ case 1: nValidFlags |= FrmValidFlags::AllMask;
break; // NONE
case 2: pLeft = &theDefLine;
- nValidFlags |= FRM_VALID_LEFT;
+ nValidFlags |= FrmValidFlags::Left;
break; // LEFT
case 3: pRight = &theDefLine;
- nValidFlags |= FRM_VALID_RIGHT;
+ nValidFlags |= FrmValidFlags::Right;
break; // RIGHT
case 4: pLeft = pRight = &theDefLine;
- nValidFlags |= FRM_VALID_RIGHT|FRM_VALID_LEFT;
+ nValidFlags |= FrmValidFlags::Right|FrmValidFlags::Left;
break; // LEFTRIGHT
case 5: pTop = &theDefLine;
- nValidFlags |= FRM_VALID_TOP;
+ nValidFlags |= FrmValidFlags::Top;
break; // TOP
case 6: pBottom = &theDefLine;
- nValidFlags |= FRM_VALID_BOTTOM;
+ nValidFlags |= FrmValidFlags::Bottom;
break; // BOTTOM
case 7: pTop = pBottom = &theDefLine;
- nValidFlags |= FRM_VALID_BOTTOM|FRM_VALID_TOP;
+ nValidFlags |= FrmValidFlags::Bottom|FrmValidFlags::Top;
break; // TOPBOTTOM
case 8: pLeft = pRight = pTop = pBottom = &theDefLine;
- nValidFlags |= FRM_VALID_OUTER;
+ nValidFlags |= FrmValidFlags::Left | FrmValidFlags::Right | FrmValidFlags::Top | FrmValidFlags::Bottom;
break; // OUTER
// Inner Table:
@@ -1856,28 +1863,28 @@ IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl, ValueSet*, void)
pTop = pBottom = &theDefLine;
aBorderInner.SetLine( &theDefLine, SvxBoxInfoItemLine::HORI );
aBorderInner.SetLine( nullptr, SvxBoxInfoItemLine::VERT );
- nValidFlags |= FRM_VALID_HINNER|FRM_VALID_TOP|FRM_VALID_BOTTOM;
+ nValidFlags |= FrmValidFlags::HInner|FrmValidFlags::Top|FrmValidFlags::Bottom;
break;
case 10: // HORINNER
pLeft = pRight = pTop = pBottom = &theDefLine;
aBorderInner.SetLine( &theDefLine, SvxBoxInfoItemLine::HORI );
aBorderInner.SetLine( nullptr, SvxBoxInfoItemLine::VERT );
- nValidFlags |= FRM_VALID_RIGHT|FRM_VALID_LEFT|FRM_VALID_HINNER|FRM_VALID_TOP|FRM_VALID_BOTTOM;
+ nValidFlags |= FrmValidFlags::Right|FrmValidFlags::Left|FrmValidFlags::HInner|FrmValidFlags::Top|FrmValidFlags::Bottom;
break;
case 11: // VERINNER
pLeft = pRight = pTop = pBottom = &theDefLine;
aBorderInner.SetLine( nullptr, SvxBoxInfoItemLine::HORI );
aBorderInner.SetLine( &theDefLine, SvxBoxInfoItemLine::VERT );
- nValidFlags |= FRM_VALID_RIGHT|FRM_VALID_LEFT|FRM_VALID_VINNER|FRM_VALID_TOP|FRM_VALID_BOTTOM;
+ nValidFlags |= FrmValidFlags::Right|FrmValidFlags::Left|FrmValidFlags::VInner|FrmValidFlags::Top|FrmValidFlags::Bottom;
break;
case 12: // ALL
pLeft = pRight = pTop = pBottom = &theDefLine;
aBorderInner.SetLine( &theDefLine, SvxBoxInfoItemLine::HORI );
aBorderInner.SetLine( &theDefLine, SvxBoxInfoItemLine::VERT );
- nValidFlags |= FRM_VALID_ALL;
+ nValidFlags |= FrmValidFlags::AllMask;
break;
default:
@@ -1889,13 +1896,13 @@ IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl, ValueSet*, void)
aBorderOuter.SetLine( pBottom, SvxBoxItemLine::BOTTOM );
if(nModifier == KEY_SHIFT)
- nValidFlags |= FRM_VALID_ALL;
- aBorderInner.SetValid( SvxBoxInfoItemValidFlags::TOP, 0 != (nValidFlags&FRM_VALID_TOP ));
- aBorderInner.SetValid( SvxBoxInfoItemValidFlags::BOTTOM, 0 != (nValidFlags&FRM_VALID_BOTTOM ));
- aBorderInner.SetValid( SvxBoxInfoItemValidFlags::LEFT, 0 != (nValidFlags&FRM_VALID_LEFT));
- aBorderInner.SetValid( SvxBoxInfoItemValidFlags::RIGHT, 0 != (nValidFlags&FRM_VALID_RIGHT ));
- aBorderInner.SetValid( SvxBoxInfoItemValidFlags::HORI, 0 != (nValidFlags&FRM_VALID_HINNER ));
- aBorderInner.SetValid( SvxBoxInfoItemValidFlags::VERT, 0 != (nValidFlags&FRM_VALID_VINNER));
+ nValidFlags |= FrmValidFlags::AllMask;
+ aBorderInner.SetValid( SvxBoxInfoItemValidFlags::TOP, bool(nValidFlags&FrmValidFlags::Top ));
+ aBorderInner.SetValid( SvxBoxInfoItemValidFlags::BOTTOM, bool(nValidFlags&FrmValidFlags::Bottom ));
+ aBorderInner.SetValid( SvxBoxInfoItemValidFlags::LEFT, bool(nValidFlags&FrmValidFlags::Left));
+ aBorderInner.SetValid( SvxBoxInfoItemValidFlags::RIGHT, bool(nValidFlags&FrmValidFlags::Right ));
+ aBorderInner.SetValid( SvxBoxInfoItemValidFlags::HORI, bool(nValidFlags&FrmValidFlags::HInner ));
+ aBorderInner.SetValid( SvxBoxInfoItemValidFlags::VERT, bool(nValidFlags&FrmValidFlags::VInner));
aBorderInner.SetValid( SvxBoxInfoItemValidFlags::DISTANCE );
aBorderInner.SetValid( SvxBoxInfoItemValidFlags::DISABLE, false );
commit ead32fe3fdee8ba9506f8abb3bcbb1bc36137fae
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Nov 24 14:25:12 2016 +0200
convert MODIFY constants to o3tl::typed_flags
Change-Id: I230469605b1b3a2a639f51917c23f1a82ec519b5
diff --git a/include/svx/srchdlg.hxx b/include/svx/srchdlg.hxx
index 5b5f7ae..25798fd 100644
--- a/include/svx/srchdlg.hxx
+++ b/include/svx/srchdlg.hxx
@@ -38,8 +38,8 @@ class SvxSearchItem;
class SfxStyleSheetBasePool;
class SvxJSearchOptionsPage;
class SvxSearchController;
-
struct SearchDlg_Impl;
+enum class ModifyFlags;
struct SearchAttrItem
{
@@ -210,7 +210,7 @@ private:
SearchOptionFlags nOptions;
bool bSet;
bool bConstruct;
- sal_uIntPtr nModifyFlag;
+ ModifyFlags nModifyFlag;
OUString aStylesStr;
OUString aLayoutStr;
OUString aLayoutWriterStr;
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 4cea924..e080edc 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -68,6 +68,7 @@
#include <tools/resary.hxx>
#include <svx/svxdlg.hxx>
#include <vcl/toolbox.hxx>
+#include <o3tl/typed_flags_set.hxx>
#include <cstdlib>
#include <memory>
@@ -81,23 +82,29 @@ using namespace comphelper;
#define REMEMBER_SIZE 10
-#define MODIFY_SEARCH 0x00000001
-#define MODIFY_REPLACE 0x00000002
-#define MODIFY_WORD 0x00000004
-#define MODIFY_EXACT 0x00000008
-#define MODIFY_BACKWARDS 0x00000010
-#define MODIFY_SELECTION 0x00000020
-#define MODIFY_REGEXP 0x00000040
-#define MODIFY_LAYOUT 0x00000080
-#define MODIFY_SIMILARITY 0x00000100
-#define MODIFY_FORMULAS 0x00000200
-#define MODIFY_VALUES 0x00000400
-#define MODIFY_CALC_NOTES 0x00000800
-#define MODIFY_ROWS 0x00001000
-#define MODIFY_COLUMNS 0x00002000
-#define MODIFY_ALLTABLES 0x00004000
-#define MODIFY_NOTES 0x00008000
-#define MODIFY_WILDCARD 0x00010000
+enum class ModifyFlags {
+ NONE = 0x000000,
+ Search = 0x000001,
+ Replace = 0x000002,
+ Word = 0x000004,
+ Exact = 0x000008,
+ Backwards = 0x000010,
+ Selection = 0x000020,
+ Regexp = 0x000040,
+ Layout = 0x000080,
+ Similarity = 0x000100,
+ Formulas = 0x000200,
+ Values = 0x000400,
+ CalcNotes = 0x000800,
+ Rows = 0x001000,
+ Columns = 0x002000,
+ AllTables = 0x004000,
+ Notes = 0x008000,
+ Wildcard = 0x010000
+};
+namespace o3tl {
+ template<> struct typed_flags<ModifyFlags> : is_typed_flags<ModifyFlags, 0x01ffff> {};
+}
namespace
{
@@ -256,7 +263,7 @@ SvxSearchDialog::SvxSearchDialog( vcl::Window* pParent, SfxChildWindow* pChildWi
, nOptions(SearchOptionFlags::ALL)
, bSet(false)
, bConstruct(true)
- , nModifyFlag(0)
+ , nModifyFlag(ModifyFlags::NONE)
, pSearchList(nullptr)
, pReplaceList(new SearchAttrItemList)
, pSearchItem(nullptr)
@@ -778,21 +785,21 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern )
bWriter = ( pSearchItem->GetAppFlag() == SvxSearchApp::WRITER );
- if ( ( nModifyFlag & MODIFY_WORD ) == 0 )
+ if ( !( nModifyFlag & ModifyFlags::Word ) )
m_pWordBtn->Check( pSearchItem->GetWordOnly() );
- if ( ( nModifyFlag & MODIFY_EXACT ) == 0 )
+ if ( !( nModifyFlag & ModifyFlags::Exact ) )
m_pMatchCaseCB->Check( pSearchItem->GetExact() );
- if ( ( nModifyFlag & MODIFY_BACKWARDS ) == 0 )
+ if ( !( nModifyFlag & ModifyFlags::Backwards ) )
m_pReplaceBackwardsCB->Check( bReplaceBackwards ); //adjustment to replace backwards
- if ( ( nModifyFlag & MODIFY_NOTES ) == 0 )
+ if ( !( nModifyFlag & ModifyFlags::Notes ) )
m_pNotesBtn->Check( pSearchItem->GetNotes() );
- if ( ( nModifyFlag & MODIFY_SELECTION ) == 0 )
+ if ( !( nModifyFlag & ModifyFlags::Selection ) )
m_pSelectionBtn->Check( pSearchItem->GetSelection() );
- if ( ( nModifyFlag & MODIFY_REGEXP ) == 0 )
+ if ( !( nModifyFlag & ModifyFlags::Regexp ) )
m_pRegExpBtn->Check( pSearchItem->GetRegExp() );
- if ( ( nModifyFlag & MODIFY_WILDCARD ) == 0 )
+ if ( !( nModifyFlag & ModifyFlags::Wildcard ) )
m_pWildcardBtn->Check( pSearchItem->GetWildcard() );
- if ( ( nModifyFlag & MODIFY_LAYOUT ) == 0 )
+ if ( !( nModifyFlag & ModifyFlags::Layout ) )
m_pLayoutBtn->Check( pSearchItem->GetPattern() );
if (m_pNotesBtn->IsChecked())
m_pLayoutBtn->Disable();
@@ -818,37 +825,37 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern )
m_pAllSheetsCB->SetClickHdl( aLink );
m_pSearchFormattedCB->SetClickHdl( aLink );
- sal_uIntPtr nModifyFlagCheck;
+ ModifyFlags nModifyFlagCheck;
switch ( pSearchItem->GetCellType() )
{
case SvxSearchCellType::FORMULA:
- nModifyFlagCheck = MODIFY_FORMULAS;
+ nModifyFlagCheck = ModifyFlags::Formulas;
break;
case SvxSearchCellType::VALUE:
- nModifyFlagCheck = MODIFY_VALUES;
+ nModifyFlagCheck = ModifyFlags::Values;
break;
case SvxSearchCellType::NOTE:
- nModifyFlagCheck = MODIFY_CALC_NOTES;
+ nModifyFlagCheck = ModifyFlags::CalcNotes;
break;
default:
std::abort(); // cannot happen
}
- if ( (nModifyFlag & nModifyFlagCheck) == 0 )
+ if ( !(nModifyFlag & nModifyFlagCheck) )
m_pCalcSearchInLB->SelectEntryPos( static_cast<sal_Int32>(pSearchItem->GetCellType()) );
m_pWordBtn->SetText( aCalcStr.getToken( 0, '#' ) );
if ( pSearchItem->GetRowDirection() &&
- ( nModifyFlag & MODIFY_ROWS ) == 0 )
+ !( nModifyFlag & ModifyFlags::Rows ) )
m_pRowsBtn->Check();
else if ( !pSearchItem->GetRowDirection() &&
- ( nModifyFlag & MODIFY_COLUMNS ) == 0 )
+ !( nModifyFlag & ModifyFlags::Columns ) )
m_pColumnsBtn->Check();
- if ( ( nModifyFlag & MODIFY_ALLTABLES ) == 0 )
+ if ( !( nModifyFlag & ModifyFlags::AllTables ) )
m_pAllSheetsCB->Check( pSearchItem->IsAllTables() );
// only look for formatting in Writer
@@ -898,7 +905,7 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern )
}
// similarity search?
- if ( ( nModifyFlag & MODIFY_SIMILARITY ) == 0 )
+ if ( !( nModifyFlag & ModifyFlags::Similarity ) )
m_pSimilarityBox->Check( pSearchItem->IsLevenshtein() );
bSet = true;
@@ -964,8 +971,8 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern )
}
else
{
- bool bSetSearch = ( ( nModifyFlag & MODIFY_SEARCH ) == 0 );
- bool bSetReplace = ( ( nModifyFlag & MODIFY_REPLACE ) == 0 );
+ bool bSetSearch = !( nModifyFlag & ModifyFlags::Search );
+ bool bSetReplace = !( nModifyFlag & ModifyFlags::Replace );
if ( !(pSearchItem->GetSearchString().isEmpty()) && bSetSearch )
m_pSearchLB->SetText( pSearchItem->GetSearchString() );
@@ -1365,7 +1372,7 @@ IMPL_LINK( SvxSearchDialog, CommandHdl_Impl, Button *, pBtn, void )
if ( pReplaceList )
pReplaceList->Clear();
}
- nModifyFlag = 0;
+ nModifyFlag = ModifyFlags::NONE;
const SfxPoolItem* ppArgs[] = { pSearchItem, nullptr };
rBindings.ExecuteSynchron( FID_SEARCH_NOW, ppArgs );
}
@@ -2228,39 +2235,39 @@ void SvxSearchDialog::PaintAttrText_Impl()
void SvxSearchDialog::SetModifyFlag_Impl( const Control* pCtrl )
{
if ( m_pSearchLB == pCtrl )
- nModifyFlag |= MODIFY_SEARCH;
+ nModifyFlag |= ModifyFlags::Search;
else if ( m_pReplaceLB == pCtrl )
- nModifyFlag |= MODIFY_REPLACE;
+ nModifyFlag |= ModifyFlags::Replace;
else if ( m_pWordBtn == pCtrl )
- nModifyFlag |= MODIFY_WORD;
+ nModifyFlag |= ModifyFlags::Word;
else if ( m_pMatchCaseCB == pCtrl )
- nModifyFlag |= MODIFY_EXACT;
+ nModifyFlag |= ModifyFlags::Exact;
else if ( m_pReplaceBackwardsCB == pCtrl )
- nModifyFlag |= MODIFY_BACKWARDS;
+ nModifyFlag |= ModifyFlags::Backwards;
else if ( m_pNotesBtn == pCtrl )
- nModifyFlag |= MODIFY_NOTES;
+ nModifyFlag |= ModifyFlags::Notes;
else if ( m_pSelectionBtn == pCtrl )
- nModifyFlag |= MODIFY_SELECTION;
+ nModifyFlag |= ModifyFlags::Selection;
else if ( m_pRegExpBtn == pCtrl )
- nModifyFlag |= MODIFY_REGEXP;
+ nModifyFlag |= ModifyFlags::Regexp;
else if ( m_pWildcardBtn == pCtrl )
- nModifyFlag |= MODIFY_WILDCARD;
+ nModifyFlag |= ModifyFlags::Wildcard;
else if ( m_pLayoutBtn == pCtrl )
- nModifyFlag |= MODIFY_LAYOUT;
+ nModifyFlag |= ModifyFlags::Layout;
else if ( m_pSimilarityBox == pCtrl )
- nModifyFlag |= MODIFY_SIMILARITY;
+ nModifyFlag |= ModifyFlags::Similarity;
else if ( m_pCalcSearchInLB == pCtrl )
{
- nModifyFlag |= MODIFY_FORMULAS;
- nModifyFlag |= MODIFY_VALUES;
- nModifyFlag |= MODIFY_CALC_NOTES;
+ nModifyFlag |= ModifyFlags::Formulas;
+ nModifyFlag |= ModifyFlags::Values;
+ nModifyFlag |= ModifyFlags::CalcNotes;
}
else if ( m_pRowsBtn == pCtrl )
- nModifyFlag |= MODIFY_ROWS;
+ nModifyFlag |= ModifyFlags::Rows;
else if ( m_pColumnsBtn == pCtrl )
- nModifyFlag |= MODIFY_COLUMNS;
+ nModifyFlag |= ModifyFlags::Columns;
else if ( m_pAllSheetsCB == pCtrl )
- nModifyFlag |= MODIFY_ALLTABLES;
+ nModifyFlag |= ModifyFlags::AllTables;
}
@@ -2324,7 +2331,7 @@ void SvxSearchDialog::SaveToModule_Impl()
}
pSearchItem->SetCommand( SvxSearchCmd::FIND );
- nModifyFlag = 0;
+ nModifyFlag = ModifyFlags::NONE;
const SfxPoolItem* ppArgs[] = { pSearchItem, nullptr };
rBindings.GetDispatcher()->Execute( SID_SEARCH_ITEM, SfxCallMode::SLOT, ppArgs );
}
commit 1c3cb6bb41ded9c1becbf904b60de76bfbfa38c7
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Nov 24 14:12:43 2016 +0200
convert HTMLCFG constants to o3tl::typed_flags
Change-Id: I0859fdc3e737ab0714e994f1326123e93e93affb
diff --git a/svtools/source/config/htmlcfg.cxx b/svtools/source/config/htmlcfg.cxx
index a558b0a..f20d725 100644
--- a/svtools/source/config/htmlcfg.cxx
+++ b/svtools/source/config/htmlcfg.cxx
@@ -29,17 +29,21 @@
#include <sal/macros.h>
#include <rtl/instance.hxx>
#include <list>
-
-
-#define HTMLCFG_UNKNOWN_TAGS 0x01
-//#define HTMLCFG_STYLE_SHEETS 0x02
-//#define HTMLCFG_NETSCAPE3 0x04
-#define HTMLCFG_STAR_BASIC 0x08
-#define HTMLCFG_LOCAL_GRF 0x10
-#define HTMLCFG_PRINT_LAYOUT_EXTENSION 0x20
-#define HTMLCFG_IGNORE_FONT_FAMILY 0x40
-#define HTMLCFG_IS_BASIC_WARNING 0x80
-#define HTMLCFG_NUMBERS_ENGLISH_US 0x100
+#include <o3tl/typed_flags_set.hxx>
+
+enum class HtmlCfgFlags {
+ NONE = 0x000,
+ UnknownTags = 0x001,
+ StarBasic = 0x008,
+ LocalGrf = 0x010,
+ PrintLayoutExtension = 0x020,
+ IgnoreFontFamily = 0x040,
+ IsBasicWarning = 0x080,
+ NumbersEnglishUS = 0x100,
+};
+namespace o3tl {
+ template<> struct typed_flags<HtmlCfgFlags> : is_typed_flags<HtmlCfgFlags, 0x1f9> {};
+}
using namespace utl;
using namespace com::sun::star::uno;
@@ -47,14 +51,14 @@ using namespace com::sun::star::uno;
struct HtmlOptions_Impl
{
- sal_Int32 nFlags;
- sal_Int32 nExportMode;
- sal_Int32 aFontSizeArr[HTML_FONT_COUNT];
- sal_Int32 eEncoding;
- bool bIsEncodingDefault;
+ HtmlCfgFlags nFlags;
+ sal_Int32 nExportMode;
+ sal_Int32 aFontSizeArr[HTML_FONT_COUNT];
+ sal_Int32 eEncoding;
+ bool bIsEncodingDefault;
HtmlOptions_Impl() :
- nFlags(HTMLCFG_LOCAL_GRF|HTMLCFG_IS_BASIC_WARNING),
+ nFlags(HtmlCfgFlags::LocalGrf|HtmlCfgFlags::IsBasicWarning),
nExportMode(HTML_CFG_NS40),
eEncoding( osl_getThreadTextEncoding() ),
bIsEncodingDefault(true)
@@ -121,7 +125,7 @@ void SvxHtmlOptions::Load( const Sequence< OUString >& aNames )
DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
if(aValues.getLength() == aNames.getLength())
{
- pImpl->nFlags = 0;
+ pImpl->nFlags = HtmlCfgFlags::NONE;
for(int nProp = 0; nProp < aNames.getLength(); nProp++)
{
if(pValues[nProp].hasValue())
@@ -130,11 +134,11 @@ void SvxHtmlOptions::Load( const Sequence< OUString >& aNames )
{
case 0:
if(*o3tl::doAccess<bool>(pValues[nProp]))
- pImpl->nFlags |= HTMLCFG_UNKNOWN_TAGS;
+ pImpl->nFlags |= HtmlCfgFlags::UnknownTags;
break;//"Import/UnknownTag",
case 1:
if(*o3tl::doAccess<bool>(pValues[nProp]))
- pImpl->nFlags |= HTMLCFG_IGNORE_FONT_FAMILY;
+ pImpl->nFlags |= HtmlCfgFlags::IgnoreFontFamily;
break;//"Import/FontSetting",
case 2: pValues[nProp] >>= pImpl->aFontSizeArr[0]; break;//"Import/FontSize/Size_1",
case 3: pValues[nProp] >>= pImpl->aFontSizeArr[1]; break;//"Import/FontSize/Size_2",
@@ -160,19 +164,19 @@ void SvxHtmlOptions::Load( const Sequence< OUString >& aNames )
break;
case 10:
if(*o3tl::doAccess<bool>(pValues[nProp]))
- pImpl->nFlags |= HTMLCFG_STAR_BASIC;
+ pImpl->nFlags |= HtmlCfgFlags::StarBasic;
break;//"Export/Basic",
case 11:
if(*o3tl::doAccess<bool>(pValues[nProp]))
- pImpl->nFlags |= HTMLCFG_PRINT_LAYOUT_EXTENSION;
+ pImpl->nFlags |= HtmlCfgFlags::PrintLayoutExtension;
break;//"Export/PrintLayout",
case 12:
if(*o3tl::doAccess<bool>(pValues[nProp]))
- pImpl->nFlags |= HTMLCFG_LOCAL_GRF;
+ pImpl->nFlags |= HtmlCfgFlags::LocalGrf;
break;//"Export/LocalGraphic",
case 13:
if(*o3tl::doAccess<bool>(pValues[nProp]))
- pImpl->nFlags |= HTMLCFG_IS_BASIC_WARNING;
+ pImpl->nFlags |= HtmlCfgFlags::IsBasicWarning;
break;//"Export/Warning"
case 14: pValues[nProp] >>= pImpl->eEncoding;
@@ -181,7 +185,7 @@ void SvxHtmlOptions::Load( const Sequence< OUString >& aNames )
case 15:
if(*o3tl::doAccess<bool>(pValues[nProp]))
- pImpl->nFlags |= HTMLCFG_NUMBERS_ENGLISH_US;
+ pImpl->nFlags |= HtmlCfgFlags::NumbersEnglishUS;
break;//"Import/NumbersEnglishUS"
}
}
@@ -202,8 +206,8 @@ void SvxHtmlOptions::ImplCommit()
bool bSet = false;
switch(nProp)
{
- case 0: bSet = 0 != (pImpl->nFlags & HTMLCFG_UNKNOWN_TAGS);break;//"Import/UnknownTag",
- case 1: bSet = 0 != (pImpl->nFlags & HTMLCFG_IGNORE_FONT_FAMILY);break;//"Import/FontSetting",
+ case 0: bSet = bool(pImpl->nFlags & HtmlCfgFlags::UnknownTags);break;//"Import/UnknownTag",
+ case 1: bSet = bool(pImpl->nFlags & HtmlCfgFlags::IgnoreFontFamily);break;//"Import/FontSetting",
case 2: pValues[nProp] <<= pImpl->aFontSizeArr[0];break;//"Import/FontSize/Size_1",
case 3: pValues[nProp] <<= pImpl->aFontSizeArr[1];break;//"Import/FontSize/Size_2",
case 4: pValues[nProp] <<= pImpl->aFontSizeArr[2];break;//"Import/FontSize/Size_3",
@@ -226,15 +230,15 @@ void SvxHtmlOptions::ImplCommit()
pValues[nProp] <<= nExpMode;
break;
}
- case 10: bSet = 0 != (pImpl->nFlags & HTMLCFG_STAR_BASIC);break;//"Export/Basic",
- case 11: bSet = 0 != (pImpl->nFlags & HTMLCFG_PRINT_LAYOUT_EXTENSION);break;//"Export/PrintLayout",
- case 12: bSet = 0 != (pImpl->nFlags & HTMLCFG_LOCAL_GRF);break;//"Export/LocalGraphic",
- case 13: bSet = 0 != (pImpl->nFlags & HTMLCFG_IS_BASIC_WARNING);break;//"Export/Warning"
+ case 10: bSet = bool(pImpl->nFlags & HtmlCfgFlags::StarBasic);break;//"Export/Basic",
+ case 11: bSet = bool(pImpl->nFlags & HtmlCfgFlags::PrintLayoutExtension);break;//"Export/PrintLayout",
+ case 12: bSet = bool(pImpl->nFlags & HtmlCfgFlags::LocalGrf);break;//"Export/LocalGraphic",
+ case 13: bSet = bool(pImpl->nFlags & HtmlCfgFlags::IsBasicWarning);break;//"Export/Warning"
case 14:
if(!pImpl->bIsEncodingDefault)
pValues[nProp] <<= pImpl->eEncoding;
break;//"Export/Encoding",
- case 15: bSet = 0 != (pImpl->nFlags & HTMLCFG_NUMBERS_ENGLISH_US);break;//"Import/NumbersEnglishUS"
+ case 15: bSet = bool(pImpl->nFlags & HtmlCfgFlags::NumbersEnglishUS);break;//"Import/NumbersEnglishUS"
}
if(nProp < 2 || ( nProp > 9 && nProp < 14 ) || nProp == 15)
pValues[nProp] <<= bSet;
@@ -267,16 +271,16 @@ void SvxHtmlOptions::SetFontSize(sal_uInt16 nPos, sal_uInt16 nSize)
bool SvxHtmlOptions::IsImportUnknown() const
{
- return 0 != (pImpl->nFlags & HTMLCFG_UNKNOWN_TAGS) ;
+ return bool(pImpl->nFlags & HtmlCfgFlags::UnknownTags) ;
}
void SvxHtmlOptions::SetImportUnknown(bool bSet)
{
if(bSet)
- pImpl->nFlags |= HTMLCFG_UNKNOWN_TAGS;
+ pImpl->nFlags |= HtmlCfgFlags::UnknownTags;
else
- pImpl->nFlags &= ~HTMLCFG_UNKNOWN_TAGS;
+ pImpl->nFlags &= ~HtmlCfgFlags::UnknownTags;
SetModified();
}
@@ -289,36 +293,36 @@ sal_uInt16 SvxHtmlOptions::GetExportMode() const
bool SvxHtmlOptions::IsStarBasic() const
{
- return 0 != (pImpl->nFlags & HTMLCFG_STAR_BASIC) ;
+ return bool(pImpl->nFlags & HtmlCfgFlags::StarBasic) ;
}
void SvxHtmlOptions::SetStarBasic(bool bSet)
{
if(bSet)
- pImpl->nFlags |= HTMLCFG_STAR_BASIC;
+ pImpl->nFlags |= HtmlCfgFlags::StarBasic;
else
- pImpl->nFlags &= ~HTMLCFG_STAR_BASIC;
+ pImpl->nFlags &= ~HtmlCfgFlags::StarBasic;
SetModified();
}
bool SvxHtmlOptions::IsSaveGraphicsLocal() const
{
- return 0 != (pImpl->nFlags & HTMLCFG_LOCAL_GRF) ;
+ return bool(pImpl->nFlags & HtmlCfgFlags::LocalGrf) ;
}
void SvxHtmlOptions::SetSaveGraphicsLocal(bool bSet)
{
if(bSet)
- pImpl->nFlags |= HTMLCFG_LOCAL_GRF;
+ pImpl->nFlags |= HtmlCfgFlags::LocalGrf;
else
- pImpl->nFlags &= ~HTMLCFG_LOCAL_GRF;
+ pImpl->nFlags &= ~HtmlCfgFlags::LocalGrf;
SetModified();
}
bool SvxHtmlOptions::IsPrintLayoutExtension() const
{
- bool bRet = 0 != (pImpl->nFlags & HTMLCFG_PRINT_LAYOUT_EXTENSION);
+ bool bRet(pImpl->nFlags & HtmlCfgFlags::PrintLayoutExtension);
switch( pImpl->nExportMode )
{
case HTML_CFG_MSIE:
@@ -334,37 +338,37 @@ bool SvxHtmlOptions::IsPrintLayoutExtension() const
void SvxHtmlOptions::SetPrintLayoutExtension(bool bSet)
{
if(bSet)
- pImpl->nFlags |= HTMLCFG_PRINT_LAYOUT_EXTENSION;
+ pImpl->nFlags |= HtmlCfgFlags::PrintLayoutExtension;
else
- pImpl->nFlags &= ~HTMLCFG_PRINT_LAYOUT_EXTENSION;
+ pImpl->nFlags &= ~HtmlCfgFlags::PrintLayoutExtension;
SetModified();
}
bool SvxHtmlOptions::IsIgnoreFontFamily() const
{
- return 0 != (pImpl->nFlags & HTMLCFG_IGNORE_FONT_FAMILY) ;
+ return bool(pImpl->nFlags & HtmlCfgFlags::IgnoreFontFamily) ;
}
void SvxHtmlOptions::SetIgnoreFontFamily(bool bSet)
{
if(bSet)
- pImpl->nFlags |= HTMLCFG_IGNORE_FONT_FAMILY;
+ pImpl->nFlags |= HtmlCfgFlags::IgnoreFontFamily;
else
- pImpl->nFlags &= ~HTMLCFG_IGNORE_FONT_FAMILY;
+ pImpl->nFlags &= ~HtmlCfgFlags::IgnoreFontFamily;
SetModified();
}
bool SvxHtmlOptions::IsStarBasicWarning() const
{
- return 0 != (pImpl->nFlags & HTMLCFG_IS_BASIC_WARNING) ;
+ return bool(pImpl->nFlags & HtmlCfgFlags::IsBasicWarning) ;
}
void SvxHtmlOptions::SetStarBasicWarning(bool bSet)
{
if(bSet)
- pImpl->nFlags |= HTMLCFG_IS_BASIC_WARNING;
+ pImpl->nFlags |= HtmlCfgFlags::IsBasicWarning;
else
- pImpl->nFlags &= ~HTMLCFG_IS_BASIC_WARNING;
+ pImpl->nFlags &= ~HtmlCfgFlags::IsBasicWarning;
SetModified();
}
@@ -402,15 +406,15 @@ SvxHtmlOptions& SvxHtmlOptions::Get()
bool SvxHtmlOptions::IsNumbersEnglishUS() const
{
- return 0 != (pImpl->nFlags & HTMLCFG_NUMBERS_ENGLISH_US) ;
+ return bool(pImpl->nFlags & HtmlCfgFlags::NumbersEnglishUS) ;
}
void SvxHtmlOptions::SetNumbersEnglishUS(bool bSet)
{
if(bSet)
- pImpl->nFlags |= HTMLCFG_NUMBERS_ENGLISH_US;
+ pImpl->nFlags |= HtmlCfgFlags::NumbersEnglishUS;
else
- pImpl->nFlags &= ~HTMLCFG_NUMBERS_ENGLISH_US;
+ pImpl->nFlags &= ~HtmlCfgFlags::NumbersEnglishUS;
SetModified();
}
commit 2d3dc65dbaf3ce273093d870ae7ae4c49a76fb79
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Nov 24 14:06:04 2016 +0200
convert FOUND constants to o3tl::typed_flags
Change-Id: Ia167ed1abc10188d89e1bd43d7a2b884cb0bf52d
diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx
index 4a1db16..ff0d042 100644
--- a/sd/source/ui/unoidl/unoobj.cxx
+++ b/sd/source/ui/unoidl/unoobj.cxx
@@ -58,6 +58,7 @@
#include "sdresid.hxx"
#include <comphelper/serviceinfohelper.hxx>
#include <svx/svdogrp.hxx>
+#include <o3tl/typed_flags_set.hxx>
#include "anminfo.hxx"
#include "unoobj.hxx"
@@ -1148,16 +1149,22 @@ SdUnoEventsAccess::SdUnoEventsAccess( SdXShape* pShape ) throw()
{
}
-#define FOUND_CLICKACTION 0x0001
-#define FOUND_BOOKMARK 0x0002
-#define FOUND_EFFECT 0x0004
-#define FOUND_PLAYFULL 0x0008
-#define FOUND_VERB 0x0010
-#define FOUND_SOUNDURL 0x0020
-#define FOUND_SPEED 0x0040
-#define FOUND_EVENTTYPE 0x0080
-#define FOUND_MACRO 0x0100
-#define FOUND_LIBRARY 0x0200
+enum class FoundFlags {
+ NONE = 0x0000,
+ ClickAction = 0x0001,
+ Bookmark = 0x0002,
+ Effect = 0x0004,
+ PlayFull = 0x0008,
+ Verb = 0x0010,
+ SoundUrl = 0x0020,
+ Speed = 0x0040,
+ EventType = 0x0080,
+ Macro = 0x0100,
+ Library = 0x0200,
+};
+namespace o3tl {
+ template<> struct typed_flags<FoundFlags> : is_typed_flags<FoundFlags, 0x03ff> {};
+}
static void clearEventsInAnimationInfo( SdAnimationInfo* pInfo )
{
@@ -1181,7 +1188,7 @@ void SAL_CALL SdUnoEventsAccess::replaceByName( const OUString& aName, const uno
if( !aElement.hasValue() || aElement.getValueType() != getElementType() || !(aElement >>= aProperties) )
throw lang::IllegalArgumentException();
- sal_Int32 nFound = 0;
+ FoundFlags nFound = FoundFlags::NONE;
const beans::PropertyValue* pProperties = aProperties.getConstArray();
OUString aStrEventType;
@@ -1199,83 +1206,83 @@ void SAL_CALL SdUnoEventsAccess::replaceByName( const OUString& aName, const uno
sal_Int32 nIndex;
for( nIndex = 0; nIndex < nCount; nIndex++, pProperties++ )
{
- if( ( ( nFound & FOUND_EVENTTYPE ) == 0 ) && pProperties->Name == maStrEventType )
+ if( !( nFound & FoundFlags::EventType ) && pProperties->Name == maStrEventType )
{
if( pProperties->Value >>= aStrEventType )
{
- nFound |= FOUND_EVENTTYPE;
+ nFound |= FoundFlags::EventType;
continue;
}
}
- else if( ( ( nFound & FOUND_CLICKACTION ) == 0 ) && pProperties->Name == maStrClickAction )
+ else if( !( nFound & FoundFlags::ClickAction ) && pProperties->Name == maStrClickAction )
{
if( pProperties->Value >>= eClickAction )
{
- nFound |= FOUND_CLICKACTION;
+ nFound |= FoundFlags::ClickAction;
continue;
}
}
- else if( ( ( nFound & FOUND_MACRO ) == 0 ) && ( pProperties->Name == maStrMacroName || pProperties->Name == maStrScript ) )
+ else if( !( nFound & FoundFlags::Macro ) && ( pProperties->Name == maStrMacroName || pProperties->Name == maStrScript ) )
{
if( pProperties->Value >>= aStrMacro )
{
- nFound |= FOUND_MACRO;
+ nFound |= FoundFlags::Macro;
continue;
}
}
- else if( ( ( nFound & FOUND_LIBRARY ) == 0 ) && pProperties->Name == maStrLibrary )
+ else if( !( nFound & FoundFlags::Library ) && pProperties->Name == maStrLibrary )
{
if( pProperties->Value >>= aStrLibrary )
{
- nFound |= FOUND_LIBRARY;
+ nFound |= FoundFlags::Library;
continue;
}
}
- else if( ( ( nFound & FOUND_EFFECT ) == 0 ) && pProperties->Name == maStrEffect )
+ else if( !( nFound & FoundFlags::Effect ) && pProperties->Name == maStrEffect )
{
if( pProperties->Value >>= eEffect )
{
- nFound |= FOUND_EFFECT;
+ nFound |= FoundFlags::Effect;
continue;
}
}
- else if( ( ( nFound & FOUND_BOOKMARK ) == 0 ) && pProperties->Name == maStrBookmark )
+ else if( !( nFound & FoundFlags::Bookmark ) && pProperties->Name == maStrBookmark )
{
if( pProperties->Value >>= aStrBookmark )
{
- nFound |= FOUND_BOOKMARK;
+ nFound |= FoundFlags::Bookmark;
continue;
}
}
- else if( ( ( nFound & FOUND_SPEED ) == 0 ) && pProperties->Name == maStrSpeed )
+ else if( !( nFound & FoundFlags::Speed ) && pProperties->Name == maStrSpeed )
{
if( pProperties->Value >>= eSpeed )
{
- nFound |= FOUND_SPEED;
+ nFound |= FoundFlags::Speed;
continue;
}
}
- else if( ( ( nFound & FOUND_SOUNDURL ) == 0 ) && pProperties->Name == maStrSoundURL )
+ else if( !( nFound & FoundFlags::SoundUrl ) && pProperties->Name == maStrSoundURL )
{
if( pProperties->Value >>= aStrSoundURL )
{
- nFound |= FOUND_SOUNDURL;
+ nFound |= FoundFlags::SoundUrl;
continue;
}
}
- else if( ( ( nFound & FOUND_PLAYFULL ) == 0 ) && pProperties->Name == maStrPlayFull )
+ else if( !( nFound & FoundFlags::PlayFull ) && pProperties->Name == maStrPlayFull )
{
if( pProperties->Value >>= bPlayFull )
{
- nFound |= FOUND_PLAYFULL;
+ nFound |= FoundFlags::PlayFull;
continue;
}
}
- else if( ( ( nFound & FOUND_VERB ) == 0 ) && pProperties->Name == maStrVerb )
+ else if( !( nFound & FoundFlags::Verb ) && pProperties->Name == maStrVerb )
{
if( pProperties->Value >>= nVerb )
{
- nFound |= FOUND_VERB;
+ nFound |= FoundFlags::Verb;
continue;
}
}
@@ -1286,12 +1293,12 @@ void SAL_CALL SdUnoEventsAccess::replaceByName( const OUString& aName, const uno
bool bOk = false;
do
{
- if( ( nFound & FOUND_EVENTTYPE ) == 0 )
+ if( !( nFound & FoundFlags::EventType ) )
break;
if( aStrEventType == maStrPresentation )
{
- if( ( nFound & FOUND_CLICKACTION ) == 0 )
+ if( !( nFound & FoundFlags::ClickAction ) )
break;
SdAnimationInfo* pInfo = mpShape->GetAnimationInfo();
@@ -1328,7 +1335,7 @@ void SAL_CALL SdUnoEventsAccess::replaceByName( const OUString& aName, const uno
case presentation::ClickAction_PROGRAM:
case presentation::ClickAction_BOOKMARK:
case presentation::ClickAction_DOCUMENT:
- if( nFound & FOUND_BOOKMARK )
+ if( nFound & FoundFlags::Bookmark )
{
if( eClickAction == presentation::ClickAction_BOOKMARK )
{
@@ -1351,7 +1358,7 @@ void SAL_CALL SdUnoEventsAccess::replaceByName( const OUString& aName, const uno
break;
case presentation::ClickAction_MACRO:
- if( nFound & FOUND_MACRO )
+ if( nFound & FoundFlags::Macro )
{
pInfo->SetBookmark( aStrMacro );
bOk = true;
@@ -1359,7 +1366,7 @@ void SAL_CALL SdUnoEventsAccess::replaceByName( const OUString& aName, const uno
break;
case presentation::ClickAction_VERB:
- if( nFound & FOUND_VERB )
+ if( nFound & FoundFlags::Verb )
{
pInfo->mnVerb = (sal_uInt16)nVerb;
bOk = true;
@@ -1367,23 +1374,23 @@ void SAL_CALL SdUnoEventsAccess::replaceByName( const OUString& aName, const uno
break;
case presentation::ClickAction_VANISH:
- if( ( nFound & FOUND_EFFECT ) == 0 )
+ if( !( nFound & FoundFlags::Effect ) )
break;
pInfo->meSecondEffect = eEffect;
- pInfo->meSecondSpeed = nFound & FOUND_SPEED ? eSpeed : presentation::AnimationSpeed_MEDIUM;
+ pInfo->meSecondSpeed = nFound & FoundFlags::Speed ? eSpeed : presentation::AnimationSpeed_MEDIUM;
bOk = true;
SAL_FALLTHROUGH;
case presentation::ClickAction_SOUND:
- if( nFound & FOUND_SOUNDURL )
+ if( nFound & FoundFlags::SoundUrl )
{
pInfo->SetBookmark( aStrSoundURL );
if( eClickAction != presentation::ClickAction_SOUND )
pInfo->mbSecondSoundOn = !aStrSoundURL.isEmpty();
- pInfo->mbSecondPlayFull = (nFound & FOUND_PLAYFULL) && bPlayFull;
+ pInfo->mbSecondPlayFull = (nFound & FoundFlags::PlayFull) && bPlayFull;
bOk = true;
}
commit bd7c9afb8b3c49cae80593414eeb262f2e1fb643
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Nov 24 13:39:18 2016 +0200
convert VAR constants to o3tl::typed_flags
and drop the unused EXTENDABLE
Change-Id: Iddb2d4c1f3a3f76e4687ad002c0c4b9f7e6ca055
diff --git a/rsc/inc/rscclass.hxx b/rsc/inc/rscclass.hxx
index bc9b312..31bf1fd 100644
--- a/rsc/inc/rscclass.hxx
+++ b/rsc/inc/rscclass.hxx
@@ -62,7 +62,7 @@ public:
void Pre_dtor() override;
ERRTYPE SetVariable( Atom nVarName, RscTop * pClass,
RSCINST * pDflt = nullptr,
- RSCVAR nVarType = 0, sal_uInt32 nMask = 0,
+ RSCVAR nVarType = RSCVAR::NONE, sal_uInt32 nMask = 0,
Atom nDataBaseName = InvalidAtom ) override;
virtual void EnumVariables( void * pData, VarEnumCallbackProc ) override;
RSCINST GetVariable( const RSCINST & rInst, Atom nVarName,
diff --git a/rsc/inc/rsctop.hxx b/rsc/inc/rsctop.hxx
index b4feec0..24d4082 100644
--- a/rsc/inc/rsctop.hxx
+++ b/rsc/inc/rsctop.hxx
@@ -24,15 +24,20 @@
#include <rschash.hxx>
#include <rscclobj.hxx>
#include <rsc/rscsfx.hxx>
-
-typedef sal_uInt32 RSCVAR;
-#define VAR_POINTER 0x0001
-#define VAR_HIDDEN 0x0002
-#define VAR_NODATAINST 0x0004
-#define VAR_NORC 0x0008
-#define VAR_SVDYNAMIC 0x0010
-#define VAR_NOENUM 0x0020
-#define VAR_EXTENDABLE 0x0040 /* class derivation can all be given */
+#include <o3tl/typed_flags_set.hxx>
+
+enum class RSCVAR {
+ NONE = 0x0000,
+ Pointer = 0x0001,
+ Hidden = 0x0002,
+ NoDataInst = 0x0004,
+ NoRc = 0x0008,
+ SvDynamic = 0x0010,
+ NoEnum = 0x0020
+};
+namespace o3tl {
+ template<> struct typed_flags<RSCVAR> : is_typed_flags<RSCVAR, 0x007f> {};
+}
class RscTop : public RefNode
{
@@ -83,7 +88,7 @@ public:
// sets the variable
virtual ERRTYPE SetVariable( Atom nVarName, RscTop * pClass,
RSCINST * pDflt = nullptr,
- RSCVAR nVarType = 0, sal_uInt32 nMask = 0,
+ RSCVAR nVarType = RSCVAR::NONE, sal_uInt32 nMask = 0,
Atom nDataBaseName = InvalidAtom );
// enumerate all variables
diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx
index e03ce1e..05a6920 100644
--- a/rsc/source/parser/rscicpx.cxx
+++ b/rsc/source/parser/rscicpx.cxx
@@ -57,7 +57,7 @@ RscTop * RscTypCont::InitClassMgr()
pClassMgr->SetVariable( nId, pCont );
};
nId = aNmTb.Put( "Comment", VARNAME );
- pClassMgr->SetVariable( nId, &aString, nullptr, VAR_NORC );
+ pClassMgr->SetVariable( nId, &aString, nullptr, RSCVAR::NoRc );
pClass->SetTypeClass( pClassMgr );
@@ -92,7 +92,7 @@ RscTop * RscTypCont::InitClassBitmap( RscTop * pSuper )
// the class RscSysDepend handles variables "FILE" in a specific way
nId = aNmTb.Put( "File", VARNAME );
- pClassBitmap->SetVariable( nId, &aLangString, nullptr, VAR_NORC );
+ pClassBitmap->SetVariable( nId, &aLangString, nullptr, RSCVAR::NoRc );
return pClassBitmap;
}
@@ -110,7 +110,7 @@ RscTop * RscTypCont::InitClassImage( RscTop * pSuper, RscTop * pClassBitmap )
// initialize variables
nId = aNmTb.Put( "ImageBitmap", VARNAME );
- pClassImage->SetVariable( nId, pClassBitmap, nullptr, 0, (sal_uInt32)RscImageFlags::ImageBitmap );
+ pClassImage->SetVariable( nId, pClassBitmap, nullptr, RSCVAR::NONE, (sal_uInt32)RscImageFlags::ImageBitmap );
return pClassImage;
}
@@ -133,14 +133,14 @@ RscTop * RscTypCont::InitClassImageList( RscTop * pSuper, RscCont * pStrLst )
pCont->SetTypeClass( &aIdUShort );
aBaseLst.push_back( pCont );
nId = aNmTb.Put( "IdList", VARNAME );
- pClassImageList->SetVariable( nId, pCont, nullptr, 0,
+ pClassImageList->SetVariable( nId, pCont, nullptr, RSCVAR::NONE,
(sal_uInt32)RscImageListFlags::IdList );
nId = aNmTb.Put( "FileList", VARNAME );
pClassImageList->SetVariable( nId, pStrLst );
nId = aNmTb.Put( "IdCount", VARNAME );
- pClassImageList->SetVariable( nId, &aUShort, nullptr, 0,
+ pClassImageList->SetVariable( nId, &aUShort, nullptr, RSCVAR::NONE,
(sal_uInt32)RscImageListFlags::IdCount );
return pClassImageList;
}
@@ -177,7 +177,7 @@ RscTop * RscTypCont::InitClassKeyCode( RscTop * pSuper, RscEnum * pKey )
// add variable
nVarId = aNmTb.Put( "_ModifierFlags", VARNAME );
pClassKeyCode->SetVariable( nVarId, pFlag, nullptr,
- VAR_HIDDEN | VAR_NOENUM );
+ RSCVAR::Hidden | RSCVAR::NoEnum );
// add client variables
aBaseLst.push_back(
@@ -185,14 +185,14 @@ RscTop * RscTypCont::InitClassKeyCode( RscTop * pSuper, RscEnum * pKey )
);
nId = aNmTb.Put( "Shift", VARNAME );
pClassKeyCode->SetVariable( nId, pClient, nullptr,
- VAR_NODATAINST, 0, nVarId );
+ RSCVAR::NoDataInst, 0, nVarId );
aBaseLst.push_back(
pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, nMod1Id )
);
nId = aNmTb.Put( "Modifier1", VARNAME );
pClassKeyCode->SetVariable( nId, pClient, nullptr,
- VAR_NODATAINST, 0, nVarId );
+ RSCVAR::NoDataInst, 0, nVarId );
aBaseLst.push_back(
@@ -200,7 +200,7 @@ RscTop * RscTypCont::InitClassKeyCode( RscTop * pSuper, RscEnum * pKey )
);
nId = aNmTb.Put( "Modifier2", VARNAME );
pClassKeyCode->SetVariable( nId, pClient, nullptr,
- VAR_NODATAINST, 0, nVarId );
+ RSCVAR::NoDataInst, 0, nVarId );
}
{
Atom nVarId;
@@ -247,10 +247,10 @@ RscTop * RscTypCont::InitClassMenuItem( RscTop * pSuper )
// initialize variables
nId = aNmTb.Put( "Separator", VARNAME );
- pClassMenuItem->SetVariable( nId, &aBool, nullptr, 0,
+ pClassMenuItem->SetVariable( nId, &aBool, nullptr, RSCVAR::NONE,
(sal_uInt32)RscMenuItem::Separator );
nId = aNmTb.Put( "Identifier", VARNAME );
- pClassMenuItem->SetVariable( nId, &aIdNoZeroUShort, nullptr, 0,
+ pClassMenuItem->SetVariable( nId, &aIdNoZeroUShort, nullptr, RSCVAR::NONE,
(sal_uInt32)RscMenuItem::Id );
{
RscFlag * pFlag;
@@ -275,7 +275,7 @@ RscTop * RscTypCont::InitClassMenuItem( RscTop * pSuper )
// add variable
nVarId = aNmTb.Put( "_MenuItemFlags", VARNAME );
pClassMenuItem->SetVariable( nVarId, pFlag, nullptr,
- VAR_HIDDEN | VAR_NOENUM,
+ RSCVAR::Hidden | RSCVAR::NoEnum,
(sal_uInt32)RscMenuItem::Status );
// add client variables
@@ -284,51 +284,51 @@ RscTop * RscTypCont::InitClassMenuItem( RscTop * pSuper )
);
nId = aNmTb.Put( "Checkable", VARNAME );
pClassMenuItem->SetVariable( nId, pClient, nullptr,
- VAR_NODATAINST, 0, nVarId );
+ RSCVAR::NoDataInst, 0, nVarId );
aBaseLst.push_back(
pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, nAutoCheckId )
);
nId = aNmTb.Put( "AutoCheck", VARNAME );
pClassMenuItem->SetVariable( nId, pClient, nullptr,
- VAR_NODATAINST, 0, nVarId );
+ RSCVAR::NoDataInst, 0, nVarId );
aBaseLst.push_back(
pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, nRadioCheckId )
);
nId = aNmTb.Put( "RadioCheck", VARNAME );
pClassMenuItem->SetVariable( nId, pClient, nullptr,
- VAR_NODATAINST, 0, nVarId );
+ RSCVAR::NoDataInst, 0, nVarId );
aBaseLst.push_back(
pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, nAboutId )
);
nId = aNmTb.Put( "About", VARNAME );
pClassMenuItem->SetVariable( nId, pClient, nullptr,
- VAR_NODATAINST, 0, nVarId );
+ RSCVAR::NoDataInst, 0, nVarId );
aBaseLst.push_back(
pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, nHelpId )
);
nId = aNmTb.Put( "Help", VARNAME );
pClassMenuItem->SetVariable( nId, pClient, nullptr,
- VAR_NODATAINST, 0, nVarId );
+ RSCVAR::NoDataInst, 0, nVarId );
}
nId = aNmTb.Put( "Text", VARNAME );
- pClassMenuItem->SetVariable( nId, &aLangString, nullptr, 0,
+ pClassMenuItem->SetVariable( nId, &aLangString, nullptr, RSCVAR::NONE,
(sal_uInt32)RscMenuItem::Text );
nId = aNmTb.Put( "HelpText", VARNAME );
- pClassMenuItem->SetVariable( nId, &aLangString, nullptr, 0,
+ pClassMenuItem->SetVariable( nId, &aLangString, nullptr, RSCVAR::NONE,
(sal_uInt32)RscMenuItem::HelpText );
nId = aNmTb.Put( "HelpID", VARNAME );
- pClassMenuItem->SetVariable( nId, &aStringLiteral, nullptr, 0,
+ pClassMenuItem->SetVariable( nId, &aStringLiteral, nullptr, RSCVAR::NONE,
(sal_uInt32)RscMenuItem::HelpId );
nId = aNmTb.Put( "Disable", VARNAME );
- pClassMenuItem->SetVariable( nId, &aBool, nullptr, 0,
+ pClassMenuItem->SetVariable( nId, &aBool, nullptr, RSCVAR::NONE,
(sal_uInt32)RscMenuItem::Disable );
nId = aNmTb.Put( "Command", VARNAME );
- pClassMenuItem->SetVariable( nId, &aString, nullptr, 0,
+ pClassMenuItem->SetVariable( nId, &aString, nullptr, RSCVAR::NONE,
(sal_uInt32)RscMenuItem::Command );
return pClassMenuItem;
@@ -353,10 +353,10 @@ RscTop * RscTypCont::InitClassMenu( RscTop * pSuper,
aBaseLst.push_back( pCont = new RscCont( pHS->getID( "ContMenuItem" ), RSC_NOTYPE ) );
pCont->SetTypeClass( pClassMenuItem );
nId = aNmTb.Put( "ItemList", VARNAME );
- pClassMenu->SetVariable( nId, pCont, nullptr, 0, (sal_uInt32)RscMenu::Items );
+ pClassMenu->SetVariable( nId, pCont, nullptr, RSCVAR::NONE, (sal_uInt32)RscMenu::Items );
}
nId = aNmTb.Put( "Text", VARNAME );
- pClassMenu->SetVariable( nId, &aLangString, nullptr, 0, (sal_uInt32)RscMenu::Text );
+ pClassMenu->SetVariable( nId, &aLangString, nullptr, RSCVAR::NONE, (sal_uInt32)RscMenu::Text );
return pClassMenu;
}
diff --git a/rsc/source/parser/rscinit.cxx b/rsc/source/parser/rscinit.cxx
index 13b8859..18b96a8 100644
--- a/rsc/source/parser/rscinit.cxx
+++ b/rsc/source/parser/rscinit.cxx
@@ -138,7 +138,7 @@ void RscTypCont::Init()
// pClassMenu is only completely defined here
nId = aNmTb.Put( "SubMenu", VARNAME );
- pClassMenuItem->SetVariable( nId, pClassMenu, nullptr, VAR_SVDYNAMIC,
+ pClassMenuItem->SetVariable( nId, pClassMenu, nullptr, RSCVAR::SvDynamic,
(sal_uInt32)RscMenuItem::Menu );
}
diff --git a/rsc/source/res/rscclass.cxx b/rsc/source/res/rscclass.cxx
index 3e6e802..fc1d08e 100644
--- a/rsc/source/res/rscclass.cxx
+++ b/rsc/source/res/rscclass.cxx
@@ -78,7 +78,7 @@ RSCINST RscClass::GetInstData
aInst.pClass = pVarTypeList[ nEle ].pClass;
if( pData )
{
- if( VAR_NODATAINST & pVarTypeList[ nEle ].nVarType )
+ if( RSCVAR::NoDataInst & pVarTypeList[ nEle ].nVarType )
{
RSCINST aTmpI;
@@ -96,12 +96,9 @@ RSCINST RscClass::GetInstData
RSCINST()
).pData;
}
- else if( VAR_POINTER & pVarTypeList[ nEle ].nVarType )
+ else if( RSCVAR::Pointer & pVarTypeList[ nEle ].nVarType )
{
- if( VAR_EXTENDABLE & pVarTypeList[ nEle ].nVarType )
- aInst = *reinterpret_cast<RSCINST *>(pData + pVarTypeList[ nEle ].nOffset);
- else
- aInst.pData = *reinterpret_cast<CLASS_DATA *>(pData + pVarTypeList[ nEle ].nOffset);
+ aInst.pData = *reinterpret_cast<CLASS_DATA *>(pData + pVarTypeList[ nEle ].nOffset);
}
else
aInst.pData = pData + pVarTypeList[ nEle ].nOffset;
@@ -167,19 +164,10 @@ RSCINST RscClass::Create( RSCINST * pInst,
{
aDfltI = GetInstData( bOwnClass ? rDflt.pData : nullptr, i, true );
- if( (VAR_POINTER & pVarTypeList[ i ].nVarType) &&
- !(VAR_NODATAINST & pVarTypeList[ i ].nVarType) )
+ if( (RSCVAR::Pointer & pVarTypeList[ i ].nVarType) &&
+ !(RSCVAR::NoDataInst & pVarTypeList[ i ].nVarType) )
{
- CLASS_DATA * ppData;
- if( VAR_EXTENDABLE & pVarTypeList[ i ].nVarType )
- {
- RSCINST * pInstance = reinterpret_cast<RSCINST *>(aInst.pData + pVarTypeList[ i ].nOffset );
- pInstance->pClass = pVarTypeList[ i ].pClass;
- ppData = &pInstance->pData;
- }
- else
- ppData = reinterpret_cast<CLASS_DATA*>(aInst.pData + pVarTypeList[ i ].nOffset );
-
+ CLASS_DATA * ppData = reinterpret_cast<CLASS_DATA*>(aInst.pData + pVarTypeList[ i ].nOffset );
*ppData = nullptr;
if( aDfltI.IsInst() )
{
@@ -205,7 +193,7 @@ void RscClass::Destroy( const RSCINST & rInst )
for( i = 0; i < nEntries; i++ )
{
- if( !(pVarTypeList[ i ].nVarType & VAR_NODATAINST) )
+ if( !(pVarTypeList[ i ].nVarType & RSCVAR::NoDataInst) )
{
RSCINST aTmpI;
@@ -214,7 +202,7 @@ void RscClass::Destroy( const RSCINST & rInst )
{
// destroy object
aTmpI.pClass->Destroy( aTmpI );
- if( pVarTypeList[ i ].nVarType & VAR_POINTER )
+ if( pVarTypeList[ i ].nVarType & RSCVAR::Pointer )
{
// free memory
rtl_freeMemory( aTmpI.pData );
@@ -251,18 +239,15 @@ ERRTYPE RscClass::SetVariable( Atom nVarName,
else
pVarTypeList[ nEntries ].pDefault = nullptr;
- pVarTypeList[ nEntries ].nVarType = ~VAR_POINTER & nVarType;
- if( pClass->Size() > 10 || (nVarType & VAR_EXTENDABLE) )
- pVarTypeList[ nEntries ].nVarType |= VAR_POINTER;
+ pVarTypeList[ nEntries ].nVarType = ~RSCVAR::Pointer & nVarType;
+ if( pClass->Size() > 10 )
+ pVarTypeList[ nEntries ].nVarType |= RSCVAR::Pointer;
- if( !(pVarTypeList[ nEntries ].nVarType & VAR_NODATAINST) )
+ if( !(pVarTypeList[ nEntries ].nVarType & RSCVAR::NoDataInst) )
{
- if( pVarTypeList[ nEntries ].nVarType & VAR_POINTER )
+ if( pVarTypeList[ nEntries ].nVarType & RSCVAR::Pointer )
{
- if( pVarTypeList[ nEntries ].nVarType & VAR_EXTENDABLE )
- nSize += sizeof( RSCINST );
- else
- nSize += sizeof( CLASS_DATA );
+ nSize += sizeof( CLASS_DATA );
}
else
nSize += pClass->Size();
@@ -284,7 +269,7 @@ void RscClass::EnumVariables( void * pData, VarEnumCallbackProc pProc )
RscTop::EnumVariables( pData, pProc );
for( i = 0; i < nEntries; i ++ )
{
- if( !(pVarTypeList[ i ].nVarType & VAR_NOENUM) )
+ if( !(pVarTypeList[ i ].nVarType & RSCVAR::NoEnum) )
(*pProc)( pData, pVarTypeList[ i ].pClass->GetClassType(), pVarTypeList[ i ].nVarName );
}
}
@@ -303,7 +288,7 @@ RSCINST RscClass::GetVariable( const RSCINST & rInst,
if( i < nEntries )
{
- if( VAR_NODATAINST & pVarTypeList[ i ].nVarType )
+ if( RSCVAR::NoDataInst & pVarTypeList[ i ].nVarType )
{
aTmpI = GetVariable( rInst,
pVarTypeList[ i ].nDataBaseName,
@@ -332,23 +317,10 @@ RSCINST RscClass::GetVariable( const RSCINST & rInst,
}
else
{ // is provided via pointer
- if( VAR_EXTENDABLE & pVarTypeList[ i ].nVarType )
- {
- RSCINST * pInst = reinterpret_cast<RSCINST *>
- (rInst.pData + pVarTypeList[ i ].nOffset );
- if( pCreateClass && pCreateClass->InHierarchy( aTmpI.pClass ) )
- *pInst = pCreateClass->Create( nullptr, aDefInst );
- else
- *pInst = aTmpI.pClass->Create( nullptr, aDefInst );
- aTmpI = *pInst;
- }
- else
- {
- CLASS_DATA * ppData
- = reinterpret_cast<CLASS_DATA *>(rInst.pData + pVarTypeList[ i ].nOffset);
- aTmpI = aTmpI.pClass->Create( nullptr, aDefInst );
- *ppData = aTmpI.pData;
- }
+ CLASS_DATA * ppData
+ = reinterpret_cast<CLASS_DATA *>(rInst.pData + pVarTypeList[ i ].nOffset);
+ aTmpI = aTmpI.pClass->Create( nullptr, aDefInst );
+ *ppData = aTmpI.pData;
}
}
// set as non default
@@ -370,7 +342,7 @@ RSCINST RscClass::GetCopyVar( const RSCINST & rInst, Atom nVarName)
if( i < nEntries )
{
- if( VAR_NODATAINST & pVarTypeList[ i ].nVarType )
+ if( RSCVAR::NoDataInst & pVarTypeList[ i ].nVarType )
{
aVarI = GetCopyVar( rInst, pVarTypeList[ i ].nDataBaseName );
aVarI.pClass = pVarTypeList[ i ].pClass;
@@ -403,7 +375,7 @@ bool RscClass::IsConsistent( const RSCINST & rInst )
for( i = 0; i < nEntries; i++ )
{
- if( !(VAR_NODATAINST & pVarTypeList[ i ].nVarType) )
+ if( !(RSCVAR::NoDataInst & pVarTypeList[ i ].nVarType) )
{
aTmpI = GetInstData( rInst.pData, i, true );
@@ -427,7 +399,7 @@ void RscClass::SetToDefault( const RSCINST & rInst )
for( i = 0; i < nEntries; i++ )
{
// variables without own memory are set from "data server" to default
- if( !(VAR_NODATAINST & pVarTypeList[ i ].nVarType) )
+ if( !(RSCVAR::NoDataInst & pVarTypeList[ i ].nVarType) )
{
aTmpI = GetInstData( rInst.pData, i, true );
if( aTmpI.IsInst() )
@@ -447,7 +419,7 @@ bool RscClass::IsDefault( const RSCINST & rInst )
for( i = 0; i < nEntries; i++ )
{
// variables without own memory are looked for default in "data server"
- if( !(VAR_NODATAINST & pVarTypeList[ i ].nVarType) )
+ if( !(RSCVAR::NoDataInst & pVarTypeList[ i ].nVarType) )
if( !IsDflt( rInst.pData, i ) )
return false;
}
@@ -483,7 +455,7 @@ bool RscClass::IsValueDflt( CLASS_DATA pData, sal_uInt32 nEle )
if( aTmpI.IsInst() )
{
- if( VAR_SVDYNAMIC & pVarTypeList[ nEle ].nVarType )
+ if( RSCVAR::SvDynamic & pVarTypeList[ nEle ].nVarType )
return false;
if( aTmpI.pClass == pVarTypeList[ nEle ].pClass )
@@ -566,7 +538,7 @@ void RscClass::WriteSrc( const RSCINST & rInst,
for( i = 0; i < nEntries; i++ )
{
- if( !(VAR_HIDDEN & pVarTypeList[ i ].nVarType) )
+ if( !(RSCVAR::Hidden & pVarTypeList[ i ].nVarType) )
{
if( !IsDflt( rInst.pData, i ) && !IsValueDflt( rInst.pData, i ) )
{
@@ -616,7 +588,7 @@ ERRTYPE RscClass::WriteInstRc( const RSCINST & rInst,
for( i = 0; i < nEntries && aError.IsOk(); i++ )
{
- if( !((VAR_NODATAINST | VAR_NORC) & pVarTypeList[ i ].nVarType ))
+ if( !((RSCVAR::NoDataInst | RSCVAR::NoRc) & pVarTypeList[ i ].nVarType ))
{
if( pVarTypeList[ i ].nMask )
{
@@ -749,7 +721,7 @@ void RscTupel::WriteSrc( const RSCINST & rInst, FILE * fOutput,
fprintf( fOutput, "< " );
for( i = 0; i < nEntries; i++ )
{
- if( !(VAR_HIDDEN & pVarTypeList[ i ].nVarType) )
+ if( !(RSCVAR::Hidden & pVarTypeList[ i ].nVarType) )
{
if( !IsDflt( rInst.pData, i )
&& !IsValueDflt( rInst.pData, i ) )
commit a0ee31da5cb12e353da745455f1b4e9f147410da
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Nov 24 13:28:56 2016 +0200
convert FLAG constants to o3tl::typed_flags
Change-Id: I3b51321c425b8e0039932b5d4b48d35c3bf14378
diff --git a/rsc/inc/rscall.h b/rsc/inc/rscall.h
index ba23997..53cedd6 100644
--- a/rsc/inc/rscall.h
+++ b/rsc/inc/rscall.h
@@ -24,6 +24,7 @@
#include <rscdef.hxx>
#include <rschash.hxx>
#include <rtl/alloc.h>
+#include <o3tl/typed_flags_set.hxx>
/******************* T y p e s *******************************************/
typedef char * CLASS_DATA; // Zeiger auf die Daten einer Klasse
@@ -45,16 +46,22 @@ extern AtomContainer* pHS;
/******************* D e f i n e s ***************************************/
-#define HELP_FLAG 0x0001 // Hilfe anzeigen
-#define NOPREPRO_FLAG 0x0002 // kein Preprozesor
-#define NOSYNTAX_FLAG 0x0004 // keine Syntaxanalyse
-#define NOLINK_FLAG 0x0008 // nicht linken
-#define NORESFILE_FLAG 0x0010 // keine .res-Datei erzeugen
-#define DEFINE_FLAG 0x0020 // es wurde Definitionen angegeben
-#define INCLUDE_FLAG 0x0040 // der Include-Pfad wurde erweitert
-#define PRELOAD_FLAG 0x0200 // Alle Resourcen Preloaden
-#define SRSDEFAULT_FLAG 0x1000 // immer der Default geschrieben
-#define NOSYSRESTEST_FLAG 0x2000 // ueberprueft nicht die Richtigkeit von (bmp, ico, cur)
+enum class CommandFlags {
+ NONE = 0x0000,
+ Help = 0x0001, // Hilfe anzeigen
+ NoPrePro = 0x0002, // kein Preprozesor
+ NoSyntax = 0x0004, // keine Syntaxanalyse
+ NoLink = 0x0008, // nicht linken
+ NoResFile = 0x0010, // keine .res-Datei erzeugen
+ Define = 0x0020, // es wurde Definitionen angegeben
+ Include = 0x0040, // der Include-Pfad wurde erweitert
+ Preload = 0x0200, // Alle Resourcen Preloaden
+ SrsDefault = 0x1000, // immer der Default geschrieben
+ NoSysResTest = 0x2000 // ueberprueft nicht die Richtigkeit von (bmp, ico, cur)
+};
+namespace o3tl {
+ template<> struct typed_flags<CommandFlags> : is_typed_flags<CommandFlags, 0x327f> {};
+}
/******************* T y p e s *******************************************/
diff --git a/rsc/inc/rscdb.hxx b/rsc/inc/rscdb.hxx
index 11e369b..70feb5a 100644
--- a/rsc/inc/rscdb.hxx
+++ b/rsc/inc/rscdb.hxx
@@ -113,16 +113,16 @@ public:
RscError* pEH; // error handler
RscNameTable aNmTb; // name table
- RscFileTab aFileTab; // fila name table
- sal_uInt32 nFlags;
+ RscFileTab aFileTab; // file name table
+ CommandFlags nFlags;
std::map<sal_uInt64, sal_uLong> aIdTranslator; // map resources types and ids to an id (under PM9 or to a file position (MTF)
- RscTypCont( RscError *, RSCBYTEORDER_TYPE, const OString& rSearchPath, sal_uInt32 nFlags );
+ RscTypCont( RscError *, RSCBYTEORDER_TYPE, const OString& rSearchPath, CommandFlags nFlags );
~RscTypCont();
Atom AddLanguage( const char* );
bool IsSrsDefault() const
- { return (nFlags & SRSDEFAULT_FLAG) != 0; }
+ { return bool(nFlags & CommandFlags::SrsDefault); }
OString ChangeLanguage(const OString & rNewLang);
const std::vector< sal_uInt32 >& GetFallbacks() const
{ return aLangFallbacks; }
diff --git a/rsc/inc/rscrsc.hxx b/rsc/inc/rscrsc.hxx
index 7e834970..8f2bc6c 100644
--- a/rsc/inc/rscrsc.hxx
+++ b/rsc/inc/rscrsc.hxx
@@ -35,10 +35,10 @@ class RscCmdLine
public:
- RscStrList aInputList; // source file list
+ RscStrList aInputList; // source file list
OString aPath; // path list
RSCBYTEORDER_TYPE nByteOrder;
- unsigned short nCommands; // command bits
+ CommandFlags nCommands; // command bits
OString aOutputSrs; // Srs output file name
OString aILDir;
diff --git a/rsc/source/parser/rscdb.cxx b/rsc/source/parser/rscdb.cxx
index e7da28e..f9a7afa 100644
--- a/rsc/source/parser/rscdb.cxx
+++ b/rsc/source/parser/rscdb.cxx
@@ -38,7 +38,7 @@
RscTypCont::RscTypCont( RscError * pErrHdl,
RSCBYTEORDER_TYPE nOrder,
const OString& rSearchPath,
- sal_uInt32 nFlagsP )
+ CommandFlags nFlagsP )
: nSourceCharSet( RTL_TEXTENCODING_UTF8 )
, nByteOrder( nOrder )
, aSearchPath( rSearchPath )
diff --git a/rsc/source/rsc/rsc.cxx b/rsc/source/rsc/rsc.cxx
index 4b921d7..87183b5 100644
--- a/rsc/source/rsc/rsc.cxx
+++ b/rsc/source/rsc/rsc.cxx
@@ -65,7 +65,7 @@ AtomContainer* pHS = nullptr;
void RscCmdLine::Init()
{
- nCommands = 0;
+ nCommands = CommandFlags::NONE;
nByteOrder = RSC_BIGENDIAN;
aPath = OString(".");
@@ -114,24 +114,24 @@ RscCmdLine::RscCmdLine( int argc, char ** argv, RscError * pEH )
if( !rsc_stricmp( (*ppStr) + 1, "h" )
|| !strcmp( (*ppStr) + 1, "?" ) )
{ // Write help to standard output
- nCommands |= HELP_FLAG;
+ nCommands |= CommandFlags::Help;
}
else if( !rsc_stricmp( (*ppStr) + 1, "p" ) )
{ // No preprocessor
- nCommands |= NOPREPRO_FLAG;
+ nCommands |= CommandFlags::NoPrePro;
}
else if( !rsc_stricmp( (*ppStr) + 1, "s" ) )
{ // Syntax analysis, creates .srs file
- nCommands |= NOLINK_FLAG;
+ nCommands |= CommandFlags::NoLink;
}
else if( !rsc_stricmp( (*ppStr) + 1, "l" ) )
{ // links, no syntax and no preprocessing
- nCommands |= NOPREPRO_FLAG;
- nCommands |= NOSYNTAX_FLAG;
+ nCommands |= CommandFlags::NoPrePro;
+ nCommands |= CommandFlags::NoSyntax;
}
else if( !rsc_stricmp( (*ppStr) + 1, "r" ) )
{ // generate no .res file
- nCommands |= NORESFILE_FLAG;
+ nCommands |= CommandFlags::NoResFile;
}
else if( !rsc_strnicmp( (*ppStr) + 1, "sub", 3 ) )
{
@@ -146,7 +146,7 @@ RscCmdLine::RscCmdLine( int argc, char ** argv, RscError * pEH )
}
else if( !rsc_stricmp( (*ppStr) + 1, "PreLoad" ) )
{ // all resources with Preload
- nCommands |= PRELOAD_FLAG;
+ nCommands |= CommandFlags::Preload;
}
else if( !rsc_stricmp( (*ppStr) + 1, "LITTLEENDIAN" ) )
{ // endianness when writing
@@ -158,11 +158,11 @@ RscCmdLine::RscCmdLine( int argc, char ** argv, RscError * pEH )
}
else if( !rsc_strnicmp( (*ppStr) + 1, "d", 1 ) )
{ // define symbols
- nCommands |= DEFINE_FLAG;
+ nCommands |= CommandFlags::Define;
}
else if( !rsc_strnicmp( (*ppStr) + 1, "i", 1 ) )
{ // define include path
- nCommands |= INCLUDE_FLAG;
+ nCommands |= CommandFlags::Include;
OStringBuffer aBuffer(aPath);
if (!aBuffer.isEmpty())
aBuffer.append(SAL_PATHSEPARATOR);
@@ -204,11 +204,11 @@ RscCmdLine::RscCmdLine( int argc, char ** argv, RscError * pEH )
}
else if( !rsc_stricmp( (*ppStr) + 1, "NoSysResTest" ) )
{ // don't check Bitmap, Pointers, Icons
- nCommands |= NOSYSRESTEST_FLAG;
+ nCommands |= CommandFlags::NoSysResTest;
}
else if( !rsc_stricmp( (*ppStr) + 1, "SrsDefault" ) )
{ // Only write one language to srs file
- nCommands |= SRSDEFAULT_FLAG;
+ nCommands |= CommandFlags::SrsDefault;
}
else if( !rsc_stricmp( (*ppStr) + 1, "lg" ) )
{
@@ -232,7 +232,7 @@ RscCmdLine::RscCmdLine( int argc, char ** argv, RscError * pEH )
i++;
}
- if( nCommands & HELP_FLAG )
+ if( nCommands & CommandFlags::Help )
pEH->FatalError( ERR_USAGE, RscId() );
// was an inputted file specified
else if( !aInputList.empty() )
@@ -319,9 +319,9 @@ ERRTYPE RscCompiler::Start()
for( size_t i = 0, n = pCL->aInputList.size(); i < n; ++i )
pTC->aFileTab.NewCodeFile( *pCL->aInputList[ i ] );
- if( !(pCL->nCommands & NOSYNTAX_FLAG) )
+ if( !(pCL->nCommands & CommandFlags::NoSyntax) )
{
- if( pCL->nCommands & NOPREPRO_FLAG )
+ if( pCL->nCommands & CommandFlags::NoPrePro )
{
pTC->pEH->SetListFile( nullptr );
@@ -371,7 +371,7 @@ ERRTYPE RscCompiler::Start()
void RscCompiler::EndCompile()
{
- if( !pCL->aOutputSrs.isEmpty() && (pCL->nCommands & NOLINK_FLAG) )
+ if( !pCL->aOutputSrs.isEmpty() && (pCL->nCommands & CommandFlags::NoLink) )
{
pTC->pEH->StdOut( "Writing file ", RscVerbosityVerbose );
pTC->pEH->StdOut( pCL->aOutputSrs.getStr(), RscVerbosityVerbose );
@@ -379,7 +379,7 @@ void RscCompiler::EndCompile()
// copy from TMP to real names
unlink( pCL->aOutputSrs.getStr() ); // delete target file
- if( !(pCL->nCommands & NOSYNTAX_FLAG) )
+ if( !(pCL->nCommands & CommandFlags::NoSyntax) )
{
FILE * foutput;
@@ -558,7 +558,7 @@ ERRTYPE RscCompiler::Link()
ERRTYPE aError;
RscFile* pFName;
- if( !(pCL->nCommands & NOLINK_FLAG) )
+ if( !(pCL->nCommands & CommandFlags::NoLink) )
{
::std::list<RscCmdLine::OutputFile>::const_iterator it;
commit c2775560ab2fa6166b2ce6fa2811ab10a0ffebe8
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Nov 24 13:22:18 2016 +0200
convert STRING_TYP to scoped enum
Change-Id: If0bcc6e13864fd534eb65eda06b1bc2b5498cee9
diff --git a/l10ntools/inc/export.hxx b/l10ntools/inc/export.hxx
index 8e8f5743..220259c 100644
--- a/l10ntools/inc/export.hxx
+++ b/l10ntools/inc/export.hxx
@@ -103,9 +103,9 @@ enum class ExportListType {
NONE, String, Filter, Item, Paired
};
-#define STRING_TYP_TEXT 0x0010
-#define STRING_TYP_QUICKHELPTEXT 0x0040
-#define STRING_TYP_TITLE 0x0080
+enum class StringType {
+ Text, QuickHelpText, Title
+};
typedef ::std::vector< ResData* > ResStack;
@@ -152,7 +152,7 @@ private:
static void CleanValue( OString &rValue );
static OString GetText(const OString &rSource, int nToken);
- void ResData2Output( MergeEntrys *pEntry, sal_uInt16 nType, const OString& rTextType );
+ void ResData2Output( MergeEntrys *pEntry, StringType nType, const OString& rTextType );
void MergeRest( ResData *pResData );
static void ConvertMergeContent( OString &rText );
static void ConvertExportContent( OString &rText );
@@ -204,7 +204,7 @@ public:
sTitle[ rId ] = rTitle;
bTitleFirst[ rId ] = true;
}
- bool GetText( OString &rReturn, sal_uInt16 nTyp, const OString &nLangIndex, bool bDel = false );
+ bool GetText( OString &rReturn, StringType nTyp, const OString &nLangIndex, bool bDel = false );
/**
Generate QTZ string with ResData
diff --git a/l10ntools/source/cfgmerge.cxx b/l10ntools/source/cfgmerge.cxx
index 20a6f0d..240650c 100644
--- a/l10ntools/source/cfgmerge.cxx
+++ b/l10ntools/source/cfgmerge.cxx
@@ -471,7 +471,7 @@ void CfgMerge::WorkOnResourceEnd()
sCur = aLanguages[ i ];
OString sContent;
- pEntrys->GetText( sContent, STRING_TYP_TEXT, sCur , true );
+ pEntrys->GetText( sContent, StringType::Text, sCur , true );
if (
( !sCur.equalsIgnoreAsciiCase("en-US") ) && !sContent.isEmpty())
{
diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx
index 5a29d8d..47f46a8 100644
--- a/l10ntools/source/export.cxx
+++ b/l10ntools/source/export.cxx
@@ -996,7 +996,7 @@ void Export::ConvertExportContent( OString& rText )
rText = helper::unEscapeAll(rText,"\\n""\\t""\\\\""\\\"","\n""\t""\\""\"");
}
-void Export::ResData2Output( MergeEntrys *pEntry, sal_uInt16 nType, const OString& rTextType )
+void Export::ResData2Output( MergeEntrys *pEntry, StringType nType, const OString& rTextType )
{
bool bAddSemicolon = false;
bool bFirst = true;
@@ -1058,13 +1058,13 @@ void Export::MergeRest( ResData *pResData )
if ( pEntry )
{
if ( pResData->bText )
- ResData2Output( pEntry, STRING_TYP_TEXT, pResData->sTextTyp );
+ ResData2Output( pEntry, StringType::Text, pResData->sTextTyp );
if ( pResData->bQuickHelpText )
- ResData2Output( pEntry, STRING_TYP_QUICKHELPTEXT, OString("QuickHelpText") );
+ ResData2Output( pEntry, StringType::QuickHelpText, OString("QuickHelpText") );
if ( pResData->bTitle )
- ResData2Output( pEntry, STRING_TYP_TITLE, OString("Title") );
+ ResData2Output( pEntry, StringType::Title, OString("Title") );
}
// Merge Lists
@@ -1143,7 +1143,7 @@ void Export::MergeRest( ResData *pResData )
if( pEntrys )
{
OString sText;
- pEntrys->GetText( sText, STRING_TYP_TEXT, sCur );
+ pEntrys->GetText( sText, StringType::Text, sCur );
if( !sText.isEmpty())
{
ConvertMergeContent( sText );
diff --git a/l10ntools/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx
index d6ad3af..3cd2d9d 100644
--- a/l10ntools/source/helpmerge.cxx
+++ b/l10ntools/source/helpmerge.cxx
@@ -243,7 +243,7 @@ void HelpParser::ProcessHelp( LangHashMap* aLangHM , const OString& sCur , ResDa
pEntrys = pMergeDataFile->GetMergeEntrys( pResData );
if( pEntrys != nullptr)
{
- pEntrys->GetText( sNewText, STRING_TYP_TEXT, sCur, true );
+ pEntrys->GetText( sNewText, StringType::Text, sCur, true );
if (helper::isWellFormedXML(XMLUtil::QuotHTML(sNewText)))
{
sNewdata = sSourceText.copy(0,nPreSpaces) + sNewText;
diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx
index 1d33c92..a1de58d 100644
--- a/l10ntools/source/lngmerge.cxx
+++ b/l10ntools/source/lngmerge.cxx
@@ -241,7 +241,7 @@ bool LngParser::Merge(
if( !sLang.isEmpty() )
{
OString sNewText;
- pEntrys->GetText( sNewText, STRING_TYP_TEXT, sLang, true );
+ pEntrys->GetText( sNewText, StringType::Text, sLang, true );
if( sLang == "qtz" )
continue;
@@ -279,7 +279,7 @@ bool LngParser::Merge(
{
OString sNewText;
- pEntrys->GetText( sNewText, STRING_TYP_TEXT, sCur, true );
+ pEntrys->GetText( sNewText, StringType::Text, sCur, true );
if( sCur == "qtz" )
continue;
if ( !sNewText.isEmpty() && sCur != "x-comment")
diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx
index f927420..a4a887c 100644
--- a/l10ntools/source/merge.cxx
+++ b/l10ntools/source/merge.cxx
@@ -92,25 +92,25 @@ ResData::ResData( const OString &rGId, const OString &rFilename)
bool MergeEntrys::GetText( OString &rReturn,
- sal_uInt16 nTyp, const OString &nLangIndex, bool bDel )
+ StringType nTyp, const OString &nLangIndex, bool bDel )
{
bool bReturn = true;
switch ( nTyp ) {
- case STRING_TYP_TEXT :
+ case StringType::Text :
rReturn = sText[ nLangIndex ];
if ( bDel )
sText[ nLangIndex ] = "";
bReturn = bTextFirst[ nLangIndex ];
bTextFirst[ nLangIndex ] = false;
break;
- case STRING_TYP_QUICKHELPTEXT :
+ case StringType::QuickHelpText :
rReturn = sQuickHelpText[ nLangIndex ];
if ( bDel )
sQuickHelpText[ nLangIndex ] = "";
bReturn = bQuickHelpTextFirst[ nLangIndex ];
bQuickHelpTextFirst[ nLangIndex ] = false;
break;
- case STRING_TYP_TITLE :
+ case StringType::Title :
rReturn = sTitle[ nLangIndex ];
if ( bDel )
sTitle[ nLangIndex ] = "";
diff --git a/l10ntools/source/propmerge.cxx b/l10ntools/source/propmerge.cxx
index 78680e8..e4e75f6 100644
--- a/l10ntools/source/propmerge.cxx
+++ b/l10ntools/source/propmerge.cxx
@@ -205,7 +205,7 @@ void PropParser::Merge( const OString &rMergeSrc, const OString &rDestinationFil
MergeEntrys* pEntrys = pMergeDataFile->GetMergeEntrys( &aResData );
if( pEntrys )
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list