Kaydet (Commit) 5eab3e5e authored tarafından Stephan Bergmann's avatar Stephan Bergmann

clang-cl loplugin: embeddedobj

Change-Id: Id8359ff2bc2ae177837f5c58f949d40b818a8684
Reviewed-on: https://gerrit.libreoffice.org/29869Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 3b658759
......@@ -55,7 +55,7 @@ class VerbExecutionController
bool m_bWasEverActive;
bool m_bVerbExecutionInProgress;
oslThreadIdentifier m_nVerbExecutionThreadIdentifier;
sal_Bool m_bChangedOnVerbExecution;
bool m_bChangedOnVerbExecution;
#endif
public:
......@@ -66,13 +66,13 @@ public:
, m_bWasEverActive( false )
, m_bVerbExecutionInProgress( false )
, m_nVerbExecutionThreadIdentifier( 0 )
, m_bChangedOnVerbExecution( sal_False )
, m_bChangedOnVerbExecution( false )
#endif
{}
#ifdef _WIN32
void StartControlExecution();
sal_Bool EndControlExecution_WasModified();
bool EndControlExecution_WasModified();
void ModificationNotificationIsDone();
// no need to lock anything to check the value of the numeric members
bool CanDoNotification() { return ( !m_bVerbExecutionInProgress && !m_bWasEverActive && !m_nNotificationLock ); }
......@@ -211,13 +211,13 @@ protected:
#endif
void MakeEventListenerNotification_Impl( const OUString& aEventName );
#ifdef _WIN32
void StateChangeNotification_Impl( sal_Bool bBeforeChange, sal_Int32 nOldState, sal_Int32 nNewState );
void StateChangeNotification_Impl( bool bBeforeChange, sal_Int32 nOldState, sal_Int32 nNewState );
css::uno::Reference< css::io::XOutputStream > GetStreamForSaving();
css::uno::Sequence< sal_Int32 > GetIntermediateVerbsSequence_Impl( sal_Int32 nNewState );
css::uno::Sequence< sal_Int32 > GetReachableStatesList_Impl(
static css::uno::Sequence< sal_Int32 > GetReachableStatesList_Impl(
const css::uno::Sequence< css::embed::VerbDescriptor >& aVerbList );
#endif
......@@ -241,7 +241,7 @@ protected:
bool bSaveAs )
throw ( css::uno::Exception );
#ifdef _WIN32
void StoreObjectToStream( css::uno::Reference< css::io::XOutputStream > xOutStream )
void StoreObjectToStream( css::uno::Reference< css::io::XOutputStream > const & xOutStream )
throw ( css::uno::Exception );
#endif
void InsertVisualCache_Impl(
......@@ -264,11 +264,11 @@ protected:
bool bAllowRepair50 = false )
throw ();
#ifdef _WIN32
sal_Bool SaveObject_Impl();
sal_Bool OnShowWindow_Impl( sal_Bool bShow );
void CreateOleComponent_Impl( OleComponent* pOleComponent = NULL );
void CreateOleComponentAndLoad_Impl( OleComponent* pOleComponent = NULL );
void CreateOleComponentFromClipboard_Impl( OleComponent* pOleComponent = NULL );
bool SaveObject_Impl();
bool OnShowWindow_Impl( bool bShow );
void CreateOleComponent_Impl( OleComponent* pOleComponent = nullptr );
void CreateOleComponentAndLoad_Impl( OleComponent* pOleComponent = nullptr );
void CreateOleComponentFromClipboard_Impl( OleComponent* pOleComponent = nullptr );
OUString CreateTempURLEmpty_Impl();
OUString GetTempURL_Impl();
void SetObjectIsLink_Impl( bool bIsLink ) { m_bIsLink = bIsLink; }
......@@ -298,7 +298,7 @@ public:
virtual ~OleEmbeddedObject() override;
#ifdef _WIN32
void OnIconChanged_Impl();
static void OnIconChanged_Impl();
void OnViewChanged_Impl();
void OnClosed_Impl();
#endif
......
......@@ -36,17 +36,17 @@ OleWrapperAdviseSink::~OleWrapperAdviseSink()
STDMETHODIMP OleWrapperAdviseSink::QueryInterface( REFIID riid , void** ppv )
{
*ppv=NULL;
*ppv=nullptr;
if ( riid == IID_IUnknown )
*ppv = (IUnknown*)this;
*ppv = static_cast<IUnknown*>(this);
if ( riid == IID_IAdviseSink )
*ppv = (IAdviseSink*)this;
*ppv = static_cast<IAdviseSink*>(this);
if ( *ppv != NULL )
if ( *ppv != nullptr )
{
((IUnknown*)*ppv)->AddRef();
static_cast<IUnknown*>(*ppv)->AddRef();
return S_OK;
}
......@@ -71,7 +71,7 @@ void OleWrapperAdviseSink::disconnectOleComponent()
{
// must not be called from the descructor of OleComponent!!!
osl::MutexGuard aGuard( m_aMutex );
m_pOleComp = NULL;
m_pOleComp = nullptr;
}
STDMETHODIMP_(void) OleWrapperAdviseSink::OnDataChange(LPFORMATETC, LPSTGMEDIUM)
......
......@@ -38,15 +38,15 @@ public:
virtual ~OleWrapperAdviseSink();
void disconnectOleComponent();
STDMETHODIMP QueryInterface(REFIID, void**);
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
STDMETHODIMP_(void) OnDataChange(LPFORMATETC, LPSTGMEDIUM);
STDMETHODIMP_(void) OnViewChange(DWORD, LONG);
STDMETHODIMP_(void) OnRename(LPMONIKER);
STDMETHODIMP_(void) OnSave();
STDMETHODIMP_(void) OnClose();
STDMETHODIMP QueryInterface(REFIID, void**) override;
STDMETHODIMP_(ULONG) AddRef() override;
STDMETHODIMP_(ULONG) Release() override;
STDMETHODIMP_(void) OnDataChange(LPFORMATETC, LPSTGMEDIUM) override;
STDMETHODIMP_(void) OnViewChange(DWORD, LONG) override;
STDMETHODIMP_(void) OnRename(LPMONIKER) override;
STDMETHODIMP_(void) OnSave() override;
STDMETHODIMP_(void) OnClose() override;
};
#endif
......
......@@ -34,6 +34,7 @@
#include <tools/stream.hxx>
#include <vcl/graphicfilter.hxx>
#include <graphconvert.hxx>
#include "mtnotification.hxx"
#include "oleembobj.hxx"
......@@ -41,7 +42,7 @@
using namespace ::com::sun::star;
sal_Bool ConvertBufferToFormat( void* pBuf,
bool ConvertBufferToFormat( void* pBuf,
sal_uInt32 nBufSize,
const OUString& aMimeType,
uno::Any& aResult )
......@@ -56,11 +57,11 @@ sal_Bool ConvertBufferToFormat( void* pBuf,
if (rFilter.CanImportGraphic(OUString(), aMemoryStream, GRFILTER_FORMAT_DONTKNOW, &nRetFormat) == GRFILTER_OK &&
rFilter.GetImportFormatMediaType(nRetFormat) == aMimeType)
{
aResult <<= uno::Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( aMemoryStream.GetData() ), aMemoryStream.Seek( STREAM_SEEK_TO_END ) );
return sal_True;
aResult <<= uno::Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemoryStream.GetData() ), aMemoryStream.Seek( STREAM_SEEK_TO_END ) );
return true;
}
uno::Sequence < sal_Int8 > aData( (sal_Int8*)pBuf, nBufSize );
uno::Sequence < sal_Int8 > aData( static_cast<sal_Int8*>(pBuf), nBufSize );
uno::Reference < io::XInputStream > xIn = new comphelper::SequenceInputStream( aData );
try
{
......@@ -80,15 +81,15 @@ sal_Bool ConvertBufferToFormat( void* pBuf,
aOutMediaProperties[1].Value <<= aMimeType;
xGraphicProvider->storeGraphic( xGraphic, aOutMediaProperties );
aResult <<= uno::Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( aNewStream.GetData() ), aNewStream.Seek( STREAM_SEEK_TO_END ) );
return sal_True;
aResult <<= uno::Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aNewStream.GetData() ), aNewStream.Seek( STREAM_SEEK_TO_END ) );
return true;
}
}
catch (const uno::Exception&)
{}
}
return sal_False;
return false;
}
......@@ -116,7 +117,7 @@ void SAL_CALL MainThreadNotificationRequest::notify (const uno::Any& ) throw (un
else if ( m_nAspect == embed::Aspects::MSOLE_CONTENT )
m_pObject->OnViewChanged_Impl();
else if ( m_nAspect == embed::Aspects::MSOLE_ICON )
m_pObject->OnIconChanged_Impl();
OleEmbeddedObject::OnIconChanged_Impl();
}
}
catch( const uno::Exception& )
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_EMBEDDEDOBJ_SOURCE_MSOLE_GRAPHCONVERT_HXX
#define INCLUDED_EMBEDDEDOBJ_SOURCE_MSOLE_GRAPHCONVERT_HXX
#include <sal/config.h>
#include <rtl/ustring.hxx>
#include <sal/types.h>
namespace com { namespace sun { namespace star { namespace uno {
class Any;
} } } }
bool ConvertBufferToFormat(
void * pBuf, sal_uInt32 nBufSize, OUString const & aFormatShortName,
css::uno::Any & aResult);
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -42,9 +42,9 @@ class MainThreadNotificationRequest : public cppu::WeakImplHelper< css::awt::XC
public:
virtual void SAL_CALL notify (const css::uno::Any& rUserData)
throw (css::uno::RuntimeException);
throw (css::uno::RuntimeException) override;
MainThreadNotificationRequest( const ::rtl::Reference< OleEmbeddedObject >& xObj, sal_uInt16 nNotificationType, sal_uInt32 nAspect = 0 );
~MainThreadNotificationRequest();
~MainThreadNotificationRequest() override;
};
#endif
......
......@@ -59,8 +59,8 @@ class OleComponent : public ::cppu::WeakImplHelper< css::util::XCloseable, css::
::osl::Mutex m_aMutex;
::cppu::OMultiTypeInterfaceContainerHelper* m_pInterfaceContainer;
sal_Bool m_bDisposed;
sal_Bool m_bModified;
bool m_bDisposed;
bool m_bModified;
OleComponentNative_Impl* m_pNativeImpl;
OleEmbeddedObject* m_pUnoOleObject;
......@@ -75,13 +75,13 @@ class OleComponent : public ::cppu::WeakImplHelper< css::util::XCloseable, css::
css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory;
sal_Bool m_bOleInitialized;
bool m_bOleInitialized;
// specifies whether the workaround for some rare embedded objects is activated ( f.e. AcrobatReader 7.0.8 object )
// such objects report the dirty state wrongly sometimes and do not allow to store them any time
sal_Bool m_bWorkaroundActive;
bool m_bWorkaroundActive;
sal_Bool InitializeObject_Impl();
bool InitializeObject_Impl();
void CreateNewIStorage_Impl();
void RetrieveObjectDataFlavors_Impl();
......@@ -92,7 +92,7 @@ public:
OleComponent( const css::uno::Reference< css::lang::XMultiServiceFactory >& m_xFactory,
OleEmbeddedObject* pOleObj );
virtual ~OleComponent();
virtual ~OleComponent() override;
OleComponent* createEmbeddedCopyOfLink();
......@@ -102,13 +102,13 @@ public:
const css::awt::Size& aMultiplier,
const css::awt::Size& aDivisor );
css::awt::Size CalculateTheRealSize( const css::awt::Size& aContSize, sal_Bool bUpdate );
css::awt::Size CalculateTheRealSize( const css::awt::Size& aContSize, bool bUpdate );
// ==== Initialization ==================================================
void LoadEmbeddedObject( const OUString& aTempURL );
void CreateObjectFromClipboard();
void CreateNewEmbeddedObject( const css::uno::Sequence< sal_Int8 >& aSeqCLSID );
void CreateObjectFromData(
static void CreateObjectFromData(
const css::uno::Reference< css::datatransfer::XTransferable >& xTransfer );
void CreateObjectFromFile( const OUString& aFileName );
void CreateLinkFromFile( const OUString& aFileName );
......@@ -132,40 +132,40 @@ public:
css::uno::Sequence< sal_Int8 > GetCLSID();
sal_Bool IsWorkaroundActive() { return m_bWorkaroundActive; }
sal_Bool IsDirty();
bool IsWorkaroundActive() { return m_bWorkaroundActive; }
bool IsDirty();
void StoreOwnTmpIfNecessary();
sal_Bool SaveObject_Impl();
sal_Bool OnShowWindow_Impl( bool bShow );
bool SaveObject_Impl();
bool OnShowWindow_Impl( bool bShow );
void OnViewChange_Impl( sal_uInt32 dwAspect );
void OnClose_Impl();
// XCloseable
virtual void SAL_CALL close( sal_Bool DeliverOwnership ) throw (css::util::CloseVetoException, css::uno::RuntimeException);
virtual void SAL_CALL addCloseListener( const css::uno::Reference< css::util::XCloseListener >& Listener ) throw (css::uno::RuntimeException);
virtual void SAL_CALL removeCloseListener( const css::uno::Reference< css::util::XCloseListener >& Listener ) throw (css::uno::RuntimeException);
virtual void SAL_CALL close( sal_Bool DeliverOwnership ) throw (css::util::CloseVetoException, css::uno::RuntimeException) override;
virtual void SAL_CALL addCloseListener( const css::uno::Reference< css::util::XCloseListener >& Listener ) throw (css::uno::RuntimeException) override;
virtual void SAL_CALL removeCloseListener( const css::uno::Reference< css::util::XCloseListener >& Listener ) throw (css::uno::RuntimeException) override;
// XTransferable
virtual css::uno::Any SAL_CALL getTransferData( const css::datatransfer::DataFlavor& aFlavor ) throw (css::datatransfer::UnsupportedFlavorException, css::io::IOException, css::uno::RuntimeException);
virtual css::uno::Sequence< css::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors( ) throw (css::uno::RuntimeException);
virtual sal_Bool SAL_CALL isDataFlavorSupported( const css::datatransfer::DataFlavor& aFlavor ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL getTransferData( const css::datatransfer::DataFlavor& aFlavor ) throw (css::datatransfer::UnsupportedFlavorException, css::io::IOException, css::uno::RuntimeException) override;
virtual css::uno::Sequence< css::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors( ) throw (css::uno::RuntimeException) override;
virtual sal_Bool SAL_CALL isDataFlavorSupported( const css::datatransfer::DataFlavor& aFlavor ) throw (css::uno::RuntimeException) override;
// XComponent
virtual void SAL_CALL dispose() throw (css::uno::RuntimeException);
virtual void SAL_CALL addEventListener(const css::uno::Reference < css::lang::XEventListener >& aListener) throw (css::uno::RuntimeException);
virtual void SAL_CALL removeEventListener(const css::uno::Reference < css::lang::XEventListener >& aListener) throw (css::uno::RuntimeException);
virtual void SAL_CALL dispose() throw (css::uno::RuntimeException) override;
virtual void SAL_CALL addEventListener(const css::uno::Reference < css::lang::XEventListener >& aListener) throw (css::uno::RuntimeException) override;
virtual void SAL_CALL removeEventListener(const css::uno::Reference < css::lang::XEventListener >& aListener) throw (css::uno::RuntimeException) override;
// XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) throw(css::uno::RuntimeException) ;
virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) throw(css::uno::RuntimeException) override;
// XModifiable
virtual sal_Bool SAL_CALL isModified() throw (css::uno::RuntimeException);
virtual sal_Bool SAL_CALL isModified() throw (css::uno::RuntimeException) override;
virtual void SAL_CALL setModified( sal_Bool bModified )
throw (css::beans::PropertyVetoException, css::uno::RuntimeException);
virtual void SAL_CALL addModifyListener( const css::uno::Reference < css::util::XModifyListener >& xListener ) throw(css::uno::RuntimeException);
virtual void SAL_CALL removeModifyListener( const css::uno::Reference < css::util::XModifyListener >& xListener) throw(css::uno::RuntimeException);
throw (css::beans::PropertyVetoException, css::uno::RuntimeException) override;
virtual void SAL_CALL addModifyListener( const css::uno::Reference < css::util::XModifyListener >& xListener ) throw(css::uno::RuntimeException) override;
virtual void SAL_CALL removeModifyListener( const css::uno::Reference < css::util::XModifyListener >& xListener) throw(css::uno::RuntimeException) override;
};
#endif
......
......@@ -484,7 +484,7 @@ void SAL_CALL OleEmbeddedObject::changeState( sal_Int32 nNewState )
sal_Int32 nOldState = m_nObjectState;
aGuard.clear();
StateChangeNotification_Impl( sal_True, nOldState, nNewState );
StateChangeNotification_Impl( true, nOldState, nNewState );
aGuard.reset();
try
......@@ -506,7 +506,7 @@ void SAL_CALL OleEmbeddedObject::changeState( sal_Int32 nNewState )
}
aGuard.clear();
StateChangeNotification_Impl( sal_False, nOldState, m_nObjectState );
StateChangeNotification_Impl( false, nOldState, m_nObjectState );
aGuard.reset();
}
else if ( nNewState == embed::EmbedStates::RUNNING || nNewState == embed::EmbedStates::ACTIVE )
......@@ -523,7 +523,7 @@ void SAL_CALL OleEmbeddedObject::changeState( sal_Int32 nNewState )
SwitchComponentToRunningState_Impl();
m_nObjectState = embed::EmbedStates::RUNNING;
aGuard.clear();
StateChangeNotification_Impl( sal_False, nOldState, m_nObjectState );
StateChangeNotification_Impl( false, nOldState, m_nObjectState );
aGuard.reset();
if ( m_pOleComponent && m_bHasSizeToSet )
......@@ -531,7 +531,7 @@ void SAL_CALL OleEmbeddedObject::changeState( sal_Int32 nNewState )
aGuard.clear();
try {
m_pOleComponent->SetExtent( m_aSizeToSet, m_nAspectToSet );
m_bHasSizeToSet = sal_False;
m_bHasSizeToSet = false;
}
catch( const uno::Exception& ) {}
aGuard.reset();
......@@ -556,7 +556,7 @@ void SAL_CALL OleEmbeddedObject::changeState( sal_Int32 nNewState )
aGuard.clear();
try {
m_pOleComponent->SetExtent( m_aSizeToSet, m_nAspectToSet );
m_bHasSizeToSet = sal_False;
m_bHasSizeToSet = false;
}
catch( uno::Exception& ) {}
aGuard.reset();
......@@ -583,7 +583,7 @@ void SAL_CALL OleEmbeddedObject::changeState( sal_Int32 nNewState )
catch( uno::Exception& )
{
aGuard.clear();
StateChangeNotification_Impl( sal_False, nOldState, m_nObjectState );
StateChangeNotification_Impl( false, nOldState, m_nObjectState );
throw;
}
}
......@@ -803,7 +803,7 @@ void SAL_CALL OleEmbeddedObject::doVerb( sal_Int32 nVerbID )
m_pOleComponent->ExecuteVerb( nVerbID );
// ==== the STAMPIT related solution =============================
sal_Bool bModifiedOnExecution = m_aVerbExecutionController.EndControlExecution_WasModified();
bool bModifiedOnExecution = m_aVerbExecutionController.EndControlExecution_WasModified();
// this workaround is implemented for STAMPIT object
// if object was modified during verb execution it is saved here
......@@ -818,7 +818,7 @@ void SAL_CALL OleEmbeddedObject::doVerb( sal_Int32 nVerbID )
aGuard.clear();
StateChangeNotification_Impl( sal_False, nOldState, m_nObjectState );
StateChangeNotification_Impl( false, nOldState, m_nObjectState );
throw;
}
......@@ -1081,7 +1081,7 @@ sal_Int64 SAL_CALL OleEmbeddedObject::getStatus( sal_Int64
m_nStatus = m_pOleComponent->GetMiscStatus( nAspect );
m_nStatusAspect = nAspect;
m_bGotStatus = sal_True;
m_bGotStatus = true;
nResult = m_nStatus;
}
#endif
......
......@@ -108,31 +108,31 @@ OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< lang::XMultiServiceF
// this constructor let object be initialized from clipboard
OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< lang::XMultiServiceFactory >& xFactory )
: m_pOleComponent( NULL )
, m_pInterfaceContainer( NULL )
, m_bReadOnly( sal_False )
: m_pOleComponent( nullptr )
, m_pInterfaceContainer( nullptr )
, m_bReadOnly( false )
, m_bDisposed( false )
, m_nObjectState( -1 )
, m_nTargetState( -1 )
, m_nUpdateMode( embed::EmbedUpdateModes::ALWAYS_UPDATE )
, m_xFactory( xFactory )
, m_bWaitSaveCompleted( sal_False )
, m_bNewVisReplInStream( sal_True )
, m_bStoreLoaded( sal_False )
, m_bVisReplInitialized( sal_False )
, m_bVisReplInStream( sal_False )
, m_bStoreVisRepl( sal_False )
, m_bIsLink( sal_False )
, m_bHasCachedSize( sal_False )
, m_bWaitSaveCompleted( false )
, m_bNewVisReplInStream( true )
, m_bStoreLoaded( false )
, m_bVisReplInitialized( false )
, m_bVisReplInStream( false )
, m_bStoreVisRepl( false )
, m_bIsLink( false )
, m_bHasCachedSize( false )
, m_nCachedAspect( 0 )
, m_bHasSizeToSet( sal_False )
, m_bHasSizeToSet( false )
, m_nAspectToSet( 0 )
, m_bGotStatus( sal_False )
, m_bGotStatus( false )
, m_nStatus( 0 )
, m_nStatusAspect( 0 )
, m_pOwnView( NULL )
, m_bFromClipboard( sal_True )
, m_bTriedConversion( sal_False )
, m_pOwnView( nullptr )
, m_bFromClipboard( true )
, m_bTriedConversion( false )
{
}
#endif
......@@ -185,13 +185,13 @@ void OleEmbeddedObject::MakeEventListenerNotification_Impl( const OUString& aEve
}
#ifdef _WIN32
void OleEmbeddedObject::StateChangeNotification_Impl( sal_Bool bBeforeChange, sal_Int32 nOldState, sal_Int32 nNewState )
void OleEmbeddedObject::StateChangeNotification_Impl( bool bBeforeChange, sal_Int32 nOldState, sal_Int32 nNewState )
{
if ( m_pInterfaceContainer )
{
::cppu::OInterfaceContainerHelper* pContainer = m_pInterfaceContainer->getContainer(
cppu::UnoType<embed::XStateChangeListener>::get());
if ( pContainer != NULL )
if ( pContainer != nullptr )
{
lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
......@@ -202,7 +202,7 @@ void OleEmbeddedObject::StateChangeNotification_Impl( sal_Bool bBeforeChange, sa
{
try
{
((embed::XStateChangeListener*)pIterator.next())->changingState( aSource, nOldState, nNewState );
static_cast<embed::XStateChangeListener*>(pIterator.next())->changingState( aSource, nOldState, nNewState );
}
catch( const uno::Exception& )
{
......@@ -213,7 +213,7 @@ void OleEmbeddedObject::StateChangeNotification_Impl( sal_Bool bBeforeChange, sa
{
try
{
((embed::XStateChangeListener*)pIterator.next())->stateChanged( aSource, nOldState, nNewState );
static_cast<embed::XStateChangeListener*>(pIterator.next())->stateChanged( aSource, nOldState, nNewState );
}
catch( const uno::Exception& )
{
......@@ -237,7 +237,7 @@ void OleEmbeddedObject::GetRidOfComponent()
m_pOleComponent->removeCloseListener( m_xClosePreventer );
try
{
m_pOleComponent->close( sal_False );
m_pOleComponent->close( false );
}
catch( const uno::Exception& )
{
......@@ -249,7 +249,7 @@ void OleEmbeddedObject::GetRidOfComponent()
m_pOleComponent->disconnectEmbeddedObject();
m_pOleComponent->release();
m_pOleComponent = NULL;
m_pOleComponent = nullptr;
}
#endif
}
......@@ -386,7 +386,7 @@ uno::Reference< util::XCloseable > SAL_CALL OleEmbeddedObject::getComponent()
}
#if defined(_WIN32)
if (m_pOleComponent != 0)
if (m_pOleComponent != nullptr)
{
return uno::Reference< util::XCloseable >( static_cast< ::cppu::OWeakObject* >( m_pOleComponent ), uno::UNO_QUERY );
}
......
......@@ -169,7 +169,7 @@ OUString GetNewFilledTempFile_Impl( const uno::Reference< embed::XOptimizedStora
xParentStorage->copyStreamElementData( aEntryName, xTempStream );
xTempFile->setPropertyValue("RemoveFile", uno::makeAny( sal_False ) );
xTempFile->setPropertyValue("RemoveFile", uno::makeAny( false ) );
uno::Any aUrl = xTempFile->getPropertyValue("Uri");
aUrl >>= aResult;
}
......@@ -216,22 +216,22 @@ void VerbExecutionController::StartControlExecution()
// the class is used to detect STAMPIT object, that can never be active
if ( !m_bVerbExecutionInProgress && !m_bWasEverActive )
{
m_bVerbExecutionInProgress = sal_True;
m_bVerbExecutionInProgress = true;
m_nVerbExecutionThreadIdentifier = osl::Thread::getCurrentIdentifier();
m_bChangedOnVerbExecution = sal_False;
m_bChangedOnVerbExecution = false;
}
}
sal_Bool VerbExecutionController::EndControlExecution_WasModified()
bool VerbExecutionController::EndControlExecution_WasModified()
{
osl::MutexGuard aGuard( m_aVerbExecutionMutex );
sal_Bool bResult = sal_False;
bool bResult = false;
if ( m_bVerbExecutionInProgress && m_nVerbExecutionThreadIdentifier == osl::Thread::getCurrentIdentifier() )
{
bResult = m_bChangedOnVerbExecution;
m_bVerbExecutionInProgress = sal_False;
m_bVerbExecutionInProgress = false;
}
return bResult;
......@@ -243,7 +243,7 @@ void VerbExecutionController::ModificationNotificationIsDone()
osl::MutexGuard aGuard( m_aVerbExecutionMutex );
if ( m_bVerbExecutionInProgress && osl::Thread::getCurrentIdentifier() == m_nVerbExecutionThreadIdentifier )
m_bChangedOnVerbExecution = sal_True;
m_bChangedOnVerbExecution = true;
}
#endif
......@@ -736,7 +736,7 @@ uno::Reference< io::XStream > OleEmbeddedObject::TryToRetrieveCachedVisualRepres
try
{
CreateOleComponentAndLoad_Impl( NULL );
CreateOleComponentAndLoad_Impl();
m_aClassID = m_pOleComponent->GetCLSID(); // was not set during consruction
}
catch( const uno::Exception& )
......@@ -803,16 +803,16 @@ void OleEmbeddedObject::SwitchOwnPersistence( const uno::Reference< embed::XStor
#ifdef _WIN32
sal_Bool OleEmbeddedObject::SaveObject_Impl()
bool OleEmbeddedObject::SaveObject_Impl()
{
sal_Bool bResult = sal_False;
bool bResult = false;
if ( m_xClientSite.is() )
{
try
{
m_xClientSite->saveObject();
bResult = sal_True;
bResult = true;
}
catch( const uno::Exception& )
{
......@@ -823,16 +823,16 @@ sal_Bool OleEmbeddedObject::SaveObject_Impl()
}
sal_Bool OleEmbeddedObject::OnShowWindow_Impl( sal_Bool bShow )
bool OleEmbeddedObject::OnShowWindow_Impl( bool bShow )
{
::osl::ResettableMutexGuard aGuard( m_aMutex );
sal_Bool bResult = sal_False;
bool bResult = false;
SAL_WARN_IF( m_nObjectState == -1, "embeddedobj.ole", "The object has no persistence!" );
SAL_WARN_IF( m_nObjectState == embed::EmbedStates::LOADED, "embeddedobj.ole", "The object get OnShowWindow in loaded state!" );
if ( m_nObjectState == -1 || m_nObjectState == embed::EmbedStates::LOADED )
return sal_False;
return false;
// the object is either activated or deactivated
sal_Int32 nOldState = m_nObjectState;
......@@ -842,13 +842,13 @@ sal_Bool OleEmbeddedObject::OnShowWindow_Impl( sal_Bool bShow )
m_aVerbExecutionController.ObjectIsActive();
aGuard.clear();
StateChangeNotification_Impl( sal_False, nOldState, m_nObjectState );
StateChangeNotification_Impl( false, nOldState, m_nObjectState );
}
else if ( !bShow && m_nObjectState == embed::EmbedStates::ACTIVE )
{
m_nObjectState = embed::EmbedStates::RUNNING;
aGuard.clear();
StateChangeNotification_Impl( sal_False, nOldState, m_nObjectState );
StateChangeNotification_Impl( false, nOldState, m_nObjectState );
}
if ( m_xClientSite.is() )
......@@ -856,7 +856,7 @@ sal_Bool OleEmbeddedObject::OnShowWindow_Impl( sal_Bool bShow )
try
{
m_xClientSite->visibilityChanged( bShow );
bResult = sal_True;
bResult = true;
}
catch( const uno::Exception& )
{
......@@ -899,7 +899,7 @@ void OleEmbeddedObject::OnViewChanged_Impl()
// The view is changed while the object is in running state, save the new object
m_xCachedVisualRepresentation.clear();
SaveObject_Impl();
MakeEventListenerNotification_Impl( OUString( "OnVisAreaChanged" ) );
MakeEventListenerNotification_Impl( "OnVisAreaChanged" );
}
}
......@@ -914,7 +914,7 @@ void OleEmbeddedObject::OnClosed_Impl()
{
sal_Int32 nOldState = m_nObjectState;
m_nObjectState = embed::EmbedStates::LOADED;
StateChangeNotification_Impl( sal_False, nOldState, m_nObjectState );
StateChangeNotification_Impl( false, nOldState, m_nObjectState );
}
}
......@@ -1027,7 +1027,7 @@ uno::Reference< io::XOutputStream > OleEmbeddedObject::GetStreamForSaving()
}
void OleEmbeddedObject::StoreObjectToStream( uno::Reference< io::XOutputStream > xOutStream )
void OleEmbeddedObject::StoreObjectToStream( uno::Reference< io::XOutputStream > const & xOutStream )
throw ( uno::Exception )
{
// this method should be used only on windows
......@@ -1167,13 +1167,13 @@ void OleEmbeddedObject::StoreToLocation_Impl(
if ( !xTargetStream.is() )
throw io::IOException(); //TODO: access denied
SetStreamMediaType_Impl( xTargetStream, OUString( "application/vnd.sun.star.oleobject" ));
SetStreamMediaType_Impl( xTargetStream, "application/vnd.sun.star.oleobject" );
uno::Reference< io::XOutputStream > xOutStream = xTargetStream->getOutputStream();
if ( !xOutStream.is() )
throw io::IOException(); //TODO: access denied
StoreObjectToStream( xOutStream );
bVisReplIsStored = sal_True;
bVisReplIsStored = true;
if ( bSaveAs )
{
......@@ -1188,7 +1188,7 @@ void OleEmbeddedObject::StoreToLocation_Impl(
if ( xTmpCVRepresentation.is() )
{
xCachedVisualRepresentation = xTmpCVRepresentation;
bNeedLocalCache = sal_False;
bNeedLocalCache = false;
}
}
}
......@@ -1375,7 +1375,7 @@ void SAL_CALL OleEmbeddedObject::setPersistentEntry(
{
// the object should be initialized from clipboard
// inpossibility to initialize the object means error here
CreateOleComponentFromClipboard_Impl( NULL );
CreateOleComponentFromClipboard_Impl();
m_aClassID = m_pOleComponent->GetCLSID(); // was not set during consruction
m_pOleComponent->RunObject();
m_nObjectState = embed::EmbedStates::RUNNING;
......@@ -1387,7 +1387,7 @@ void SAL_CALL OleEmbeddedObject::setPersistentEntry(
// will be detected by olecomponent
try
{
CreateOleComponentAndLoad_Impl( NULL );
CreateOleComponentAndLoad_Impl();
m_aClassID = m_pOleComponent->GetCLSID(); // was not set during consruction
}
catch( const uno::Exception& )
......@@ -1759,14 +1759,14 @@ void SAL_CALL OleEmbeddedObject::storeOwn()
#ifdef _WIN32
if ( m_nObjectState != embed::EmbedStates::LOADED && m_pOleComponent && m_pOleComponent->IsDirty() )
{
bStoreLoaded = sal_False;
bStoreLoaded = false;
OSL_ENSURE( m_xParentStorage.is() && m_xObjectStream.is(), "The object has no valid persistence!\n" );
if ( !m_xObjectStream.is() )
throw io::IOException(); //TODO: access denied
SetStreamMediaType_Impl( m_xObjectStream, OUString( "application/vnd.sun.star.oleobject" ));
SetStreamMediaType_Impl( m_xObjectStream, "application/vnd.sun.star.oleobject" );
uno::Reference< io::XOutputStream > xOutStream = m_xObjectStream->getOutputStream();
if ( !xOutStream.is() )
throw io::IOException(); //TODO: access denied
......@@ -1777,7 +1777,7 @@ void SAL_CALL OleEmbeddedObject::storeOwn()
// the replacement is changed probably, and it must be in the object stream
if ( !m_pOleComponent->IsWorkaroundActive() )
m_xCachedVisualRepresentation.clear();
SetVisReplInStream( sal_True );
SetVisReplInStream( true );
}
#endif
......@@ -2015,7 +2015,7 @@ void SAL_CALL OleEmbeddedObject::breakLink( const uno::Reference< embed::XStorag
m_nObjectState = nTargetState;
}
m_bIsLink = sal_False;
m_bIsLink = false;
m_aLinkURL.clear();
}
else
......
......@@ -32,6 +32,8 @@ namespace com { namespace sun { namespace star {
namespace lang { class XMultiServiceFactory; }
} } }
OUString GetNewTempFileURL_Impl( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
OUString GetNewFilledTempFile_Impl(
css::uno::Reference<css::io::XInputStream > const & xInStream,
css::uno::Reference<css::lang::XMultiServiceFactory> const & xFactory)
......
......@@ -54,7 +54,7 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL emboleobj_component_getFactory(
// the following service makes sense only on windows
else if ( aImplName.equals( MSOLEDialogObjectCreator::impl_staticGetImplementationName() ) )
{
xFactory= ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory*>( pServiceManager ),
xFactory= ::cppu::createOneInstanceFactory( static_cast< lang::XMultiServiceFactory*>( pServiceManager ),
MSOLEDialogObjectCreator::impl_staticGetImplementationName(),
MSOLEDialogObjectCreator::impl_staticCreateSelfInstance,
MSOLEDialogObjectCreator::impl_staticGetSupportedServiceNames() );
......
......@@ -112,7 +112,7 @@ void SAL_CALL OleEmbeddedObject::setVisualAreaSize( sal_Int64 nAspect, const awt
// SetExtent() is called only for objects that require it,
// it should not be called for MSWord documents to workaround problem i49369
// If cached size is not set, that means that this is the size initialization, so there is no need to set the real size
sal_Bool bAllowToSetExtent =
bool bAllowToSetExtent =
( ( getStatus( nAspect ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE )
&& !MimeConfigurationHelper::ClassIDsEqual(m_aClassID, MimeConfigurationHelper::GetSequenceClassID(MSO_WW8_CLASSID))
&& m_bHasCachedSize );
......@@ -136,12 +136,12 @@ void SAL_CALL OleEmbeddedObject::setVisualAreaSize( sal_Int64 nAspect, const awt
aGuard.clear();
try {
m_pOleComponent->SetExtent( aSizeToSet, nAspect ); // will throw an exception in case of failure
m_bHasSizeToSet = sal_False;
m_bHasSizeToSet = false;
}
catch( const uno::Exception& )
{
// some objects do not allow to set the size even in running state
m_bHasSizeToSet = sal_True;
m_bHasSizeToSet = true;
m_aSizeToSet = aSizeToSet;
m_nAspectToSet = nAspect;
}
......@@ -205,7 +205,7 @@ awt::Size SAL_CALL OleEmbeddedObject::getVisualAreaSize( sal_Int64 nAspect )
bool bBackToLoaded = false;
sal_Bool bSuccess = sal_False;
bool bSuccess = false;
if ( getCurrentState() == embed::EmbedStates::LOADED )
{
SAL_WARN( "embeddedobj.ole", "Loaded object has no cached size!" );
......@@ -229,7 +229,7 @@ awt::Size SAL_CALL OleEmbeddedObject::getVisualAreaSize( sal_Int64 nAspect )
{
// first try to get size using replacement image
aSize = m_pOleComponent->GetExtent( nAspect ); // will throw an exception in case of failure
bSuccess = sal_True;
bSuccess = true;
}
catch( const uno::Exception& )
{
......@@ -255,7 +255,7 @@ awt::Size SAL_CALL OleEmbeddedObject::getVisualAreaSize( sal_Int64 nAspect )
{
// second try the cached replacement image
aSize = m_pOleComponent->GetCachedExtent( nAspect ); // will throw an exception in case of failure
bSuccess = sal_True;
bSuccess = true;
}
catch( const uno::Exception& )
{
......@@ -268,7 +268,7 @@ awt::Size SAL_CALL OleEmbeddedObject::getVisualAreaSize( sal_Int64 nAspect )
{
// third try the size reported by the object
aSize = m_pOleComponent->GetReccomendedExtent( nAspect ); // will throw an exception in case of failure
bSuccess = sal_True;
bSuccess = true;
}
catch( const uno::Exception& )
{
......@@ -284,7 +284,7 @@ awt::Size SAL_CALL OleEmbeddedObject::getVisualAreaSize( sal_Int64 nAspect )
m_aCachedSize = aSize;
m_nCachedAspect = nAspect;
m_bHasCachedSize = sal_True;
m_bHasCachedSize = true;
aResult = m_aCachedSize;
}
......
......@@ -37,17 +37,17 @@ OleWrapperClientSite::~OleWrapperClientSite()
STDMETHODIMP OleWrapperClientSite::QueryInterface( REFIID riid , void** ppv )
{
*ppv=NULL;
*ppv=nullptr;
if ( riid == IID_IUnknown )
*ppv = (IUnknown*)this;
*ppv = static_cast<IUnknown*>(this);
if ( riid == IID_IOleClientSite )
*ppv = (IOleClientSite*)this;
*ppv = static_cast<IOleClientSite*>(this);
if ( *ppv != NULL )
if ( *ppv != nullptr )
{
((IUnknown*)*ppv)->AddRef();
static_cast<IUnknown*>(*ppv)->AddRef();
return S_OK;
}
......@@ -72,12 +72,12 @@ void OleWrapperClientSite::disconnectOleComponent()
{
// must not be called from the descructor of OleComponent!!!
osl::MutexGuard aGuard( m_aMutex );
m_pOleComp = NULL;
m_pOleComp = nullptr;
}
STDMETHODIMP OleWrapperClientSite::SaveObject()
{
OleComponent* pLockComponent = NULL;
OleComponent* pLockComponent = nullptr;
HRESULT hResult = E_FAIL;
{
......@@ -102,13 +102,13 @@ STDMETHODIMP OleWrapperClientSite::SaveObject()
STDMETHODIMP OleWrapperClientSite::GetMoniker( DWORD, DWORD, LPMONIKER *ppmk )
{
*ppmk = NULL;
*ppmk = nullptr;
return E_NOTIMPL;
}
STDMETHODIMP OleWrapperClientSite::GetContainer( LPOLECONTAINER* ppContainer )
{
*ppContainer = NULL;
*ppContainer = nullptr;
return E_NOTIMPL;
}
......@@ -119,7 +119,7 @@ STDMETHODIMP OleWrapperClientSite::ShowObject()
STDMETHODIMP OleWrapperClientSite::OnShowWindow( BOOL bShow )
{
OleComponent* pLockComponent = NULL;
OleComponent* pLockComponent = nullptr;
// TODO/LATER: redirect the notification to the main thread so that SolarMutex can be locked
{
......
......@@ -37,16 +37,16 @@ public:
void disconnectOleComponent();
STDMETHODIMP QueryInterface(REFIID, void**);
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
STDMETHODIMP SaveObject();
STDMETHODIMP GetMoniker(DWORD, DWORD, LPMONIKER *);
STDMETHODIMP GetContainer(LPOLECONTAINER *);
STDMETHODIMP ShowObject();
STDMETHODIMP OnShowWindow(BOOL);
STDMETHODIMP RequestNewObjectLayout();
STDMETHODIMP QueryInterface(REFIID, void**) override;
STDMETHODIMP_(ULONG) AddRef() override;
STDMETHODIMP_(ULONG) Release() override;
STDMETHODIMP SaveObject() override;
STDMETHODIMP GetMoniker(DWORD, DWORD, LPMONIKER *) override;
STDMETHODIMP GetContainer(LPOLECONTAINER *) override;
STDMETHODIMP ShowObject() override;
STDMETHODIMP OnShowWindow(BOOL) override;
STDMETHODIMP RequestNewObjectLayout() override;
};
#endif
......
......@@ -48,7 +48,7 @@ class InitializedOleGuard
public:
InitializedOleGuard()
{
if ( !SUCCEEDED( OleInitialize( NULL ) ) )
if ( !SUCCEEDED( OleInitialize( nullptr ) ) )
throw css::uno::RuntimeException();
}
......@@ -169,11 +169,11 @@ embed::InsertedObjectInfo SAL_CALL MSOLEDialogObjectCreator::createInstanceByDia
::osl::Module aOleDlgLib;
if( !aOleDlgLib.load( OUString( "oledlg" ) ))
if( !aOleDlgLib.load( "oledlg" ))
throw uno::RuntimeException();
OleUIInsertObjectA_Type * pInsertFct = (OleUIInsertObjectA_Type *)
aOleDlgLib.getSymbol( OUString( "OleUIInsertObjectA" ));
OleUIInsertObjectA_Type * pInsertFct = reinterpret_cast<OleUIInsertObjectA_Type *>(
aOleDlgLib.getSymbol( "OleUIInsertObjectA" ));
if( !pInsertFct )
throw uno::RuntimeException();
......@@ -231,20 +231,20 @@ embed::InsertedObjectInfo SAL_CALL MSOLEDialogObjectCreator::createInstanceByDia
uno::UNO_QUERY );
}
if ( ( io.dwFlags & IOF_CHECKDISPLAYASICON) && io.hMetaPict != NULL )
if ( ( io.dwFlags & IOF_CHECKDISPLAYASICON) && io.hMetaPict != nullptr )
{
METAFILEPICT* pMF = ( METAFILEPICT* )GlobalLock( io.hMetaPict );
METAFILEPICT* pMF = static_cast<METAFILEPICT*>(GlobalLock( io.hMetaPict ));
if ( pMF )
{
sal_uInt32 nBufSize = GetMetaFileBitsEx( pMF->hMF, 0, NULL );
sal_uInt32 nBufSize = GetMetaFileBitsEx( pMF->hMF, 0, nullptr );
uno::Sequence< sal_Int8 > aMetafile( nBufSize + 22 );
sal_uInt8* pBuf = (sal_uInt8*)( aMetafile.getArray() );
*( (long* )pBuf ) = 0x9ac6cdd7L;
*( (short* )( pBuf+6 )) = ( SHORT ) 0;
*( (short* )( pBuf+8 )) = ( SHORT ) 0;
*( (short* )( pBuf+10 )) = ( SHORT ) pMF->xExt;
*( (short* )( pBuf+12 )) = ( SHORT ) pMF->yExt;
*( (short* )( pBuf+14 )) = ( USHORT ) 2540;
sal_Int8* pBuf = aMetafile.getArray();
*reinterpret_cast<long*>( pBuf ) = 0x9ac6cdd7L;
*reinterpret_cast<short*>( pBuf+6 ) = ( SHORT ) 0;
*reinterpret_cast<short*>( pBuf+8 ) = ( SHORT ) 0;
*reinterpret_cast<short*>( pBuf+10 ) = ( SHORT ) pMF->xExt;
*reinterpret_cast<short*>( pBuf+12 ) = ( SHORT ) pMF->yExt;
*reinterpret_cast<short*>( pBuf+14 ) = ( USHORT ) 2540;
if ( nBufSize && nBufSize == GetMetaFileBitsEx( pMF->hMF, nBufSize, pBuf+22 ) )
{
......
......@@ -52,15 +52,15 @@ public:
// XInsertObjectDialog
virtual css::embed::InsertedObjectInfo SAL_CALL createInstanceByDialog( const css::uno::Reference< css::embed::XStorage >& xStorage, const OUString& sEntName, const css::uno::Sequence< css::beans::PropertyValue >& lObjArgs ) throw (css::lang::IllegalArgumentException, css::io::IOException, css::uno::Exception, css::uno::RuntimeException);
virtual css::embed::InsertedObjectInfo SAL_CALL createInstanceByDialog( const css::uno::Reference< css::embed::XStorage >& xStorage, const OUString& sEntName, const css::uno::Sequence< css::beans::PropertyValue >& lObjArgs ) throw (css::lang::IllegalArgumentException, css::io::IOException, css::uno::Exception, css::uno::RuntimeException) override;
// XEmbedObjectClipboardCreator
virtual css::embed::InsertedObjectInfo SAL_CALL createInstanceInitFromClipboard( const css::uno::Reference< css::embed::XStorage >& xStorage, const OUString& sEntryName, const css::uno::Sequence< css::beans::PropertyValue >& aObjectArgs ) throw (css::lang::IllegalArgumentException, css::io::IOException, css::uno::Exception, css::uno::RuntimeException);
virtual css::embed::InsertedObjectInfo SAL_CALL createInstanceInitFromClipboard( const css::uno::Reference< css::embed::XStorage >& xStorage, const OUString& sEntryName, const css::uno::Sequence< css::beans::PropertyValue >& aObjectArgs ) throw (css::lang::IllegalArgumentException, css::io::IOException, css::uno::Exception, css::uno::RuntimeException) override;
// XServiceInfo
virtual OUString SAL_CALL getImplementationName() throw (css::uno::RuntimeException);
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (css::uno::RuntimeException);
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (css::uno::RuntimeException);
virtual OUString SAL_CALL getImplementationName() throw (css::uno::RuntimeException) override;
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (css::uno::RuntimeException) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (css::uno::RuntimeException) override;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment