summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-04-13 13:21:04 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-04-15 11:35:03 +0000
commitd208cf834f4f191558ae27ea7a8c7a31b8e440a6 (patch)
tree4b318cdb42b9888197247089cb0a7349f122dd99
parent9782438a5887c40246016c1f2b5fe12401d2c68d (diff)
convert SIGNATURESTATE_ constants to scoped enum
Change-Id: I715e39599464a199a8b78ec274bfe47b90fc4bb7 Reviewed-on: https://gerrit.libreoffice.org/15301 Tested-by: Noel Grandin <noelgrandin@gmail.com> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r--basctl/source/basicide/basides1.cxx4
-rw-r--r--basctl/source/basicide/basides2.cxx2
-rw-r--r--basctl/source/basicide/docsignature.cxx4
-rw-r--r--basctl/source/inc/docsignature.hxx4
-rw-r--r--dbaccess/source/core/dataaccess/ModelImpl.cxx4
-rw-r--r--dbaccess/source/core/dataaccess/ModelImpl.hxx2
-rw-r--r--include/sfx2/docfile.hxx5
-rw-r--r--include/sfx2/docmacromode.hxx3
-rw-r--r--include/sfx2/objsh.hxx9
-rw-r--r--include/sfx2/signaturestate.hxx25
-rw-r--r--sfx2/inc/guisaveas.hxx2
-rw-r--r--sfx2/source/doc/docfile.cxx8
-rw-r--r--sfx2/source/doc/docmacromode.cxx8
-rw-r--r--sfx2/source/doc/guisaveas.cxx10
-rw-r--r--sfx2/source/doc/objmisc.cxx24
-rw-r--r--sfx2/source/doc/objserv.cxx56
-rw-r--r--sfx2/source/doc/objstor.cxx18
-rw-r--r--sfx2/source/doc/objxtor.cxx4
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx4
-rw-r--r--sfx2/source/inc/objshimp.hxx6
-rw-r--r--svx/source/stbctrls/xmlsecctrl.cxx26
21 files changed, 117 insertions, 111 deletions
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index eabb0a24b03d..4a952cad67ff 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -733,13 +733,13 @@ void Shell::GetState(SfxItemSet &rSet)
break;
case SID_SIGNATURE:
{
- sal_uInt16 nState = 0;
+ SignatureState nState = SignatureState::NOSIGNATURES;
if ( pCurWin )
{
DocumentSignature aSignature( pCurWin->GetDocument() );
nState = aSignature.getScriptingSignatureState();
}
- rSet.Put( SfxUInt16Item( SID_SIGNATURE, nState ) );
+ rSet.Put( SfxUInt16Item( SID_SIGNATURE, static_cast<sal_uInt16>(nState) ) );
}
break;
case SID_BASICIDE_MODULEDLG:
diff --git a/basctl/source/basicide/basides2.cxx b/basctl/source/basicide/basides2.cxx
index 874f797f46f3..1801060e581e 100644
--- a/basctl/source/basicide/basides2.cxx
+++ b/basctl/source/basicide/basides2.cxx
@@ -106,7 +106,7 @@ void Shell::SetMDITitle()
aTitleBuf = IDE_RESSTR(RID_STR_ALL) ;
DocumentSignature aCurSignature( m_aCurDocument );
- if ( aCurSignature.getScriptingSignatureState() == SIGNATURESTATE_SIGNATURES_OK )
+ if ( aCurSignature.getScriptingSignatureState() == SignatureState::OK )
{
aTitleBuf = aTitleBuf + " " + IDE_RESSTR(RID_STR_SIGNED) + " ";
}
diff --git a/basctl/source/basicide/docsignature.cxx b/basctl/source/basicide/docsignature.cxx
index 0212f9e6924b..dd1626a1aead 100644
--- a/basctl/source/basicide/docsignature.cxx
+++ b/basctl/source/basicide/docsignature.cxx
@@ -80,11 +80,11 @@ namespace basctl
m_pImpl->pShell->SignScriptingContent();
}
- sal_uInt16 DocumentSignature::getScriptingSignatureState() const
+ SignatureState DocumentSignature::getScriptingSignatureState() const
{
if ( m_pImpl->pShell )
return m_pImpl->pShell->GetScriptingSignatureState();
- return SIGNATURESTATE_NOSIGNATURES;
+ return SignatureState::NOSIGNATURES;
}
} // namespace basctl
diff --git a/basctl/source/inc/docsignature.hxx b/basctl/source/inc/docsignature.hxx
index bc80115ca7bb..adbefe849b45 100644
--- a/basctl/source/inc/docsignature.hxx
+++ b/basctl/source/inc/docsignature.hxx
@@ -20,8 +20,8 @@
#define INCLUDED_BASCTL_SOURCE_INC_DOCSIGNATURE_HXX
#include <com/sun/star/frame/XModel.hpp>
-
#include <boost/scoped_ptr.hpp>
+#include <sfx2/signaturestate.hxx>
namespace basctl
@@ -62,7 +62,7 @@ namespace basctl
If the instance is not valid, then SIGNATURESTATE_NOSIGNATURES is returned.
*/
- sal_uInt16 getScriptingSignatureState() const;
+ SignatureState getScriptingSignatureState() const;
private:
DocumentSignature(); // not implemented
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index 6d800cbe10f7..936ba5c4dbbb 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -1345,10 +1345,10 @@ Reference< XEmbeddedScripts > ODatabaseModelImpl::getEmbeddedDocumentScripts() c
return Reference< XEmbeddedScripts >( getModel_noCreate(), UNO_QUERY );
}
-sal_Int16 ODatabaseModelImpl::getScriptingSignatureState()
+SignatureState ODatabaseModelImpl::getScriptingSignatureState()
{
// no support for signatures at the moment
- return SIGNATURESTATE_NOSIGNATURES;
+ return SignatureState::NOSIGNATURES;
}
bool ODatabaseModelImpl::hasTrustedScriptingSignature( bool /*bAllowUIToAddAuthor*/ )
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.hxx b/dbaccess/source/core/dataaccess/ModelImpl.hxx
index 72129d42922f..d51070c641b1 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.hxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.hxx
@@ -474,7 +474,7 @@ public:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > getZipStorageToSign() SAL_OVERRIDE;
virtual bool documentStorageHasMacros() const SAL_OVERRIDE;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedScripts > getEmbeddedDocumentScripts() const SAL_OVERRIDE;
- virtual sal_Int16 getScriptingSignatureState() SAL_OVERRIDE;
+ virtual SignatureState getScriptingSignatureState() SAL_OVERRIDE;
virtual bool hasTrustedScriptingSignature( bool bAllowUIToAddAuthor ) SAL_OVERRIDE;
virtual void showBrokenSignatureWarning( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxInteraction ) const SAL_OVERRIDE;
diff --git a/include/sfx2/docfile.hxx b/include/sfx2/docfile.hxx
index 9e6160ea98b1..2964e1998f77 100644
--- a/include/sfx2/docfile.hxx
+++ b/include/sfx2/docfile.hxx
@@ -23,6 +23,7 @@
#include <com/sun/star/io/XSeekable.hpp>
#include <sal/config.h>
#include <sfx2/dllapi.h>
+#include <sfx2/signaturestate.hxx>
#include <sal/types.h>
#include <com/sun/star/util/RevisionTag.hpp>
#include <com/sun/star/util/DateTime.hpp>
@@ -260,8 +261,8 @@ public:
// the following two methods must be used and make sense only during saving currently
// TODO/LATER: in future the signature state should be controlled by the medium not by the document
// in this case the methods will be used generally, and might need to be renamed
- SAL_DLLPRIVATE sal_uInt16 GetCachedSignatureState_Impl();
- SAL_DLLPRIVATE void SetCachedSignatureState_Impl( sal_uInt16 nState );
+ SAL_DLLPRIVATE SignatureState GetCachedSignatureState_Impl();
+ SAL_DLLPRIVATE void SetCachedSignatureState_Impl( SignatureState nState );
static css::uno::Sequence < css::util::RevisionTag > GetVersionList(
const css::uno::Reference< css::embed::XStorage >& xStorage );
diff --git a/include/sfx2/docmacromode.hxx b/include/sfx2/docmacromode.hxx
index 6945c788cdfc..f245962ab274 100644
--- a/include/sfx2/docmacromode.hxx
+++ b/include/sfx2/docmacromode.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_SFX2_DOCMACROMODE_HXX
#include <sfx2/dllapi.h>
+#include <sfx2/signaturestate.hxx>
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <com/sun/star/embed/XStorage.hpp>
@@ -148,7 +149,7 @@ namespace sfx2
@seealso <sfx2/signaturestate.hxx>
*/
- virtual sal_Int16
+ virtual SignatureState
getScriptingSignatureState() = 0;
/** allows to detect whether there is a trusted scripting signature
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index 7e235d99ef82..152e864dcc8c 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -21,6 +21,7 @@
#include <sal/config.h>
#include <sfx2/dllapi.h>
+#include <sfx2/signaturestate.hxx>
#include <sal/types.h>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/uno/Reference.h>
@@ -363,9 +364,9 @@ public:
bool ExportTo( SfxMedium &rMedium );
// xmlsec05, check with SFX team
- sal_uInt16 GetDocumentSignatureState();
+ SignatureState GetDocumentSignatureState();
void SignDocumentContent();
- sal_uInt16 GetScriptingSignatureState();
+ SignatureState GetScriptingSignatureState();
void SignScriptingContent();
virtual SfxDocumentInfoDialog* CreateDocumentInfoDialog(
@@ -635,7 +636,7 @@ public:
SAL_DLLPRIVATE void BreakMacroSign_Impl( bool bBreakMacroSing );
SAL_DLLPRIVATE void CheckSecurityOnLoading_Impl();
SAL_DLLPRIVATE void CheckForBrokenDocSignatures_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
- SAL_DLLPRIVATE sal_uInt16 ImplCheckSignaturesInformation(
+ SAL_DLLPRIVATE SignatureState ImplCheckSignaturesInformation(
const ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation >& aInfos );
SAL_DLLPRIVATE void CheckEncryption_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
SAL_DLLPRIVATE void SetModifyPasswordEntered( bool bEntered = true );
@@ -696,7 +697,7 @@ public:
// configuration items
SAL_DLLPRIVATE SfxToolBoxConfig* GetToolBoxConfig_Impl();
- SAL_DLLPRIVATE sal_uInt16 ImplGetSignatureState( bool bScriptingContent = false );
+ SAL_DLLPRIVATE SignatureState ImplGetSignatureState( bool bScriptingContent = false );
SAL_DLLPRIVATE ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation >
ImplAnalyzeSignature(
diff --git a/include/sfx2/signaturestate.hxx b/include/sfx2/signaturestate.hxx
index 0e795d5d5255..b2bccf3469c0 100644
--- a/include/sfx2/signaturestate.hxx
+++ b/include/sfx2/signaturestate.hxx
@@ -21,17 +21,20 @@
#define INCLUDED_SFX2_SIGNATURESTATE_HXX
// xmlsec05, check with SFX team
-#define SIGNATURESTATE_UNKNOWN (sal_Int16)(-1)
-#define SIGNATURESTATE_NOSIGNATURES (sal_Int16)0
-#define SIGNATURESTATE_SIGNATURES_OK (sal_Int16)1
-#define SIGNATURESTATE_SIGNATURES_BROKEN (sal_Int16)2
-// State was SIGNATURES_OK, but doc is modified now
-#define SIGNATURESTATE_SIGNATURES_INVALID (sal_Int16)3
-// signature is OK, but certificate could not be validated
-#define SIGNATURESTATE_SIGNATURES_NOTVALIDATED (sal_Int16)4
-//signatur and certificate are ok,but not al files are signed, as was the case in
-//OOo 2.x - OOo 3.1.1. This state is only used together with document signatures.
-#define SIGNATURESTATE_SIGNATURES_PARTIAL_OK (sal_Int16)5
+enum class SignatureState
+{
+ UNKNOWN = 0xffff, // used to be -1 when this was a sal_uInt16
+ NOSIGNATURES = 0,
+ OK = 1,
+ BROKEN = 2,
+ // State was SignatureState::OK, but doc is modified now
+ INVALID = 3,
+ // signature is OK, but certificate could not be validated
+ NOTVALIDATED = 4,
+ //signatur and certificate are ok,but not al files are signed, as was the case in
+ //OOo 2.x - OOo 3.1.1. This state is only used together with document signatures.
+ PARTIAL_OK = 5
+};
#endif // INCLUDED_SFX2_SIGNATURESTATE_HXX
diff --git a/sfx2/inc/guisaveas.hxx b/sfx2/inc/guisaveas.hxx
index 914094b5e1d9..c409f150c232 100644
--- a/sfx2/inc/guisaveas.hxx
+++ b/sfx2/inc/guisaveas.hxx
@@ -63,7 +63,7 @@ public:
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgsSequence,
bool bPreselectPassword,
const OUString& aUserSelectedName,
- sal_uInt16 nDocumentSignatureState = SIGNATURESTATE_NOSIGNATURES );
+ SignatureState nDocumentSignatureState = SignatureState::NOSIGNATURES );
static bool CheckFilterOptionsAppearence(
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& xFilterCFG,
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 73deeca8877c..cdd18ce638a2 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -232,7 +232,7 @@ public:
// the following member is changed and makes sense only during saving
// TODO/LATER: in future the signature state should be controlled by the medium not by the document
// in this case the member will hold this information
- sal_uInt16 m_nSignatureState;
+ SignatureState m_nSignatureState;
util::DateTime m_aDateTime;
@@ -275,7 +275,7 @@ SfxMedium_Impl::SfxMedium_Impl( SfxMedium* pAntiImplP ) :
aExpireTime( Date( Date::SYSTEM ) + 10, tools::Time( tools::Time::SYSTEM ) ),
pTempFile( NULL ),
nLastStorageError( 0 ),
- m_nSignatureState( SIGNATURESTATE_NOSIGNATURES )
+ m_nSignatureState( SignatureState::NOSIGNATURES )
{
aDoneLink.CreateMutex();
}
@@ -3456,13 +3456,13 @@ bool SfxMedium::SignContents_Impl( bool bScriptingContent, const OUString& aODFV
}
-sal_uInt16 SfxMedium::GetCachedSignatureState_Impl()
+SignatureState SfxMedium::GetCachedSignatureState_Impl()
{
return pImp->m_nSignatureState;
}
-void SfxMedium::SetCachedSignatureState_Impl( sal_uInt16 nState )
+void SfxMedium::SetCachedSignatureState_Impl( SignatureState nState )
{
pImp->m_nSignatureState = nState;
}
diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx
index 54fd58ef51f0..9381651d7f1a 100644
--- a/sfx2/source/doc/docmacromode.cxx
+++ b/sfx2/source/doc/docmacromode.cxx
@@ -246,8 +246,8 @@ namespace sfx2
// the trusted macro check will also retrieve the signature state ( small optimization )
bool bHasTrustedMacroSignature = m_xData->m_rDocumentAccess.hasTrustedScriptingSignature( nMacroExecutionMode != MacroExecMode::FROM_LIST_AND_SIGNED_NO_WARN );
- sal_uInt16 nSignatureState = m_xData->m_rDocumentAccess.getScriptingSignatureState();
- if ( nSignatureState == SIGNATURESTATE_SIGNATURES_BROKEN )
+ SignatureState nSignatureState = m_xData->m_rDocumentAccess.getScriptingSignatureState();
+ if ( nSignatureState == SignatureState::BROKEN )
{
// the signature is broken, no macro execution
if ( nMacroExecutionMode != MacroExecMode::FROM_LIST_AND_SIGNED_NO_WARN )
@@ -260,8 +260,8 @@ namespace sfx2
// there is trusted macro signature, allow macro execution
return allowMacroExecution();
}
- else if ( nSignatureState == SIGNATURESTATE_SIGNATURES_OK
- || nSignatureState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED )
+ else if ( nSignatureState == SignatureState::OK
+ || nSignatureState == SignatureState::NOTVALIDATED )
{
// there is valid signature, but it is not from the trusted author
return disallowMacroExecution();
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 3dc833cfbe6a..b335dbf45d0e 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -1383,7 +1383,7 @@ bool SfxStoringHelper::GUIStoreModel( uno::Reference< frame::XModel > xModel,
uno::Sequence< beans::PropertyValue >& aArgsSequence,
bool bPreselectPassword,
const OUString& _aSuggestedName,
- sal_uInt16 nDocumentSignatureState )
+ SignatureState nDocumentSignatureState )
{
OUString aSuggestedName = _aSuggestedName;
ModelData_Impl aModelData( *this, xModel, aArgsSequence );
@@ -1459,10 +1459,10 @@ bool SfxStoringHelper::GUIStoreModel( uno::Reference< frame::XModel > xModel,
if ( !( nStoreMode & EXPORT_REQUESTED ) )
{
// if it is no export, warn user that the signature will be removed
- if ( SIGNATURESTATE_SIGNATURES_OK == nDocumentSignatureState
- || SIGNATURESTATE_SIGNATURES_INVALID == nDocumentSignatureState
- || SIGNATURESTATE_SIGNATURES_NOTVALIDATED == nDocumentSignatureState
- || SIGNATURESTATE_SIGNATURES_PARTIAL_OK == nDocumentSignatureState)
+ if ( SignatureState::OK == nDocumentSignatureState
+ || SignatureState::INVALID == nDocumentSignatureState
+ || SignatureState::NOTVALIDATED == nDocumentSignatureState
+ || SignatureState::PARTIAL_OK == nDocumentSignatureState)
{
if (MessageDialog(NULL, SfxResId(RID_SVXSTR_XMLSEC_QUERY_LOSINGSIGNATURE),
VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO).Execute() != RET_YES)
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index f3ac27ce1752..09b5bf13f715 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -1127,8 +1127,8 @@ void SfxObjectShell::CheckEncryption_Impl( const uno::Reference< task::XInteract
void SfxObjectShell::CheckForBrokenDocSignatures_Impl( const uno::Reference< task::XInteractionHandler >& xHandler )
{
- sal_Int16 nSignatureState = GetDocumentSignatureState();
- bool bSignatureBroken = ( nSignatureState == SIGNATURESTATE_SIGNATURES_BROKEN );
+ SignatureState nSignatureState = GetDocumentSignatureState();
+ bool bSignatureBroken = ( nSignatureState == SignatureState::BROKEN );
if ( !bSignatureBroken )
return;
@@ -1921,14 +1921,14 @@ Reference< XEmbeddedScripts > SfxObjectShell_Impl::getEmbeddedDocumentScripts()
return Reference< XEmbeddedScripts >( rDocShell.GetModel(), UNO_QUERY );
}
-sal_Int16 SfxObjectShell_Impl::getScriptingSignatureState()
+SignatureState SfxObjectShell_Impl::getScriptingSignatureState()
{
- sal_Int16 nSignatureState( rDocShell.GetScriptingSignatureState() );
+ SignatureState nSignatureState( rDocShell.GetScriptingSignatureState() );
- if ( nSignatureState != SIGNATURESTATE_NOSIGNATURES && m_bMacroSignBroken )
+ if ( nSignatureState != SignatureState::NOSIGNATURES && m_bMacroSignBroken )
{
// if there is a macro signature it must be handled as broken
- nSignatureState = SIGNATURESTATE_SIGNATURES_BROKEN;
+ nSignatureState = SignatureState::BROKEN;
}
return nSignatureState;
@@ -1952,19 +1952,19 @@ bool SfxObjectShell_Impl::hasTrustedScriptingSignature( bool bAllowUIToAddAuthor
uno::Reference< security::XDocumentDigitalSignatures > xSigner( security::DocumentDigitalSignatures::createWithVersion(comphelper::getProcessComponentContext(), aVersion) );
- if ( nScriptingSignatureState == SIGNATURESTATE_UNKNOWN
- || nScriptingSignatureState == SIGNATURESTATE_SIGNATURES_OK
- || nScriptingSignatureState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED )
+ if ( nScriptingSignatureState == SignatureState::UNKNOWN
+ || nScriptingSignatureState == SignatureState::OK
+ || nScriptingSignatureState == SignatureState::NOTVALIDATED )
{
uno::Sequence< security::DocumentSignatureInformation > aInfo = rDocShell.ImplAnalyzeSignature( true, xSigner );
if ( aInfo.getLength() )
{
- if ( nScriptingSignatureState == SIGNATURESTATE_UNKNOWN )
+ if ( nScriptingSignatureState == SignatureState::UNKNOWN )
nScriptingSignatureState = rDocShell.ImplCheckSignaturesInformation( aInfo );
- if ( nScriptingSignatureState == SIGNATURESTATE_SIGNATURES_OK
- || nScriptingSignatureState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED )
+ if ( nScriptingSignatureState == SignatureState::OK
+ || nScriptingSignatureState == SignatureState::NOTVALIDATED )
{
for ( sal_Int32 nInd = 0; !bResult && nInd < aInfo.getLength(); nInd++ )
{
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 119e52f9e6f6..8f10da507570 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -1109,14 +1109,14 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet)
}
case SID_SIGNATURE:
{
- rSet.Put( SfxUInt16Item( SID_SIGNATURE, GetDocumentSignatureState() ) );
+ rSet.Put( SfxUInt16Item( SID_SIGNATURE, static_cast<sal_uInt16>(GetDocumentSignatureState()) ) );
break;
}
case SID_MACRO_SIGNATURE:
{
// the slot makes sense only if there is a macro in the document
if ( pImp->documentStorageHasMacros() || pImp->aMacroMode.hasMacroLibrary() )
- rSet.Put( SfxUInt16Item( SID_MACRO_SIGNATURE, GetScriptingSignatureState() ) );
+ rSet.Put( SfxUInt16Item( SID_MACRO_SIGNATURE, static_cast<sal_uInt16>(GetScriptingSignatureState()) ) );
else
rSet.DisableItem( nWhich );
break;
@@ -1287,36 +1287,36 @@ void SfxObjectShell::StateView_Impl(SfxItemSet& /*rSet*/)
{
}
-sal_uInt16 SfxObjectShell::ImplCheckSignaturesInformation( const uno::Sequence< security::DocumentSignatureInformation >& aInfos )
+SignatureState SfxObjectShell::ImplCheckSignaturesInformation( const uno::Sequence< security::DocumentSignatureInformation >& aInfos )
{
bool bCertValid = true;
- sal_uInt16 nResult = SIGNATURESTATE_NOSIGNATURES;
+ SignatureState nResult = SignatureState::NOSIGNATURES;
int nInfos = aInfos.getLength();
bool bCompleteSignature = true;
if( nInfos )
{
- nResult = SIGNATURESTATE_SIGNATURES_OK;
+ nResult = SignatureState::OK;
for ( int n = 0; n < nInfos; n++ )
{
if ( bCertValid )
{
sal_Int32 nCertStat = aInfos[n].CertificateStatus;
- bCertValid = nCertStat == security::CertificateValidity::VALID ? sal_True : sal_False;
+ bCertValid = nCertStat == security::CertificateValidity::VALID;
}
if ( !aInfos[n].SignatureIsValid )
{
- nResult = SIGNATURESTATE_SIGNATURES_BROKEN;
+ nResult = SignatureState::BROKEN;
break; // we know enough
}
bCompleteSignature &= !aInfos[n].PartialDocumentSignature;
}
}
- if ( nResult == SIGNATURESTATE_SIGNATURES_OK && !bCertValid )
- nResult = SIGNATURESTATE_SIGNATURES_NOTVALIDATED;
- else if ( nResult == SIGNATURESTATE_SIGNATURES_OK && bCertValid && !bCompleteSignature)
- nResult = SIGNATURESTATE_SIGNATURES_PARTIAL_OK;
+ if ( nResult == SignatureState::OK && !bCertValid )
+ nResult = SignatureState::NOTVALIDATED;
+ else if ( nResult == SignatureState::OK && bCertValid && !bCompleteSignature)
+ nResult = SignatureState::PARTIAL_OK;
// this code must not check whether the document is modified
// it should only check the provided info
@@ -1364,26 +1364,26 @@ uno::Sequence< security::DocumentSignatureInformation > SfxObjectShell::ImplAnal
return aResult;
}
-sal_uInt16 SfxObjectShell::ImplGetSignatureState( bool bScriptingContent )
+SignatureState SfxObjectShell::ImplGetSignatureState( bool bScriptingContent )
{
- sal_Int16* pState = bScriptingContent ? &pImp->nScriptingSignatureState : &pImp->nDocumentSignatureState;
+ SignatureState* pState = bScriptingContent ? &pImp->nScriptingSignatureState : &pImp->nDocumentSignatureState;
- if ( *pState == SIGNATURESTATE_UNKNOWN )
+ if ( *pState == SignatureState::UNKNOWN )
{
- *pState = SIGNATURESTATE_NOSIGNATURES;
+ *pState = SignatureState::NOSIGNATURES;
uno::Sequence< security::DocumentSignatureInformation > aInfos = ImplAnalyzeSignature( bScriptingContent );
*pState = ImplCheckSignaturesInformation( aInfos );
}
- if ( *pState == SIGNATURESTATE_SIGNATURES_OK || *pState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED
- || *pState == SIGNATURESTATE_SIGNATURES_PARTIAL_OK)
+ if ( *pState == SignatureState::OK || *pState == SignatureState::NOTVALIDATED
+ || *pState == SignatureState::PARTIAL_OK)
{
if ( IsModified() )
- *pState = SIGNATURESTATE_SIGNATURES_INVALID;
+ *pState = SignatureState::INVALID;
}
- return (sal_uInt16)*pState;
+ return *pState;
}
void SfxObjectShell::ImplSign( bool bScriptingContent )
@@ -1405,7 +1405,7 @@ void SfxObjectShell::ImplSign( bool bScriptingContent )
// check whether the document is signed
ImplGetSignatureState( false ); // document signature
ImplGetSignatureState( true ); // script signature
- bool bHasSign = ( pImp->nScriptingSignatureState != SIGNATURESTATE_NOSIGNATURES || pImp->nDocumentSignatureState != SIGNATURESTATE_NOSIGNATURES );
+ bool bHasSign = ( pImp->nScriptingSignatureState != SignatureState::NOSIGNATURES || pImp->nDocumentSignatureState != SignatureState::NOSIGNATURES );
// the target ODF version on saving
SvtSaveOptions aSaveOpt;
@@ -1492,9 +1492,9 @@ void SfxObjectShell::ImplSign( bool bScriptingContent )
bool bSigned = GetMedium()->SignContents_Impl(
bScriptingContent,
aODFVersion,
- pImp->nDocumentSignatureState == SIGNATURESTATE_SIGNATURES_OK
- || pImp->nDocumentSignatureState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED
- || pImp->nDocumentSignatureState == SIGNATURESTATE_SIGNATURES_PARTIAL_OK);
+ pImp->nDocumentSignatureState == SignatureState::OK
+ || pImp->nDocumentSignatureState == SignatureState::NOTVALIDATED
+ || pImp->nDocumentSignatureState == SignatureState::PARTIAL_OK);
DoSaveCompleted( GetMedium() );
@@ -1502,13 +1502,13 @@ void SfxObjectShell::ImplSign( bool bScriptingContent )
{
if ( bScriptingContent )
{
- pImp->nScriptingSignatureState = SIGNATURESTATE_UNKNOWN;// Re-Check
+ pImp->nScriptingSignatureState = SignatureState::UNKNOWN;// Re-Check
// adding of scripting signature removes existing document signature
- pImp->nDocumentSignatureState = SIGNATURESTATE_UNKNOWN;// Re-Check
+ pImp->nDocumentSignatureState = SignatureState::UNKNOWN;// Re-Check
}
else
- pImp->nDocumentSignatureState = SIGNATURESTATE_UNKNOWN;// Re-Check
+ pImp->nDocumentSignatureState = SignatureState::UNKNOWN;// Re-Check
pImp->bSignatureErrorIsShown = false;
@@ -1522,7 +1522,7 @@ void SfxObjectShell::ImplSign( bool bScriptingContent )
EnableSetModified( true );
}
-sal_uInt16 SfxObjectShell::GetDocumentSignatureState()
+SignatureState SfxObjectShell::GetDocumentSignatureState()
{
return ImplGetSignatureState( false );
}
@@ -1532,7 +1532,7 @@ void SfxObjectShell::SignDocumentContent()
ImplSign( false );
}
-sal_uInt16 SfxObjectShell::GetScriptingSignatureState()
+SignatureState SfxObjectShell::GetScriptingSignatureState()
{
return ImplGetSignatureState( true );
}
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index b1ed9b3d42c7..c609495d1462 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -1156,9 +1156,9 @@ bool SfxObjectShell::SaveTo_Impl
// no way to detect whether a filter is oasis format, have to wait for saving process
bool bNoPreserveForOasis = false;
if ( bOwnSource && bOwnTarget
- && ( pImp->nScriptingSignatureState == SIGNATURESTATE_SIGNATURES_OK
- || pImp->nScriptingSignatureState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED
- || pImp->nScriptingSignatureState == SIGNATURESTATE_SIGNATURES_INVALID ) )
+ && ( pImp->nScriptingSignatureState == SignatureState::OK
+ || pImp->nScriptingSignatureState == SignatureState::NOTVALIDATED
+ || pImp->nScriptingSignatureState == SignatureState::INVALID ) )
{
AddLog( OUString( OSL_LOG_PREFIX "MacroSignaturePreserving" ) );
@@ -1640,9 +1640,9 @@ bool SfxObjectShell::SaveTo_Impl
uno::Sequence< security::DocumentSignatureInformation > aInfos =
xDDSigns->verifyScriptingContentSignatures( xTarget,
uno::Reference< io::XInputStream >() );
- sal_uInt16 nState = ImplCheckSignaturesInformation( aInfos );
- if ( nState == SIGNATURESTATE_SIGNATURES_OK || nState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED
- || nState == SIGNATURESTATE_SIGNATURES_PARTIAL_OK)
+ SignatureState nState = ImplCheckSignaturesInformation( aInfos );
+ if ( nState == SignatureState::OK || nState == SignatureState::NOTVALIDATED
+ || nState == SignatureState::PARTIAL_OK)
{
rMedium.SetCachedSignatureState_Impl( nState );
@@ -2073,13 +2073,13 @@ bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed )
}
// before the title regenerated the document must lose the signatures
- pImp->nDocumentSignatureState = SIGNATURESTATE_NOSIGNATURES;
+ pImp->nDocumentSignatureState = SignatureState::NOSIGNATURES;
pImp->nScriptingSignatureState = pNewMed->GetCachedSignatureState_Impl();
- OSL_ENSURE( pImp->nScriptingSignatureState != SIGNATURESTATE_SIGNATURES_BROKEN, "The signature must not be broken at this place" );
+ OSL_ENSURE( pImp->nScriptingSignatureState != SignatureState::BROKEN, "The signature must not be broken at this place" );
pImp->bSignatureErrorIsShown = false;
// TODO/LATER: in future the medium must control own signature state, not the document
- pNewMed->SetCachedSignatureState_Impl( SIGNATURESTATE_NOSIGNATURES ); // set the default value back
+ pNewMed->SetCachedSignatureState_Impl( SignatureState::NOSIGNATURES ); // set the default value back
// Set new title
if (!pNewMed->GetName().isEmpty() && SfxObjectCreateMode::EMBEDDED != eCreateMode)
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index 611441161138..854094b293fd 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -211,8 +211,8 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell )
,pProgress( 0)
,nTime( DateTime::SYSTEM )
,nVisualDocumentNumber( USHRT_MAX)
- ,nDocumentSignatureState( SIGNATURESTATE_UNKNOWN )
- ,nScriptingSignatureState( SIGNATURESTATE_UNKNOWN )
+ ,nDocumentSignatureState( SignatureState::UNKNOWN )
+ ,nScriptingSignatureState( SignatureState::UNKNOWN )
,bInList( false)
,bClosing( false)
,bIsSaving( false)
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index d3c4eb5c6c86..c24f3eaf5852 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -3448,7 +3448,7 @@ bool SfxBaseModel::hasValidSignatures() const
{
SolarMutexGuard aGuard;
if ( m_pData->m_pObjectShell.Is() )
- return ( m_pData->m_pObjectShell->ImplGetSignatureState( false ) == SIGNATURESTATE_SIGNATURES_OK );
+ return ( m_pData->m_pObjectShell->ImplGetSignatureState( false ) == SignatureState::OK );
return false;
}
@@ -4007,7 +4007,7 @@ OUString SAL_CALL SfxBaseModel::getTitle()
else if ( m_pData->m_pObjectShell->IsDocShared() )
aResult += SfxResId(STR_SHARED).toString();
- if ( m_pData->m_pObjectShell->GetDocumentSignatureState() == SIGNATURESTATE_SIGNATURES_OK )
+ if ( m_pData->m_pObjectShell->GetDocumentSignatureState() == SignatureState::OK )
aResult += SfxResId(RID_XMLSEC_DOCUMENTSIGNED).toString();
}
diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx
index 88678606daa1..794af0b52ec4 100644
--- a/sfx2/source/inc/objshimp.hxx
+++ b/sfx2/source/inc/objshimp.hxx
@@ -62,8 +62,8 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess
OUString aTempName;
DateTime nTime;
sal_uInt16 nVisualDocumentNumber;
- sal_Int16 nDocumentSignatureState;
- sal_Int16 nScriptingSignatureState;
+ SignatureState nDocumentSignatureState;
+ SignatureState nScriptingSignatureState;
bool bInList:1, // if reachable by First/Next
bClosing:1, // sal_True while Close(), to prevent recurrences Notification
bIsSaving:1,
@@ -147,7 +147,7 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess
virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > getZipStorageToSign() SAL_OVERRIDE;
virtual bool documentStorageHasMacros() const SAL_OVERRIDE;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedScripts > getEmbeddedDocumentScripts() const SAL_OVERRIDE;
- virtual sal_Int16 getScriptingSignatureState() SAL_OVERRIDE;
+ virtual SignatureState getScriptingSignatureState() SAL_OVERRIDE;
virtual bool hasTrustedScriptingSignature( bool bAllowUIToAddAuthor ) SAL_OVERRIDE;
virtual void showBrokenSignatureWarning( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxInteraction ) const SAL_OVERRIDE;
diff --git a/svx/source/stbctrls/xmlsecctrl.cxx b/svx/source/stbctrls/xmlsecctrl.cxx
index 4a83066f7f06..f49c25584738 100644
--- a/svx/source/stbctrls/xmlsecctrl.cxx
+++ b/svx/source/stbctrls/xmlsecctrl.cxx
@@ -43,7 +43,7 @@ struct XmlSecStatusBarControl::XmlSecStatusBarControl_Impl
{
Point maPos;
Size maSize;
- sal_uInt16 mnState;
+ SignatureState mnState;
Image maImage;
Image maImageBroken;
Image maImageNotValidated;
@@ -54,7 +54,7 @@ XmlSecStatusBarControl::XmlSecStatusBarControl( sal_uInt16 _nSlotId, sal_uInt16
:SfxStatusBarControl( _nSlotId, _nId, _rStb )
,mpImpl( new XmlSecStatusBarControl_Impl )
{
- mpImpl->mnState = (sal_uInt16)SIGNATURESTATE_UNKNOWN;
+ mpImpl->mnState = SignatureState::UNKNOWN;
mpImpl->maImage = Image( SVX_RES( RID_SVXBMP_SIGNET ) );
mpImpl->maImageBroken = Image( SVX_RES( RID_SVXBMP_SIGNET_BROKEN ) );
@@ -87,16 +87,16 @@ void XmlSecStatusBarControl::StateChanged( sal_uInt16, SfxItemState eState, cons
{
if( SfxItemState::DEFAULT != eState )
{
- mpImpl->mnState = (sal_uInt16)SIGNATURESTATE_UNKNOWN;
+ mpImpl->mnState = SignatureState::UNKNOWN;
}
else if( pState->ISA( SfxUInt16Item ) )
{
- mpImpl->mnState = static_cast<const SfxUInt16Item*>(pState)->GetValue();
+ mpImpl->mnState = static_cast<SignatureState>(static_cast<const SfxUInt16Item*>(pState)->GetValue());
}
else
{
SAL_WARN( "svx.stbcrtls", "+XmlSecStatusBarControl::StateChanged(): invalid item type" );
- mpImpl->mnState = (sal_uInt16)SIGNATURESTATE_UNKNOWN;
+ mpImpl->mnState = SignatureState::UNKNOWN;
}
if( GetStatusBar().AreItemsVisible() ) // necessary ?
@@ -105,13 +105,13 @@ void XmlSecStatusBarControl::StateChanged( sal_uInt16, SfxItemState eState, cons
GetStatusBar().SetItemText( GetId(), "" ); // necessary ?
sal_uInt16 nResId = RID_SVXSTR_XMLSEC_NO_SIG;
- if ( mpImpl->mnState == SIGNATURESTATE_SIGNATURES_OK )
+ if ( mpImpl->mnState == SignatureState::OK )
nResId = RID_SVXSTR_XMLSEC_SIG_OK;
- else if ( mpImpl->mnState == SIGNATURESTATE_SIGNATURES_BROKEN )
+ else if ( mpImpl->mnState == SignatureState::BROKEN )
nResId = RID_SVXSTR_XMLSEC_SIG_NOT_OK;
- else if ( mpImpl->mnState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED )
+ else if ( mpImpl->mnState == SignatureState::NOTVALIDATED )
nResId = RID_SVXSTR_XMLSEC_SIG_OK_NO_VERIFY;
- else if ( mpImpl->mnState == SIGNATURESTATE_SIGNATURES_PARTIAL_OK )
+ else if ( mpImpl->mnState == SignatureState::PARTIAL_OK )
nResId = RID_SVXSTR_XMLSEC_SIG_CERT_OK_PARTIAL_SIG;
GetStatusBar().SetQuickHelpText( GetId(), SVX_RESSTR( nResId ) );
@@ -153,18 +153,18 @@ void XmlSecStatusBarControl::Paint( const UserDrawEvent& rUsrEvt )
long yOffset = (aRect.GetHeight() - mpImpl->maImage.GetSizePixel().Height()) / 2;
- if( mpImpl->mnState == SIGNATURESTATE_SIGNATURES_OK )
+ if( mpImpl->mnState == SignatureState::OK )
{
aRect.Top() += yOffset;
pDev->DrawImage( aRect.TopLeft(), mpImpl->maImage );
}
- else if( mpImpl->mnState == SIGNATURESTATE_SIGNATURES_BROKEN )
+ else if( mpImpl->mnState == SignatureState::BROKEN )
{
aRect.Top() += yOffset;
pDev->DrawImage( aRect.TopLeft(), mpImpl->maImageBroken );
}
- else if( mpImpl->mnState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED
- || mpImpl->mnState == SIGNATURESTATE_SIGNATURES_PARTIAL_OK)
+ else if( mpImpl->mnState == SignatureState::NOTVALIDATED
+ || mpImpl->mnState == SignatureState::PARTIAL_OK)
{
aRect.Top() += yOffset;
pDev->DrawImage( aRect.TopLeft(), mpImpl->maImageNotValidated );