basctl/source/basicide/baside2.cxx | 30 basctl/source/basicide/baside2.hxx | 9 basctl/source/basicide/baside2b.cxx | 20 canvas/source/tools/spriteredrawmanager.cxx | 4 codemaker/source/codemaker/exceptiontree.cxx | 2 codemaker/source/codemaker/typemanager.cxx | 108 +-- codemaker/source/commoncpp/commoncpp.cxx | 12 codemaker/source/commonjava/commonjava.cxx | 6 codemaker/source/cppumaker/cpputype.cxx | 306 +++++----- codemaker/source/cppumaker/dependencies.cxx | 62 +- codemaker/source/cppumaker/includes.cxx | 44 - codemaker/source/javamaker/classfile.cxx | 8 codemaker/source/javamaker/javatype.cxx | 241 +++---- comphelper/qa/unit/syntaxhighlighttest.cxx | 31 - comphelper/source/container/enumerablemap.cxx | 2 comphelper/source/misc/configurationhelper.cxx | 16 comphelper/source/misc/docpasswordhelper.cxx | 20 comphelper/source/misc/docpasswordrequest.cxx | 4 comphelper/source/misc/scopeguard.cxx | 33 - comphelper/source/misc/syntaxhighlight.cxx | 56 - comphelper/source/property/propagg.cxx | 10 comphelper/source/property/propertycontainerhelper.cxx | 26 framework/source/accelerators/acceleratorconfiguration.cxx | 6 framework/source/helper/persistentwindowstate.cxx | 4 framework/source/jobs/helponstartup.cxx | 6 framework/source/loadenv/loadenv.cxx | 6 framework/source/services/autorecovery.cxx | 22 framework/source/services/modulemanager.cxx | 4 framework/source/services/pathsettings.cxx | 4 helpcompiler/inc/BasCodeTagger.hxx | 2 helpcompiler/source/BasCodeTagger.cxx | 28 include/canvas/spriteredrawmanager.hxx | 8 include/codemaker/commoncpp.hxx | 10 include/codemaker/global.hxx | 8 include/codemaker/unotype.hxx | 60 - include/comphelper/componentbase.hxx | 6 include/comphelper/configurationhelper.hxx | 44 - include/comphelper/configurationlistener.hxx | 5 include/comphelper/docpasswordhelper.hxx | 8 include/comphelper/docpasswordrequest.hxx | 6 include/comphelper/flagguard.hxx | 8 include/comphelper/propagg.hxx | 8 include/comphelper/propertycontainerhelper.hxx | 10 include/comphelper/scopeguard.hxx | 7 include/comphelper/syntaxhighlight.hxx | 36 - include/svtools/editsyntaxhighlighter.hxx | 4 oox/source/core/filterdetect.cxx | 6 oox/source/ole/vbaproject.cxx | 2 reportdesign/source/core/api/Shape.cxx | 24 sc/source/filter/excel/xistream.cxx | 4 sc/source/filter/ftools/fapihelper.cxx | 2 sc/source/filter/oox/biffcodec.cxx | 4 sfx2/source/appl/appopen.cxx | 10 sfx2/source/appl/newhelp.cxx | 2 sfx2/source/dialog/filedlghelper.cxx | 4 sfx2/source/doc/docfac.cxx | 2 sfx2/source/view/viewfrm.cxx | 2 svtools/source/config/accessibilityoptions.cxx | 2 svtools/source/config/printoptions.cxx | 2 svtools/source/edit/editsyntaxhighlighter.cxx | 34 - sw/source/filter/ww8/ww8par.cxx | 2 unodevtools/source/skeletonmaker/cppcompskeleton.cxx | 2 unodevtools/source/skeletonmaker/cpptypemaker.cxx | 118 +-- unodevtools/source/skeletonmaker/javatypemaker.cxx | 116 +-- unodevtools/source/skeletonmaker/skeletoncommon.cxx | 28 unotools/source/config/historyoptions.cxx | 4 unotools/source/config/useroptions.cxx | 2 unotools/source/config/viewoptions.cxx | 2 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx | 2 69 files changed, 862 insertions(+), 874 deletions(-)
New commits: commit f163745cca6627fd8de0a089a8c30b3c6e17193f Author: Noel Grandin <n...@peralex.com> Date: Wed Feb 24 11:47:30 2016 +0200 convert HighlighterLanguage to scoped enum Change-Id: Ibf0871601e52ea4fa49e9622176431943c55abdd diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 26ecbdc..4b40a42 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -221,7 +221,7 @@ EditorWindow::EditorWindow (vcl::Window* pParent, ModulWindow* pModulWindow) : Window(pParent, WB_BORDER), rModulWindow(*pModulWindow), nCurTextWidth(0), - aHighlighter(HIGHLIGHT_BASIC), + aHighlighter(HighlighterLanguage::Basic), bHighlightning(false), bDoSyntaxHighlight(true), bDelayHighlight(true), diff --git a/comphelper/qa/unit/syntaxhighlighttest.cxx b/comphelper/qa/unit/syntaxhighlighttest.cxx index 848c741..47289db 100644 --- a/comphelper/qa/unit/syntaxhighlighttest.cxx +++ b/comphelper/qa/unit/syntaxhighlighttest.cxx @@ -45,7 +45,7 @@ std::ostream& operator<<(std::ostream& rStrm, const TokenType& tt) void SyntaxHighlightTest::testBasicString() { OUString s("\"foo\""); std::vector<HighlightPortion> ps; - SyntaxHighlighter(HIGHLIGHT_BASIC).getHighlightPortions(s, ps); + SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions(s, ps); CPPUNIT_ASSERT_EQUAL( static_cast<std::vector<HighlightPortion>::size_type>(1), ps.size()); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ps[0].nBegin); @@ -56,7 +56,7 @@ void SyntaxHighlightTest::testBasicString() { void SyntaxHighlightTest::testBasicComment() { OUString s("' foo"); std::vector<HighlightPortion> ps; - SyntaxHighlighter(HIGHLIGHT_BASIC).getHighlightPortions(s, ps); + SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions(s, ps); CPPUNIT_ASSERT_EQUAL( static_cast<std::vector<HighlightPortion>::size_type>(1), ps.size()); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ps[0].nBegin); @@ -67,7 +67,7 @@ void SyntaxHighlightTest::testBasicComment() { void SyntaxHighlightTest::testBasicCommentNewline() { OUString s("' foo\n"); std::vector<HighlightPortion> ps; - SyntaxHighlighter(HIGHLIGHT_BASIC).getHighlightPortions(s, ps); + SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions(s, ps); CPPUNIT_ASSERT_EQUAL( static_cast<std::vector<HighlightPortion>::size_type>(2), ps.size()); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ps[0].nBegin); @@ -81,7 +81,7 @@ void SyntaxHighlightTest::testBasicCommentNewline() { void SyntaxHighlightTest::testBasicEmptyComment() { OUString s("'"); std::vector<HighlightPortion> ps; - SyntaxHighlighter(HIGHLIGHT_BASIC).getHighlightPortions(s, ps); + SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions(s, ps); CPPUNIT_ASSERT_EQUAL( static_cast<std::vector<HighlightPortion>::size_type>(1), ps.size()); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ps[0].nBegin); @@ -92,7 +92,7 @@ void SyntaxHighlightTest::testBasicEmptyComment() { void SyntaxHighlightTest::testBasicEmptyCommentNewline() { OUString s("'\n"); std::vector<HighlightPortion> ps; - SyntaxHighlighter(HIGHLIGHT_BASIC).getHighlightPortions(s, ps); + SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions(s, ps); CPPUNIT_ASSERT_EQUAL( static_cast<std::vector<HighlightPortion>::size_type>(2), ps.size()); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ps[0].nBegin); @@ -108,7 +108,7 @@ void SyntaxHighlightTest::testBasic() OUString aBasicString(" if Mid(sText,iRun,1 )<> \" \" then Mid( sText ,iRun, 1, Chr( 1 + Asc( Mid(sText,iRun,1 )) ) '"); std::vector<HighlightPortion> aPortions; - SyntaxHighlighter(HIGHLIGHT_BASIC).getHighlightPortions( + SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions( aBasicString, aPortions ); sal_Int32 prevEnd = 0; diff --git a/comphelper/source/misc/syntaxhighlight.cxx b/comphelper/source/misc/syntaxhighlight.cxx index 639a957..ac4dd70 100644 --- a/comphelper/source/misc/syntaxhighlight.cxx +++ b/comphelper/source/misc/syntaxhighlight.cxx @@ -387,7 +387,7 @@ bool SyntaxHighlighter::Tokenizer::getNextToken(const sal_Unicode*& pos, /*out*/ // Operator? // only for BASIC '\'' should be a comment, otherwise it is a normal string and handled there - else if ( testCharFlags( c, CHAR_OPERATOR ) || ( (c == '\'') && (aLanguage==HIGHLIGHT_BASIC)) ) + else if ( testCharFlags( c, CHAR_OPERATOR ) || ( (c == '\'') && (aLanguage==HighlighterLanguage::Basic)) ) { // parameters for SQL view if ( (c==':') || (c=='?')) @@ -691,11 +691,11 @@ SyntaxHighlighter::SyntaxHighlighter(HighlighterLanguage language): { switch (eLanguage) { - case HIGHLIGHT_BASIC: + case HighlighterLanguage::Basic: m_tokenizer->setKeyWords( strListBasicKeyWords, sizeof( strListBasicKeyWords ) / sizeof( char* )); break; - case HIGHLIGHT_SQL: + case HighlighterLanguage::SQL: m_tokenizer->setKeyWords( strListSqlKeyWords, sizeof( strListSqlKeyWords ) / sizeof( char* )); break; diff --git a/helpcompiler/source/BasCodeTagger.cxx b/helpcompiler/source/BasCodeTagger.cxx index cad4090..b472ac6 100644 --- a/helpcompiler/source/BasCodeTagger.cxx +++ b/helpcompiler/source/BasCodeTagger.cxx @@ -50,7 +50,7 @@ bool LibXmlTreeWalker::end() BasicCodeTagger::BasicCodeTagger( xmlDocPtr rootDoc ): - m_Highlighter(HIGHLIGHT_BASIC) + m_Highlighter(HighlighterLanguage::Basic) { if ( rootDoc == nullptr ) throw NULL_DOCUMENT; diff --git a/include/comphelper/syntaxhighlight.hxx b/include/comphelper/syntaxhighlight.hxx index cfe8896..76e8712 100644 --- a/include/comphelper/syntaxhighlight.hxx +++ b/include/comphelper/syntaxhighlight.hxx @@ -59,10 +59,10 @@ struct HighlightPortion { // Language mode of the Highlighter (possibly to be refined later with keyword // lists, C comment flags) -enum HighlighterLanguage +enum class HighlighterLanguage { - HIGHLIGHT_BASIC, - HIGHLIGHT_SQL + Basic, + SQL }; class COMPHELPER_DLLPUBLIC SyntaxHighlighter diff --git a/include/svtools/editsyntaxhighlighter.hxx b/include/svtools/editsyntaxhighlighter.hxx index d205e32..33666a7 100644 --- a/include/svtools/editsyntaxhighlighter.hxx +++ b/include/svtools/editsyntaxhighlighter.hxx @@ -39,7 +39,7 @@ class SVT_DLLPUBLIC MultiLineEditSyntaxHighlight : public MultiLineEdit virtual bool PreNotify( NotifyEvent& rNEvt ) override; public: - MultiLineEditSyntaxHighlight( vcl::Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER , HighlighterLanguage aLanguage = HIGHLIGHT_SQL); + MultiLineEditSyntaxHighlight( vcl::Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER , HighlighterLanguage aLanguage = HighlighterLanguage::SQL); virtual void UpdateData() override; virtual void SetText(const OUString& rNewText) override; diff --git a/svtools/source/edit/editsyntaxhighlighter.cxx b/svtools/source/edit/editsyntaxhighlighter.cxx index c403334..b8bc4d1 100644 --- a/svtools/source/edit/editsyntaxhighlighter.cxx +++ b/svtools/source/edit/editsyntaxhighlighter.cxx @@ -120,7 +120,7 @@ Color MultiLineEditSyntaxHighlight::GetColorValue(TokenType aToken) Color aColor; switch (aHighlighter.GetLanguage()) { - case HIGHLIGHT_SQL: + case HighlighterLanguage::SQL: { switch (aToken) { @@ -135,7 +135,7 @@ Color MultiLineEditSyntaxHighlight::GetColorValue(TokenType aToken) } break; } - case HIGHLIGHT_BASIC: + case HighlighterLanguage::Basic: { switch (aToken) { commit a5e53f9ffdde320a7ba104a1e01b3f5ef75d7975 Author: Noel Grandin <n...@peralex.com> Date: Wed Feb 24 10:11:43 2016 +0200 convert TokenTypes to scoped enum Change-Id: I17c0a616dd6cf48a22896b6cd6b0df157d1f9a9f diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index bc8072c..38b8043 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -1512,9 +1512,9 @@ ModulWindowLayout::SyntaxColors::SyntaxColors () : { aConfig.AddListener(this); - aColors[TT_UNKNOWN] = - aColors[TT_WHITESPACE] = - aColors[TT_EOL] = + aColors[TokenType::Unknown] = + aColors[TokenType::Whitespace] = + aColors[TokenType::EOL] = Application::GetSettings().GetStyleSettings().GetFieldTextColor(); NewConfig(true); @@ -1528,11 +1528,11 @@ ModulWindowLayout::SyntaxColors::~SyntaxColors () void ModulWindowLayout::SyntaxColors::SettingsChanged () { Color const aColor = Application::GetSettings().GetStyleSettings().GetFieldTextColor(); - if (aColor != aColors[TT_UNKNOWN]) + if (aColor != aColors[TokenType::Unknown]) { - aColors[TT_UNKNOWN] = - aColors[TT_WHITESPACE] = - aColors[TT_EOL] = + aColors[TokenType::Unknown] = + aColors[TokenType::Whitespace] = + aColors[TokenType::EOL] = aColor; if (pEditor) pEditor->UpdateSyntaxHighlighting(); @@ -1550,18 +1550,18 @@ void ModulWindowLayout::SyntaxColors::NewConfig (bool bFirst) { static struct { - TokenTypes eTokenType; + TokenType eTokenType; svtools::ColorConfigEntry eEntry; } const vIds[] = { - { TT_IDENTIFIER, svtools::BASICIDENTIFIER }, - { TT_NUMBER, svtools::BASICNUMBER }, - { TT_STRING, svtools::BASICSTRING }, - { TT_COMMENT, svtools::BASICCOMMENT }, - { TT_ERROR, svtools::BASICERROR }, - { TT_OPERATOR, svtools::BASICOPERATOR }, - { TT_KEYWORDS, svtools::BASICKEYWORD }, + { TokenType::Identifier, svtools::BASICIDENTIFIER }, + { TokenType::Number, svtools::BASICNUMBER }, + { TokenType::String, svtools::BASICSTRING }, + { TokenType::Comment, svtools::BASICCOMMENT }, + { TokenType::Error, svtools::BASICERROR }, + { TokenType::Operator, svtools::BASICOPERATOR }, + { TokenType::Keywords, svtools::BASICKEYWORD }, }; bool bChanged = false; diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx index 9e66970..996579a 100644 --- a/basctl/source/basicide/baside2.hxx +++ b/basctl/source/basicide/baside2.hxx @@ -38,6 +38,7 @@ class SvxSearchItem; #include <vcl/idle.hxx> #include <sfx2/progress.hxx> +#include <o3tl/enumarray.hxx> #include <set> @@ -428,7 +429,7 @@ public: public: void BasicAddWatch (OUString const&); void BasicRemoveWatch (); - Color GetSyntaxColor (TokenTypes eType) const { return aSyntaxColors.GetColor(eType); } + Color GetSyntaxColor (TokenType eType) const { return aSyntaxColors.GetColor(eType); } protected: // Window: @@ -456,15 +457,15 @@ private: void SetActiveEditor (EditorWindow* pEditor_) { pEditor = pEditor_; } void SettingsChanged (); public: - Color GetColor (TokenTypes eType) const { return aColors[eType]; } + Color GetColor (TokenType eType) const { return aColors[eType]; } private: virtual void ConfigurationChanged (utl::ConfigurationBroadcaster*, sal_uInt32) override; void NewConfig (bool bFirst); private: - // the color values (the indexes are TokenTypes, see comphelper/syntaxhighlight.hxx) - Color aColors[TT_KEYWORDS + 1]; + // the color values (the indexes are TokenType, see comphelper/syntaxhighlight.hxx) + o3tl::enumarray<TokenType, Color> aColors; // the configuration svtools::ColorConfig aConfig; // the active editor diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 70f6e73..26ecbdc 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -622,7 +622,7 @@ void EditorWindow::HandleAutoCorrect() OUString sStr = aLine.copy( r.nBegin, r.nEnd - r.nBegin ); //if WS or empty string: stop, nothing to do - if( ( r.tokenType == TT_WHITESPACE ) || sStr.isEmpty() ) + if( ( r.tokenType == TokenType::Whitespace ) || sStr.isEmpty() ) return; //create the appropriate TextSelection, and update the cache TextPaM aStart( nLine, r.nBegin ); @@ -631,7 +631,7 @@ void EditorWindow::HandleAutoCorrect() rModulWindow.UpdateModule(); rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse( aCodeCompleteCache ); // correct the last entered keyword - if( r.tokenType == TT_KEYWORDS ) + if( r.tokenType == TokenType::Keywords ) { sStr = sStr.toAsciiLowerCase(); if( !SbModule::GetKeywordCase(sStr).isEmpty() ) @@ -644,7 +644,7 @@ void EditorWindow::HandleAutoCorrect() pEditEngine->ReplaceText( sTextSelection, sStr ); pEditView->SetSelection( aSel ); } - if( r.tokenType == TT_IDENTIFIER ) + if( r.tokenType == TokenType::Identifier ) {// correct variables if( !aCodeCompleteCache.GetCorrectCaseVarName( sStr, sActSubName ).isEmpty() ) { @@ -729,7 +729,7 @@ void EditorWindow::HandleAutoCloseDoubleQuotes() if( aPortions.empty() ) return; - if( aLine.getLength() > 0 && !aLine.endsWith("\"") && (aPortions.back().tokenType != TT_STRING) ) + if( aLine.getLength() > 0 && !aLine.endsWith("\"") && (aPortions.back().tokenType != TokenType::String) ) { GetEditView()->InsertText("\""); //leave the cursor on its place: inside the two double quotes @@ -776,7 +776,7 @@ void EditorWindow::HandleProcedureCompletion() HighlightPortion& r = aCurrPortions.front(); OUString sStr = aCurrLine.copy(r.nBegin, r.nEnd - r.nBegin); - if( r.tokenType == 9 ) + if( r.tokenType == TokenType::Keywords ) { if( sStr.equalsIgnoreAsciiCase("sub") || sStr.equalsIgnoreAsciiCase("function") ) { @@ -808,13 +808,13 @@ bool EditorWindow::GetProcedureName(OUString& rLine, OUString& rProcType, OUStri { OUString sTokStr = rLine.copy(i->nBegin, i->nEnd - i->nBegin); - if( i->tokenType == 9 && ( sTokStr.equalsIgnoreAsciiCase("sub") + if( i->tokenType == TokenType::Keywords && ( sTokStr.equalsIgnoreAsciiCase("sub") || sTokStr.equalsIgnoreAsciiCase("function")) ) { rProcType = sTokStr; bFoundType = true; } - if( i->tokenType == 1 && bFoundType ) + if( i->tokenType == TokenType::Identifier && bFoundType ) { rProcName = sTokStr; bFoundName = true; @@ -847,9 +847,9 @@ void EditorWindow::HandleCodeCompletion() aPortions.rbegin()); i != aPortions.rend(); ++i) { - if( i->tokenType == TT_WHITESPACE ) // a whitespace: stop; if there is no ws, it goes to the beginning of the line + if( i->tokenType == TokenType::Whitespace ) // a whitespace: stop; if there is no ws, it goes to the beginning of the line break; - if( i->tokenType == TT_IDENTIFIER || i->tokenType == TT_KEYWORDS ) // extract the identifiers(methods, base variable) + if( i->tokenType == TokenType::Identifier || i->tokenType == TokenType::Keywords ) // extract the identifiers(methods, base variable) /* an example: Dim aLocVar2 as com.sun.star.beans.PropertyValue * here, aLocVar2.Name, and PropertyValue's Name field is treated as a keyword(?!) * */ diff --git a/comphelper/qa/unit/syntaxhighlighttest.cxx b/comphelper/qa/unit/syntaxhighlighttest.cxx index 5297bf1..848c741 100644 --- a/comphelper/qa/unit/syntaxhighlighttest.cxx +++ b/comphelper/qa/unit/syntaxhighlighttest.cxx @@ -37,6 +37,11 @@ public: CPPUNIT_TEST_SUITE_END(); }; +std::ostream& operator<<(std::ostream& rStrm, const TokenType& tt) +{ + return rStrm << (int)tt; +} + void SyntaxHighlightTest::testBasicString() { OUString s("\"foo\""); std::vector<HighlightPortion> ps; @@ -45,7 +50,7 @@ void SyntaxHighlightTest::testBasicString() { static_cast<std::vector<HighlightPortion>::size_type>(1), ps.size()); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ps[0].nBegin); CPPUNIT_ASSERT_EQUAL(sal_Int32(5), ps[0].nEnd); - CPPUNIT_ASSERT_EQUAL(TT_STRING, ps[0].tokenType); + CPPUNIT_ASSERT_EQUAL(TokenType::String, ps[0].tokenType); } void SyntaxHighlightTest::testBasicComment() { @@ -56,7 +61,7 @@ void SyntaxHighlightTest::testBasicComment() { static_cast<std::vector<HighlightPortion>::size_type>(1), ps.size()); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ps[0].nBegin); CPPUNIT_ASSERT_EQUAL(sal_Int32(5), ps[0].nEnd); - CPPUNIT_ASSERT_EQUAL(TT_COMMENT, ps[0].tokenType); + CPPUNIT_ASSERT_EQUAL(TokenType::Comment, ps[0].tokenType); } void SyntaxHighlightTest::testBasicCommentNewline() { @@ -67,10 +72,10 @@ void SyntaxHighlightTest::testBasicCommentNewline() { static_cast<std::vector<HighlightPortion>::size_type>(2), ps.size()); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ps[0].nBegin); CPPUNIT_ASSERT_EQUAL(sal_Int32(5), ps[0].nEnd); - CPPUNIT_ASSERT_EQUAL(TT_COMMENT, ps[0].tokenType); + CPPUNIT_ASSERT_EQUAL(TokenType::Comment, ps[0].tokenType); CPPUNIT_ASSERT_EQUAL(sal_Int32(5), ps[1].nBegin); CPPUNIT_ASSERT_EQUAL(sal_Int32(6), ps[1].nEnd); - CPPUNIT_ASSERT_EQUAL(TT_EOL, ps[1].tokenType); + CPPUNIT_ASSERT_EQUAL(TokenType::EOL, ps[1].tokenType); } void SyntaxHighlightTest::testBasicEmptyComment() { @@ -81,7 +86,7 @@ void SyntaxHighlightTest::testBasicEmptyComment() { static_cast<std::vector<HighlightPortion>::size_type>(1), ps.size()); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ps[0].nBegin); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), ps[0].nEnd); - CPPUNIT_ASSERT_EQUAL(TT_COMMENT, ps[0].tokenType); + CPPUNIT_ASSERT_EQUAL(TokenType::Comment, ps[0].tokenType); } void SyntaxHighlightTest::testBasicEmptyCommentNewline() { @@ -92,10 +97,10 @@ void SyntaxHighlightTest::testBasicEmptyCommentNewline() { static_cast<std::vector<HighlightPortion>::size_type>(2), ps.size()); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ps[0].nBegin); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), ps[0].nEnd); - CPPUNIT_ASSERT_EQUAL(TT_COMMENT, ps[0].tokenType); + CPPUNIT_ASSERT_EQUAL(TokenType::Comment, ps[0].tokenType); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), ps[1].nBegin); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), ps[1].nEnd); - CPPUNIT_ASSERT_EQUAL(TT_EOL, ps[1].tokenType); + CPPUNIT_ASSERT_EQUAL(TokenType::EOL, ps[1].tokenType); } void SyntaxHighlightTest::testBasic() diff --git a/comphelper/source/misc/syntaxhighlight.cxx b/comphelper/source/misc/syntaxhighlight.cxx index 6254908..639a957 100644 --- a/comphelper/source/misc/syntaxhighlight.cxx +++ b/comphelper/source/misc/syntaxhighlight.cxx @@ -265,7 +265,7 @@ class SyntaxHighlighter::Tokenizer bool testCharFlags(sal_Unicode c, sal_uInt16 nTestFlags) const; // Get new token, EmptyString == nothing more over there - bool getNextToken(const sal_Unicode*& pos, /*out*/TokenTypes& reType, + bool getNextToken(const sal_Unicode*& pos, /*out*/TokenType& reType, /*out*/const sal_Unicode*& rpStartPos, /*out*/const sal_Unicode*& rpEndPos) const; const char** ppListKeyWords; @@ -304,10 +304,10 @@ void SyntaxHighlighter::Tokenizer::setKeyWords( const char** ppKeyWords, sal_uIn nKeyWordCount = nCount; } -bool SyntaxHighlighter::Tokenizer::getNextToken(const sal_Unicode*& pos, /*out*/TokenTypes& reType, +bool SyntaxHighlighter::Tokenizer::getNextToken(const sal_Unicode*& pos, /*out*/TokenType& reType, /*out*/const sal_Unicode*& rpStartPos, /*out*/const sal_Unicode*& rpEndPos) const { - reType = TT_UNKNOWN; + reType = TokenType::Unknown; rpStartPos = pos; @@ -324,7 +324,7 @@ bool SyntaxHighlighter::Tokenizer::getNextToken(const sal_Unicode*& pos, /*out*/ while( testCharFlags( *pos, CHAR_SPACE ) ) ++pos; - reType = TT_WHITESPACE; + reType = TokenType::Whitespace; } // Identifier? @@ -341,7 +341,7 @@ bool SyntaxHighlighter::Tokenizer::getNextToken(const sal_Unicode*& pos, /*out*/ } while( bIdentifierChar ); - reType = TT_IDENTIFIER; + reType = TokenType::Identifier; // Keyword table if (ppListKeyWords != nullptr) @@ -367,7 +367,7 @@ bool SyntaxHighlighter::Tokenizer::getNextToken(const sal_Unicode*& pos, /*out*/ if ( bsearch( aByteStr.getStr(), ppListKeyWords, nKeyWordCount, sizeof( char* ), compare_strings ) ) { - reType = TT_KEYWORDS; + reType = TokenType::Keywords; if( aByteStr == "rem" ) { @@ -378,7 +378,7 @@ bool SyntaxHighlighter::Tokenizer::getNextToken(const sal_Unicode*& pos, /*out*/ cPeek = *++pos; } - reType = TT_COMMENT; + reType = TokenType::Comment; } } } @@ -405,7 +405,7 @@ bool SyntaxHighlighter::Tokenizer::getNextToken(const sal_Unicode*& pos, /*out*/ } while( bIdentifierChar ); } - reType = TT_PARAMETER; + reType = TokenType::Parameter; } else if (c=='-') { @@ -418,7 +418,7 @@ bool SyntaxHighlighter::Tokenizer::getNextToken(const sal_Unicode*& pos, /*out*/ ++pos; cPeekNext = *pos; } - reType = TT_COMMENT; + reType = TokenType::Comment; } } else if (c=='/') @@ -432,7 +432,7 @@ bool SyntaxHighlighter::Tokenizer::getNextToken(const sal_Unicode*& pos, /*out*/ ++pos; cPeekNext = *pos; } - reType = TT_COMMENT; + reType = TokenType::Comment; } } else @@ -449,14 +449,14 @@ bool SyntaxHighlighter::Tokenizer::getNextToken(const sal_Unicode*& pos, /*out*/ ++pos; } - reType = TT_COMMENT; + reType = TokenType::Comment; } // The real operator; can be easily used since not the actual // operator (e.g. +=) is concerned, but the fact that it is one - if( reType != TT_COMMENT ) + if( reType != TokenType::Comment ) { - reType = TT_OPERATOR; + reType = TokenType::Operator; } } @@ -465,13 +465,13 @@ bool SyntaxHighlighter::Tokenizer::getNextToken(const sal_Unicode*& pos, /*out*/ // Object separator? Must be handled before Number else if( c == '.' && ( *pos < '0' || *pos > '9' ) ) { - reType = TT_OPERATOR; + reType = TokenType::Operator; } // Number? else if( testCharFlags( c, CHAR_START_NUMBER ) ) { - reType = TT_NUMBER; + reType = TokenType::Number; // Number system, 10 = normal, it is changed for Oct/Hex int nRadix = 10; @@ -503,12 +503,12 @@ bool SyntaxHighlighter::Tokenizer::getNextToken(const sal_Unicode*& pos, /*out*/ } else { - reType = TT_OPERATOR; + reType = TokenType::Operator; } } // When it is not Oct or Hex, then it is double - if( reType == TT_NUMBER && nRadix == 10 ) + if( reType == TokenType::Number && nRadix == 10 ) { // Flag if the last character is an exponent bool bAfterExpChar = false; @@ -540,25 +540,25 @@ bool SyntaxHighlighter::Tokenizer::getNextToken(const sal_Unicode*& pos, /*out*/ if( *pos == 0 ) { // ERROR: unterminated string literal - reType = TT_ERROR; + reType = TokenType::Error; break; } c = *pos++; if( testCharFlags( c, CHAR_EOL ) ) { // ERROR: unterminated string literal - reType = TT_ERROR; + reType = TokenType::Error; break; } } - if( reType != TT_ERROR ) + if( reType != TokenType::Error ) { ++pos; if( cEndString == ']' ) - reType = TT_IDENTIFIER; + reType = TokenType::Identifier; else - reType = TT_STRING; + reType = TokenType::String; } } @@ -570,10 +570,10 @@ bool SyntaxHighlighter::Tokenizer::getNextToken(const sal_Unicode*& pos, /*out*/ if( cNext != c && testCharFlags( cNext, CHAR_EOL ) ) ++pos; - reType = TT_EOL; + reType = TokenType::EOL; } - // All other will remain TT_UNKNOWN + // All other will remain TokenType::Unknown // Save end position rpEndPos = pos; @@ -672,7 +672,7 @@ void SyntaxHighlighter::Tokenizer::getHighlightPortions(const OUString& rLine, const sal_Unicode* pos = rLine.getStr(); // Variables for the out parameter - TokenTypes eType; + TokenType eType; const sal_Unicode* pStartPos; const sal_Unicode* pEndPos; diff --git a/helpcompiler/inc/BasCodeTagger.hxx b/helpcompiler/inc/BasCodeTagger.hxx index 25f4304..1020374 100644 --- a/helpcompiler/inc/BasCodeTagger.hxx +++ b/helpcompiler/inc/BasCodeTagger.hxx @@ -33,7 +33,7 @@ class L10N_DLLPUBLIC BasicCodeTagger SyntaxHighlighter m_Highlighter; bool m_bTaggingCompleted; void tagParagraph( xmlNodePtr paragraph ); - static xmlChar* getTypeString( TokenTypes tokenType ); + static xmlChar* getTypeString( TokenType tokenType ); void getBasicCodeContainerNodes(); void tagBasCodeParagraphs(); diff --git a/helpcompiler/source/BasCodeTagger.cxx b/helpcompiler/source/BasCodeTagger.cxx index f8b1f95..cad4090 100644 --- a/helpcompiler/source/BasCodeTagger.cxx +++ b/helpcompiler/source/BasCodeTagger.cxx @@ -150,7 +150,7 @@ void BasicCodeTagger::tagParagraph( xmlNodePtr paragraph ) { OString sToken(OUStringToOString(strLine.copy(i->nBegin, i->nEnd-i->nBegin), RTL_TEXTENCODING_UTF8)); xmlNodePtr text = xmlNewText(reinterpret_cast<const xmlChar*>(sToken.getStr())); - if ( i->tokenType != TT_WHITESPACE ) + if ( i->tokenType != TokenType::Whitespace ) { xmlChar* typeStr = getTypeString( i->tokenType ); curNode = xmlNewTextChild( paragraph, nullptr, reinterpret_cast<xmlChar const *>("item"), nullptr ); @@ -188,42 +188,42 @@ void BasicCodeTagger::tagBasicCodes() } //! Converts SyntaxHighlighter's TokenTypes enum to a type string for <item type=... > -xmlChar* BasicCodeTagger::getTypeString( TokenTypes tokenType ) +xmlChar* BasicCodeTagger::getTypeString( TokenType tokenType ) { const char* str; switch ( tokenType ) { - case TT_UNKNOWN : + case TokenType::Unknown : str = "unknown"; break; - case TT_IDENTIFIER : + case TokenType::Identifier : str = "identifier"; break; - case TT_WHITESPACE : + case TokenType::Whitespace : str = "whitespace"; break; - case TT_NUMBER : + case TokenType::Number : str = "number"; break; - case TT_STRING : + case TokenType::String : str = "string"; break; - case TT_EOL : + case TokenType::EOL : str = "eol"; break; - case TT_COMMENT : + case TokenType::Comment : str = "comment"; break; - case TT_ERROR : + case TokenType::Error : str = "error"; break; - case TT_OPERATOR : + case TokenType::Operator : str = "operator"; break; - case TT_KEYWORDS : + case TokenType::Keywords : str = "keyword"; break; - case TT_PARAMETER : + case TokenType::Parameter : str = "parameter"; break; default : diff --git a/include/comphelper/syntaxhighlight.hxx b/include/comphelper/syntaxhighlight.hxx index 77543ed..cfe8896 100644 --- a/include/comphelper/syntaxhighlight.hxx +++ b/include/comphelper/syntaxhighlight.hxx @@ -30,29 +30,29 @@ #include <vector> #include <memory> -// Token-Typen TT_... -enum TokenTypes +enum class TokenType { - TT_UNKNOWN, - TT_IDENTIFIER, - TT_WHITESPACE, - TT_NUMBER, - TT_STRING, - TT_EOL, - TT_COMMENT, - TT_ERROR, - TT_OPERATOR, - TT_KEYWORDS, - TT_PARAMETER + Unknown, + Identifier, + Whitespace, + Number, + String, + EOL, + Comment, + Error, + Operator, + Keywords, + Parameter, + LAST = Parameter }; struct HighlightPortion { sal_Int32 nBegin; sal_Int32 nEnd; - TokenTypes tokenType; + TokenType tokenType; HighlightPortion( - sal_Int32 theBegin, sal_Int32 theEnd, TokenTypes theTokenType): + sal_Int32 theBegin, sal_Int32 theEnd, TokenType theTokenType): nBegin(theBegin), nEnd(theEnd), tokenType(theTokenType) {} }; diff --git a/include/svtools/editsyntaxhighlighter.hxx b/include/svtools/editsyntaxhighlighter.hxx index f177f99..d205e32 100644 --- a/include/svtools/editsyntaxhighlighter.hxx +++ b/include/svtools/editsyntaxhighlighter.hxx @@ -46,7 +46,7 @@ class SVT_DLLPUBLIC MultiLineEditSyntaxHighlight : public MultiLineEdit virtual void SetText( const OUString& rStr, const Selection& rNewSelection ) override { SetText( rStr ); SetSelection( rNewSelection ); } - Color GetColorValue(TokenTypes aToken); + Color GetColorValue(TokenType aToken); }; #endif diff --git a/svtools/source/edit/editsyntaxhighlighter.cxx b/svtools/source/edit/editsyntaxhighlighter.cxx index 894741f..c403334 100644 --- a/svtools/source/edit/editsyntaxhighlighter.cxx +++ b/svtools/source/edit/editsyntaxhighlighter.cxx @@ -115,7 +115,7 @@ bool MultiLineEditSyntaxHighlight::PreNotify( NotifyEvent& rNEvt ) return MultiLineEdit::PreNotify(rNEvt); } -Color MultiLineEditSyntaxHighlight::GetColorValue(TokenTypes aToken) +Color MultiLineEditSyntaxHighlight::GetColorValue(TokenType aToken) { Color aColor; switch (aHighlighter.GetLanguage()) @@ -124,13 +124,13 @@ Color MultiLineEditSyntaxHighlight::GetColorValue(TokenTypes aToken) { switch (aToken) { - case TT_IDENTIFIER: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLIDENTIFIER).nColor; break; - case TT_NUMBER: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLNUMBER).nColor; break; - case TT_STRING: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLSTRING).nColor; break; - case TT_OPERATOR: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLOPERATOR).nColor; break; - case TT_KEYWORDS: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLKEYWORD).nColor; break; - case TT_PARAMETER: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLPARAMETER).nColor; break; - case TT_COMMENT: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLCOMMENT).nColor; break; + case TokenType::Identifier: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLIDENTIFIER).nColor; break; + case TokenType::Number: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLNUMBER).nColor; break; + case TokenType::String: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLSTRING).nColor; break; + case TokenType::Operator: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLOPERATOR).nColor; break; + case TokenType::Keywords: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLKEYWORD).nColor; break; + case TokenType::Parameter: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLPARAMETER).nColor; break; + case TokenType::Comment: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLCOMMENT).nColor; break; default: aColor = Color(0,0,0); } break; @@ -139,13 +139,13 @@ Color MultiLineEditSyntaxHighlight::GetColorValue(TokenTypes aToken) { switch (aToken) { - case TT_IDENTIFIER: aColor = Color(255,0,0); break; - case TT_COMMENT: aColor = Color(0,0,45); break; - case TT_NUMBER: aColor = Color(204,102,204); break; - case TT_STRING: aColor = Color(0,255,45); break; - case TT_OPERATOR: aColor = Color(0,0,100); break; - case TT_KEYWORDS: aColor = Color(0,0,255); break; - case TT_ERROR : aColor = Color(0,255,255); break; + case TokenType::Identifier: aColor = Color(255,0,0); break; + case TokenType::Comment: aColor = Color(0,0,45); break; + case TokenType::Number: aColor = Color(204,102,204); break; + case TokenType::String: aColor = Color(0,255,45); break; + case TokenType::Operator: aColor = Color(0,0,100); break; + case TokenType::Keywords: aColor = Color(0,0,255); break; + case TokenType::Error : aColor = Color(0,255,255); break; default: aColor = Color(0,0,0); } break; commit 2f9d53df89614955215a630beb0966f0c4a663c2 Author: Noel Grandin <n...@peralex.com> Date: Wed Feb 24 09:29:54 2016 +0200 remove unused exc_handling enum Change-Id: I5e2e084114c8b0eedd0f2cd8327d6c6d68742462 diff --git a/comphelper/source/misc/scopeguard.cxx b/comphelper/source/misc/scopeguard.cxx index f159b29..6eeb7c8 100644 --- a/comphelper/source/misc/scopeguard.cxx +++ b/comphelper/source/misc/scopeguard.cxx @@ -26,27 +26,18 @@ namespace comphelper { ScopeGuard::~ScopeGuard() { - if (m_func) - { - if (m_excHandling == IGNORE_EXCEPTIONS) - { - try { - m_func(); - } - catch (css::uno::Exception & exc) { - (void) exc; // avoid warning about unused variable - OSL_FAIL( - OUStringToOString( "UNO exception occurred: " + - exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); - } - catch (...) { - OSL_FAIL( "unknown exception occurred!" ); - } - } - else - { - m_func(); - } + if (!m_func) + return; + try { + m_func(); + } + catch (css::uno::Exception & exc) { + (void) exc; // avoid warning about unused variable + OSL_FAIL( OUStringToOString( "UNO exception occurred: " + exc.Message, + RTL_TEXTENCODING_UTF8 ).getStr() ); + } + catch (...) { + OSL_FAIL( "unknown exception occurred!" ); } } diff --git a/include/comphelper/flagguard.hxx b/include/comphelper/flagguard.hxx index 7ab88e4..96e721e 100644 --- a/include/comphelper/flagguard.hxx +++ b/include/comphelper/flagguard.hxx @@ -31,8 +31,8 @@ namespace comphelper class COMPHELPER_DLLPUBLIC FlagRestorationGuard : public ScopeGuard { public: - FlagRestorationGuard( bool& i_flagRef, bool i_temporaryValue, exc_handling i_excHandling = IGNORE_EXCEPTIONS ) - : ScopeGuard(RestoreFlag(i_flagRef), i_excHandling) + FlagRestorationGuard( bool& i_flagRef, bool i_temporaryValue ) + : ScopeGuard(RestoreFlag(i_flagRef)) { i_flagRef = i_temporaryValue; } @@ -61,8 +61,8 @@ namespace comphelper class COMPHELPER_DLLPUBLIC FlagGuard : public ScopeGuard { public: - explicit FlagGuard( bool& i_flagRef, exc_handling i_excHandling = IGNORE_EXCEPTIONS ) - : ScopeGuard( [&i_flagRef] () { i_flagRef = false; }, i_excHandling) + explicit FlagGuard( bool& i_flagRef ) + : ScopeGuard( [&i_flagRef] () { i_flagRef = false; } ) { i_flagRef = true; } diff --git a/include/comphelper/scopeguard.hxx b/include/comphelper/scopeguard.hxx index 629950c..47b62b5 100644 --- a/include/comphelper/scopeguard.hxx +++ b/include/comphelper/scopeguard.hxx @@ -31,16 +31,12 @@ namespace comphelper { class COMPHELPER_DLLPUBLIC ScopeGuard { public: - enum exc_handling { IGNORE_EXCEPTIONS, ALLOW_EXCEPTIONS }; - /** @param func function object to be executed in dtor @param excHandling switches whether thrown exceptions in dtor will be silently ignored (but OSL_ asserted) */ template <typename func_type> - explicit ScopeGuard( func_type const & func, - exc_handling excHandling = IGNORE_EXCEPTIONS ) - : m_func( func ), m_excHandling( excHandling ) {} + explicit ScopeGuard( func_type const & func ) : m_func( func ) {} ~ScopeGuard(); @@ -55,7 +51,6 @@ private: ScopeGuard& operator=(const ScopeGuard&) = delete; ::std::function<void ()> m_func; - exc_handling const m_excHandling; }; } // namespace comphelper commit cdf176c9749ed1a0c2faceeae0c73bf735c5b00b Author: Noel Grandin <n...@peralex.com> Date: Tue Feb 23 16:00:10 2016 +0200 convert PropertyDescription::LocationType to scoped enum Change-Id: Ifcd6bf1728c632ed10301c4a426dae57dbf0912a diff --git a/comphelper/source/property/propertycontainerhelper.cxx b/comphelper/source/property/propertycontainerhelper.cxx index e0f0c4f..9122ba0 100644 --- a/comphelper/source/property/propertycontainerhelper.cxx +++ b/comphelper/source/property/propertycontainerhelper.cxx @@ -83,7 +83,7 @@ void OPropertyContainerHelper::registerProperty(const OUString& _rName, sal_Int3 PropertyDescription aNewProp; aNewProp.aProperty = Property( _rName, _nHandle, _rMemberType, (sal_Int16)_nAttributes ); - aNewProp.eLocated = PropertyDescription::ltDerivedClassRealType; + aNewProp.eLocated = PropertyDescription::LocationType::DerivedClassRealType; aNewProp.aLocation.pDerivedClassMember = _pPointerToMember; implPushBackProperty(aNewProp); @@ -113,7 +113,7 @@ void OPropertyContainerHelper::registerMayBeVoidProperty(const OUString& _rName, PropertyDescription aNewProp; aNewProp.aProperty = Property( _rName, _nHandle, _rExpectedType, (sal_Int16)_nAttributes ); - aNewProp.eLocated = PropertyDescription::ltDerivedClassAnyType; + aNewProp.eLocated = PropertyDescription::LocationType::DerivedClassAnyType; aNewProp.aLocation.pDerivedClassMember = _pPointerToMember; implPushBackProperty(aNewProp); @@ -130,7 +130,7 @@ void OPropertyContainerHelper::registerPropertyNoMember(const OUString& _rName, PropertyDescription aNewProp; aNewProp.aProperty = Property( _rName, _nHandle, _rType, (sal_Int16)_nAttributes ); - aNewProp.eLocated = PropertyDescription::ltHoldMyself; + aNewProp.eLocated = PropertyDescription::LocationType::HoldMyself; aNewProp.aLocation.nOwnClassVectorIndex = m_aHoldProperties.size(); if (_pInitialValue) m_aHoldProperties.push_back(Any(_pInitialValue, _rType)); @@ -232,8 +232,8 @@ bool OPropertyContainerHelper::convertFastPropertyValue( switch (aPos->eLocated) { // similar handling for the two cases where the value is stored in an any - case PropertyDescription::ltHoldMyself: - case PropertyDescription::ltDerivedClassAnyType: + case PropertyDescription::LocationType::HoldMyself: + case PropertyDescription::LocationType::DerivedClassAnyType: { bool bMayBeVoid = ((aPos->aProperty.Attributes & PropertyAttribute::MAYBEVOID) != 0); @@ -275,7 +275,7 @@ bool OPropertyContainerHelper::convertFastPropertyValue( // the pointer to the any which holds the property value, no matter if located in the derived class // or in out vector - if (PropertyDescription::ltHoldMyself == aPos->eLocated) + if (PropertyDescription::LocationType::HoldMyself == aPos->eLocated) { OSL_ENSURE(aPos->aLocation.nOwnClassVectorIndex < (sal_Int32)m_aHoldProperties.size(), "OPropertyContainerHelper::convertFastPropertyValue: invalid position !"); @@ -303,7 +303,7 @@ bool OPropertyContainerHelper::convertFastPropertyValue( } } break; - case PropertyDescription::ltDerivedClassRealType: + case PropertyDescription::LocationType::DerivedClassRealType: // let the UNO runtime library do any possible conversion // this may include a change of the type - for instance, if a LONG is required, // but a short is given, then this is valid, as it can be converted without any potential @@ -376,15 +376,15 @@ bool OPropertyContainerHelper::setFastPropertyValue(sal_Int32 _nHandle, const An switch (aPos->eLocated) { - case PropertyDescription::ltHoldMyself: + case PropertyDescription::LocationType::HoldMyself: m_aHoldProperties[aPos->aLocation.nOwnClassVectorIndex] = _rValue; break; - case PropertyDescription::ltDerivedClassAnyType: + case PropertyDescription::LocationType::DerivedClassAnyType: *static_cast< Any* >(aPos->aLocation.pDerivedClassMember) = _rValue; break; - case PropertyDescription::ltDerivedClassRealType: + case PropertyDescription::LocationType::DerivedClassRealType: // copy the data from the to-be-set value bSuccess = uno_type_assignData( aPos->aLocation.pDerivedClassMember, aPos->aProperty.Type.getTypeLibType(), @@ -416,15 +416,15 @@ void OPropertyContainerHelper::getFastPropertyValue(Any& _rValue, sal_Int32 _nHa switch (aPos->eLocated) { - case PropertyDescription::ltHoldMyself: + case PropertyDescription::LocationType::HoldMyself: OSL_ENSURE(aPos->aLocation.nOwnClassVectorIndex < (sal_Int32)m_aHoldProperties.size(), "OPropertyContainerHelper::convertFastPropertyValue: invalid position !"); _rValue = m_aHoldProperties[aPos->aLocation.nOwnClassVectorIndex]; break; - case PropertyDescription::ltDerivedClassAnyType: + case PropertyDescription::LocationType::DerivedClassAnyType: _rValue = *static_cast<Any*>(aPos->aLocation.pDerivedClassMember); break; - case PropertyDescription::ltDerivedClassRealType: + case PropertyDescription::LocationType::DerivedClassRealType: _rValue.setValue(aPos->aLocation.pDerivedClassMember, aPos->aProperty.Type); break; } diff --git a/include/comphelper/propertycontainerhelper.hxx b/include/comphelper/propertycontainerhelper.hxx index 0fe37bb..39bdcbf 100644 --- a/include/comphelper/propertycontainerhelper.hxx +++ b/include/comphelper/propertycontainerhelper.hxx @@ -35,11 +35,11 @@ namespace comphelper struct COMPHELPER_DLLPUBLIC PropertyDescription { // the possibilities where a property holding object may be located - enum LocationType + enum class LocationType { - ltDerivedClassRealType, // within the derived class, it's a "real" (non-Any) type - ltDerivedClassAnyType, // within the derived class, it's a com.sun.star.uno::Any - ltHoldMyself // within m_aHoldProperties + DerivedClassRealType, // within the derived class, it's a "real" (non-Any) type + DerivedClassAnyType, // within the derived class, it's a com.sun.star.uno::Any + HoldMyself // within m_aHoldProperties }; // the location of an object holding a property value : union LocationAccess @@ -54,7 +54,7 @@ struct COMPHELPER_DLLPUBLIC PropertyDescription PropertyDescription() :aProperty( OUString(), -1, css::uno::Type(), 0 ) - ,eLocated( ltHoldMyself ) + ,eLocated( LocationType::HoldMyself ) { aLocation.nOwnClassVectorIndex = -1; } commit 3b168bc6854cb494cf3a0c1e826ce3fed1d0c141 Author: Noel Grandin <n...@peralex.com> Date: Tue Feb 23 15:47:28 2016 +0200 convert DocPasswordRequestType to scoped enum Change-Id: I25d217ca2cf3e8cc4dfaccc6dc7d5453ffdc6cb6 diff --git a/comphelper/source/misc/docpasswordrequest.cxx b/comphelper/source/misc/docpasswordrequest.cxx index ba3f699..3061757 100644 --- a/comphelper/source/misc/docpasswordrequest.cxx +++ b/comphelper/source/misc/docpasswordrequest.cxx @@ -120,14 +120,14 @@ DocPasswordRequest::DocPasswordRequest( DocPasswordRequestType eType, { switch( eType ) { - case DocPasswordRequestType_STANDARD: + case DocPasswordRequestType::Standard: { DocumentPasswordRequest2 aRequest( OUString(), Reference< XInterface >(), InteractionClassification_QUERY, eMode, rDocumentUrl, bPasswordToModify ); maRequest <<= aRequest; } break; - case DocPasswordRequestType_MS: + case DocPasswordRequestType::MS: { DocumentMSPasswordRequest2 aRequest( OUString(), Reference< XInterface >(), InteractionClassification_QUERY, eMode, rDocumentUrl, bPasswordToModify ); diff --git a/include/comphelper/docpasswordrequest.hxx b/include/comphelper/docpasswordrequest.hxx index 31e2aad..3dce6c9 100644 --- a/include/comphelper/docpasswordrequest.hxx +++ b/include/comphelper/docpasswordrequest.hxx @@ -32,10 +32,10 @@ class PasswordContinuation; /** Selects which UNO document password request type to use. */ -enum DocPasswordRequestType +enum class DocPasswordRequestType { - DocPasswordRequestType_STANDARD, /// Uses the standard com.sun.star.task.DocumentPasswordRequest request. - DocPasswordRequestType_MS /// Uses the com.sun.star.task.DocumentMSPasswordRequest request. + Standard, /// Uses the standard com.sun.star.task.DocumentPasswordRequest request. + MS /// Uses the com.sun.star.task.DocumentMSPasswordRequest request. }; diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx index 02aec2b..66d581a 100644 --- a/oox/source/core/filterdetect.cxx +++ b/oox/source/core/filterdetect.cxx @@ -334,7 +334,7 @@ Reference< XInputStream > FilterDetect::extractUnencryptedPackage( MediaDescript Sequence<NamedValue> aEncryptionData; aEncryptionData = rMediaDescriptor.requestAndVerifyDocPassword( aVerifier, - comphelper::DocPasswordRequestType_MS, + comphelper::DocPasswordRequestType::MS, &aDefaultPasswords ); if( aEncryptionData.getLength() == 0 ) diff --git a/sc/source/filter/ftools/fapihelper.cxx b/sc/source/filter/ftools/fapihelper.cxx index e874405..cd317c4 100644 --- a/sc/source/filter/ftools/fapihelper.cxx +++ b/sc/source/filter/ftools/fapihelper.cxx @@ -117,7 +117,7 @@ uno::Sequence< beans::NamedValue > ScfApiHelper::QueryEncryptionDataForMedium( S bool bIsDefaultPassword = false; aEncryptionData = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword( rVerifier, aEncryptionData, aPassword, rMedium.GetInteractionHandler(), rMedium.GetOrigURL(), - ::comphelper::DocPasswordRequestType_MS, pDefaultPasswords, &bIsDefaultPassword ); + ::comphelper::DocPasswordRequestType::MS, pDefaultPasswords, &bIsDefaultPassword ); rMedium.GetItemSet()->ClearItem( SID_PASSWORD ); rMedium.GetItemSet()->ClearItem( SID_ENCRYPTIONDATA ); diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 9675138..dd8b200 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -239,7 +239,7 @@ sal_uInt32 CheckPasswd_Impl SfxDocPasswordVerifier aVerifier( xStorage ); aEncryptionData = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword( - aVerifier, aEncryptionData, aPassword, xInteractionHandler, pFile->GetOrigURL(), comphelper::DocPasswordRequestType_STANDARD ); + aVerifier, aEncryptionData, aPassword, xInteractionHandler, pFile->GetOrigURL(), comphelper::DocPasswordRequestType::Standard ); pSet->ClearItem( SID_PASSWORD ); pSet->ClearItem( SID_ENCRYPTIONDATA ); diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index ed5b055..ba34cbc 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -2607,8 +2607,8 @@ ErrCode RequestPassword(const SfxFilter* pCurrentFilter, OUString& aURL, SfxItem // for now MS-filters are the only alien filters that support encryption bool bMSType = !pCurrentFilter->IsOwnFormat(); ::comphelper::DocPasswordRequestType eType = bMSType ? - ::comphelper::DocPasswordRequestType_MS : - ::comphelper::DocPasswordRequestType_STANDARD; + ::comphelper::DocPasswordRequestType::MS : + ::comphelper::DocPasswordRequestType::Standard; ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( new ::comphelper::DocPasswordRequest( eType, css::task::PasswordRequestMode_PASSWORD_CREATE, aURL, bool( pCurrentFilter->GetFilterFlags() & SfxFilterFlags::PASSWORDTOMODIFY ) ) ); diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 0f49b8c..5b1e613 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -172,7 +172,7 @@ static bool AskPasswordToModify_Impl( const uno::Reference< task::XInteractionHa ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( new ::comphelper::DocPasswordRequest( - bMSType ? ::comphelper::DocPasswordRequestType_MS : ::comphelper::DocPasswordRequestType_STANDARD, + bMSType ? ::comphelper::DocPasswordRequestType::MS : ::comphelper::DocPasswordRequestType::Standard, bFirstTime ? css::task::PasswordRequestMode_PASSWORD_ENTER : css::task::PasswordRequestMode_PASSWORD_REENTER, aPath, true ) ); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index b40c2f96..be8df23 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -5530,7 +5530,7 @@ namespace if( xHandler.is() ) { ::comphelper::DocPasswordRequest* pRequest = new ::comphelper::DocPasswordRequest( - ::comphelper::DocPasswordRequestType_MS, task::PasswordRequestMode_PASSWORD_ENTER, + ::comphelper::DocPasswordRequestType::MS, task::PasswordRequestMode_PASSWORD_ENTER, INetURLObject( rMedium.GetOrigURL() ).GetName( INetURLObject::DECODE_WITH_CHARSET ) ); uno::Reference< task::XInteractionRequest > xRequest( pRequest ); diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index 2b6bd55..bfee176 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -85,7 +85,7 @@ char* GetPasswordFunction( PK11SlotInfo* pSlot, PRBool bRetry, void* /*arg*/ ) task::PasswordRequestMode eMode = bRetry ? task::PasswordRequestMode_PASSWORD_REENTER : task::PasswordRequestMode_PASSWORD_ENTER; ::comphelper::DocPasswordRequest* pPasswordRequest = new ::comphelper::DocPasswordRequest( - ::comphelper::DocPasswordRequestType_STANDARD, eMode, OUString::createFromAscii(PK11_GetTokenName(pSlot)) ); + ::comphelper::DocPasswordRequestType::Standard, eMode, OUString::createFromAscii(PK11_GetTokenName(pSlot)) ); uno::Reference< task::XInteractionRequest > xRequest( pPasswordRequest ); xInteractionHandler->handle( xRequest ); commit 5d8474bae086bc798212186ff5057eb3350d225b Author: Noel Grandin <n...@peralex.com> Date: Tue Feb 23 15:39:02 2016 +0200 convert PropertyOrigin to scoped enum Change-Id: I26c9929be8aad02030722508334e66f5028ffb37 diff --git a/comphelper/source/property/propagg.cxx b/comphelper/source/property/propagg.cxx index 103b243..a1044c7 100644 --- a/comphelper/source/property/propagg.cxx +++ b/comphelper/source/property/propagg.cxx @@ -146,7 +146,7 @@ OPropertyArrayAggregationHelper::OPropertyArrayAggregationHelper( OPropertyArrayAggregationHelper::PropertyOrigin OPropertyArrayAggregationHelper::classifyProperty( const OUString& _rName ) { - PropertyOrigin eOrigin = UNKNOWN_PROPERTY; + PropertyOrigin eOrigin = PropertyOrigin::Unknown; // look up the name const Property* pPropertyDescriptor = lcl_findPropertyByName( m_aProperties, _rName ); if ( pPropertyDescriptor ) @@ -156,7 +156,7 @@ OPropertyArrayAggregationHelper::PropertyOrigin OPropertyArrayAggregationHelper: OSL_ENSURE( m_aPropertyAccessors.end() != aPos, "OPropertyArrayAggregationHelper::classifyProperty: should have this handle in my map!" ); if ( m_aPropertyAccessors.end() != aPos ) { - eOrigin = aPos->second.bAggregate ? AGGREGATE_PROPERTY : DELEGATOR_PROPERTY; + eOrigin = aPos->second.bAggregate ? PropertyOrigin::Aggregate : PropertyOrigin::Delegator; } } return eOrigin; @@ -660,12 +660,12 @@ void SAL_CALL OPropertySetAggregationHelper::setPropertyValues( for ( sal_Int32 i = 0; i < nLen; ++i, ++pNames ) { OPropertyArrayAggregationHelper::PropertyOrigin ePropOrg = rPH.classifyProperty( *pNames ); - if ( OPropertyArrayAggregationHelper::UNKNOWN_PROPERTY == ePropOrg ) + if ( OPropertyArrayAggregationHelper::PropertyOrigin::Unknown == ePropOrg ) throw WrappedTargetException( OUString(), static_cast< XMultiPropertySet* >( this ), makeAny( UnknownPropertyException( ) ) ); // due to a flaw in the API design, this method is not allowed to throw an UnknownPropertyException // so we wrap it into a WrappedTargetException - if ( OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY == ePropOrg ) + if ( OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate == ePropOrg ) ++nAggCount; } @@ -705,7 +705,7 @@ void SAL_CALL OPropertySetAggregationHelper::setPropertyValues( for ( sal_Int32 i = 0; i < nLen; ++i, ++pNames, ++pValues ) { - if ( OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY == rPH.classifyProperty( *pNames ) ) + if ( OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate == rPH.classifyProperty( *pNames ) ) { *pAggNames++ = *pNames; *pAggValues++ = *pValues; diff --git a/include/comphelper/propagg.hxx b/include/comphelper/propagg.hxx index a129ea0..68fafa01 100644 --- a/include/comphelper/propagg.hxx +++ b/include/comphelper/propagg.hxx @@ -156,11 +156,11 @@ public: bool getPropertyByHandle( sal_Int32 _nHandle, css::beans::Property& _rProperty ) const; - enum PropertyOrigin + enum class PropertyOrigin { - AGGREGATE_PROPERTY, - DELEGATOR_PROPERTY, - UNKNOWN_PROPERTY + Aggregate, + Delegator, + Unknown }; /** prefer this one over the XPropertySetInfo of the aggregate! diff --git a/reportdesign/source/core/api/Shape.cxx b/reportdesign/source/core/api/Shape.cxx index 5b37df6..e02132b 100644 --- a/reportdesign/source/core/api/Shape.cxx +++ b/reportdesign/source/core/api/Shape.cxx @@ -208,20 +208,20 @@ cppu::IPropertyArrayHelper& OShape::getInfoHelper() void SAL_CALL OShape::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception) { getInfoHelper(); - if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY ) + if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate ) m_aProps.aComponent.m_xProperty->setPropertyValue( aPropertyName,aValue); // can be in both - if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::DELEGATOR_PROPERTY ) + if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Delegator ) ShapePropertySet::setPropertyValue( aPropertyName, aValue ); } uno::Any SAL_CALL OShape::getPropertyValue( const OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception) { getInfoHelper(); - if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY ) + if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate ) return m_aProps.aComponent.m_xProperty->getPropertyValue( PropertyName); // can be in both - if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::DELEGATOR_PROPERTY ) + if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Delegator ) return ShapePropertySet::getPropertyValue( PropertyName); return uno::Any(); } @@ -229,40 +229,40 @@ uno::Any SAL_CALL OShape::getPropertyValue( const OUString& PropertyName ) throw void SAL_CALL OShape::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception) { getInfoHelper(); - if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY || aPropertyName.isEmpty() ) + if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate || aPropertyName.isEmpty() ) m_aProps.aComponent.m_xProperty->addPropertyChangeListener( aPropertyName, xListener); // can be in both - if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::DELEGATOR_PROPERTY || aPropertyName.isEmpty() ) + if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Delegator || aPropertyName.isEmpty() ) ShapePropertySet::addPropertyChangeListener( aPropertyName, xListener ); } void SAL_CALL OShape::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception) { getInfoHelper(); - if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY || aPropertyName.isEmpty() ) + if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate || aPropertyName.isEmpty() ) m_aProps.aComponent.m_xProperty->removePropertyChangeListener( aPropertyName, aListener ); // can be in both - if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::DELEGATOR_PROPERTY || aPropertyName.isEmpty() ) + if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Delegator || aPropertyName.isEmpty() ) ShapePropertySet::removePropertyChangeListener( aPropertyName, aListener ); } void SAL_CALL OShape::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception) { getInfoHelper(); - if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY || PropertyName.isEmpty() ) + if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate || PropertyName.isEmpty() ) m_aProps.aComponent.m_xProperty->addVetoableChangeListener( PropertyName, aListener ); // can be in both - if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::DELEGATOR_PROPERTY || PropertyName.isEmpty() ) + if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Delegator || PropertyName.isEmpty() ) ShapePropertySet::addVetoableChangeListener( PropertyName, aListener ); } void SAL_CALL OShape::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception) { getInfoHelper(); - if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY || PropertyName.isEmpty() ) + if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate || PropertyName.isEmpty() ) m_aProps.aComponent.m_xProperty->removeVetoableChangeListener( PropertyName, aListener ); // can be in both - if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::DELEGATOR_PROPERTY || PropertyName.isEmpty() ) + if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Delegator || PropertyName.isEmpty() ) ShapePropertySet::removeVetoableChangeListener( PropertyName, aListener ); } commit dc1f1cde6329044611607d8bfc10203b6d83dcee Author: Noel Grandin <n...@peralex.com> Date: Tue Feb 23 15:14:58 2016 +0200 convert DocPasswordVerifierResult to scoped enum Change-Id: Ib5a595819dec8511d284ed1022d8f7c624f8d8f9 diff --git a/comphelper/source/misc/docpasswordhelper.cxx b/comphelper/source/misc/docpasswordhelper.cxx index 2dd70e3..301612c 100644 --- a/comphelper/source/misc/docpasswordhelper.cxx +++ b/comphelper/source/misc/docpasswordhelper.cxx @@ -356,48 +356,48 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence( bool* pbIsDefaultPassword ) { css::uno::Sequence< css::beans::NamedValue > aEncData; - DocPasswordVerifierResult eResult = DocPasswordVerifierResult_WRONG_PASSWORD; + DocPasswordVerifierResult eResult = DocPasswordVerifierResult::WrongPassword; // first, try provided default passwords if( pbIsDefaultPassword ) *pbIsDefaultPassword = false; if( pDefaultPasswords ) { - for( ::std::vector< OUString >::const_iterator aIt = pDefaultPasswords->begin(), aEnd = pDefaultPasswords->end(); (eResult == DocPasswordVerifierResult_WRONG_PASSWORD) && (aIt != aEnd); ++aIt ) + for( ::std::vector< OUString >::const_iterator aIt = pDefaultPasswords->begin(), aEnd = pDefaultPasswords->end(); (eResult == DocPasswordVerifierResult::WrongPassword) && (aIt != aEnd); ++aIt ) { OSL_ENSURE( !aIt->isEmpty(), "DocPasswordHelper::requestAndVerifyDocPassword - unexpected empty default password" ); if( !aIt->isEmpty() ) { eResult = rVerifier.verifyPassword( *aIt, aEncData ); if( pbIsDefaultPassword ) - *pbIsDefaultPassword = eResult == DocPasswordVerifierResult_OK; + *pbIsDefaultPassword = eResult == DocPasswordVerifierResult::OK; } } } // try media encryption data (skip, if result is OK or ABORT) - if( eResult == DocPasswordVerifierResult_WRONG_PASSWORD ) + if( eResult == DocPasswordVerifierResult::WrongPassword ) { if( rMediaEncData.getLength() > 0 ) { eResult = rVerifier.verifyEncryptionData( rMediaEncData ); - if( eResult == DocPasswordVerifierResult_OK ) + if( eResult == DocPasswordVerifierResult::OK ) aEncData = rMediaEncData; } } // try media password (skip, if result is OK or ABORT) - if( eResult == DocPasswordVerifierResult_WRONG_PASSWORD ) + if( eResult == DocPasswordVerifierResult::WrongPassword ) { if( !rMediaPassword.isEmpty() ) eResult = rVerifier.verifyPassword( rMediaPassword, aEncData ); } // request a password (skip, if result is OK or ABORT) - if( (eResult == DocPasswordVerifierResult_WRONG_PASSWORD) && rxInteractHandler.is() ) try + if( (eResult == DocPasswordVerifierResult::WrongPassword) && rxInteractHandler.is() ) try { PasswordRequestMode eRequestMode = PasswordRequestMode_PASSWORD_ENTER; - while( eResult == DocPasswordVerifierResult_WRONG_PASSWORD ) + while( eResult == DocPasswordVerifierResult::WrongPassword ) { DocPasswordRequest* pRequest = new DocPasswordRequest( eRequestType, eRequestMode, rDocumentUrl ); Reference< XInteractionRequest > xRequest( pRequest ); @@ -409,7 +409,7 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence( } else { - eResult = DocPasswordVerifierResult_ABORT; + eResult = DocPasswordVerifierResult::Abort; } eRequestMode = PasswordRequestMode_PASSWORD_REENTER; } @@ -418,7 +418,7 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence( { } - return (eResult == DocPasswordVerifierResult_OK) ? aEncData : uno::Sequence< beans::NamedValue >(); + return (eResult == DocPasswordVerifierResult::OK) ? aEncData : uno::Sequence< beans::NamedValue >(); } } // namespace comphelper diff --git a/include/comphelper/docpasswordhelper.hxx b/include/comphelper/docpasswordhelper.hxx index e1f9976..12ecb7ee6 100644 --- a/include/comphelper/docpasswordhelper.hxx +++ b/include/comphelper/docpasswordhelper.hxx @@ -30,11 +30,11 @@ namespace com { namespace sun { namespace star { namespace beans { struct Proper namespace comphelper { -enum DocPasswordVerifierResult +enum class DocPasswordVerifierResult { - DocPasswordVerifierResult_OK, - DocPasswordVerifierResult_WRONG_PASSWORD, - DocPasswordVerifierResult_ABORT + OK, + WrongPassword, + Abort }; diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx index ede7849..02aec2b 100644 --- a/oox/source/core/filterdetect.cxx +++ b/oox/source/core/filterdetect.cxx @@ -283,12 +283,12 @@ comphelper::DocPasswordVerifierResult PasswordVerifier::verifyPassword( const OU if(mDecryptor.generateEncryptionKey(rPassword)) rEncryptionData = mDecryptor.createEncryptionData(rPassword); - return rEncryptionData.hasElements() ? comphelper::DocPasswordVerifierResult_OK : comphelper::DocPasswordVerifierResult_WRONG_PASSWORD; + return rEncryptionData.hasElements() ? comphelper::DocPasswordVerifierResult::OK : comphelper::DocPasswordVerifierResult::WrongPassword; } comphelper::DocPasswordVerifierResult PasswordVerifier::verifyEncryptionData( const Sequence<NamedValue>& ) { - return comphelper::DocPasswordVerifierResult_WRONG_PASSWORD; + return comphelper::DocPasswordVerifierResult::WrongPassword; } } // namespace diff --git a/sc/source/filter/excel/xistream.cxx b/sc/source/filter/excel/xistream.cxx index 88448ec..1c9ab9c 100644 --- a/sc/source/filter/excel/xistream.cxx +++ b/sc/source/filter/excel/xistream.cxx @@ -62,14 +62,14 @@ XclImpDecrypterRef XclImpDecrypter::Clone() const { o_rEncryptionData = OnVerifyPassword( rPassword ); mnError = o_rEncryptionData.getLength() ? ERRCODE_NONE : ERRCODE_ABORT; - return o_rEncryptionData.getLength() ? ::comphelper::DocPasswordVerifierResult_OK : ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD; + return o_rEncryptionData.getLength() ? ::comphelper::DocPasswordVerifierResult::OK : ::comphelper::DocPasswordVerifierResult::WrongPassword; } ::comphelper::DocPasswordVerifierResult XclImpDecrypter::verifyEncryptionData( const uno::Sequence< beans::NamedValue >& rEncryptionData ) { bool bValid = OnVerifyEncryptionData( rEncryptionData ); mnError = bValid ? ERRCODE_NONE : ERRCODE_ABORT; - return bValid ? ::comphelper::DocPasswordVerifierResult_OK : ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD; + return bValid ? ::comphelper::DocPasswordVerifierResult::OK : ::comphelper::DocPasswordVerifierResult::WrongPassword; } void XclImpDecrypter::Update( SvStream& rStrm, sal_uInt16 nRecSize ) diff --git a/sc/source/filter/oox/biffcodec.cxx b/sc/source/filter/oox/biffcodec.cxx index 382ac5f..18b19d0 100644 --- a/sc/source/filter/oox/biffcodec.cxx +++ b/sc/source/filter/oox/biffcodec.cxx @@ -45,13 +45,13 @@ BiffDecoderBase::~BiffDecoderBase() { o_rEncryptionData = implVerifyPassword( rPassword ); mbValid = o_rEncryptionData.hasElements(); - return mbValid ? ::comphelper::DocPasswordVerifierResult_OK : ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD; + return mbValid ? ::comphelper::DocPasswordVerifierResult::OK : ::comphelper::DocPasswordVerifierResult::WrongPassword; } ::comphelper::DocPasswordVerifierResult BiffDecoderBase::verifyEncryptionData( const Sequence< NamedValue >& rEncryptionData ) { mbValid = implVerifyEncryptionData( rEncryptionData ); - return mbValid ? ::comphelper::DocPasswordVerifierResult_OK : ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD; + return mbValid ? ::comphelper::DocPasswordVerifierResult::OK : ::comphelper::DocPasswordVerifierResult::WrongPassword; } void BiffDecoderBase::decode( sal_uInt8* pnDestData, const sal_uInt8* pnSrcData, sal_Int64 nStreamPos, sal_uInt16 nBytes ) diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 61b7dcd..9675138 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -147,7 +147,7 @@ private: ::comphelper::DocPasswordVerifierResult SfxDocPasswordVerifier::verifyEncryptionData( const uno::Sequence< beans::NamedValue >& rEncryptionData ) { - ::comphelper::DocPasswordVerifierResult eResult = ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD; + ::comphelper::DocPasswordVerifierResult eResult = ::comphelper::DocPasswordVerifierResult::WrongPassword; try { // check the encryption data @@ -160,17 +160,17 @@ private: embed::ElementModes::READ | embed::ElementModes::NOCREATE ); // no exception -> success - eResult = ::comphelper::DocPasswordVerifierResult_OK; + eResult = ::comphelper::DocPasswordVerifierResult::OK; } catch( const packages::WrongPasswordException& ) { - eResult = ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD; + eResult = ::comphelper::DocPasswordVerifierResult::WrongPassword; } catch( const uno::Exception& ) { // unknown error, report it as wrong password // TODO/LATER: we need an additional way to report unknown problems in this case - eResult = ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD; + eResult = ::comphelper::DocPasswordVerifierResult::WrongPassword; } return eResult; } commit 0839f90394d96cf0fe414913527b3e3e5ba3c86a Author: Noel Grandin <n...@peralex.com> Date: Tue Feb 23 13:32:21 2016 +0200 convert EConfigurationModes to scoped enum Change-Id: I1e81c8d637e738f536f7efad8b67d0c9183e6483 diff --git a/comphelper/source/misc/configurationhelper.cxx b/comphelper/source/misc/configurationhelper.cxx index d802ea1..f5eb95e 100644 --- a/comphelper/source/misc/configurationhelper.cxx +++ b/comphelper/source/misc/configurationhelper.cxx @@ -31,8 +31,8 @@ namespace comphelper{ css::uno::Reference< css::uno::XInterface > ConfigurationHelper::openConfig(const css::uno::Reference< css::uno::XComponentContext >& rxContext, - const OUString& sPackage, - sal_Int32 eMode ) + const OUString& sPackage, + EConfigurationModes eMode ) { css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider( css::configuration::theDefaultProvider::get( rxContext ) ); @@ -46,7 +46,7 @@ css::uno::Reference< css::uno::XInterface > ConfigurationHelper::openConfig(cons lParams.push_back(css::uno::makeAny(aParam)); // enable all locales mode - if ((eMode & ConfigurationHelper::E_ALL_LOCALES)==ConfigurationHelper::E_ALL_LOCALES) + if (eMode & EConfigurationModes::AllLocales) { aParam.Name = "locale"; aParam.Value <<= OUString("*"); @@ -54,7 +54,7 @@ css::uno::Reference< css::uno::XInterface > ConfigurationHelper::openConfig(cons } // enable lazy writing - bool bLazy = ((eMode & ConfigurationHelper::E_LAZY_WRITE)==ConfigurationHelper::E_LAZY_WRITE); + bool bLazy(eMode & EConfigurationModes::LazyWrite); aParam.Name = "lazywrite"; aParam.Value = css::uno::makeAny(bLazy); lParams.push_back(css::uno::makeAny(aParam)); @@ -62,7 +62,7 @@ css::uno::Reference< css::uno::XInterface > ConfigurationHelper::openConfig(cons // open it css::uno::Reference< css::uno::XInterface > xCFG; - bool bReadOnly = ((eMode & ConfigurationHelper::E_READONLY)==ConfigurationHelper::E_READONLY); + bool bReadOnly(eMode & EConfigurationModes::ReadOnly); if (bReadOnly) xCFG = xConfigProvider->createInstanceWithArguments( "com.sun.star.configuration.ConfigurationAccess", @@ -158,7 +158,7 @@ css::uno::Any ConfigurationHelper::readDirectKey(const css::uno::Reference< css: const OUString& sPackage, const OUString& sRelPath, const OUString& sKey , - sal_Int32 eMode ) + EConfigurationModes eMode ) { css::uno::Reference< css::uno::XInterface > xCFG = ConfigurationHelper::openConfig(rxContext, sPackage, eMode); return ConfigurationHelper::readRelativeKey(xCFG, sRelPath, sKey); @@ -169,8 +169,8 @@ void ConfigurationHelper::writeDirectKey(const css::uno::Reference< css::uno::XC const OUString& sPackage, const OUString& sRelPath, const OUString& sKey , - const css::uno::Any& aValue , - sal_Int32 eMode ) + const css::uno::Any& aValue , + EConfigurationModes eMode ) { css::uno::Reference< css::uno::XInterface > xCFG = ConfigurationHelper::openConfig(rxContext, sPackage, eMode); ConfigurationHelper::writeRelativeKey(xCFG, sRelPath, sKey, aValue); diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx index 586011a..b575fbe 100644 --- a/framework/source/accelerators/acceleratorconfiguration.cxx +++ b/framework/source/accelerators/acceleratorconfiguration.cxx @@ -522,7 +522,7 @@ XCUBasedAcceleratorConfiguration::XCUBasedAcceleratorConfiguration(const css::un { const OUString CFG_ENTRY_ACCELERATORS("org.openoffice.Office.Accelerators"); m_xCfg.set( - ::comphelper::ConfigurationHelper::openConfig( m_xContext, CFG_ENTRY_ACCELERATORS, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ), + ::comphelper::ConfigurationHelper::openConfig( m_xContext, CFG_ENTRY_ACCELERATORS, ::comphelper::EConfigurationModes::AllLocales ), css::uno::UNO_QUERY ); } @@ -972,14 +972,14 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::reset() if ( sConfig == "Global" ) { m_xCfg.set( - ::comphelper::ConfigurationHelper::openConfig( m_xContext, CFG_ENTRY_GLOBAL, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ), + ::comphelper::ConfigurationHelper::openConfig( m_xContext, CFG_ENTRY_GLOBAL, ::comphelper::EConfigurationModes::AllLocales ), css::uno::UNO_QUERY ); XCUBasedAcceleratorConfiguration::reload(); } else if ( sConfig == "Modules" ) { m_xCfg.set( - ::comphelper::ConfigurationHelper::openConfig( m_xContext, CFG_ENTRY_MODULES, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ), + ::comphelper::ConfigurationHelper::openConfig( m_xContext, CFG_ENTRY_MODULES, ::comphelper::EConfigurationModes::AllLocales ), css::uno::UNO_QUERY ); XCUBasedAcceleratorConfiguration::reload(); } diff --git a/framework/source/helper/persistentwindowstate.cxx b/framework/source/helper/persistentwindowstate.cxx index 3cdf500..c4fbaf0 100644 --- a/framework/source/helper/persistentwindowstate.cxx +++ b/framework/source/helper/persistentwindowstate.cxx @@ -175,7 +175,7 @@ OUString PersistentWindowState::implst_getWindowStateFromConfig( "org.openoffice.Setup/", "Office/Factories/*[\"" + sModuleName + "\"]", "ooSetupFactoryWindowAttributes", - ::comphelper::ConfigurationHelper::E_READONLY) >>= sWindowState; + ::comphelper::EConfigurationModes::ReadOnly) >>= sWindowState; } catch(const css::uno::RuntimeException&) { throw; } @@ -196,7 +196,7 @@ void PersistentWindowState::implst_setWindowStateOnConfig( "Office/Factories/*[\"" + sModuleName + "\"]", "ooSetupFactoryWindowAttributes", css::uno::makeAny(sWindowState), - ::comphelper::ConfigurationHelper::E_STANDARD); + ::comphelper::EConfigurationModes::Standard); } catch(const css::uno::RuntimeException&) { throw; } diff --git a/framework/source/jobs/helponstartup.cxx b/framework/source/jobs/helponstartup.cxx index d1e75f1..2b8d2e1 100644 --- a/framework/source/jobs/helponstartup.cxx +++ b/framework/source/jobs/helponstartup.cxx @@ -59,7 +59,7 @@ DEFINE_INIT_SERVICE(HelpOnStartup, ::comphelper::ConfigurationHelper::openConfig( m_xContext, "/org.openoffice.Setup/Office/Factories", - ::comphelper::ConfigurationHelper::E_READONLY), + ::comphelper::EConfigurationModes::ReadOnly), css::uno::UNO_QUERY_THROW); // ask for office locale @@ -68,7 +68,7 @@ DEFINE_INIT_SERVICE(HelpOnStartup, "/org.openoffice.Setup", "L10N", "ooLocale", - ::comphelper::ConfigurationHelper::E_READONLY) >>= m_sLocale; + ::comphelper::EConfigurationModes::ReadOnly) >>= m_sLocale; // detect system ::comphelper::ConfigurationHelper::readDirectKey( @@ -76,7 +76,7 @@ DEFINE_INIT_SERVICE(HelpOnStartup, "/org.openoffice.Office.Common", "Help", "System", - ::comphelper::ConfigurationHelper::E_READONLY) >>= m_sSystem; + ::comphelper::EConfigurationModes::ReadOnly) >>= m_sSystem; // Start listening for disposing events of these services, // so we can react e.g. for an office shutdown diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 0ebf000..1a29255 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -923,7 +923,7 @@ bool LoadEnv::impl_furtherDocsAllowed() "org.openoffice.Office.Common/", "Misc", "MaxOpenDocuments", - ::comphelper::ConfigurationHelper::E_READONLY); + ::comphelper::EConfigurationModes::ReadOnly); // NIL means: count of allowed documents = infinite ! // => return sal_True @@ -1641,7 +1641,7 @@ void LoadEnv::impl_makeFrameWindowVisible(const css::uno::Reference< css::awt::X "org.openoffice.Office.Common/View", "NewDocumentHandling", "ForceFocusAndToFront", - ::comphelper::ConfigurationHelper::E_READONLY); + ::comphelper::EConfigurationModes::ReadOnly); a >>= bForceFrontAndFocus; } @@ -1718,7 +1718,7 @@ void LoadEnv::impl_applyPersistentWindowState(const css::uno::Reference< css::aw css::uno::Reference< css::container::XNameAccess > xModuleCfg(::comphelper::ConfigurationHelper::openConfig( xContext, PACKAGE_SETUP_MODULES, - ::comphelper::ConfigurationHelper::E_READONLY), + ::comphelper::EConfigurationModes::ReadOnly), css::uno::UNO_QUERY_THROW); // read window state from the configuration diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 240493a..82ef364 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -1761,7 +1761,7 @@ css::uno::Reference< css::container::XNameAccess > AutoRecovery::implts_openConf OUString sCFG_PACKAGE_RECOVERY(CFG_PACKAGE_RECOVERY); // throws a RuntimeException if an error occurs! css::uno::Reference< css::container::XNameAccess > xCFG( - ::comphelper::ConfigurationHelper::openConfig(m_xContext, sCFG_PACKAGE_RECOVERY, ::comphelper::ConfigurationHelper::E_STANDARD), + ::comphelper::ConfigurationHelper::openConfig(m_xContext, sCFG_PACKAGE_RECOVERY, ::comphelper::EConfigurationModes::Standard), css::uno::UNO_QUERY); sal_Int32 nMinSpaceDocSave = MIN_DISCSPACE_DOCSAVE; @@ -1774,13 +1774,13 @@ css::uno::Reference< css::container::XNameAccess > AutoRecovery::implts_openConf sCFG_PACKAGE_RECOVERY, sCFG_PATH_AUTOSAVE, CFG_ENTRY_MINSPACE_DOCSAVE, - ::comphelper::ConfigurationHelper::E_STANDARD) >>= nMinSpaceDocSave; + ::comphelper::EConfigurationModes::Standard) >>= nMinSpaceDocSave; ::comphelper::ConfigurationHelper::readDirectKey(m_xContext, sCFG_PACKAGE_RECOVERY, sCFG_PATH_AUTOSAVE, CFG_ENTRY_MINSPACE_CONFIGSAVE, - ::comphelper::ConfigurationHelper::E_STANDARD) >>= nMinSpaceConfigSave; + ::comphelper::EConfigurationModes::Standard) >>= nMinSpaceConfigSave; } catch(const css::uno::Exception&) { @@ -1952,7 +1952,7 @@ void AutoRecovery::implts_specifyDefaultFilterAndExtension(AutoRecovery::TDocume { // open module config on demand and cache the update access xCFG.set( ::comphelper::ConfigurationHelper::openConfig(m_xContext, CFG_PACKAGE_MODULES, - ::comphelper::ConfigurationHelper::E_STANDARD), + ::comphelper::EConfigurationModes::Standard), css::uno::UNO_QUERY_THROW); /* SAFE */ { @@ -3717,7 +3717,7 @@ void AutoRecovery::implts_doEmergencySave(const DispatchParams& aParams) CFG_PATH_RECOVERYINFO, CFG_ENTRY_CRASHED, css::uno::makeAny(sal_True), - ::comphelper::ConfigurationHelper::E_STANDARD); + ::comphelper::EConfigurationModes::Standard); // for all docs, store their current view/names in the configurtion implts_persistAllActiveViewNames(); @@ -3777,7 +3777,7 @@ void AutoRecovery::implts_doRecovery(const DispatchParams& aParams) CFG_PATH_RECOVERYINFO, CFG_ENTRY_CRASHED, css::uno::makeAny(sal_False), - ::comphelper::ConfigurationHelper::E_STANDARD); + ::comphelper::EConfigurationModes::Standard); } void AutoRecovery::implts_doSessionSave(const DispatchParams& aParams) @@ -3842,7 +3842,7 @@ void AutoRecovery::implts_doSessionQuietQuit(const DispatchParams& /*aParams*/) CFG_PATH_RECOVERYINFO, CFG_ENTRY_SESSIONDATA, css::uno::makeAny(sal_True), - ::comphelper::ConfigurationHelper::E_STANDARD); + ::comphelper::EConfigurationModes::Standard); // flush config cached back to disc. impl_flushALLConfigChanges(); @@ -3877,7 +3877,7 @@ void AutoRecovery::implts_doSessionRestore(const DispatchParams& aParams) CFG_PATH_RECOVERYINFO, CFG_ENTRY_SESSIONDATA, css::uno::makeAny(sal_False), - ::comphelper::ConfigurationHelper::E_STANDARD); + ::comphelper::EConfigurationModes::Standard); SAL_INFO("fwk.autorecovery", "... AutoRecovery::implts_doSessionRestore()"); } @@ -4009,7 +4009,7 @@ void SAL_CALL AutoRecovery::getFastPropertyValue(css::uno::Any& aValue , CFG_PACKAGE_RECOVERY, CFG_PATH_RECOVERYINFO, CFG_ENTRY_SESSIONDATA, - ::comphelper::ConfigurationHelper::E_READONLY) >>= bSessionData; + ::comphelper::EConfigurationModes::ReadOnly) >>= bSessionData; bool bRecoveryData = m_lDocCache.size() > 0; @@ -4028,7 +4028,7 @@ void SAL_CALL AutoRecovery::getFastPropertyValue(css::uno::Any& aValue , CFG_PACKAGE_RECOVERY, CFG_PATH_RECOVERYINFO, CFG_ENTRY_CRASHED, - ::comphelper::ConfigurationHelper::E_READONLY); + ::comphelper::EConfigurationModes::ReadOnly); break; case AUTORECOVERY_PROPHANDLE_EXISTS_SESSIONDATA : @@ -4037,7 +4037,7 @@ void SAL_CALL AutoRecovery::getFastPropertyValue(css::uno::Any& aValue , CFG_PACKAGE_RECOVERY, CFG_PATH_RECOVERYINFO, CFG_ENTRY_SESSIONDATA, - ::comphelper::ConfigurationHelper::E_READONLY); + ::comphelper::EConfigurationModes::ReadOnly); break; } } diff --git a/framework/source/services/modulemanager.cxx b/framework/source/services/modulemanager.cxx index a9ffb24..e697295 100644 --- a/framework/source/services/modulemanager.cxx +++ b/framework/source/services/modulemanager.cxx @@ -147,7 +147,7 @@ ModuleManager::ModuleManager(const css::uno::Reference< css::uno::XComponentCont { m_xCFG.set( comphelper::ConfigurationHelper::openConfig( m_xContext, "/org.openoffice.Setup/Office/Factories", - comphelper::ConfigurationHelper::E_READONLY), + comphelper::EConfigurationModes::ReadOnly ), css::uno::UNO_QUERY_THROW ); } @@ -250,7 +250,7 @@ void SAL_CALL ModuleManager::replaceByName(const OUString& sName , css::uno::Reference< css::uno::XInterface > xCfg = ::comphelper::ConfigurationHelper::openConfig( m_xContext, "/org.openoffice.Setup/Office/Factories", - ::comphelper::ConfigurationHelper::E_STANDARD); + ::comphelper::EConfigurationModes::Standard); css::uno::Reference< css::container::XNameAccess > xModules (xCfg, css::uno::UNO_QUERY_THROW); css::uno::Reference< css::container::XNameReplace > xModule ; diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx index 063966f..552b2e8 100644 --- a/framework/source/services/pathsettings.cxx +++ b/framework/source/services/pathsettings.cxx @@ -1464,7 +1464,7 @@ css::uno::Reference< css::container::XNameAccess > PathSettings::fa_getCfgOld() xCfg.set( ::comphelper::ConfigurationHelper::openConfig( m_xContext, CFG_NODE_OLD, - ::comphelper::ConfigurationHelper::E_STANDARD), // not readonly! Sometimes we need write access there !!! + ::comphelper::EConfigurationModes::Standard), // not readonly! Sometimes we need write access there !!! css::uno::UNO_QUERY_THROW); { // SAFE -> @@ -1491,7 +1491,7 @@ css::uno::Reference< css::container::XNameAccess > PathSettings::fa_getCfgNew() xCfg.set( ::comphelper::ConfigurationHelper::openConfig( m_xContext, CFG_NODE_NEW, - ::comphelper::ConfigurationHelper::E_STANDARD), + ::comphelper::EConfigurationModes::Standard), css::uno::UNO_QUERY_THROW); { // SAFE -> diff --git a/include/comphelper/configurationhelper.hxx b/include/comphelper/configurationhelper.hxx index 51ea3e6..c5cf9d4 100644 --- a/include/comphelper/configurationhelper.hxx +++ b/include/comphelper/configurationhelper.hxx @@ -29,37 +29,43 @@ #include <rtl/ustring.hxx> #include <rtl/ustrbuf.hxx> #include <comphelper/comphelperdllapi.h> +#include <o3tl/typed_flags_set.hxx> -// namespaces - -namespace comphelper{ - - -class COMPHELPER_DLLPUBLIC ConfigurationHelper +namespace comphelper { - public: - - /** specify all possible modes, which can be used to open a configuration access. * * @see openConfig() * @see readDirectKey() * @see writeDirectKey() */ - enum EConfigurationModes + enum class EConfigurationModes { /// opens configuration in read/write mode (without LAZY writing!) - E_STANDARD = 0, + Standard = 0, /// configuration will be opened readonly - E_READONLY = 1, + ReadOnly = 1, /// all localized nodes will be interpreted as XInterface instead of interpreting it as atomic value nodes - E_ALL_LOCALES = 2, + AllLocales = 2, /// enable lazy writing - E_LAZY_WRITE = 4 + LazyWrite = 4 }; +} + +namespace o3tl +{ + template<> struct typed_flags<comphelper::EConfigurationModes> : is_typed_flags<comphelper::EConfigurationModes, 0x7> {}; +} + +namespace comphelper +{ + +class COMPHELPER_DLLPUBLIC ConfigurationHelper +{ +public: /** returns access to the specified configuration package. * * This method should be used, if e.g. more than one request to the same @@ -86,8 +92,8 @@ class COMPHELPER_DLLPUBLIC ConfigurationHelper * E.g. css::uno::Exception if the configuration could not be opened. */ static css::uno::Reference< css::uno::XInterface > openConfig(const css::uno::Reference< css::uno::XComponentContext >& rxContext, - const OUString& sPackage, - sal_Int32 eMode ); + const OUString& sPackage, + EConfigurationModes eMode ); /** reads the value of an existing(!) configuration key, @@ -211,7 +217,7 @@ class COMPHELPER_DLLPUBLIC ConfigurationHelper const OUString& sPackage, const OUString& sRelPath, const OUString& sKey , - sal_Int32 eMode ); + EConfigurationModes eMode ); /** does the same then openConfig() / writeRelativeKey() & flush() together. @@ -227,8 +233,8 @@ class COMPHELPER_DLLPUBLIC ConfigurationHelper const OUString& sPackage, const OUString& sRelPath, const OUString& sKey , - const css::uno::Any& aValue , - sal_Int32 eMode ); + const css::uno::Any& aValue , + EConfigurationModes eMode ); }; } // namespace comphelper diff --git a/include/comphelper/configurationlistener.hxx b/include/comphelper/configurationlistener.hxx index 6e598c1..6d3091d 100644 --- a/include/comphelper/configurationlistener.hxx +++ b/include/comphelper/configurationlistener.hxx @@ -70,9 +70,8 @@ public: ConfigurationListener(const OUString &rPath, css::uno::Reference< css::uno::XComponentContext > const & xContext = comphelper::getProcessComponentContext()) - : mxConfig( ConfigurationHelper::openConfig( xContext, rPath, - ConfigurationHelper::EConfigurationModes::E_READONLY ), - css::uno::UNO_QUERY_THROW ) + : mxConfig( ConfigurationHelper::openConfig( xContext, rPath, EConfigurationModes::ReadOnly ), + css::uno::UNO_QUERY_THROW ) { } virtual ~ConfigurationListener() diff --git a/oox/source/ole/vbaproject.cxx b/oox/source/ole/vbaproject.cxx index 7cab269..607bec8 100644 --- a/oox/source/ole/vbaproject.cxx +++ b/oox/source/ole/vbaproject.cxx @@ -85,7 +85,7 @@ VbaFilterConfig::VbaFilterConfig( const Reference< XComponentContext >& rxContex { OSL_ENSURE( !rConfigCompName.isEmpty(), "VbaFilterConfig::VbaFilterConfig - invalid configuration component name" ); OUString aConfigPackage = "org.openoffice.Office." + rConfigCompName; - mxConfigAccess = ConfigurationHelper::openConfig( rxContext, aConfigPackage, ConfigurationHelper::E_READONLY ); + mxConfigAccess = ConfigurationHelper::openConfig( rxContext, aConfigPackage, comphelper::EConfigurationModes::ReadOnly ); } catch(const Exception& ) { diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 506bd1b..e8716e3 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -2020,7 +2020,7 @@ void SfxHelpTextWindow_Impl::InitOnStartupBox( bool bOnlyText ) try { xConfiguration = ConfigurationHelper::openConfig( - xContext, PACKAGE_SETUP, ConfigurationHelper::E_STANDARD ); + xContext, PACKAGE_SETUP, EConfigurationModes::Standard ); if ( xConfiguration.is() ) { Any aAny = ConfigurationHelper::readRelativeKey( xConfiguration, sPath, sKey ); diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index 9443ac9..f7cba15 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -197,7 +197,7 @@ void SfxObjectFactory::SetSystemTemplate( const OUString& rServiceName, const OU { uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); uno::Reference< uno::XInterface > xConfig = ::comphelper::ConfigurationHelper::openConfig( - ::comphelper::getProcessComponentContext(), CONF_ROOT, ::comphelper::ConfigurationHelper::E_STANDARD ); + ::comphelper::getProcessComponentContext(), CONF_ROOT, ::comphelper::EConfigurationModes::Standard ); OUString aActualFilter; ::comphelper::ConfigurationHelper::readRelativeKey( xConfig, CONF_PATH, PROP_ACTUAL_FILTER ) >>= aActualFilter; diff --git a/svtools/source/config/accessibilityoptions.cxx b/svtools/source/config/accessibilityoptions.cxx index 338210c..52b999b 100644 ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits