clang-cl loplugin: embedserv

Change-Id: I9901dac882a74453015881ded2355ff0a51b50d5
Reviewed-on: https://gerrit.libreoffice.org/29868
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann
2016-10-14 16:56:18 +02:00
parent d11ac60459
commit 3b658759c9
27 changed files with 797 additions and 813 deletions

View File

@@ -62,13 +62,12 @@
#include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/util/XModifyBroadcaster.hpp> #include <com/sun/star/util/XModifyBroadcaster.hpp>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <o3tl/any.hxx>
#include <osl/diagnose.h> #include <osl/diagnose.h>
#include <rtl/process.h> #include <rtl/process.h>
using namespace ::com::sun::star; using namespace ::com::sun::star;
extern OUString getFilterNameFromGUID_Impl( GUID* );
// add mutex locking ??? // add mutex locking ???
DocumentHolder::DocumentHolder( DocumentHolder::DocumentHolder(
@@ -76,24 +75,24 @@ DocumentHolder::DocumentHolder(
const ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl >& xOleAccess ) const ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl >& xOleAccess )
: :
m_bAllowInPlace(true), m_bAllowInPlace(true),
m_pIOleIPSite(0), m_pIOleIPSite(nullptr),
m_pIOleIPFrame(0), m_pIOleIPFrame(nullptr),
m_pIOleIPUIWindow(0), m_pIOleIPUIWindow(nullptr),
m_pCHatchWin(0), m_pCHatchWin(nullptr),
m_xOleAccess( xOleAccess ), m_xOleAccess( xOleAccess ),
m_pInterceptor(0), m_pInterceptor(nullptr),
m_xFactory( xFactory ), m_xFactory( xFactory ),
m_bOnDeactivate(false), m_bOnDeactivate(false),
m_hWndxWinParent(NULL), m_hWndxWinParent(nullptr),
m_hWndxWinCont(NULL), m_hWndxWinCont(nullptr),
m_nMenuHandle(NULL), m_nMenuHandle(nullptr),
m_nMenuShared(NULL), m_nMenuShared(nullptr),
m_nOLEMenu(NULL), m_nOLEMenu(nullptr),
m_nMacroExecMode( document::MacroExecMode::USE_CONFIG ), m_nMacroExecMode( document::MacroExecMode::USE_CONFIG ),
m_bLink( sal_False ) m_bLink( false )
{ {
uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(comphelper::getComponentContext(m_xFactory)); uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(comphelper::getComponentContext(m_xFactory));
xDesktop->addTerminateListener( (frame::XTerminateListener*)this ); xDesktop->addTerminateListener( static_cast<frame::XTerminateListener*>(this) );
} }
@@ -105,14 +104,14 @@ DocumentHolder::~DocumentHolder()
} }
void DocumentHolder::LoadDocInFrame( sal_Bool bPluginMode ) void DocumentHolder::LoadDocInFrame( bool bPluginMode )
{ {
uno::Reference<frame::XComponentLoader> xComponentLoader( uno::Reference<frame::XComponentLoader> xComponentLoader(
m_xFrame,uno::UNO_QUERY); m_xFrame,uno::UNO_QUERY);
if( xComponentLoader.is() && m_xDocument.is() ) if( xComponentLoader.is() && m_xDocument.is() )
{ {
uno::Reference< task::XInteractionHandler2 > xHandler( uno::Reference< task::XInteractionHandler2 > xHandler(
task::InteractionHandler::createWithParent(comphelper::getComponentContext(m_xFactory), 0) ); task::InteractionHandler::createWithParent(comphelper::getComponentContext(m_xFactory), nullptr) );
sal_Int32 nLen = 3; sal_Int32 nLen = 3;
uno::Sequence<beans::PropertyValue> aSeq( nLen ); uno::Sequence<beans::PropertyValue> aSeq( nLen );
@@ -159,8 +158,8 @@ void DocumentHolder::LoadDocInFrame( sal_Bool bPluginMode )
beans::PropertyState_DIRECT_VALUE); beans::PropertyState_DIRECT_VALUE);
xComponentLoader->loadComponentFromURL( xComponentLoader->loadComponentFromURL(
OUString("private:object"), "private:object",
OUString("_self"), "_self",
0, 0,
aSeq); aSeq);
@@ -192,7 +191,7 @@ void DocumentHolder::DisableInplaceActivation(BOOL b)
BOOL DocumentHolder::isActive() const BOOL DocumentHolder::isActive() const
{ {
return m_pIOleIPSite != 0; return m_pIOleIPSite != nullptr;
} }
HRESULT DocumentHolder::InPlaceActivate( HRESULT DocumentHolder::InPlaceActivate(
@@ -210,10 +209,10 @@ HRESULT DocumentHolder::InPlaceActivate(
RECT rcClip; RECT rcClip;
OLEINPLACEFRAMEINFO frameInfo; OLEINPLACEFRAMEINFO frameInfo;
if (NULL==pActiveSite) if (nullptr==pActiveSite)
return ResultFromScode(E_INVALIDARG); return ResultFromScode(E_INVALIDARG);
if (NULL!=m_pIOleIPSite) if (nullptr!=m_pIOleIPSite)
{ {
if (fIncludeUI) if (fIncludeUI)
UIActivate(); UIActivate();
@@ -227,7 +226,7 @@ HRESULT DocumentHolder::InPlaceActivate(
//1. Initialization, obtaining interfaces, OnInPlaceActivate. //1. Initialization, obtaining interfaces, OnInPlaceActivate.
hr=pActiveSite->QueryInterface( hr=pActiveSite->QueryInterface(
IID_IOleInPlaceSite, IID_IOleInPlaceSite,
(void**) &m_pIOleIPSite); reinterpret_cast<void**>(&m_pIOleIPSite));
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
@@ -236,7 +235,8 @@ HRESULT DocumentHolder::InPlaceActivate(
if (NOERROR!=hr) if (NOERROR!=hr)
{ {
m_pIOleIPSite->Release(), m_pIOleIPSite=NULL; m_pIOleIPSite->Release();
m_pIOleIPSite=nullptr;
return ResultFromScode(E_FAIL); return ResultFromScode(E_FAIL);
} }
@@ -255,13 +255,13 @@ HRESULT DocumentHolder::InPlaceActivate(
// initialize the office as, with hwnd as parentwindow // initialize the office as, with hwnd as parentwindow
uno::Any aAny; uno::Any aAny;
uno::Sequence<sal_Int8> aProcessIdent(16); uno::Sequence<sal_Int8> aProcessIdent(16);
rtl_getGlobalProcessId((sal_uInt8*)aProcessIdent.getArray()); rtl_getGlobalProcessId(reinterpret_cast<sal_uInt8*>(aProcessIdent.getArray()));
try try
{ {
if(!m_xEditWindow.is()) if(!m_xEditWindow.is())
{ // determine XWindow and window handle of parent { // determine XWindow and window handle of parent
HWND hWndxWinParent(0); HWND hWndxWinParent(nullptr);
uno::Reference<awt::XWindow> xWin; uno::Reference<awt::XWindow> xWin;
uno::Reference<awt::XToolkit2> xToolkit = uno::Reference<awt::XToolkit2> xToolkit =
@@ -272,14 +272,15 @@ HRESULT DocumentHolder::InPlaceActivate(
m_pCHatchWin = new winwrap::CHatchWin( m_pCHatchWin = new winwrap::CHatchWin(
m_hInstance,this); m_hInstance,this);
if(m_pCHatchWin->Init(hWndSite,/*ID_HATCHWINDOW*/2000, NULL)) { if(m_pCHatchWin->Init(hWndSite,/*ID_HATCHWINDOW*/2000, nullptr)) {
m_pCHatchWin->RectsSet(&rcPos,&rcClip); //set visible area m_pCHatchWin->RectsSet(&rcPos,&rcClip); //set visible area
hWndxWinParent = m_pCHatchWin->Window(); hWndxWinParent = m_pCHatchWin->Window();
ShowWindow(hWndxWinParent,SW_SHOW); //Make visible. ShowWindow(hWndxWinParent,SW_SHOW); //Make visible.
} }
else { else {
// no success initializing hatch window // no success initializing hatch window
delete m_pCHatchWin, m_pCHatchWin = 0; delete m_pCHatchWin;
m_pCHatchWin = nullptr;
hWndxWinParent = hWndSite; hWndxWinParent = hWndSite;
} }
@@ -297,7 +298,7 @@ HRESULT DocumentHolder::InPlaceActivate(
rcPos.right-rcPos.left, rcPos.right-rcPos.left,
rcPos.bottom - rcPos.top, rcPos.bottom - rcPos.top,
awt::PosSize::POSSIZE); awt::PosSize::POSSIZE);
xWin->setVisible(sal_True); xWin->setVisible(true);
m_xEditWindow = xWin; m_xEditWindow = xWin;
m_hWndxWinParent = hWndxWinParent; m_hWndxWinParent = hWndxWinParent;
@@ -320,7 +321,7 @@ HRESULT DocumentHolder::InPlaceActivate(
0, 0,
0, 0,
awt::PosSize::POSSIZE); awt::PosSize::POSSIZE);
m_xEditWindow->setVisible(sal_True); m_xEditWindow->setVisible(true);
} }
if(m_xContainerWindow.is()) { if(m_xContainerWindow.is()) {
@@ -350,7 +351,7 @@ HRESULT DocumentHolder::InPlaceActivate(
m_xLayoutManager->setDockingAreaAcceptor(this); m_xLayoutManager->setDockingAreaAcceptor(this);
// load the model into the frame // load the model into the frame
LoadDocInFrame( sal_True ); LoadDocInFrame( true );
uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(comphelper::getComponentContext(m_xFactory)); uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(comphelper::getComponentContext(m_xFactory));
xDesktop->getFrames()->append(m_xFrame); xDesktop->getFrames()->append(m_xFrame);
@@ -359,8 +360,7 @@ HRESULT DocumentHolder::InPlaceActivate(
if(m_xLayoutManager.is()) { if(m_xLayoutManager.is()) {
uno::Reference< css::ui::XUIElement > xUIEl( uno::Reference< css::ui::XUIElement > xUIEl(
m_xLayoutManager->getElement( m_xLayoutManager->getElement(
OUString( "private:resource/menubar/menubar"));
"private:resource/menubar/menubar")));
OSL_ENSURE(xUIEl.is(),"no menubar"); OSL_ENSURE(xUIEl.is(),"no menubar");
uno::Reference<awt::XSystemDependentMenuPeer> xSDMP( uno::Reference<awt::XSystemDependentMenuPeer> xSDMP(
xUIEl->getRealInterface(), xUIEl->getRealInterface(),
@@ -371,8 +371,7 @@ HRESULT DocumentHolder::InPlaceActivate(
if( aAny >>= tmp ) if( aAny >>= tmp )
m_nMenuHandle = HMENU(tmp); m_nMenuHandle = HMENU(tmp);
m_xLayoutManager->hideElement( m_xLayoutManager->hideElement(
OUString( "private:resource/menubar/menubar" );
"private:resource/menubar/menubar" ));
} }
} }
@@ -419,13 +418,13 @@ void DocumentHolder::InPlaceDeactivate()
if(m_xEditWindow.is()) { if(m_xEditWindow.is()) {
m_xEditWindow->setVisible(false); m_xEditWindow->setVisible(false);
ShowWindow(m_hWndxWinParent,SW_HIDE); ShowWindow(m_hWndxWinParent,SW_HIDE);
SetParent(m_hWndxWinParent,0); SetParent(m_hWndxWinParent,nullptr);
} }
if(m_xContainerWindow.is()) { if(m_xContainerWindow.is()) {
m_xContainerWindow->setVisible(false); m_xContainerWindow->setVisible(false);
ShowWindow(m_hWndxWinCont,SW_HIDE); ShowWindow(m_hWndxWinCont,SW_HIDE);
SetParent(m_hWndxWinCont,0); SetParent(m_hWndxWinCont,nullptr);
} }
// TODO/cd: Workaround for status indicator bug. It always makes the // TODO/cd: Workaround for status indicator bug. It always makes the
@@ -435,12 +434,12 @@ void DocumentHolder::InPlaceDeactivate()
if (m_xLayoutManager.is()) if (m_xLayoutManager.is())
m_xLayoutManager->setVisible(false); m_xLayoutManager->setVisible(false);
if (NULL!=m_pIOleIPSite) if (nullptr!=m_pIOleIPSite)
m_pIOleIPSite->OnInPlaceDeactivate(); m_pIOleIPSite->OnInPlaceDeactivate();
if(m_pIOleIPFrame) m_pIOleIPFrame->Release(); m_pIOleIPFrame = 0; if(m_pIOleIPFrame) m_pIOleIPFrame->Release(); m_pIOleIPFrame = nullptr;
if(m_pIOleIPUIWindow) m_pIOleIPUIWindow->Release(); m_pIOleIPUIWindow = 0; if(m_pIOleIPUIWindow) m_pIOleIPUIWindow->Release(); m_pIOleIPUIWindow = nullptr;
if(m_pIOleIPSite) m_pIOleIPSite->Release(); m_pIOleIPSite = 0; if(m_pIOleIPSite) m_pIOleIPSite->Release(); m_pIOleIPSite = nullptr;
if ( m_xOleAccess.is() ) if ( m_xOleAccess.is() )
{ {
@@ -458,7 +457,7 @@ void DocumentHolder::InPlaceDeactivate()
HRESULT DocumentHolder::UIActivate() HRESULT DocumentHolder::UIActivate()
{ {
// 1. Call IOleInPlaceSite::UIActivate // 1. Call IOleInPlaceSite::UIActivate
if (NULL!=m_pIOleIPSite) if (nullptr!=m_pIOleIPSite)
m_pIOleIPSite->OnUIActivate(); m_pIOleIPSite->OnUIActivate();
//2. Critical for accelerators to work initially. //2. Critical for accelerators to work initially.
@@ -470,11 +469,11 @@ HRESULT DocumentHolder::UIActivate()
OLECHAR starOffice[] = {'S','t','a','r','O','f','f','i','c','e',0}; OLECHAR starOffice[] = {'S','t','a','r','O','f','f','i','c','e',0};
CComPtr< IOleInPlaceActiveObject > pObj = new CIIAObj( this ); CComPtr< IOleInPlaceActiveObject > pObj = new CIIAObj( this );
if (NULL!=m_pIOleIPFrame) if (nullptr!=m_pIOleIPFrame)
m_pIOleIPFrame->SetActiveObject( m_pIOleIPFrame->SetActiveObject(
pObj, starOffice ); pObj, starOffice );
if (NULL!=m_pIOleIPUIWindow) if (nullptr!=m_pIOleIPUIWindow)
m_pIOleIPUIWindow->SetActiveObject( m_pIOleIPUIWindow->SetActiveObject(
pObj, starOffice ); pObj, starOffice );
@@ -489,14 +488,14 @@ void DocumentHolder::UIDeactivate()
//1. Remove the shared menu. //1. Remove the shared menu.
InPlaceMenuDestroy(); InPlaceMenuDestroy();
if (NULL!=m_pIOleIPFrame) if (nullptr!=m_pIOleIPFrame)
m_pIOleIPFrame->SetActiveObject(NULL, NULL); m_pIOleIPFrame->SetActiveObject(nullptr, nullptr);
if (NULL!=m_pIOleIPUIWindow) if (nullptr!=m_pIOleIPUIWindow)
m_pIOleIPUIWindow->SetActiveObject(NULL, NULL); m_pIOleIPUIWindow->SetActiveObject(nullptr, nullptr);
//3. Call IOleInPlaceSite::OnUIDeactivate //3. Call IOleInPlaceSite::OnUIDeactivate
if (NULL!=m_pIOleIPSite) if (nullptr!=m_pIOleIPSite)
m_pIOleIPSite->OnUIDeactivate(FALSE); m_pIOleIPSite->OnUIDeactivate(FALSE);
return; return;
@@ -504,7 +503,7 @@ void DocumentHolder::UIDeactivate()
void CopyToOLEMenu(HMENU hOrig,WORD origPos,HMENU hDest,WORD destPos) void CopyToOLEMenu(HMENU hOrig,WORD origPos,HMENU hDest,WORD destPos)
{ {
HMENU subMenu(NULL); HMENU subMenu(nullptr);
UINT uTemp = MF_BYPOSITION | MF_POPUP; UINT uTemp = MF_BYPOSITION | MF_POPUP;
char buffer[256]; char buffer[256];
@@ -561,11 +560,11 @@ BOOL DocumentHolder::InPlaceMenuCreate()
uno::Reference<awt::XSystemDependentWindowPeer> xSysDepWin(m_xContainerWindow,uno::UNO_QUERY); uno::Reference<awt::XSystemDependentWindowPeer> xSysDepWin(m_xContainerWindow,uno::UNO_QUERY);
if(xSysDepWin.is()) { if(xSysDepWin.is()) {
uno::Sequence<sal_Int8> aProcessIdent(16); uno::Sequence<sal_Int8> aProcessIdent(16);
rtl_getGlobalProcessId((sal_uInt8*)aProcessIdent.getArray()); rtl_getGlobalProcessId(reinterpret_cast<sal_uInt8*>(aProcessIdent.getArray()));
uno::Any aAny = xSysDepWin->getWindowHandle(aProcessIdent,lang::SystemDependent::SYSTEM_WIN32); uno::Any aAny = xSysDepWin->getWindowHandle(aProcessIdent,lang::SystemDependent::SYSTEM_WIN32);
sal_Int64 tmp; sal_Int64 tmp;
aAny >>= tmp; aAny >>= tmp;
HWND aHwnd = (HWND) tmp; HWND aHwnd = reinterpret_cast<HWND>(tmp);
m_pIOleIPFrame->SetMenu( m_pIOleIPFrame->SetMenu(
m_nMenuShared,m_nOLEMenu,aHwnd); m_nMenuShared,m_nOLEMenu,aHwnd);
} }
@@ -577,12 +576,13 @@ BOOL DocumentHolder::InPlaceMenuCreate()
BOOL DocumentHolder::InPlaceMenuDestroy() BOOL DocumentHolder::InPlaceMenuDestroy()
{ {
if( NULL == m_nMenuShared ) if( nullptr == m_nMenuShared )
return TRUE; return TRUE;
m_pIOleIPFrame->SetMenu(NULL,NULL,NULL); m_pIOleIPFrame->SetMenu(nullptr,nullptr,nullptr);
OleDestroyMenuDescriptor(m_nOLEMenu),m_nOLEMenu = NULL; OleDestroyMenuDescriptor(m_nOLEMenu);
m_nOLEMenu = nullptr;
return TRUE; return TRUE;
} }
@@ -602,15 +602,15 @@ void DocumentHolder::FreeOffice()
{ {
uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(comphelper::getComponentContext(m_xFactory)); uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(comphelper::getComponentContext(m_xFactory));
xDesktop->removeTerminateListener( xDesktop->removeTerminateListener(
(frame::XTerminateListener*)this ); static_cast<frame::XTerminateListener*>(this) );
} }
void DocumentHolder::DisconnectFrameDocument( sal_Bool bComplete ) void DocumentHolder::DisconnectFrameDocument( bool bComplete )
{ {
try try
{ {
uno::Reference< util::XModifyBroadcaster > xModifiable( m_xDocument, uno::UNO_QUERY_THROW ); uno::Reference< util::XModifyBroadcaster > xModifiable( m_xDocument, uno::UNO_QUERY_THROW );
xModifiable->removeModifyListener( (util::XModifyListener*)this ); xModifiable->removeModifyListener( static_cast<util::XModifyListener*>(this) );
} }
catch( const uno::Exception& ) catch( const uno::Exception& )
{} {}
@@ -619,7 +619,7 @@ void DocumentHolder::DisconnectFrameDocument( sal_Bool bComplete )
{ {
uno::Reference< util::XCloseBroadcaster > xBroadcaster( uno::Reference< util::XCloseBroadcaster > xBroadcaster(
m_xDocument, uno::UNO_QUERY_THROW ); m_xDocument, uno::UNO_QUERY_THROW );
xBroadcaster->removeCloseListener( (util::XCloseListener*)this ); xBroadcaster->removeCloseListener( static_cast<util::XCloseListener*>(this) );
} }
catch( const uno::Exception& ) catch( const uno::Exception& )
{} {}
@@ -628,7 +628,7 @@ void DocumentHolder::DisconnectFrameDocument( sal_Bool bComplete )
{ {
uno::Reference< util::XCloseBroadcaster > xBroadcaster( uno::Reference< util::XCloseBroadcaster > xBroadcaster(
m_xFrame, uno::UNO_QUERY_THROW ); m_xFrame, uno::UNO_QUERY_THROW );
xBroadcaster->removeCloseListener( (util::XCloseListener*)this ); xBroadcaster->removeCloseListener( static_cast<util::XCloseListener*>(this) );
} }
catch( const uno::Exception& ) catch( const uno::Exception& )
{} {}
@@ -636,7 +636,7 @@ void DocumentHolder::DisconnectFrameDocument( sal_Bool bComplete )
if ( bComplete ) if ( bComplete )
{ {
m_xFrame.clear(); m_xFrame.clear();
m_pIDispatch = NULL; m_pIDispatch = nullptr;
m_xDocument.clear(); m_xDocument.clear();
} }
} }
@@ -652,13 +652,13 @@ void DocumentHolder::CloseDocument()
{ {
try try
{ {
xCloseable->close( sal_True ); xCloseable->close( true );
} }
catch( const uno::Exception& ) catch( const uno::Exception& )
{} {}
} }
m_pIDispatch = NULL; m_pIDispatch = nullptr;
m_xDocument.clear(); m_xDocument.clear();
} }
@@ -669,7 +669,7 @@ void DocumentHolder::CloseFrame()
{ {
uno::Reference< util::XCloseBroadcaster > xBroadcaster( uno::Reference< util::XCloseBroadcaster > xBroadcaster(
m_xFrame, uno::UNO_QUERY_THROW ); m_xFrame, uno::UNO_QUERY_THROW );
xBroadcaster->removeCloseListener( (util::XCloseListener*)this ); xBroadcaster->removeCloseListener( static_cast<util::XCloseListener*>(this) );
} }
catch( const uno::Exception& ) catch( const uno::Exception& )
{} {}
@@ -678,7 +678,7 @@ void DocumentHolder::CloseFrame()
m_xFrame,uno::UNO_QUERY); m_xFrame,uno::UNO_QUERY);
if(xCloseable.is()) if(xCloseable.is())
try { try {
xCloseable->close(sal_True); xCloseable->close(true);
} }
catch( const uno::Exception& ) { catch( const uno::Exception& ) {
} }
@@ -691,7 +691,7 @@ void DocumentHolder::CloseFrame()
m_xFrame.clear(); m_xFrame.clear();
} }
void DocumentHolder::SetDocument( const uno::Reference< frame::XModel >& xDoc, sal_Bool bLink ) void DocumentHolder::SetDocument( const uno::Reference< frame::XModel >& xDoc, bool bLink )
{ {
if ( m_xDocument.is() ) if ( m_xDocument.is() )
CloseDocument(); CloseDocument();
@@ -703,19 +703,19 @@ void DocumentHolder::SetDocument( const uno::Reference< frame::XModel >& xDoc, s
m_xDocument, uno::UNO_QUERY ); m_xDocument, uno::UNO_QUERY );
if ( xBroadcaster.is() ) if ( xBroadcaster.is() )
xBroadcaster->addCloseListener( (util::XCloseListener*)this ); xBroadcaster->addCloseListener( static_cast<util::XCloseListener*>(this) );
if ( m_xDocument.is() && !m_bLink ) if ( m_xDocument.is() && !m_bLink )
{ {
// set the document mode to embedded // set the document mode to embedded
uno::Sequence< beans::PropertyValue > aSeq(1); uno::Sequence< beans::PropertyValue > aSeq(1);
aSeq[0].Name = "SetEmbedded"; aSeq[0].Name = "SetEmbedded";
aSeq[0].Value <<= sal_True; aSeq[0].Value <<= true;
m_xDocument->attachResource(OUString(),aSeq); m_xDocument->attachResource(OUString(),aSeq);
} }
} }
sal_Bool DocumentHolder::ExecuteSuspendCloseFrame() bool DocumentHolder::ExecuteSuspendCloseFrame()
{ {
if ( m_xFrame.is() && m_xFactory.is() ) if ( m_xFrame.is() && m_xFactory.is() )
{ {
@@ -724,15 +724,15 @@ sal_Bool DocumentHolder::ExecuteSuspendCloseFrame()
uno::Reference< frame::XController > xController = m_xFrame->getController(); uno::Reference< frame::XController > xController = m_xFrame->getController();
if ( xController.is() ) if ( xController.is() )
{ {
if ( !xController->suspend( sal_True ) ) if ( !xController->suspend( true ) )
return sal_False; return false;
FreeOffice(); FreeOffice();
try try
{ {
uno::Reference<util::XCloseable> xCloseable( m_xFrame, uno::UNO_QUERY ); uno::Reference<util::XCloseable> xCloseable( m_xFrame, uno::UNO_QUERY );
if ( xCloseable.is() ) if ( xCloseable.is() )
xCloseable->close(sal_True); xCloseable->close(true);
else else
{ {
m_xFrame->dispose(); m_xFrame->dispose();
@@ -741,7 +741,7 @@ sal_Bool DocumentHolder::ExecuteSuspendCloseFrame()
catch( const util::CloseVetoException& ) catch( const util::CloseVetoException& )
{ {
// should be called if the frame could not be closed // should be called if the frame could not be closed
xController->suspend( sal_False ); xController->suspend( false );
} }
} }
} }
@@ -752,7 +752,7 @@ sal_Bool DocumentHolder::ExecuteSuspendCloseFrame()
m_xFrame.clear(); m_xFrame.clear();
} }
return sal_True; return true;
} }
uno::Reference< frame::XFrame2 > DocumentHolder::DocumentFrame() uno::Reference< frame::XFrame2 > DocumentHolder::DocumentFrame()
@@ -767,14 +767,14 @@ uno::Reference< frame::XFrame2 > DocumentHolder::DocumentFrame()
// is loaded into the frame in ::show() method the terminate listener will be removed // is loaded into the frame in ::show() method the terminate listener will be removed
// this is so only for outplace activation // this is so only for outplace activation
if( xFrame.is() ) if( xFrame.is() )
m_xFrame.set( xFrame->findFrame( OUString("_blank"), 0 ), uno::UNO_QUERY ); m_xFrame.set( xFrame->findFrame( "_blank", 0 ), uno::UNO_QUERY );
uno::Reference< util::XCloseBroadcaster > xBroadcaster( uno::Reference< util::XCloseBroadcaster > xBroadcaster(
m_xFrame, uno::UNO_QUERY ); m_xFrame, uno::UNO_QUERY );
if ( xBroadcaster.is() ) if ( xBroadcaster.is() )
{ {
xBroadcaster->addCloseListener( (util::XCloseListener*)this ); xBroadcaster->addCloseListener( static_cast<util::XCloseListener*>(this) );
FreeOffice(); // the frame is part of the desktop FreeOffice(); // the frame is part of the desktop
} }
} }
@@ -808,14 +808,14 @@ void DocumentHolder::ClearInterceptorInternally()
m_pInterceptor->DisconnectDocHolder(); m_pInterceptor->DisconnectDocHolder();
m_xInterceptorLocker.clear(); m_xInterceptorLocker.clear();
m_pInterceptor = 0; m_pInterceptor = nullptr;
} }
void DocumentHolder::ClearInterceptor() void DocumentHolder::ClearInterceptor()
{ {
::osl::MutexGuard aGuard( m_aMutex ); ::osl::MutexGuard aGuard( m_aMutex );
m_xInterceptorLocker.clear(); m_xInterceptorLocker.clear();
m_pInterceptor = 0; m_pInterceptor = nullptr;
} }
@@ -833,7 +833,7 @@ void DocumentHolder::show()
} }
else if( DocumentFrame().is() ) else if( DocumentFrame().is() )
{ {
LoadDocInFrame( sal_False ); LoadDocInFrame( false );
// get rid of second closer if it is there // get rid of second closer if it is there
uno::Reference< beans::XPropertySet > xLMProps( m_xFrame->getLayoutManager(), uno::UNO_QUERY ); uno::Reference< beans::XPropertySet > xLMProps( m_xFrame->getLayoutManager(), uno::UNO_QUERY );
@@ -848,7 +848,7 @@ void DocumentHolder::show()
try try
{ {
uno::Reference< util::XModifyBroadcaster > xModifiable( m_xDocument, uno::UNO_QUERY_THROW ); uno::Reference< util::XModifyBroadcaster > xModifiable( m_xDocument, uno::UNO_QUERY_THROW );
xModifiable->addModifyListener( (util::XModifyListener*)this ); xModifiable->addModifyListener( static_cast<util::XModifyListener*>(this) );
} }
catch( const uno::Exception& ) catch( const uno::Exception& )
{} {}
@@ -888,7 +888,7 @@ void DocumentHolder::resizeWin( const SIZEL& rNewSize )
if ( aOldSize.cx != rNewSize.cx || aOldSize.cy != rNewSize.cy ) if ( aOldSize.cx != rNewSize.cx || aOldSize.cy != rNewSize.cy )
{ {
HDC hdc = GetDC( NULL ); HDC hdc = GetDC( nullptr );
SetMapMode( hdc, MM_HIMETRIC ); SetMapMode( hdc, MM_HIMETRIC );
POINT aOldOffset; POINT aOldOffset;
@@ -901,7 +901,7 @@ void DocumentHolder::resizeWin( const SIZEL& rNewSize )
aNewOffset.y = rNewSize.cy; aNewOffset.y = rNewSize.cy;
bIsOk = LPtoDP( hdc, &aNewOffset, 1 ); bIsOk = LPtoDP( hdc, &aNewOffset, 1 );
ReleaseDC( NULL, hdc ); ReleaseDC( nullptr, hdc );
awt::Rectangle aWinRect = xWindow->getPosSize(); awt::Rectangle aWinRect = xWindow->getPosSize();
@@ -952,7 +952,7 @@ void DocumentHolder::setTitle(const OUString& aDocumentName)
{ {
for(sal_Int32 j = 0; j < aSeq.getLength(); ++j) for(sal_Int32 j = 0; j < aSeq.getLength(); ++j)
if(aSeq[j].Name == if(aSeq[j].Name ==
OUString("UIName")) "UIName")
{ {
aSeq[j].Value >>= m_aFilterName; aSeq[j].Value >>= m_aFilterName;
break; break;
@@ -985,7 +985,7 @@ void DocumentHolder::setTitle(const OUString& aDocumentName)
{ {
::osl::ClearableMutexGuard aGuard( m_aMutex ); ::osl::ClearableMutexGuard aGuard( m_aMutex );
Interceptor* pTmpInter = NULL; Interceptor* pTmpInter = nullptr;
uno::Reference< frame::XDispatchProviderInterceptor > xLock( m_xInterceptorLocker ); uno::Reference< frame::XDispatchProviderInterceptor > xLock( m_xInterceptorLocker );
if ( xLock.is() && m_pInterceptor ) if ( xLock.is() && m_pInterceptor )
pTmpInter = m_pInterceptor; pTmpInter = m_pInterceptor;
@@ -1025,7 +1025,7 @@ IDispatch* DocumentHolder::GetIDispatch()
if ( xSupplier.is() ) if ( xSupplier.is() )
{ {
uno::Sequence< sal_Int8 > aProcId( 16 ); uno::Sequence< sal_Int8 > aProcId( 16 );
rtl_getGlobalProcessId( (sal_uInt8*)aProcId.getArray() ); rtl_getGlobalProcessId( reinterpret_cast<sal_uInt8*>(aProcId.getArray()) );
try { try {
uno::Any anyResult = xSupplier->createBridge( uno::Any anyResult = xSupplier->createBridge(
@@ -1034,10 +1034,9 @@ IDispatch* DocumentHolder::GetIDispatch()
bridge::ModelDependent::UNO, bridge::ModelDependent::UNO,
bridge::ModelDependent::OLE ); bridge::ModelDependent::OLE );
if ( anyResult.getValueTypeClass() == if ( auto var = o3tl::tryAccess<sal_uIntPtr>(anyResult) )
cppu::UnoType<sal_uIntPtr>::get().getTypeClass() )
{ {
VARIANT* pVariant = *(VARIANT**)anyResult.getValue(); VARIANT* pVariant = reinterpret_cast<VARIANT*>(*var);
if ( pVariant->vt == VT_DISPATCH ) if ( pVariant->vt == VT_DISPATCH )
m_pIDispatch = pVariant->pdispVal; m_pIDispatch = pVariant->pdispVal;
@@ -1154,7 +1153,7 @@ HRESULT DocumentHolder::SetContRects(LPCRECT aRect)
RECT wi; RECT wi;
memset(&wi,0,sizeof(wi)); memset(&wi,0,sizeof(wi));
if(m_pIOleIPFrame) { if(m_pIOleIPFrame) {
m_pIOleIPFrame->GetBorder((LPRECT)&wi); m_pIOleIPFrame->GetBorder(&wi);
m_xContainerWindow->setPosSize( m_xContainerWindow->setPosSize(
0,0, 0,0,
wi.right - wi.left, wi.right - wi.left,
@@ -1177,17 +1176,17 @@ HRESULT DocumentHolder::SetContRects(LPCRECT aRect)
HRESULT DocumentHolder::SetObjectRects(LPCRECT aRect, LPCRECT aClip) HRESULT DocumentHolder::SetObjectRects(LPCRECT aRect, LPCRECT aClip)
{ {
((LPRECT)aRect)->left -= m_aBorder.left; const_cast<LPRECT>(aRect)->left -= m_aBorder.left;
((LPRECT)aRect)->right += m_aBorder.right; const_cast<LPRECT>(aRect)->right += m_aBorder.right;
((LPRECT)aRect)->top -= m_aBorder.top; const_cast<LPRECT>(aRect)->top -= m_aBorder.top;
((LPRECT)aRect)->bottom += m_aBorder.bottom; const_cast<LPRECT>(aRect)->bottom += m_aBorder.bottom;
((LPRECT)aClip)->left -= m_aBorder.left; const_cast<LPRECT>(aClip)->left -= m_aBorder.left;
((LPRECT)aClip)->right += m_aBorder.right; const_cast<LPRECT>(aClip)->right += m_aBorder.right;
((LPRECT)aClip)->top -= m_aBorder.top; const_cast<LPRECT>(aClip)->top -= m_aBorder.top;
((LPRECT)aClip)->bottom += m_aBorder.bottom; const_cast<LPRECT>(aClip)->bottom += m_aBorder.bottom;
if(m_pCHatchWin) if(m_pCHatchWin)
m_pCHatchWin->RectsSet((LPRECT)aRect, (LPRECT)aClip); m_pCHatchWin->RectsSet(const_cast<LPRECT>(aRect), const_cast<LPRECT>(aClip));
if(m_xEditWindow.is()) { if(m_xEditWindow.is()) {
m_xEditWindow->setVisible(false); m_xEditWindow->setVisible(false);
m_xEditWindow->setPosSize( m_xEditWindow->setPosSize(
@@ -1210,7 +1209,7 @@ css::uno::Reference< css::awt::XWindow> SAL_CALL DocumentHolder::getContainerWin
if(m_xContainerWindow.is()) if(m_xContainerWindow.is())
return m_xContainerWindow; return m_xContainerWindow;
uno::Reference<awt::XWindow> xWin(0); uno::Reference<awt::XWindow> xWin(nullptr);
uno::Reference<awt::XToolkit2> xToolkit = awt::Toolkit::create( comphelper::getComponentContext(m_xFactory) ); uno::Reference<awt::XToolkit2> xToolkit = awt::Toolkit::create( comphelper::getComponentContext(m_xFactory) );
@@ -1219,7 +1218,7 @@ css::uno::Reference< css::awt::XWindow> SAL_CALL DocumentHolder::getContainerWin
m_pIOleIPFrame->GetWindow(&hWnd); m_pIOleIPFrame->GetWindow(&hWnd);
uno::Sequence<sal_Int8> aProcessIdent(16); uno::Sequence<sal_Int8> aProcessIdent(16);
rtl_getGlobalProcessId((sal_uInt8*)aProcessIdent.getArray()); rtl_getGlobalProcessId(reinterpret_cast<sal_uInt8*>(aProcessIdent.getArray()));
xWin.set( xWin.set(
xToolkit->createSystemChild( xToolkit->createSystemChild(
@@ -1230,7 +1229,7 @@ css::uno::Reference< css::awt::XWindow> SAL_CALL DocumentHolder::getContainerWin
RECT wi; RECT wi;
memset(&wi,0,sizeof(wi)); memset(&wi,0,sizeof(wi));
if(xWin.is() && m_pIOleIPFrame->GetBorder((LPRECT)&wi) == NOERROR) { if(xWin.is() && m_pIOleIPFrame->GetBorder(&wi) == NOERROR) {
xWin->setVisible(true); xWin->setVisible(true);
xWin->setPosSize( xWin->setPosSize(
0,0, 0,0,
@@ -1245,7 +1244,7 @@ css::uno::Reference< css::awt::XWindow> SAL_CALL DocumentHolder::getContainerWin
aProcessIdent,lang::SystemDependent::SYSTEM_WIN32); aProcessIdent,lang::SystemDependent::SYSTEM_WIN32);
sal_Int64 tmp; sal_Int64 tmp;
if( aAny >>= tmp ) if( aAny >>= tmp )
SetContainerWindowHandle((HWND) tmp); SetContainerWindowHandle(reinterpret_cast<HWND>(tmp));
} }
} }
} }
@@ -1261,16 +1260,16 @@ sal_Bool SAL_CALL DocumentHolder::requestDockingAreaSpace( const css::awt::Recta
) )
{ {
if(m_bOnDeactivate) if(m_bOnDeactivate)
return sal_True; return true;
BORDERWIDTHS bw; BORDERWIDTHS bw;
SetRect((LPRECT)&bw, SetRect(&bw,
RequestedSpace.X,RequestedSpace.Y, RequestedSpace.X,RequestedSpace.Y,
RequestedSpace.Width,RequestedSpace.Height); RequestedSpace.Width,RequestedSpace.Height);
if( m_pIOleIPFrame ) if( m_pIOleIPFrame )
return m_pIOleIPFrame->RequestBorderSpace(&bw) == NOERROR ; return m_pIOleIPFrame->RequestBorderSpace(&bw) == NOERROR ;
else else
return sal_Bool(false); return false;
} }
@@ -1283,7 +1282,7 @@ void SAL_CALL DocumentHolder::setDockingAreaSpace( const css::awt::Rectangle& Bo
return; return;
BORDERWIDTHS bw; BORDERWIDTHS bw;
SetRect((LPRECT)&bw, SetRect(&bw,
BorderSpace.X,BorderSpace.Y, BorderSpace.X,BorderSpace.Y,
BorderSpace.Width,BorderSpace.Height); BorderSpace.Width,BorderSpace.Height);
if( m_pIOleIPFrame ) { if( m_pIOleIPFrame ) {
@@ -1314,7 +1313,7 @@ void SAL_CALL DocumentHolder::disposing( const css::lang::EventObject& aSource )
{ {
if ( m_xDocument.is() && m_xDocument == aSource.Source ) if ( m_xDocument.is() && m_xDocument == aSource.Source )
{ {
m_pIDispatch = NULL; m_pIDispatch = nullptr;
m_xDocument.clear(); m_xDocument.clear();
} }
@@ -1348,7 +1347,7 @@ DocumentHolder::notifyClosing(
{ {
uno::Reference< util::XCloseBroadcaster > xEventBroadcaster( uno::Reference< util::XCloseBroadcaster > xEventBroadcaster(
aSource.Source, uno::UNO_QUERY_THROW ); aSource.Source, uno::UNO_QUERY_THROW );
xEventBroadcaster->removeCloseListener( (util::XCloseListener*)this ); xEventBroadcaster->removeCloseListener( static_cast<util::XCloseListener*>(this) );
} }
catch( const uno::Exception& ) catch( const uno::Exception& )
{} {}
@@ -1356,7 +1355,7 @@ DocumentHolder::notifyClosing(
if ( m_xDocument.is() && m_xDocument == aSource.Source ) if ( m_xDocument.is() && m_xDocument == aSource.Source )
{ {
// can happen only in case of links // can happen only in case of links
m_pIDispatch = NULL; m_pIDispatch = nullptr;
m_xDocument.clear(); m_xDocument.clear();
m_xFrame.clear(); m_xFrame.clear();
@@ -1391,7 +1390,7 @@ DocumentHolder::notifyTermination(
aSource.Source, uno::UNO_QUERY ); aSource.Source, uno::UNO_QUERY );
if ( xDesktop.is() ) if ( xDesktop.is() )
xDesktop->removeTerminateListener( (frame::XTerminateListener*)this ); xDesktop->removeTerminateListener( static_cast<frame::XTerminateListener*>(this) );
} }

View File

@@ -35,7 +35,7 @@ using namespace ::com::sun::star;
// EmbedDocument_Impl // EmbedDocument_Impl
sal_uInt64 EmbedDocument_Impl::getMetaFileHandle_Impl( sal_Bool isEnhMeta ) sal_uInt64 EmbedDocument_Impl::getMetaFileHandle_Impl( bool isEnhMeta )
{ {
sal_uInt64 pResult = NULL; sal_uInt64 pResult = NULL;
@@ -85,13 +85,13 @@ STDMETHODIMP EmbedDocument_Impl::GetData( FORMATETC * pFormatetc, STGMEDIUM * pM
if ( !( pFormatetc->tymed & TYMED_ENHMF ) ) if ( !( pFormatetc->tymed & TYMED_ENHMF ) )
return DV_E_TYMED; return DV_E_TYMED;
HENHMETAFILE hMeta = reinterpret_cast<HENHMETAFILE>( getMetaFileHandle_Impl( sal_True ) ); HENHMETAFILE hMeta = reinterpret_cast<HENHMETAFILE>( getMetaFileHandle_Impl( true ) );
if ( hMeta ) if ( hMeta )
{ {
pMedium->tymed = TYMED_ENHMF; pMedium->tymed = TYMED_ENHMF;
pMedium->hEnhMetaFile = hMeta; pMedium->hEnhMetaFile = hMeta;
pMedium->pUnkForRelease = NULL; pMedium->pUnkForRelease = nullptr;
return S_OK; return S_OK;
} }
@@ -103,13 +103,13 @@ STDMETHODIMP EmbedDocument_Impl::GetData( FORMATETC * pFormatetc, STGMEDIUM * pM
if ( !( pFormatetc->tymed & TYMED_MFPICT ) ) if ( !( pFormatetc->tymed & TYMED_MFPICT ) )
return DV_E_TYMED; return DV_E_TYMED;
HGLOBAL hMeta = reinterpret_cast<HGLOBAL>( getMetaFileHandle_Impl( sal_False ) ); HGLOBAL hMeta = reinterpret_cast<HGLOBAL>( getMetaFileHandle_Impl( false ) );
if ( hMeta ) if ( hMeta )
{ {
pMedium->tymed = TYMED_MFPICT; pMedium->tymed = TYMED_MFPICT;
pMedium->hMetaFilePict = hMeta; pMedium->hMetaFilePict = hMeta;
pMedium->pUnkForRelease = NULL; pMedium->pUnkForRelease = nullptr;
return S_OK; return S_OK;
} }
@@ -126,7 +126,7 @@ STDMETHODIMP EmbedDocument_Impl::GetData( FORMATETC * pFormatetc, STGMEDIUM * pM
return DV_E_TYMED; return DV_E_TYMED;
CComPtr< IStorage > pNewStg; CComPtr< IStorage > pNewStg;
HRESULT hr = StgCreateDocfile( NULL, STGM_CREATE | STGM_READWRITE | STGM_DELETEONRELEASE, 0, &pNewStg ); HRESULT hr = StgCreateDocfile( nullptr, STGM_CREATE | STGM_READWRITE | STGM_DELETEONRELEASE, 0, &pNewStg );
if ( FAILED( hr ) || !pNewStg ) return STG_E_MEDIUMFULL; if ( FAILED( hr ) || !pNewStg ) return STG_E_MEDIUMFULL;
hr = SaveTo_Impl( pNewStg ); hr = SaveTo_Impl( pNewStg );
@@ -135,7 +135,7 @@ STDMETHODIMP EmbedDocument_Impl::GetData( FORMATETC * pFormatetc, STGMEDIUM * pM
pMedium->tymed = TYMED_ISTORAGE; pMedium->tymed = TYMED_ISTORAGE;
pMedium->pstg = pNewStg; pMedium->pstg = pNewStg;
pMedium->pstg->AddRef(); pMedium->pstg->AddRef();
pMedium->pUnkForRelease = ( IUnknown* )pNewStg; pMedium->pUnkForRelease = static_cast<IUnknown*>(pNewStg);
return S_OK; return S_OK;
} }
@@ -171,7 +171,7 @@ STDMETHODIMP EmbedDocument_Impl::GetDataHere( FORMATETC * pFormatetc, STGMEDIUM
if ( FAILED( hr ) ) return STG_E_MEDIUMFULL; if ( FAILED( hr ) ) return STG_E_MEDIUMFULL;
pMedium->tymed = TYMED_ISTORAGE; pMedium->tymed = TYMED_ISTORAGE;
pMedium->pUnkForRelease = NULL; pMedium->pUnkForRelease = nullptr;
return S_OK; return S_OK;
} }
@@ -225,7 +225,7 @@ STDMETHODIMP EmbedDocument_Impl::GetCanonicalFormatEtc( FORMATETC * pFormatetcIn
if ( !pFormatetcIn || !pFormatetcOut ) if ( !pFormatetcIn || !pFormatetcOut )
return DV_E_FORMATETC; return DV_E_FORMATETC;
pFormatetcOut->ptd = NULL; pFormatetcOut->ptd = nullptr;
pFormatetcOut->cfFormat = pFormatetcIn->cfFormat; pFormatetcOut->cfFormat = pFormatetcIn->cfFormat;
pFormatetcOut->dwAspect = DVASPECT_CONTENT; pFormatetcOut->dwAspect = DVASPECT_CONTENT;
@@ -272,7 +272,7 @@ STDMETHODIMP EmbedDocument_Impl::DAdvise( FORMATETC * pFormatetc, DWORD advf, IA
if ( !SUCCEEDED( CreateDataAdviseHolder( &m_pDAdviseHolder ) ) || !m_pDAdviseHolder ) if ( !SUCCEEDED( CreateDataAdviseHolder( &m_pDAdviseHolder ) ) || !m_pDAdviseHolder )
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
return m_pDAdviseHolder->Advise( (IDataObject*)this, pFormatetc, advf, pAdvSink, pdwConnection ); return m_pDAdviseHolder->Advise( static_cast<IDataObject*>(this), pFormatetc, advf, pAdvSink, pdwConnection );
} }
STDMETHODIMP EmbedDocument_Impl::DUnadvise( DWORD dwConnection ) STDMETHODIMP EmbedDocument_Impl::DUnadvise( DWORD dwConnection )

View File

@@ -26,7 +26,7 @@ STDMETHODIMP EmbedDocument_Impl::GetWindow(HWND *hWnd)
OSL_ENSURE(m_pDocHolder,"no document for inplace activation"); OSL_ENSURE(m_pDocHolder,"no document for inplace activation");
*hWnd = m_pDocHolder->GetTopMostWinHandle(); *hWnd = m_pDocHolder->GetTopMostWinHandle();
if(*hWnd != NULL) if(*hWnd != nullptr)
return NOERROR; return NOERROR;
else else
return ERROR; return ERROR;

View File

@@ -25,10 +25,6 @@
using namespace ::com::sun::star; using namespace ::com::sun::star;
extern OUString getFilterNameFromGUID_Impl( GUID* );
// IOleObject // IOleObject
@@ -51,10 +47,10 @@ STDMETHODIMP EmbedDocument_Impl::SetHostNames( LPCOLESTR szContainerApp, LPCOLES
{ {
m_pDocHolder->setTitle( m_pDocHolder->setTitle(
OUString( OUString(
(sal_Unicode*)szContainerObj)); szContainerObj));
m_pDocHolder->setContainerName( m_pDocHolder->setContainerName(
OUString( OUString(
(sal_Unicode*)szContainerApp)); szContainerApp));
} }
return S_OK; return S_OK;
@@ -149,7 +145,7 @@ STDMETHODIMP EmbedDocument_Impl::DoVerb(
return OLEOBJ_S_CANNOT_DOVERB_NOW; return OLEOBJ_S_CANNOT_DOVERB_NOW;
// an object can not handle any Verbs in Hands off mode // an object can not handle any Verbs in Hands off mode
if ( m_pMasterStorage == NULL || m_pOwnStream == NULL ) if ( m_pMasterStorage == nullptr || m_pOwnStream == nullptr )
return OLE_E_CANT_BINDTOSOURCE; return OLE_E_CANT_BINDTOSOURCE;
@@ -427,8 +423,8 @@ HRESULT EmbedDocument_Impl::SaveObject()
OUString aPreservFileName = m_aFileName; OUString aPreservFileName = m_aFileName;
// in case of links the containers does not provide client site sometimes // in case of links the containers does not provide client site sometimes
hr = Save( (LPCOLESTR)NULL, FALSE ); // triggers saving to the link location hr = Save( static_cast<LPCOLESTR>(nullptr), FALSE ); // triggers saving to the link location
SaveCompleted( (LPCOLESTR)aPreservFileName.getStr() ); SaveCompleted( aPreservFileName.getStr() );
} }
notify( false ); notify( false );
@@ -458,7 +454,7 @@ void EmbedDocument_Impl::notify( bool bDataChanged )
iAdvise->second->OnViewChange( DVASPECT_CONTENT, -1 ); iAdvise->second->OnViewChange( DVASPECT_CONTENT, -1 );
if ( m_pDAdviseHolder && bDataChanged ) if ( m_pDAdviseHolder && bDataChanged )
m_pDAdviseHolder->SendOnDataChange( (IDataObject*)this, 0, 0 ); m_pDAdviseHolder->SendOnDataChange( static_cast<IDataObject*>(this), 0, 0 );
} }
void EmbedDocument_Impl::Deactivate() void EmbedDocument_Impl::Deactivate()

View File

@@ -41,9 +41,11 @@
#include <osl/diagnose.h> #include <osl/diagnose.h>
#include <sal/types.h> #include <sal/types.h>
#include <guid.hxx>
#include <string.h> #include <string.h>
#define EXT_STREAM_LENGTH 16 #define EXT_STREAM_LENGTH 4
namespace { namespace {
@@ -53,15 +55,11 @@ const sal_Int32 nConstBufferSize = 32000;
using namespace ::com::sun::star; using namespace ::com::sun::star;
extern OUString getStorageTypeFromGUID_Impl( GUID* guid );
extern OUString getServiceNameFromGUID_Impl( GUID* );
extern OUString getFilterNameFromGUID_Impl( GUID* );
const OUString aOfficeEmbedStreamName( "package_stream" ); const OUString aOfficeEmbedStreamName( "package_stream" );
const OUString aExtentStreamName( "properties_stream" ); const OUString aExtentStreamName( "properties_stream" );
uno::Reference< io::XInputStream > createTempXInStreamFromIStream( uno::Reference< io::XInputStream > createTempXInStreamFromIStream(
uno::Reference< lang::XMultiServiceFactory > xFactory, uno::Reference< lang::XMultiServiceFactory > const & xFactory,
IStream *pStream ) IStream *pStream )
{ {
uno::Reference< io::XInputStream > xResult; uno::Reference< io::XInputStream > xResult;
@@ -88,7 +86,7 @@ uno::Reference< io::XInputStream > createTempXInStreamFromIStream(
sal_uInt32 nRead = 0; sal_uInt32 nRead = 0;
do do
{ {
pStream->Read( (void*)aBuffer.getArray(), nConstBufferSize, &nRead ); pStream->Read( aBuffer.getArray(), nConstBufferSize, &nRead );
if ( nRead < nConstBufferSize ) if ( nRead < nConstBufferSize )
aBuffer.realloc( nRead ); aBuffer.realloc( nRead );
@@ -114,7 +112,7 @@ uno::Reference< io::XInputStream > createTempXInStreamFromIStream(
return xResult; return xResult;
} }
HRESULT copyXTempOutToIStream( uno::Reference< io::XOutputStream > xTempOut, IStream* pStream ) HRESULT copyXTempOutToIStream( uno::Reference< io::XOutputStream > const & xTempOut, IStream* pStream )
{ {
if ( !xTempOut.is() || !pStream ) if ( !xTempOut.is() || !pStream )
return E_FAIL; return E_FAIL;
@@ -152,7 +150,7 @@ HRESULT copyXTempOutToIStream( uno::Reference< io::XOutputStream > xTempOut, ISt
} }
sal_uInt32 nWritten = 0; sal_uInt32 nWritten = 0;
hr = pStream->Write( (void*)aBuffer.getArray(), nReadBytes, &nWritten ); hr = pStream->Write( aBuffer.getArray(), nReadBytes, &nWritten );
if ( !SUCCEEDED( hr ) || nWritten != nReadBytes ) if ( !SUCCEEDED( hr ) || nWritten != nReadBytes )
return E_FAIL; return E_FAIL;
@@ -169,9 +167,9 @@ EmbedDocument_Impl::EmbedDocument_Impl( const uno::Reference< lang::XMultiServic
: m_refCount( 0L ) : m_refCount( 0L )
, m_xFactory( xFactory ) , m_xFactory( xFactory )
, m_guid( *guid ) , m_guid( *guid )
, m_bIsDirty( sal_False ) , m_bIsDirty( false )
, m_nAdviseNum( 0 ) , m_nAdviseNum( 0 )
, m_bIsInVerbHandling( sal_False ) , m_bIsInVerbHandling( false )
//, m_bLoadedFromFile( sal_False ) //, m_bLoadedFromFile( sal_False )
{ {
m_xOwnAccess = new EmbeddedDocumentInstanceAccess_Impl( this ); m_xOwnAccess = new EmbeddedDocumentInstanceAccess_Impl( this );
@@ -186,7 +184,7 @@ EmbedDocument_Impl::~EmbedDocument_Impl()
if ( m_pDocHolder->HasFrame() && m_pDocHolder->IsLink() ) if ( m_pDocHolder->HasFrame() && m_pDocHolder->IsLink() )
{ {
// a link with frame should be only disconnected, not closed // a link with frame should be only disconnected, not closed
m_pDocHolder->DisconnectFrameDocument( sal_True ); m_pDocHolder->DisconnectFrameDocument( true );
} }
else else
{ {
@@ -197,7 +195,7 @@ EmbedDocument_Impl::~EmbedDocument_Impl()
m_pDocHolder->release(); m_pDocHolder->release();
} }
uno::Sequence< beans::PropertyValue > EmbedDocument_Impl::fillArgsForLoading_Impl( uno::Reference< io::XInputStream > xStream, DWORD /*nStreamMode*/, LPCOLESTR pFilePath ) uno::Sequence< beans::PropertyValue > EmbedDocument_Impl::fillArgsForLoading_Impl( uno::Reference< io::XInputStream > const & xStream, DWORD /*nStreamMode*/, LPCOLESTR pFilePath )
{ {
uno::Sequence< beans::PropertyValue > aArgs( 3 ); uno::Sequence< beans::PropertyValue > aArgs( 3 );
@@ -239,7 +237,7 @@ uno::Sequence< beans::PropertyValue > EmbedDocument_Impl::fillArgsForLoading_Imp
return aArgs; return aArgs;
} }
uno::Sequence< beans::PropertyValue > EmbedDocument_Impl::fillArgsForStoring_Impl( uno::Reference< io::XOutputStream > xStream) uno::Sequence< beans::PropertyValue > EmbedDocument_Impl::fillArgsForStoring_Impl( uno::Reference< io::XOutputStream > const & xStream)
{ {
uno::Sequence< beans::PropertyValue > aArgs( xStream.is() ? 2 : 1 ); uno::Sequence< beans::PropertyValue > aArgs( xStream.is() ? 2 : 1 );
@@ -264,7 +262,7 @@ HRESULT EmbedDocument_Impl::SaveTo_Impl( IStorage* pStg )
// should not enter NoScribble mode // should not enter NoScribble mode
CComPtr< IStream > pOrigOwn = m_pOwnStream; CComPtr< IStream > pOrigOwn = m_pOwnStream;
CComPtr< IStream > pOrigExt = m_pExtStream; CComPtr< IStream > pOrigExt = m_pExtStream;
HRESULT hr = Save( pStg, sal_False ); HRESULT hr = Save( pStg, false );
pStg->Commit( STGC_ONLYIFCURRENT ); pStg->Commit( STGC_ONLYIFCURRENT );
m_pOwnStream = pOrigOwn; m_pOwnStream = pOrigOwn;
m_pExtStream = pOrigExt; m_pExtStream = pOrigExt;
@@ -280,65 +278,65 @@ STDMETHODIMP EmbedDocument_Impl::QueryInterface( REFIID riid, void FAR* FAR* ppv
if(IsEqualIID(riid, IID_IUnknown)) if(IsEqualIID(riid, IID_IUnknown))
{ {
AddRef(); AddRef();
*ppv = (IUnknown*) (IPersistStorage*) this; *ppv = static_cast<IUnknown*>(static_cast<IPersistStorage*>(this));
return S_OK; return S_OK;
} }
else if (IsEqualIID(riid, IID_IPersist)) else if (IsEqualIID(riid, IID_IPersist))
{ {
AddRef(); AddRef();
*ppv = (IPersist*) (IPersistStorage*) this; *ppv = static_cast<IPersist*>(static_cast<IPersistStorage*>(this));
return S_OK; return S_OK;
} }
else if (IsEqualIID(riid, IID_IExternalConnection)) else if (IsEqualIID(riid, IID_IExternalConnection))
{ {
AddRef(); AddRef();
*ppv = (IExternalConnection*) this; *ppv = static_cast<IExternalConnection*>(this);
return S_OK; return S_OK;
} }
else if (IsEqualIID(riid, IID_IPersistStorage)) else if (IsEqualIID(riid, IID_IPersistStorage))
{ {
AddRef(); AddRef();
*ppv = (IPersistStorage*) this; *ppv = static_cast<IPersistStorage*>(this);
return S_OK; return S_OK;
} }
else if (IsEqualIID(riid, IID_IDataObject)) else if (IsEqualIID(riid, IID_IDataObject))
{ {
AddRef(); AddRef();
*ppv = (IDataObject*) this; *ppv = static_cast<IDataObject*>(this);
return S_OK; return S_OK;
} }
else if (IsEqualIID(riid, IID_IOleObject)) else if (IsEqualIID(riid, IID_IOleObject))
{ {
AddRef(); AddRef();
*ppv = (IOleObject*) this; *ppv = static_cast<IOleObject*>(this);
return S_OK; return S_OK;
} }
else if (IsEqualIID(riid, IID_IOleWindow)) else if (IsEqualIID(riid, IID_IOleWindow))
{ {
AddRef(); AddRef();
*ppv = (IOleWindow*) this; *ppv = static_cast<IOleWindow*>(this);
return S_OK; return S_OK;
} }
else if (IsEqualIID(riid, IID_IOleInPlaceObject)) else if (IsEqualIID(riid, IID_IOleInPlaceObject))
{ {
AddRef(); AddRef();
*ppv = (IOleInPlaceObject*) this; *ppv = static_cast<IOleInPlaceObject*>(this);
return S_OK; return S_OK;
} }
else if (IsEqualIID(riid, IID_IPersistFile)) else if (IsEqualIID(riid, IID_IPersistFile))
{ {
AddRef(); AddRef();
*ppv = (IPersistFile*) this; *ppv = static_cast<IPersistFile*>(this);
return S_OK; return S_OK;
} }
else if (IsEqualIID(riid, IID_IDispatch)) else if (IsEqualIID(riid, IID_IDispatch))
{ {
AddRef(); AddRef();
*ppv = (IDispatch*) this; *ppv = static_cast<IDispatch*>(this);
return S_OK; return S_OK;
} }
*ppv = NULL; *ppv = nullptr;
return ResultFromScode(E_NOINTERFACE); return ResultFromScode(E_NOINTERFACE);
} }
@@ -427,7 +425,7 @@ STDMETHODIMP EmbedDocument_Impl::InitNew( IStorage *pStg )
CLIPFORMAT cf = (CLIPFORMAT)RegisterClipboardFormatA( "Embedded Object" ); CLIPFORMAT cf = (CLIPFORMAT)RegisterClipboardFormatA( "Embedded Object" );
hr = WriteFmtUserTypeStg( pStg, hr = WriteFmtUserTypeStg( pStg,
cf, // ??? cf, // ???
reinterpret_cast<LPWSTR>(( sal_Unicode* )aCurType.getStr()) ); const_cast<sal_Unicode *>(aCurType.getStr()) );
if ( hr == S_OK ) if ( hr == S_OK )
{ {
@@ -449,7 +447,7 @@ STDMETHODIMP EmbedDocument_Impl::InitNew( IStorage *pStg )
{ {
m_pMasterStorage = pStg; m_pMasterStorage = pStg;
m_bIsDirty = sal_True; m_bIsDirty = true;
} }
else else
hr = E_FAIL; hr = E_FAIL;
@@ -486,7 +484,7 @@ STDMETHODIMP EmbedDocument_Impl::Load( IStorage *pStg )
DWORD nStreamMode = aStat.grfMode; DWORD nStreamMode = aStat.grfMode;
hr = pStg->OpenStream( reinterpret_cast<LPCWSTR>(aOfficeEmbedStreamName.getStr()), hr = pStg->OpenStream( reinterpret_cast<LPCWSTR>(aOfficeEmbedStreamName.getStr()),
0, nullptr,
nStreamMode & 0x73, nStreamMode & 0x73,
0, 0,
&m_pOwnStream ); &m_pOwnStream );
@@ -495,7 +493,7 @@ STDMETHODIMP EmbedDocument_Impl::Load( IStorage *pStg )
if ( SUCCEEDED( hr ) ) if ( SUCCEEDED( hr ) )
{ {
hr = pStg->OpenStream( reinterpret_cast<LPCWSTR>(aExtentStreamName.getStr()), hr = pStg->OpenStream( reinterpret_cast<LPCWSTR>(aExtentStreamName.getStr()),
0, nullptr,
nStreamMode & 0x73, nStreamMode & 0x73,
0, 0,
&m_pExtStream ); &m_pExtStream );
@@ -512,9 +510,9 @@ STDMETHODIMP EmbedDocument_Impl::Load( IStorage *pStg )
if ( SUCCEEDED( hr ) ) if ( SUCCEEDED( hr ) )
{ {
sal_uInt32 nRead; sal_uInt32 nRead;
sal_Int8 aInf[EXT_STREAM_LENGTH]; sal_Int32 aInf[EXT_STREAM_LENGTH];
hr = m_pExtStream->Read( (void*)aInf, EXT_STREAM_LENGTH, &nRead ); hr = m_pExtStream->Read( aInf, sizeof aInf, &nRead );
if ( nRead != EXT_STREAM_LENGTH ) hr = E_FAIL; if ( nRead != sizeof aInf ) hr = E_FAIL;
if ( SUCCEEDED( hr ) ) if ( SUCCEEDED( hr ) )
{ {
@@ -522,8 +520,8 @@ STDMETHODIMP EmbedDocument_Impl::Load( IStorage *pStg )
// aRectToSet.top = *((sal_Int32*)&aInf[4]); // aRectToSet.top = *((sal_Int32*)&aInf[4]);
// aRectToSet.right = *((sal_Int32*)&aInf[8]); // aRectToSet.right = *((sal_Int32*)&aInf[8]);
// aRectToSet.bottom = *((sal_Int32*)&aInf[12]); // aRectToSet.bottom = *((sal_Int32*)&aInf[12]);
aSizeToSet.cx = *((sal_Int32*)&aInf[8]) - *((sal_Int32*)aInf); aSizeToSet.cx = aInf[2] - aInf[0];
aSizeToSet.cy = *((sal_Int32*)&aInf[12]) - *((sal_Int32*)&aInf[4]); aSizeToSet.cy = aInf[3] - aInf[1];
} }
} }
} }
@@ -589,7 +587,7 @@ STDMETHODIMP EmbedDocument_Impl::Save( IStorage *pStgSave, BOOL fSameAsLoad )
if ( !fSameAsLoad && pStgSave != m_pMasterStorage ) if ( !fSameAsLoad && pStgSave != m_pMasterStorage )
{ {
OSL_ENSURE( m_pMasterStorage, "How could the document be initialized without storage!??\n" ); OSL_ENSURE( m_pMasterStorage, "How could the document be initialized without storage!??\n" );
HRESULT hr = m_pMasterStorage->CopyTo( NULL, NULL, NULL, pStgSave ); HRESULT hr = m_pMasterStorage->CopyTo( NULL, nullptr, nullptr, pStgSave );
if ( FAILED( hr ) ) return E_FAIL; if ( FAILED( hr ) ) return E_FAIL;
STATSTG aStat; STATSTG aStat;
@@ -627,7 +625,7 @@ STDMETHODIMP EmbedDocument_Impl::Save( IStorage *pStgSave, BOOL fSameAsLoad )
{ {
try try
{ {
xStorable->storeToURL( OUString( "private:stream" ), xStorable->storeToURL( "private:stream",
fillArgsForStoring_Impl( xTempOut ) ); fillArgsForStoring_Impl( xTempOut ) );
hr = copyXTempOutToIStream( xTempOut, pTargetStream ); hr = copyXTempOutToIStream( xTempOut, pTargetStream );
if ( SUCCEEDED( hr ) ) if ( SUCCEEDED( hr ) )
@@ -644,14 +642,10 @@ STDMETHODIMP EmbedDocument_Impl::Save( IStorage *pStgSave, BOOL fSameAsLoad )
if ( SUCCEEDED( hr ) ) if ( SUCCEEDED( hr ) )
{ {
sal_uInt32 nWritten; sal_uInt32 nWritten;
sal_Int8 aInf[EXT_STREAM_LENGTH]; sal_Int32 aInf[EXT_STREAM_LENGTH] = {0, 0, aSize.cx, aSize.cy};
*((sal_Int32*)aInf) = 0;
*((sal_Int32*)&aInf[4]) = 0;
*((sal_Int32*)&aInf[8]) = aSize.cx;
*((sal_Int32*)&aInf[12]) = aSize.cy;
hr = pNewExtStream->Write( (void*)aInf, EXT_STREAM_LENGTH, &nWritten ); hr = pNewExtStream->Write( aInf, sizeof aInf, &nWritten );
if ( nWritten != EXT_STREAM_LENGTH ) hr = E_FAIL; if ( nWritten != sizeof aInf ) hr = E_FAIL;
if ( SUCCEEDED( hr ) ) if ( SUCCEEDED( hr ) )
{ {
@@ -661,8 +655,8 @@ STDMETHODIMP EmbedDocument_Impl::Save( IStorage *pStgSave, BOOL fSameAsLoad )
{ {
uno::Reference< util::XModifiable > xMod( m_pDocHolder->GetDocument(), uno::UNO_QUERY ); uno::Reference< util::XModifiable > xMod( m_pDocHolder->GetDocument(), uno::UNO_QUERY );
if ( xMod.is() ) if ( xMod.is() )
xMod->setModified( sal_False ); xMod->setModified( false );
m_bIsDirty = sal_False; m_bIsDirty = false;
} }
} }
} }
@@ -697,20 +691,20 @@ STDMETHODIMP EmbedDocument_Impl::SaveCompleted( IStorage *pStgNew )
DWORD nStreamMode = aStat.grfMode; DWORD nStreamMode = aStat.grfMode;
hr = m_pMasterStorage->OpenStream( reinterpret_cast<LPCWSTR>(aOfficeEmbedStreamName.getStr()), hr = m_pMasterStorage->OpenStream( reinterpret_cast<LPCWSTR>(aOfficeEmbedStreamName.getStr()),
0, nullptr,
nStreamMode & 0x73, nStreamMode & 0x73,
0, 0,
&m_pOwnStream ); &m_pOwnStream );
if ( FAILED( hr ) || !m_pOwnStream ) return E_OUTOFMEMORY; if ( FAILED( hr ) || !m_pOwnStream ) return E_OUTOFMEMORY;
hr = m_pMasterStorage->OpenStream( reinterpret_cast<LPCWSTR>(aExtentStreamName.getStr()), hr = m_pMasterStorage->OpenStream( reinterpret_cast<LPCWSTR>(aExtentStreamName.getStr()),
0, nullptr,
nStreamMode & 0x73, nStreamMode & 0x73,
0, 0,
&m_pExtStream ); &m_pExtStream );
if ( FAILED( hr ) || !m_pExtStream ) return E_OUTOFMEMORY; if ( FAILED( hr ) || !m_pExtStream ) return E_OUTOFMEMORY;
sal_Bool bModified = sal_False; bool bModified = false;
uno::Reference< util::XModifiable > xMod( m_pDocHolder->GetDocument(), uno::UNO_QUERY ); uno::Reference< util::XModifiable > xMod( m_pDocHolder->GetDocument(), uno::UNO_QUERY );
if ( xMod.is() ) if ( xMod.is() )
bModified = xMod->isModified(); bModified = xMod->isModified();
@@ -748,7 +742,7 @@ STDMETHODIMP EmbedDocument_Impl::Load( LPCOLESTR pszFileName, DWORD /*dwMode*/ )
return E_FAIL; return E_FAIL;
DWORD nStreamMode = STGM_CREATE | STGM_READWRITE | STGM_DELETEONRELEASE | STGM_SHARE_EXCLUSIVE; DWORD nStreamMode = STGM_CREATE | STGM_READWRITE | STGM_DELETEONRELEASE | STGM_SHARE_EXCLUSIVE;
HRESULT hr = StgCreateDocfile( NULL, HRESULT hr = StgCreateDocfile( nullptr,
nStreamMode , nStreamMode ,
0, 0,
&m_pMasterStorage ); &m_pMasterStorage );
@@ -759,7 +753,7 @@ STDMETHODIMP EmbedDocument_Impl::Load( LPCOLESTR pszFileName, DWORD /*dwMode*/ )
CLIPFORMAT cf = (CLIPFORMAT)RegisterClipboardFormatA( "Embedded Object" ); CLIPFORMAT cf = (CLIPFORMAT)RegisterClipboardFormatA( "Embedded Object" );
hr = WriteFmtUserTypeStg( m_pMasterStorage, hr = WriteFmtUserTypeStg( m_pMasterStorage,
cf, // ??? cf, // ???
reinterpret_cast<LPWSTR>(( sal_Unicode* )aCurType.getStr()) ); const_cast<sal_Unicode *>(aCurType.getStr()) );
if ( FAILED( hr ) ) return E_FAIL; if ( FAILED( hr ) ) return E_FAIL;
hr = m_pMasterStorage->SetClass( m_guid ); hr = m_pMasterStorage->SetClass( m_guid );
@@ -785,7 +779,7 @@ STDMETHODIMP EmbedDocument_Impl::Load( LPCOLESTR pszFileName, DWORD /*dwMode*/ )
uno::UNO_QUERY ); uno::UNO_QUERY );
if ( aDocument.is() ) if ( aDocument.is() )
{ {
m_pDocHolder->SetDocument( aDocument, sal_True ); m_pDocHolder->SetDocument( aDocument, true );
uno::Reference< frame::XLoadable > xLoadable( m_pDocHolder->GetDocument(), uno::UNO_QUERY ); uno::Reference< frame::XLoadable > xLoadable( m_pDocHolder->GetDocument(), uno::UNO_QUERY );
if( xLoadable.is() ) if( xLoadable.is() )
@@ -810,7 +804,7 @@ STDMETHODIMP EmbedDocument_Impl::Load( LPCOLESTR pszFileName, DWORD /*dwMode*/ )
cf = (CLIPFORMAT)RegisterClipboardFormatA( "Embedded Object" ); cf = (CLIPFORMAT)RegisterClipboardFormatA( "Embedded Object" );
hr = WriteFmtUserTypeStg( m_pMasterStorage, hr = WriteFmtUserTypeStg( m_pMasterStorage,
cf, // ??? cf, // ???
reinterpret_cast<LPWSTR>(( sal_Unicode* )aCurType.getStr()) ); const_cast<sal_Unicode *>(aCurType.getStr()) );
if ( SUCCEEDED( hr ) ) if ( SUCCEEDED( hr ) )
{ {
@@ -826,20 +820,16 @@ STDMETHODIMP EmbedDocument_Impl::Load( LPCOLESTR pszFileName, DWORD /*dwMode*/ )
if ( SUCCEEDED( hr ) ) if ( SUCCEEDED( hr ) )
{ {
sal_uInt32 nWritten; sal_uInt32 nWritten;
sal_Int8 aInf[EXT_STREAM_LENGTH]; sal_Int32 aInf[EXT_STREAM_LENGTH] = {0, 0, aSize.cx, aSize.cy};
*((sal_Int32*)aInf) = 0;
*((sal_Int32*)&aInf[4]) = 0;
*((sal_Int32*)&aInf[8]) = aSize.cx;
*((sal_Int32*)&aInf[12]) = aSize.cy;
hr = m_pExtStream->Write( (void*)aInf, EXT_STREAM_LENGTH, &nWritten ); hr = m_pExtStream->Write( aInf, sizeof aInf, &nWritten );
if ( nWritten != EXT_STREAM_LENGTH ) hr = E_FAIL; if ( nWritten != sizeof aInf ) hr = E_FAIL;
} }
} }
} }
if ( SUCCEEDED( hr ) ) if ( SUCCEEDED( hr ) )
m_bIsDirty = sal_True; m_bIsDirty = true;
else else
hr = E_FAIL; hr = E_FAIL;
} }
@@ -847,9 +837,9 @@ STDMETHODIMP EmbedDocument_Impl::Load( LPCOLESTR pszFileName, DWORD /*dwMode*/ )
if ( FAILED( hr ) ) if ( FAILED( hr ) )
{ {
m_pDocHolder->CloseDocument(); m_pDocHolder->CloseDocument();
m_pOwnStream = NULL; m_pOwnStream = nullptr;
m_pExtStream = NULL; m_pExtStream = nullptr;
m_pMasterStorage = NULL; m_pMasterStorage = nullptr;
} }
} }
@@ -912,7 +902,7 @@ STDMETHODIMP EmbedDocument_Impl::GetCurFile( LPOLESTR *ppszFileName )
HRESULT hr = CoGetMalloc( 1, &pMalloc ); HRESULT hr = CoGetMalloc( 1, &pMalloc );
if ( FAILED( hr ) || !pMalloc ) return E_FAIL; if ( FAILED( hr ) || !pMalloc ) return E_FAIL;
*ppszFileName = (LPOLESTR)( pMalloc->Alloc( sizeof( sal_Unicode ) * ( m_aFileName.getLength() + 1 ) ) ); *ppszFileName = static_cast<LPOLESTR>( pMalloc->Alloc( sizeof( sal_Unicode ) * ( m_aFileName.getLength() + 1 ) ) );
wcsncpy( *ppszFileName, reinterpret_cast<LPCWSTR>(m_aFileName.getStr()), m_aFileName.getLength() + 1 ); wcsncpy( *ppszFileName, reinterpret_cast<LPCWSTR>(m_aFileName.getStr()), m_aFileName.getLength() + 1 );
return m_aFileName.getLength() ? S_OK : S_FALSE; return m_aFileName.getLength() ? S_OK : S_FALSE;
@@ -928,12 +918,12 @@ LockedEmbedDocument_Impl EmbeddedDocumentInstanceAccess_Impl::GetEmbedDocument()
void EmbeddedDocumentInstanceAccess_Impl::ClearEmbedDocument() void EmbeddedDocumentInstanceAccess_Impl::ClearEmbedDocument()
{ {
::osl::MutexGuard aGuard( m_aMutex ); ::osl::MutexGuard aGuard( m_aMutex );
m_pEmbedDocument = NULL; m_pEmbedDocument = nullptr;
} }
LockedEmbedDocument_Impl::LockedEmbedDocument_Impl() LockedEmbedDocument_Impl::LockedEmbedDocument_Impl()
: m_pEmbedDocument( NULL ) : m_pEmbedDocument( nullptr )
{} {}
LockedEmbedDocument_Impl::LockedEmbedDocument_Impl( EmbedDocument_Impl* pEmbedDocument ) LockedEmbedDocument_Impl::LockedEmbedDocument_Impl( EmbedDocument_Impl* pEmbedDocument )

View File

@@ -67,7 +67,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
if (dwReason == DLL_PROCESS_ATTACH) if (dwReason == DLL_PROCESS_ATTACH)
{ {
_Module.Init(ObjectMap, hInstance, NULL); _Module.Init(ObjectMap, hInstance);
DisableThreadLibraryCalls(hInstance); DisableThreadLibraryCalls(hInstance);
} }
else if (dwReason == DLL_PROCESS_DETACH) else if (dwReason == DLL_PROCESS_DETACH)

View File

@@ -24,6 +24,8 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameAccess.hpp>
#include <guid.hxx>
OUString getStorageTypeFromGUID_Impl( GUID* guid ) OUString getStorageTypeFromGUID_Impl( GUID* guid )
{ {
if ( *guid == OID_WriterTextServer ) if ( *guid == OID_WriterTextServer )

View File

@@ -0,0 +1,37 @@
/* -*- 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_EMBEDSERV_SOURCE_EMBED_GUID_HXX
#define INCLUDED_EMBEDSERV_SOURCE_EMBED_GUID_HXX
#include <sal/config.h>
#include <rtl/ustring.hxx>
#include <common.h>
OUString getFilterNameFromGUID_Impl( GUID* );
OUString getServiceNameFromGUID_Impl( GUID* );
OUString getStorageTypeFromGUID_Impl( GUID* guid );
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -37,7 +37,7 @@ CIIAObj::~CIIAObj()
STDMETHODIMP CIIAObj::QueryInterface(REFIID riid, LPVOID FAR *ppv) STDMETHODIMP CIIAObj::QueryInterface(REFIID riid, LPVOID FAR *ppv)
{ {
*ppv=NULL; *ppv=nullptr;
if(IID_IUnknown==riid || if(IID_IUnknown==riid ||
IID_IOleWindow==riid || IID_IOleWindow==riid ||
@@ -45,9 +45,9 @@ STDMETHODIMP CIIAObj::QueryInterface(REFIID riid, LPVOID FAR *ppv)
*ppv=this; *ppv=this;
//AddRef any interface we'll return. //AddRef any interface we'll return.
if (NULL!=*ppv) if (nullptr!=*ppv)
{ {
((LPUNKNOWN)*ppv)->AddRef(); static_cast<LPUNKNOWN>(*ppv)->AddRef();
return NOERROR; return NOERROR;
} }

View File

@@ -83,20 +83,20 @@ void SAL_CALL Interceptor::dispose()
if(m_pStatCL) if(m_pStatCL)
m_pStatCL->disposeAndClear( aEvt ); m_pStatCL->disposeAndClear( aEvt );
m_xSlaveDispatchProvider = 0; m_xSlaveDispatchProvider = nullptr;
m_xMasterDispatchProvider = 0; m_xMasterDispatchProvider = nullptr;
} }
Interceptor::Interceptor( Interceptor::Interceptor(
const ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl >& xOleAccess, const ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl >& xOleAccess,
DocumentHolder* pDocH, DocumentHolder* pDocH,
sal_Bool bLink ) bool bLink )
: m_xOleAccess( xOleAccess ), : m_xOleAccess( xOleAccess ),
m_xDocHLocker( static_cast< ::cppu::OWeakObject* >( pDocH ) ), m_xDocHLocker( static_cast< ::cppu::OWeakObject* >( pDocH ) ),
m_pDocH(pDocH), m_pDocH(pDocH),
m_pDisposeEventListeners(0), m_pDisposeEventListeners(nullptr),
m_pStatCL(0), m_pStatCL(nullptr),
m_bLink( bLink ) m_bLink( bLink )
{ {
m_aInterceptedURL[0] = ".uno:Save"; m_aInterceptedURL[0] = ".uno:Save";
@@ -113,7 +113,7 @@ Interceptor::~Interceptor()
delete m_pDisposeEventListeners; delete m_pDisposeEventListeners;
delete m_pStatCL; delete m_pStatCL;
DocumentHolder* pTmpDocH = NULL; DocumentHolder* pTmpDocH = nullptr;
uno::Reference< uno::XInterface > xLock; uno::Reference< uno::XInterface > xLock;
{ {
osl::MutexGuard aGuard(m_aMutex); osl::MutexGuard aGuard(m_aMutex);
@@ -130,8 +130,8 @@ void Interceptor::DisconnectDocHolder()
{ {
osl::MutexGuard aGuard(m_aMutex); osl::MutexGuard aGuard(m_aMutex);
m_xDocHLocker.clear(); m_xDocHLocker.clear();
m_pDocH = NULL; m_pDocH = nullptr;
m_xOleAccess = NULL; m_xOleAccess = nullptr;
} }
//XDispatch //XDispatch
@@ -169,7 +169,7 @@ Interceptor::dispatch(
{ {
if ( aNewArgs[nInd].Name == "SaveTo" ) if ( aNewArgs[nInd].Name == "SaveTo" )
{ {
aNewArgs[nInd].Value <<= sal_True; aNewArgs[nInd].Value <<= true;
break; break;
} }
nInd++; nInd++;
@@ -179,11 +179,11 @@ Interceptor::dispatch(
{ {
aNewArgs.realloc( nInd + 1 ); aNewArgs.realloc( nInd + 1 );
aNewArgs[nInd].Name = "SaveTo"; aNewArgs[nInd].Name = "SaveTo";
aNewArgs[nInd].Value <<= sal_True; aNewArgs[nInd].Value <<= true;
} }
uno::Reference< frame::XDispatch > xDispatch = m_xSlaveDispatchProvider->queryDispatch( uno::Reference< frame::XDispatch > xDispatch = m_xSlaveDispatchProvider->queryDispatch(
URL, OUString( "_self" ), 0 ); URL, "_self", 0 );
if ( xDispatch.is() ) if ( xDispatch.is() )
xDispatch->dispatch( URL, aNewArgs ); xDispatch->dispatch( URL, aNewArgs );
} }
@@ -196,7 +196,7 @@ void Interceptor::generateFeatureStateEvent()
{ {
if( m_pStatCL ) if( m_pStatCL )
{ {
DocumentHolder* pTmpDocH = NULL; DocumentHolder* pTmpDocH = nullptr;
uno::Reference< uno::XInterface > xLock; uno::Reference< uno::XInterface > xLock;
{ {
osl::MutexGuard aGuard(m_aMutex); osl::MutexGuard aGuard(m_aMutex);
@@ -223,14 +223,14 @@ void Interceptor::generateFeatureStateEvent()
continue; continue;
frame::FeatureStateEvent aStateEvent; frame::FeatureStateEvent aStateEvent;
aStateEvent.IsEnabled = sal_True; aStateEvent.IsEnabled = true;
aStateEvent.Requery = sal_False; aStateEvent.Requery = false;
if(i == 0) if(i == 0)
{ {
aStateEvent.FeatureURL.Complete = m_aInterceptedURL[0]; aStateEvent.FeatureURL.Complete = m_aInterceptedURL[0];
aStateEvent.FeatureDescriptor = "Update"; aStateEvent.FeatureDescriptor = "Update";
aStateEvent.State <<= (OUString("($1) ") + aTitle); aStateEvent.State <<= ("($1) " + aTitle);
} }
else if ( i == 5 ) else if ( i == 5 )
@@ -243,7 +243,7 @@ void Interceptor::generateFeatureStateEvent()
{ {
aStateEvent.FeatureURL.Complete = m_aInterceptedURL[i]; aStateEvent.FeatureURL.Complete = m_aInterceptedURL[i];
aStateEvent.FeatureDescriptor = "Close and Return"; aStateEvent.FeatureDescriptor = "Close and Return";
aStateEvent.State <<= (OUString("($2) ") + aTitle); aStateEvent.State <<= ("($2) " + aTitle);
} }
@@ -274,7 +274,7 @@ Interceptor::addStatusListener(
if( !m_bLink && URL.Complete == m_aInterceptedURL[0] ) if( !m_bLink && URL.Complete == m_aInterceptedURL[0] )
{ // Save { // Save
DocumentHolder* pTmpDocH = NULL; DocumentHolder* pTmpDocH = nullptr;
uno::Reference< uno::XInterface > xLock; uno::Reference< uno::XInterface > xLock;
{ {
osl::MutexGuard aGuard(m_aMutex); osl::MutexGuard aGuard(m_aMutex);
@@ -290,9 +290,9 @@ Interceptor::addStatusListener(
frame::FeatureStateEvent aStateEvent; frame::FeatureStateEvent aStateEvent;
aStateEvent.FeatureURL.Complete = m_aInterceptedURL[0]; aStateEvent.FeatureURL.Complete = m_aInterceptedURL[0];
aStateEvent.FeatureDescriptor = "Update"; aStateEvent.FeatureDescriptor = "Update";
aStateEvent.IsEnabled = sal_True; aStateEvent.IsEnabled = true;
aStateEvent.Requery = sal_False; aStateEvent.Requery = false;
aStateEvent.State <<= (OUString("($1) ") + aTitle ); aStateEvent.State <<= ("($1) " + aTitle );
Control->statusChanged(aStateEvent); Control->statusChanged(aStateEvent);
{ {
@@ -312,7 +312,7 @@ Interceptor::addStatusListener(
URL.Complete == m_aInterceptedURL[++i] || URL.Complete == m_aInterceptedURL[++i] ||
URL.Complete == m_aInterceptedURL[++i] ) ) URL.Complete == m_aInterceptedURL[++i] ) )
{ // Close and return { // Close and return
DocumentHolder* pTmpDocH = NULL; DocumentHolder* pTmpDocH = nullptr;
uno::Reference< uno::XInterface > xLock; uno::Reference< uno::XInterface > xLock;
{ {
osl::MutexGuard aGuard(m_aMutex); osl::MutexGuard aGuard(m_aMutex);
@@ -328,9 +328,9 @@ Interceptor::addStatusListener(
frame::FeatureStateEvent aStateEvent; frame::FeatureStateEvent aStateEvent;
aStateEvent.FeatureURL.Complete = m_aInterceptedURL[i]; aStateEvent.FeatureURL.Complete = m_aInterceptedURL[i];
aStateEvent.FeatureDescriptor = "Close and Return"; aStateEvent.FeatureDescriptor = "Close and Return";
aStateEvent.IsEnabled = sal_True; aStateEvent.IsEnabled = true;
aStateEvent.Requery = sal_False; aStateEvent.Requery = false;
aStateEvent.State <<= (OUString("($2) ") + aTitle ); aStateEvent.State <<= ("($2) " + aTitle );
Control->statusChanged(aStateEvent); Control->statusChanged(aStateEvent);
@@ -350,8 +350,8 @@ Interceptor::addStatusListener(
frame::FeatureStateEvent aStateEvent; frame::FeatureStateEvent aStateEvent;
aStateEvent.FeatureURL.Complete = m_aInterceptedURL[5]; aStateEvent.FeatureURL.Complete = m_aInterceptedURL[5];
aStateEvent.FeatureDescriptor = "SaveCopyTo"; aStateEvent.FeatureDescriptor = "SaveCopyTo";
aStateEvent.IsEnabled = sal_True; aStateEvent.IsEnabled = true;
aStateEvent.Requery = sal_False; aStateEvent.Requery = false;
aStateEvent.State <<= (OUString("($3)")); aStateEvent.State <<= (OUString("($3)"));
Control->statusChanged(aStateEvent); Control->statusChanged(aStateEvent);
@@ -422,23 +422,23 @@ Interceptor::queryDispatch(
{ {
osl::MutexGuard aGuard(m_aMutex); osl::MutexGuard aGuard(m_aMutex);
if( !m_bLink && URL.Complete == m_aInterceptedURL[0] ) if( !m_bLink && URL.Complete == m_aInterceptedURL[0] )
return (frame::XDispatch*)this; return static_cast<frame::XDispatch*>(this);
else if(URL.Complete == m_aInterceptedURL[1]) else if(URL.Complete == m_aInterceptedURL[1])
return (frame::XDispatch*)0 ; return nullptr;
else if( !m_bLink && URL.Complete == m_aInterceptedURL[2] ) else if( !m_bLink && URL.Complete == m_aInterceptedURL[2] )
return (frame::XDispatch*)this; return static_cast<frame::XDispatch*>(this);
else if( !m_bLink && URL.Complete == m_aInterceptedURL[3] ) else if( !m_bLink && URL.Complete == m_aInterceptedURL[3] )
return (frame::XDispatch*)this; return static_cast<frame::XDispatch*>(this);
else if( !m_bLink && URL.Complete == m_aInterceptedURL[4] ) else if( !m_bLink && URL.Complete == m_aInterceptedURL[4] )
return (frame::XDispatch*)this; return static_cast<frame::XDispatch*>(this);
else if(URL.Complete == m_aInterceptedURL[5]) else if(URL.Complete == m_aInterceptedURL[5])
return (frame::XDispatch*)this; return static_cast<frame::XDispatch*>(this);
else { else {
if(m_xSlaveDispatchProvider.is()) if(m_xSlaveDispatchProvider.is())
return m_xSlaveDispatchProvider->queryDispatch( return m_xSlaveDispatchProvider->queryDispatch(
URL,TargetFrameName,SearchFlags); URL,TargetFrameName,SearchFlags);
else else
return uno::Reference<frame::XDispatch>(0); return uno::Reference<frame::XDispatch>(nullptr);
} }
} }
@@ -458,17 +458,17 @@ Interceptor::queryDispatches(
for(sal_Int32 i = 0; i < Requests.getLength(); ++i) for(sal_Int32 i = 0; i < Requests.getLength(); ++i)
if ( !m_bLink && m_aInterceptedURL[0] == Requests[i].FeatureURL.Complete ) if ( !m_bLink && m_aInterceptedURL[0] == Requests[i].FeatureURL.Complete )
aRet[i] = (frame::XDispatch*) this; aRet[i] = static_cast<frame::XDispatch*>(this);
else if(m_aInterceptedURL[1] == Requests[i].FeatureURL.Complete) else if(m_aInterceptedURL[1] == Requests[i].FeatureURL.Complete)
aRet[i] = (frame::XDispatch*) 0; aRet[i] = nullptr;
else if( !m_bLink && m_aInterceptedURL[2] == Requests[i].FeatureURL.Complete ) else if( !m_bLink && m_aInterceptedURL[2] == Requests[i].FeatureURL.Complete )
aRet[i] = (frame::XDispatch*) this; aRet[i] = static_cast<frame::XDispatch*>(this);
else if( !m_bLink && m_aInterceptedURL[3] == Requests[i].FeatureURL.Complete ) else if( !m_bLink && m_aInterceptedURL[3] == Requests[i].FeatureURL.Complete )
aRet[i] = (frame::XDispatch*) this; aRet[i] = static_cast<frame::XDispatch*>(this);
else if( !m_bLink && m_aInterceptedURL[4] == Requests[i].FeatureURL.Complete ) else if( !m_bLink && m_aInterceptedURL[4] == Requests[i].FeatureURL.Complete )
aRet[i] = (frame::XDispatch*) this; aRet[i] = static_cast<frame::XDispatch*>(this);
else if(m_aInterceptedURL[5] == Requests[i].FeatureURL.Complete) else if(m_aInterceptedURL[5] == Requests[i].FeatureURL.Complete)
aRet[i] = (frame::XDispatch*) this; aRet[i] = static_cast<frame::XDispatch*>(this);
return aRet; return aRet;
} }

View File

@@ -59,14 +59,14 @@ extern "C" {
SAL_DLLPUBLIC_EXPORT void * SAL_CALL emser_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) SAL_DLLPUBLIC_EXPORT void * SAL_CALL emser_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
{ {
void * pRet = 0; void * pRet = nullptr;
OUString aImplName( OUString::createFromAscii( pImplName ) ); OUString aImplName( OUString::createFromAscii( pImplName ) );
uno::Reference< lang::XSingleServiceFactory > xFactory; uno::Reference< lang::XSingleServiceFactory > xFactory;
if(pServiceManager && aImplName.equals( EmbedServer_getImplementationName() ) ) if(pServiceManager && aImplName.equals( EmbedServer_getImplementationName() ) )
{ {
xFactory= ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory*>(pServiceManager), xFactory= ::cppu::createOneInstanceFactory( static_cast< lang::XMultiServiceFactory*>(pServiceManager),
EmbedServer_getImplementationName(), EmbedServer_getImplementationName(),
EmbedServer_createInstance, EmbedServer_createInstance,
EmbedServer_getSupportedServiceNames() ); EmbedServer_getSupportedServiceNames() );

View File

@@ -50,7 +50,7 @@ class CurThreadData
CurThreadData(); CurThreadData();
virtual ~CurThreadData(); virtual ~CurThreadData();
sal_Bool SAL_CALL setData(void *pData); bool SAL_CALL setData(void *pData);
void* SAL_CALL getData(); void* SAL_CALL getData();
@@ -60,7 +60,7 @@ class CurThreadData
CurThreadData::CurThreadData() CurThreadData::CurThreadData()
{ {
m_hKey = osl_createThreadKey( (oslThreadKeyCallbackFunction)NULL ); m_hKey = osl_createThreadKey( nullptr );
} }
CurThreadData::~CurThreadData() CurThreadData::~CurThreadData()
@@ -68,7 +68,7 @@ CurThreadData::~CurThreadData()
osl_destroyThreadKey(m_hKey); osl_destroyThreadKey(m_hKey);
} }
sal_Bool CurThreadData::setData(void *pData) bool CurThreadData::setData(void *pData)
{ {
OSL_ENSURE( m_hKey, "No thread key!\n" ); OSL_ENSURE( m_hKey, "No thread key!\n" );
return (osl_setThreadKeyData(m_hKey, pData)); return (osl_setThreadKeyData(m_hKey, pData));
@@ -84,16 +84,16 @@ void o2u_attachCurrentThread()
{ {
static CurThreadData oleThreadData; static CurThreadData oleThreadData;
if ( oleThreadData.getData() != 0 ) if ( oleThreadData.getData() != nullptr )
{ {
HRESULT hr = CoInitializeEx(0, COINIT_MULTITHREADED); HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
if (!SUCCEEDED(hr)) if (!SUCCEEDED(hr))
{ // FIXME: is it a problem that this ends up in STA currently? { // FIXME: is it a problem that this ends up in STA currently?
assert(RPC_E_CHANGED_MODE == hr); assert(RPC_E_CHANGED_MODE == hr);
SAL_INFO("embedserv.ole", SAL_INFO("embedserv.ole",
"CoInitializeEx fail: probably thread is in STA already?"); "CoInitializeEx fail: probably thread is in STA already?");
} }
oleThreadData.setData((void*)sal_True); oleThreadData.setData(reinterpret_cast<void*>(true));
} }
} }
@@ -151,7 +151,7 @@ EmbedProviderFactory_Impl::~EmbedProviderFactory_Impl()
{ {
} }
sal_Bool EmbedProviderFactory_Impl::registerClass() bool EmbedProviderFactory_Impl::registerClass()
{ {
HRESULT hresult; HRESULT hresult;
@@ -167,7 +167,7 @@ sal_Bool EmbedProviderFactory_Impl::registerClass()
return (hresult == NOERROR); return (hresult == NOERROR);
} }
sal_Bool EmbedProviderFactory_Impl::deregisterClass() bool EmbedProviderFactory_Impl::deregisterClass()
{ {
HRESULT hresult = CoRevokeClassObject( m_factoryHandle ); HRESULT hresult = CoRevokeClassObject( m_factoryHandle );
@@ -179,17 +179,17 @@ STDMETHODIMP EmbedProviderFactory_Impl::QueryInterface(REFIID riid, void FAR* FA
if(IsEqualIID(riid, IID_IUnknown)) if(IsEqualIID(riid, IID_IUnknown))
{ {
AddRef(); AddRef();
*ppv = (IUnknown*) (IClassFactory*) this; *ppv = static_cast<IUnknown*>(static_cast<IClassFactory*>(this));
return NOERROR; return NOERROR;
} }
else if (IsEqualIID(riid, IID_IClassFactory)) else if (IsEqualIID(riid, IID_IClassFactory))
{ {
AddRef(); AddRef();
*ppv = (IClassFactory*) this; *ppv = static_cast<IClassFactory*>(this);
return NOERROR; return NOERROR;
} }
*ppv = NULL; *ppv = nullptr;
return ResultFromScode(E_NOINTERFACE); return ResultFromScode(E_NOINTERFACE);
} }
@@ -214,9 +214,9 @@ STDMETHODIMP EmbedProviderFactory_Impl::CreateInstance(IUnknown FAR* punkOuter,
REFIID riid, REFIID riid,
void FAR* FAR* ppv) void FAR* FAR* ppv)
{ {
punkOuter = NULL; punkOuter = nullptr;
IUnknown* pEmbedDocument = (IUnknown*)(IPersistStorage*)( new EmbedDocument_Impl( m_xFactory, &m_guid ) ); IUnknown* pEmbedDocument = static_cast<IUnknown*>(static_cast<IPersistStorage*>( new EmbedDocument_Impl( m_xFactory, &m_guid ) ));
return pEmbedDocument->QueryInterface( riid, ppv ); return pEmbedDocument->QueryInterface( riid, ppv );
} }

View File

@@ -44,14 +44,10 @@ using namespace winwrap;
typedef CHatchWin *PCHatchWin; typedef CHatchWin *PCHatchWin;
void DrawShading(LPRECT prc, HDC hDC, UINT cWidth);
winwrap::CWindow::CWindow(HINSTANCE hInst) winwrap::CWindow::CWindow(HINSTANCE hInst)
{ {
m_hInst=hInst; m_hInst=hInst;
m_hWnd=NULL; m_hWnd=nullptr;
return; return;
} }
@@ -118,10 +114,10 @@ BOOL winwrap::HatchWindowRegister(HINSTANCE hInst)
wc.cbClsExtra = 0; wc.cbClsExtra = 0;
wc.lpfnWndProc = HatchWndProc; wc.lpfnWndProc = HatchWndProc;
wc.cbWndExtra = CBHATCHWNDEXTRA; wc.cbWndExtra = CBHATCHWNDEXTRA;
wc.hIcon = NULL; wc.hIcon = nullptr;
wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wc.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW+1);
wc.lpszMenuName = NULL; wc.lpszMenuName = nullptr;
wc.lpszClassName = SZCLASSHATCHWIN; wc.lpszClassName = SZCLASSHATCHWIN;
return RegisterClass(&wc); return RegisterClass(&wc);
@@ -140,9 +136,9 @@ CHatchWin::CHatchWin(HINSTANCE hInst,const DocumentHolder* pDocHolder)
: CWindow(hInst), : CWindow(hInst),
m_aTracker() m_aTracker()
{ {
m_hWnd=NULL; m_hWnd=nullptr;
m_hWndKid=NULL; m_hWndKid=nullptr;
m_hWndAssociate=NULL; m_hWndAssociate=nullptr;
m_uID=0; m_uID=0;
m_dBorderOrg=GetProfileInt(TEXT("windows") m_dBorderOrg=GetProfileInt(TEXT("windows")
@@ -164,7 +160,7 @@ CHatchWin::~CHatchWin()
* Chances are this was already destroyed when a document * Chances are this was already destroyed when a document
* was destroyed. * was destroyed.
*/ */
if (NULL!=m_hWnd && IsWindow(m_hWnd)) if (nullptr!=m_hWnd && IsWindow(m_hWnd))
DestroyWindow(m_hWnd); DestroyWindow(m_hWnd);
return; return;
@@ -200,7 +196,7 @@ BOOL CHatchWin::Init(HWND hWndParent, WORD uID, HWND hWndAssoc)
m_uID=uID; m_uID=uID;
m_hWndAssociate=hWndAssoc; m_hWndAssociate=hWndAssoc;
return (NULL!=m_hWnd); return (nullptr!=m_hWnd);
} }
@@ -274,7 +270,7 @@ void CHatchWin::RectsSet(LPRECT prcPos, LPRECT prcClip)
InflateRect(&rcPos, m_dBorder, m_dBorder); InflateRect(&rcPos, m_dBorder, m_dBorder);
IntersectRect(&rc, &rcPos, prcClip); IntersectRect(&rc, &rcPos, prcClip);
SetWindowPos(m_hWnd, NULL, rc.left, rc.top, rc.right-rc.left SetWindowPos(m_hWnd, nullptr, rc.left, rc.top, rc.right-rc.left
, rc.bottom-rc.top, SWP_NOZORDER | SWP_NOACTIVATE); , rc.bottom-rc.top, SWP_NOZORDER | SWP_NOACTIVATE);
/* /*
@@ -316,7 +312,7 @@ void CHatchWin::ChildSet(HWND hWndKid)
{ {
m_hWndKid=hWndKid; m_hWndKid=hWndKid;
if (NULL!=hWndKid) if (nullptr!=hWndKid)
{ {
SetParent(hWndKid, m_hWnd); SetParent(hWndKid, m_hWnd);
@@ -374,14 +370,14 @@ LRESULT APIENTRY winwrap::HatchWndProc(
HDC hDC; HDC hDC;
PAINTSTRUCT ps; PAINTSTRUCT ps;
phw=(PCHatchWin)GetWindowLongPtr(hWnd, HWWL_STRUCTURE); phw=reinterpret_cast<PCHatchWin>(GetWindowLongPtr(hWnd, HWWL_STRUCTURE));
POINT ptMouse; POINT ptMouse;
switch (iMsg) switch (iMsg)
{ {
case WM_CREATE: case WM_CREATE:
phw=(PCHatchWin)((LPCREATESTRUCT)lParam)->lpCreateParams; phw=static_cast<PCHatchWin>(reinterpret_cast<LPCREATESTRUCT>(lParam)->lpCreateParams);
SetWindowLongPtr(hWnd, HWWL_STRUCTURE, (LONG_PTR)phw); SetWindowLongPtr(hWnd, HWWL_STRUCTURE, reinterpret_cast<LONG_PTR>(phw));
break; break;
case WM_PAINT: case WM_PAINT:
hDC=BeginPaint(hWnd,&ps); hDC=BeginPaint(hWnd,&ps);
@@ -409,7 +405,7 @@ LRESULT APIENTRY winwrap::HatchWndProc(
break; break;
case WM_SETFOCUS: case WM_SETFOCUS:
//We need this since the container will SetFocus to us. //We need this since the container will SetFocus to us.
if (NULL!=phw->m_hWndKid) if (nullptr!=phw->m_hWndKid)
SetFocus(phw->m_hWndKid); SetFocus(phw->m_hWndKid);
break; break;
@@ -423,12 +419,12 @@ LRESULT APIENTRY winwrap::HatchWndProc(
* message when the mouse is on the border. So we can * message when the mouse is on the border. So we can
* just send the notification. * just send the notification.
*/ */
if (NULL!=phw->m_hWndAssociate) if (nullptr!=phw->m_hWndAssociate)
{ {
SendMessage( SendMessage(
phw->m_hWndAssociate, WM_COMMAND, phw->m_hWndAssociate, WM_COMMAND,
MAKEWPARAM(phw->m_uID, HWN_BORDERDOUBLECLICKED), MAKEWPARAM(phw->m_uID, HWN_BORDERDOUBLECLICKED),
(LPARAM) hWnd); reinterpret_cast<LPARAM>(hWnd));
} }
break; break;

View File

@@ -30,8 +30,8 @@
#include "syswinwrapper.hxx" #include "syswinwrapper.hxx"
HCURSOR _afxCursors[10] = { 0, }; HCURSOR afxCursors[10] = { nullptr, };
HBRUSH _afxHalftoneBrush = 0; HBRUSH afxHalftoneBrush = nullptr;
// the struct below is used to determine the qualities of a particular handle // the struct below is used to determine the qualities of a particular handle
@@ -48,7 +48,7 @@ struct AFX_HANDLEINFO
}; };
// this array describes all 8 handles (clock-wise) // this array describes all 8 handles (clock-wise)
const AFX_HANDLEINFO _afxHandleInfo[] = const AFX_HANDLEINFO afxHandleInfo[] =
{ {
// corner handles (top-left, top-right, bottom-right, bottom-left // corner handles (top-left, top-right, bottom-right, bottom-left
{ offsetof(RECT, left), offsetof(RECT, top), 0, 0, 0, 0, 1, 3 }, { offsetof(RECT, left), offsetof(RECT, top), 0, 0, 0, 0, 1, 3 },
@@ -72,7 +72,7 @@ struct AFX_RECTINFO
}; };
// this array is indexed by the offset of the RECT member / sizeof(int) // this array is indexed by the offset of the RECT member / sizeof(int)
const AFX_RECTINFO _afxRectInfo[] = const AFX_RECTINFO afxRectInfo[] =
{ {
{ offsetof(RECT, right), +1 }, { offsetof(RECT, right), +1 },
{ offsetof(RECT, bottom), +1 }, { offsetof(RECT, bottom), +1 },
@@ -83,26 +83,26 @@ const AFX_RECTINFO _afxRectInfo[] =
HBRUSH HalftoneBrush() HBRUSH HalftoneBrush()
{ {
if (_afxHalftoneBrush == NULL) if (afxHalftoneBrush == nullptr)
{ {
WORD grayPattern[8]; WORD grayPattern[8];
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
grayPattern[i] = (WORD)(0x5555 << (i & 1)); grayPattern[i] = (WORD)(0x5555 << (i & 1));
HBITMAP grayBitmap = CreateBitmap(8, 8, 1, 1, &grayPattern); HBITMAP grayBitmap = CreateBitmap(8, 8, 1, 1, &grayPattern);
if (grayBitmap != NULL) if (grayBitmap != nullptr)
{ {
_afxHalftoneBrush = CreatePatternBrush(grayBitmap); afxHalftoneBrush = CreatePatternBrush(grayBitmap);
DeleteObject(grayBitmap); DeleteObject(grayBitmap);
} }
} }
return _afxHalftoneBrush; return afxHalftoneBrush;
} }
void DrawDragRect( void DrawDragRect(
HDC hDC,LPRECT lpRect,SIZE size, HDC hDC,LPRECT lpRect,SIZE size,
LPRECT lpRectLast,SIZE sizeLast, LPRECT lpRectLast,SIZE sizeLast,
HBRUSH hBrush = NULL,HBRUSH hBrushLast = NULL) HBRUSH hBrush = nullptr,HBRUSH hBrushLast = nullptr)
{ {
// first, determine the update region and select it // first, determine the update region and select it
HRGN rgnNew; HRGN rgnNew;
@@ -115,15 +115,15 @@ void DrawDragRect(
rgnNew = CreateRectRgn(0, 0, 0, 0); rgnNew = CreateRectRgn(0, 0, 0, 0);
CombineRgn(rgnNew,rgnOutside,rgnInside,RGN_XOR); CombineRgn(rgnNew,rgnOutside,rgnInside,RGN_XOR);
HBRUSH hBrushOld = NULL; HBRUSH hBrushOld = nullptr;
if (hBrush == NULL) if (hBrush == nullptr)
hBrush = HalftoneBrush(); hBrush = HalftoneBrush();
if (hBrushLast == NULL) if (hBrushLast == nullptr)
hBrushLast = hBrush; hBrushLast = hBrush;
HRGN rgnLast(NULL); HRGN rgnLast(nullptr);
HRGN rgnUpdate(NULL); HRGN rgnUpdate(nullptr);
if (lpRectLast != NULL) if (lpRectLast != nullptr)
{ {
// find difference between new region and old region // find difference between new region and old region
rgnLast = CreateRectRgn(0, 0, 0, 0); rgnLast = CreateRectRgn(0, 0, 0, 0);
@@ -146,29 +146,29 @@ void DrawDragRect(
CombineRgn(rgnUpdate,rgnLast,rgnNew, RGN_XOR); CombineRgn(rgnUpdate,rgnLast,rgnNew, RGN_XOR);
} }
} }
if (hBrush != hBrushLast && lpRectLast != NULL) if (hBrush != hBrushLast && lpRectLast != nullptr)
{ {
// brushes are different -- erase old region first // brushes are different -- erase old region first
SelectClipRgn(hDC,rgnLast); SelectClipRgn(hDC,rgnLast);
GetClipBox(hDC,&rect); GetClipBox(hDC,&rect);
hBrushOld = (HBRUSH)SelectObject(hDC,(HGDIOBJ)hBrushLast); hBrushOld = static_cast<HBRUSH>(SelectObject(hDC,static_cast<HGDIOBJ>(hBrushLast)));
PatBlt(hDC,rect.left,rect.top,(rect.right-rect.left),(rect.bottom-rect.top),PATINVERT); PatBlt(hDC,rect.left,rect.top,(rect.right-rect.left),(rect.bottom-rect.top),PATINVERT);
SelectObject(hDC,(HGDIOBJ)hBrushOld); SelectObject(hDC,static_cast<HGDIOBJ>(hBrushOld));
hBrushOld = NULL; hBrushOld = nullptr;
} }
// draw into the update/new region // draw into the update/new region
SelectClipRgn(hDC,rgnUpdate); SelectClipRgn(hDC,rgnUpdate);
GetClipBox(hDC,&rect); GetClipBox(hDC,&rect);
hBrushOld = (HBRUSH) SelectObject(hDC,(HGDIOBJ) hBrush); hBrushOld = static_cast<HBRUSH>(SelectObject(hDC, static_cast<HGDIOBJ>(hBrush)));
PatBlt(hDC,rect.left, rect.top,(rect.right-rect.left),(rect.bottom-rect.top), PATINVERT); PatBlt(hDC,rect.left, rect.top,(rect.right-rect.left),(rect.bottom-rect.top), PATINVERT);
// cleanup DC // cleanup DC
if (hBrushOld != NULL) if (hBrushOld != nullptr)
SelectObject(hDC,(HGDIOBJ)hBrushOld); SelectObject(hDC, static_cast<HGDIOBJ>(hBrushOld));
SelectClipRgn(hDC,NULL); SelectClipRgn(hDC,nullptr);
} }
@@ -218,9 +218,9 @@ Tracker::Tracker(LPCRECT lpSrcRect, UINT nStyle)
m_nStyle = nStyle; m_nStyle = nStyle;
} }
HBRUSH _afxHatchBrush = 0; HBRUSH afxHatchBrush = nullptr;
HPEN _afxBlackDottedPen = 0; HPEN afxBlackDottedPen = nullptr;
int _afxHandleSize = 0; int afxHandleSize = 0;
void Tracker::Construct() void Tracker::Construct()
@@ -228,7 +228,7 @@ void Tracker::Construct()
static BOOL bInitialized = false; static BOOL bInitialized = false;
if (!bInitialized) if (!bInitialized)
{ {
if (_afxHatchBrush == NULL) if (afxHatchBrush == nullptr)
{ {
// create the hatch pattern + bitmap // create the hatch pattern + bitmap
WORD hatchPattern[8]; WORD hatchPattern[8];
@@ -242,32 +242,32 @@ void Tracker::Construct()
HBITMAP hatchBitmap = CreateBitmap(8, 8, 1, 1,&hatchPattern); HBITMAP hatchBitmap = CreateBitmap(8, 8, 1, 1,&hatchPattern);
// create black hatched brush // create black hatched brush
_afxHatchBrush = CreatePatternBrush(hatchBitmap); afxHatchBrush = CreatePatternBrush(hatchBitmap);
DeleteObject(hatchBitmap); DeleteObject(hatchBitmap);
} }
if (_afxBlackDottedPen == NULL) if (afxBlackDottedPen == nullptr)
{ {
// create black dotted pen // create black dotted pen
_afxBlackDottedPen = CreatePen(PS_DOT, 0, RGB(0, 0, 0)); afxBlackDottedPen = CreatePen(PS_DOT, 0, RGB(0, 0, 0));
} }
// get default handle size from Windows profile setting // get default handle size from Windows profile setting
static const TCHAR szWindows[] = TEXT("windows"); static const TCHAR szWindows[] = TEXT("windows");
static const TCHAR szInplaceBorderWidth[] = static const TCHAR szInplaceBorderWidth[] =
TEXT("oleinplaceborderwidth"); TEXT("oleinplaceborderwidth");
_afxHandleSize = GetProfileInt(szWindows, szInplaceBorderWidth, 4); afxHandleSize = GetProfileInt(szWindows, szInplaceBorderWidth, 4);
bInitialized = TRUE; bInitialized = TRUE;
_afxCursors[0] = _afxCursors[2] = LoadCursor(0,IDC_SIZENWSE); afxCursors[0] = afxCursors[2] = LoadCursor(nullptr,IDC_SIZENWSE);
_afxCursors[4] = _afxCursors[6] = LoadCursor(0,IDC_SIZENS); afxCursors[4] = afxCursors[6] = LoadCursor(nullptr,IDC_SIZENS);
_afxCursors[1] = _afxCursors[3] = LoadCursor(0,IDC_SIZENESW); afxCursors[1] = afxCursors[3] = LoadCursor(nullptr,IDC_SIZENESW);
_afxCursors[5] = _afxCursors[7] = LoadCursor(0,IDC_SIZEWE); afxCursors[5] = afxCursors[7] = LoadCursor(nullptr,IDC_SIZEWE);
_afxCursors[8] = LoadCursor(0,IDC_SIZEALL); afxCursors[8] = LoadCursor(nullptr,IDC_SIZEALL);
} }
m_nStyle = 0; m_nStyle = 0;
m_nHandleSize = _afxHandleSize; m_nHandleSize = afxHandleSize;
m_sizeMin.cy = m_sizeMin.cx = m_nHandleSize*2; m_sizeMin.cy = m_sizeMin.cx = m_nHandleSize*2;
SetRectEmpty(&m_rectLast); SetRectEmpty(&m_rectLast);
@@ -327,7 +327,7 @@ BOOL Tracker::SetCursor(HWND pWnd, UINT nHitTest) const
nHandle = (TrackerHit)9; nHandle = (TrackerHit)9;
} }
::SetCursor(_afxCursors[nHandle]); ::SetCursor(afxCursors[nHandle]);
return TRUE; return TRUE;
} }
@@ -353,7 +353,7 @@ BOOL Tracker::Track(HWND hWnd,POINT point,BOOL bAllowInvert,
BOOL Tracker::TrackHandle(int nHandle,HWND hWnd,POINT point,HWND hWndClipTo) BOOL Tracker::TrackHandle(int nHandle,HWND hWnd,POINT point,HWND hWndClipTo)
{ {
// don't handle if capture already set // don't handle if capture already set
if (GetCapture() != NULL) if (GetCapture() != nullptr)
return FALSE; return FALSE;
// save original width & height in pixels // save original width & height in pixels
@@ -363,7 +363,7 @@ BOOL Tracker::TrackHandle(int nHandle,HWND hWnd,POINT point,HWND hWndClipTo)
// set capture to the window which received this message // set capture to the window which received this message
SetCapture(hWnd); SetCapture(hWnd);
UpdateWindow(hWnd); UpdateWindow(hWnd);
if (hWndClipTo != NULL) if (hWndClipTo != nullptr)
UpdateWindow(hWndClipTo); UpdateWindow(hWndClipTo);
RECT rectSave = m_rect; RECT rectSave = m_rect;
@@ -376,10 +376,10 @@ BOOL Tracker::TrackHandle(int nHandle,HWND hWnd,POINT point,HWND hWndClipTo)
// get DC for drawing // get DC for drawing
HDC hDrawDC; HDC hDrawDC;
if (hWndClipTo != NULL) if (hWndClipTo != nullptr)
{ {
// clip to arbitrary window by using adjusted Window DC // clip to arbitrary window by using adjusted Window DC
hDrawDC = GetDCEx(hWndClipTo,NULL, DCX_CACHE); hDrawDC = GetDCEx(hWndClipTo,nullptr, DCX_CACHE);
} }
else else
{ {
@@ -394,7 +394,7 @@ BOOL Tracker::TrackHandle(int nHandle,HWND hWnd,POINT point,HWND hWndClipTo)
for (;;) for (;;)
{ {
MSG msg; MSG msg;
GetMessage(&msg, NULL, 0, 0); GetMessage(&msg, nullptr, 0, 0);
if (GetCapture() != hWnd) if (GetCapture() != hWnd)
break; break;
@@ -406,9 +406,9 @@ BOOL Tracker::TrackHandle(int nHandle,HWND hWnd,POINT point,HWND hWndClipTo)
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
rectOld = m_rect; rectOld = m_rect;
// handle resize cases (and part of move) // handle resize cases (and part of move)
if (px != NULL) if (px != nullptr)
*px = (int)(short)LOWORD(msg.lParam) - xDiff; *px = (int)(short)LOWORD(msg.lParam) - xDiff;
if (py != NULL) if (py != nullptr)
*py = (int)(short)HIWORD(msg.lParam) - yDiff; *py = (int)(short)HIWORD(msg.lParam) - yDiff;
// handle move case // handle move case
@@ -465,7 +465,7 @@ BOOL Tracker::TrackHandle(int nHandle,HWND hWnd,POINT point,HWND hWndClipTo)
} }
ExitLoop: ExitLoop:
if (hWndClipTo != NULL) if (hWndClipTo != nullptr)
ReleaseDC(hWndClipTo,hDrawDC); ReleaseDC(hWndClipTo,hDrawDC);
else else
ReleaseDC(hWnd,hDrawDC); ReleaseDC(hWnd,hDrawDC);
@@ -494,29 +494,29 @@ void Tracker::AdjustRect(int nHandle, LPRECT)
// convert the handle into locations within m_rect // convert the handle into locations within m_rect
int *px, *py; int *px, *py;
GetModifyPointers(nHandle, &px, &py, NULL, NULL); GetModifyPointers(nHandle, &px, &py, nullptr, nullptr);
// enforce minimum width // enforce minimum width
int nNewWidth = m_rect.right - m_rect.left; int nNewWidth = m_rect.right - m_rect.left;
int nAbsWidth = m_bAllowInvert ? abs(nNewWidth) : nNewWidth; int nAbsWidth = m_bAllowInvert ? abs(nNewWidth) : nNewWidth;
if (px != NULL && nAbsWidth < m_sizeMin.cx) if (px != nullptr && nAbsWidth < m_sizeMin.cx)
{ {
nNewWidth = nAbsWidth != 0 ? nNewWidth / nAbsWidth : 1; nNewWidth = nAbsWidth != 0 ? nNewWidth / nAbsWidth : 1;
const AFX_RECTINFO* pRectInfo = const AFX_RECTINFO* pRectInfo =
&_afxRectInfo[(int*)px - (int*)&m_rect]; &afxRectInfo[px - reinterpret_cast<int*>(&m_rect)];
*px = *(int*)((BYTE*)&m_rect + pRectInfo->nOffsetAcross) + *px = *reinterpret_cast<int*>(reinterpret_cast<BYTE*>(&m_rect) + pRectInfo->nOffsetAcross) +
nNewWidth * m_sizeMin.cx * -pRectInfo->nSignAcross; nNewWidth * m_sizeMin.cx * -pRectInfo->nSignAcross;
} }
// enforce minimum height // enforce minimum height
int nNewHeight = m_rect.bottom - m_rect.top; int nNewHeight = m_rect.bottom - m_rect.top;
int nAbsHeight = m_bAllowInvert ? abs(nNewHeight) : nNewHeight; int nAbsHeight = m_bAllowInvert ? abs(nNewHeight) : nNewHeight;
if (py != NULL && nAbsHeight < m_sizeMin.cy) if (py != nullptr && nAbsHeight < m_sizeMin.cy)
{ {
nNewHeight = nAbsHeight != 0 ? nNewHeight / nAbsHeight : 1; nNewHeight = nAbsHeight != 0 ? nNewHeight / nAbsHeight : 1;
const AFX_RECTINFO* pRectInfo = const AFX_RECTINFO* pRectInfo =
&_afxRectInfo[(int*)py - (int*)&m_rect]; &afxRectInfo[py - reinterpret_cast<int*>(&m_rect)];
*py = *(int*)((BYTE*)&m_rect + pRectInfo->nOffsetAcross) + *py = *reinterpret_cast<int*>(reinterpret_cast<BYTE*>(&m_rect) + pRectInfo->nOffsetAcross) +
nNewHeight * m_sizeMin.cy * -pRectInfo->nSignAcross; nNewHeight * m_sizeMin.cy * -pRectInfo->nSignAcross;
} }
} }
@@ -530,7 +530,7 @@ void Tracker::DrawTrackerRect(
NormalizeRect(&rect); NormalizeRect(&rect);
// convert to client coordinates // convert to client coordinates
if (pWndClipTo != NULL) if (pWndClipTo != nullptr)
TransformRect(&rect,pWnd,pWndClipTo); TransformRect(&rect,pWnd,pWndClipTo);
SIZE size; SIZE size;
@@ -564,15 +564,15 @@ void Tracker::Draw(HDC hDC) const
{ {
// set initial DC state // set initial DC state
SetMapMode(hDC,MM_TEXT); SetMapMode(hDC,MM_TEXT);
SetViewportOrgEx(hDC,0, 0,NULL); SetViewportOrgEx(hDC,0, 0,nullptr);
SetWindowOrgEx(hDC,0, 0,NULL); SetWindowOrgEx(hDC,0, 0,nullptr);
// get normalized rectangle // get normalized rectangle
RECT rect = m_rect; RECT rect = m_rect;
NormalizeRect(&rect); NormalizeRect(&rect);
HPEN pOldPen = NULL; HPEN pOldPen = nullptr;
HBRUSH pOldBrush = NULL; HBRUSH pOldBrush = nullptr;
HGDIOBJ pTemp; HGDIOBJ pTemp;
int nOldROP; int nOldROP;
@@ -580,10 +580,10 @@ void Tracker::Draw(HDC hDC) const
if ((m_nStyle & (dottedLine|solidLine)) != 0) if ((m_nStyle & (dottedLine|solidLine)) != 0)
{ {
if (m_nStyle & dottedLine) if (m_nStyle & dottedLine)
pOldPen = (HPEN)SelectObject(hDC,_afxBlackDottedPen); pOldPen = static_cast<HPEN>(SelectObject(hDC,afxBlackDottedPen));
else else
pOldPen = (HPEN)SelectObject(hDC,(HGDIOBJ)BLACK_PEN); pOldPen = static_cast<HPEN>(SelectObject(hDC,reinterpret_cast<HGDIOBJ>(BLACK_PEN)));
pOldBrush = (HBRUSH)SelectObject(hDC,(HGDIOBJ)NULL_BRUSH); pOldBrush = static_cast<HBRUSH>(SelectObject(hDC,reinterpret_cast<HGDIOBJ>(NULL_BRUSH)));
nOldROP = SetROP2(hDC,R2_COPYPEN); nOldROP = SetROP2(hDC,R2_COPYPEN);
InflateRect(&rect,+1, +1); // borders are one pixel outside InflateRect(&rect,+1, +1); // borders are one pixel outside
Rectangle(hDC,rect.left, rect.top, rect.right, rect.bottom); Rectangle(hDC,rect.left, rect.top, rect.right, rect.bottom);
@@ -592,17 +592,17 @@ void Tracker::Draw(HDC hDC) const
// if hatchBrush is going to be used, need to unrealize it // if hatchBrush is going to be used, need to unrealize it
if ((m_nStyle & (hatchInside|hatchedBorder)) != 0) if ((m_nStyle & (hatchInside|hatchedBorder)) != 0)
UnrealizeObject((HGDIOBJ)_afxHatchBrush); UnrealizeObject(static_cast<HGDIOBJ>(afxHatchBrush));
// hatch inside // hatch inside
if ((m_nStyle & hatchInside) != 0) if ((m_nStyle & hatchInside) != 0)
{ {
pTemp = SelectObject(hDC,(HGDIOBJ)NULL_PEN); pTemp = SelectObject(hDC,reinterpret_cast<HGDIOBJ>(NULL_PEN));
if (pOldPen == NULL) if (pOldPen == nullptr)
pOldPen = (HPEN)pTemp; pOldPen = static_cast<HPEN>(pTemp);
pTemp = SelectObject(hDC,(HGDIOBJ)_afxHatchBrush); pTemp = SelectObject(hDC,static_cast<HGDIOBJ>(afxHatchBrush));
if (pOldBrush == NULL) if (pOldBrush == nullptr)
pOldBrush = (HBRUSH)pTemp; pOldBrush = static_cast<HBRUSH>(pTemp);
SetBkMode(hDC,TRANSPARENT); SetBkMode(hDC,TRANSPARENT);
nOldROP = SetROP2(hDC,R2_MASKNOTPEN); nOldROP = SetROP2(hDC,R2_MASKNOTPEN);
Rectangle(hDC,rect.left+1, rect.top+1, rect.right, rect.bottom); Rectangle(hDC,rect.left+1, rect.top+1, rect.right, rect.bottom);
@@ -612,9 +612,9 @@ void Tracker::Draw(HDC hDC) const
// draw hatched border // draw hatched border
if ((m_nStyle & hatchedBorder) != 0) if ((m_nStyle & hatchedBorder) != 0)
{ {
pTemp = SelectObject(hDC,(HGDIOBJ)_afxHatchBrush); pTemp = SelectObject(hDC,static_cast<HGDIOBJ>(afxHatchBrush));
if (pOldBrush == NULL) if (pOldBrush == nullptr)
pOldBrush = (HBRUSH)pTemp; pOldBrush = static_cast<HBRUSH>(pTemp);
SetBkMode(hDC,OPAQUE); SetBkMode(hDC,OPAQUE);
RECT rectTrue; RECT rectTrue;
GetTrueRect(&rectTrue); GetTrueRect(&rectTrue);
@@ -647,9 +647,9 @@ void Tracker::Draw(HDC hDC) const
} }
// cleanup pDC state // cleanup pDC state
if (pOldPen != NULL) if (pOldPen != nullptr)
SelectObject(hDC,pOldPen); SelectObject(hDC,pOldPen);
if (pOldBrush != NULL) if (pOldBrush != nullptr)
SelectObject(hDC,pOldBrush); SelectObject(hDC,pOldBrush);
RestoreDC(hDC,-1); RestoreDC(hDC,-1);
} }
@@ -676,9 +676,9 @@ void Tracker::GetHandleRect(int nHandle,RECT* pHandleRect) const
int nWidth = rectT.right - rectT.left; int nWidth = rectT.right - rectT.left;
int nHeight = rectT.bottom - rectT.top; int nHeight = rectT.bottom - rectT.top;
RECT rect; RECT rect;
const AFX_HANDLEINFO* pHandleInfo = &_afxHandleInfo[nHandle]; const AFX_HANDLEINFO* pHandleInfo = &afxHandleInfo[nHandle];
rect.left = *(int*)((BYTE*)&rectT + pHandleInfo->nOffsetX); rect.left = *reinterpret_cast<int*>(reinterpret_cast<BYTE*>(&rectT) + pHandleInfo->nOffsetX);
rect.top = *(int*)((BYTE*)&rectT + pHandleInfo->nOffsetY); rect.top = *reinterpret_cast<int*>(reinterpret_cast<BYTE*>(&rectT) + pHandleInfo->nOffsetY);
rect.left += size * pHandleInfo->nHandleX; rect.left += size * pHandleInfo->nHandleX;
rect.top += size * pHandleInfo->nHandleY; rect.top += size * pHandleInfo->nHandleY;
rect.left += pHandleInfo->nCenterX * (nWidth - size) / 2; rect.left += pHandleInfo->nCenterX * (nWidth - size) / 2;
@@ -692,15 +692,14 @@ void Tracker::GetHandleRect(int nHandle,RECT* pHandleRect) const
int Tracker::GetHandleSize(LPRECT lpRect) const int Tracker::GetHandleSize(LPRECT lpRect) const
{ {
if (lpRect == NULL) LPCRECT rect = lpRect == nullptr ? &m_rect : lpRect;
lpRect = (LPRECT)&m_rect;
int size = m_nHandleSize; int size = m_nHandleSize;
if (!(m_nStyle & resizeOutside)) if (!(m_nStyle & resizeOutside))
{ {
// make sure size is small enough for the size of the rect // make sure size is small enough for the size of the rect
int sizeMax = min(abs(lpRect->right - lpRect->left), int sizeMax = min(abs(rect->right - rect->left),
abs(lpRect->bottom - lpRect->top)); abs(rect->bottom - rect->top));
if (size * 2 > sizeMax) if (size * 2 > sizeMax)
size = sizeMax / 2; size = sizeMax / 2;
} }
@@ -738,11 +737,11 @@ int Tracker::NormalizeHit(int nHandle) const
{ {
if (nHandle == hitMiddle || nHandle == hitNothing) if (nHandle == hitMiddle || nHandle == hitNothing)
return nHandle; return nHandle;
const AFX_HANDLEINFO* pHandleInfo = &_afxHandleInfo[nHandle]; const AFX_HANDLEINFO* pHandleInfo = &afxHandleInfo[nHandle];
if (m_rect.right - m_rect.left < 0) if (m_rect.right - m_rect.left < 0)
{ {
nHandle = (TrackerHit)pHandleInfo->nInvertX; nHandle = (TrackerHit)pHandleInfo->nInvertX;
pHandleInfo = &_afxHandleInfo[nHandle]; pHandleInfo = &afxHandleInfo[nHandle];
} }
if (m_rect.bottom - m_rect.top < 0) if (m_rect.bottom - m_rect.top < 0)
nHandle = (TrackerHit)pHandleInfo->nInvertY; nHandle = (TrackerHit)pHandleInfo->nInvertY;
@@ -791,36 +790,36 @@ void Tracker::GetModifyPointers(
if (nHandle == hitMiddle) if (nHandle == hitMiddle)
nHandle = hitTopLeft; // same as hitting top-left nHandle = hitTopLeft; // same as hitting top-left
*ppx = NULL; *ppx = nullptr;
*ppy = NULL; *ppy = nullptr;
// fill in the part of the rect that this handle modifies // fill in the part of the rect that this handle modifies
// (Note: handles that map to themselves along a given axis when that // (Note: handles that map to themselves along a given axis when that
// axis is inverted don't modify the value on that axis) // axis is inverted don't modify the value on that axis)
const AFX_HANDLEINFO* pHandleInfo = &_afxHandleInfo[nHandle]; const AFX_HANDLEINFO* pHandleInfo = &afxHandleInfo[nHandle];
if (pHandleInfo->nInvertX != nHandle) if (pHandleInfo->nInvertX != nHandle)
{ {
*ppx = (int*)((BYTE*)&m_rect + pHandleInfo->nOffsetX); *ppx = reinterpret_cast<int*>(reinterpret_cast<BYTE*>(&m_rect) + pHandleInfo->nOffsetX);
if (px != NULL) if (px != nullptr)
*px = **ppx; *px = **ppx;
} }
else else
{ {
// middle handle on X axis // middle handle on X axis
if (px != NULL) if (px != nullptr)
*px = m_rect.left + (m_rect.left-m_rect.right) / 2; *px = m_rect.left + (m_rect.left-m_rect.right) / 2;
} }
if (pHandleInfo->nInvertY != nHandle) if (pHandleInfo->nInvertY != nHandle)
{ {
*ppy = (int*)((BYTE*)&m_rect + pHandleInfo->nOffsetY); *ppy = reinterpret_cast<int*>(reinterpret_cast<BYTE*>(&m_rect) + pHandleInfo->nOffsetY);
if (py != NULL) if (py != nullptr)
*py = **ppy; *py = **ppy;
} }
else else
{ {
// middle handle on Y axis // middle handle on Y axis
if (py != NULL) if (py != nullptr)
*py = m_rect.top + (m_rect.top-m_rect.bottom) / 2; *py = m_rect.top + (m_rect.top-m_rect.bottom) / 2;
} }
} }

View File

@@ -90,7 +90,7 @@ private:
CComPtr< IDispatch > m_pIDispatch; CComPtr< IDispatch > m_pIDispatch;
sal_Bool m_bLink; bool m_bLink;
css::uno::Reference< css::frame::XFrame2 > DocumentFrame(); css::uno::Reference< css::frame::XFrame2 > DocumentFrame();
@@ -101,7 +101,7 @@ private:
void ClearInterceptorInternally(); void ClearInterceptorInternally();
void LoadDocInFrame( sal_Bool bPluginMode ); void LoadDocInFrame( bool bPluginMode );
public: public:
@@ -122,7 +122,7 @@ public:
const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory, const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory,
const ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl >& xOleAccess ); const ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl >& xOleAccess );
~DocumentHolder(); ~DocumentHolder() override;
// Methods for inplace activation // Methods for inplace activation
@@ -136,19 +136,19 @@ public:
BOOL InPlaceMenuCreate(); BOOL InPlaceMenuCreate();
BOOL InPlaceMenuDestroy(); BOOL InPlaceMenuDestroy();
void OpenIntoWindow(); static void OpenIntoWindow();
BOOL Undo(); static BOOL Undo();
// further methods // further methods
void SetDocument( void SetDocument(
const css::uno::Reference< css::frame::XModel >& xDoc, const css::uno::Reference< css::frame::XModel >& xDoc,
sal_Bool bLink = sal_False bool bLink = false
); );
sal_Bool ExecuteSuspendCloseFrame(); bool ExecuteSuspendCloseFrame();
void DisconnectFrameDocument( sal_Bool bComplete = sal_False ); void DisconnectFrameDocument( bool bComplete = false );
void CloseDocument(); void CloseDocument();
void CloseFrame(); void CloseFrame();
void ClearInterceptor(); void ClearInterceptor();
@@ -164,8 +164,8 @@ public:
void OnPosRectChanged(LPRECT lpRect) const; void OnPosRectChanged(LPRECT lpRect) const;
void show(); void show();
sal_Bool HasFrame() { return m_xFrame.is(); } bool HasFrame() { return m_xFrame.is(); }
sal_Bool IsLink() { return m_bLink; } bool IsLink() { return m_bLink; }
/** hides the document window, even in case of an external container /** hides the document window, even in case of an external container
* side managed window. * side managed window.
@@ -198,7 +198,7 @@ public:
// XEventListener // XEventListener
virtual void SAL_CALL virtual void SAL_CALL
disposing( const css::lang::EventObject& aSource ) disposing( const css::lang::EventObject& aSource )
throw( css::uno::RuntimeException ); throw( css::uno::RuntimeException ) override;
// XCloseListener // XCloseListener
virtual void SAL_CALL virtual void SAL_CALL
@@ -208,13 +208,13 @@ public:
) )
throw( throw(
css::util::CloseVetoException css::util::CloseVetoException
); ) override;
virtual void SAL_CALL virtual void SAL_CALL
notifyClosing( notifyClosing(
const css::lang::EventObject& aSource const css::lang::EventObject& aSource
) )
throw( css::uno::RuntimeException ); throw( css::uno::RuntimeException ) override;
// XTerminateListener // XTerminateListener
virtual void SAL_CALL virtual void SAL_CALL
@@ -223,13 +223,13 @@ public:
) )
throw( throw(
css::frame::TerminationVetoException css::frame::TerminationVetoException
); ) override;
virtual void SAL_CALL virtual void SAL_CALL
notifyTermination( notifyTermination(
const css::lang::EventObject& aSource const css::lang::EventObject& aSource
) )
throw( css::uno::RuntimeException ); throw( css::uno::RuntimeException ) override;
// XModifyListener // XModifyListener
@@ -239,7 +239,7 @@ public:
) )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
// XDockingAreaAcceptor // XDockingAreaAcceptor
@@ -249,7 +249,7 @@ public:
) )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
virtual sal_Bool SAL_CALL virtual sal_Bool SAL_CALL
requestDockingAreaSpace( requestDockingAreaSpace(
@@ -257,7 +257,7 @@ public:
) )
throw( throw(
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
virtual void SAL_CALL virtual void SAL_CALL
setDockingAreaSpace( setDockingAreaSpace(
@@ -265,7 +265,7 @@ public:
) )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
}; };
#endif #endif

View File

@@ -51,15 +51,15 @@ class EmbedDocument_Impl
{ {
protected: protected:
css::uno::Sequence< css::beans::PropertyValue > css::uno::Sequence< css::beans::PropertyValue >
fillArgsForLoading_Impl( css::uno::Reference< css::io::XInputStream > xStream, fillArgsForLoading_Impl( css::uno::Reference< css::io::XInputStream > const & xStream,
DWORD nStreamMode, DWORD nStreamMode,
LPCOLESTR pFilePath = NULL ); LPCOLESTR pFilePath = nullptr );
css::uno::Sequence< css::beans::PropertyValue > css::uno::Sequence< css::beans::PropertyValue >
fillArgsForStoring_Impl( css::uno::Reference< css::io::XOutputStream > xStream ); fillArgsForStoring_Impl( css::uno::Reference< css::io::XOutputStream > const & xStream );
HRESULT SaveTo_Impl( IStorage* pStg ); HRESULT SaveTo_Impl( IStorage* pStg );
sal_uInt64 getMetaFileHandle_Impl( sal_Bool isEnhMeta ); sal_uInt64 getMetaFileHandle_Impl( bool isEnhMeta );
public: public:
EmbedDocument_Impl( const css::uno::Reference< css::lang::XMultiServiceFactory >& smgr, EmbedDocument_Impl( const css::uno::Reference< css::lang::XMultiServiceFactory >& smgr,
@@ -67,78 +67,78 @@ public:
virtual ~EmbedDocument_Impl(); virtual ~EmbedDocument_Impl();
/* IUnknown methods */ /* IUnknown methods */
STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj); STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj) override;
STDMETHOD_(ULONG, AddRef)(); STDMETHOD_(ULONG, AddRef)() override;
STDMETHOD_(ULONG, Release)(); STDMETHOD_(ULONG, Release)() override;
/* IPersistMethod */ /* IPersistMethod */
STDMETHOD(GetClassID)(CLSID *pClassID); STDMETHOD(GetClassID)(CLSID *pClassID) override;
/* IPersistStorage methods */ /* IPersistStorage methods */
STDMETHOD(IsDirty) (); STDMETHOD(IsDirty) () override;
STDMETHOD(InitNew) ( IStorage *pStg ); STDMETHOD(InitNew) ( IStorage *pStg ) override;
STDMETHOD(Load) ( IStorage* pStr ); STDMETHOD(Load) ( IStorage* pStr ) override;
STDMETHOD(Save) ( IStorage *pStgSave, BOOL fSameAsLoad ); STDMETHOD(Save) ( IStorage *pStgSave, BOOL fSameAsLoad ) override;
STDMETHOD(SaveCompleted) ( IStorage *pStgNew ); STDMETHOD(SaveCompleted) ( IStorage *pStgNew ) override;
STDMETHOD(HandsOffStorage) (void); STDMETHOD(HandsOffStorage) (void) override;
/* IDataObject methods */ /* IDataObject methods */
STDMETHOD(GetData) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium ); STDMETHOD(GetData) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium ) override;
STDMETHOD(GetDataHere) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium ); STDMETHOD(GetDataHere) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium ) override;
STDMETHOD(QueryGetData) ( FORMATETC * pFormatetc ); STDMETHOD(QueryGetData) ( FORMATETC * pFormatetc ) override;
STDMETHOD(GetCanonicalFormatEtc) ( FORMATETC * pFormatetcIn, FORMATETC * pFormatetcOut ); STDMETHOD(GetCanonicalFormatEtc) ( FORMATETC * pFormatetcIn, FORMATETC * pFormatetcOut ) override;
STDMETHOD(SetData) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium, BOOL fRelease ); STDMETHOD(SetData) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium, BOOL fRelease ) override;
STDMETHOD(EnumFormatEtc) ( DWORD dwDirection, IEnumFORMATETC ** ppFormatetc ); STDMETHOD(EnumFormatEtc) ( DWORD dwDirection, IEnumFORMATETC ** ppFormatetc ) override;
STDMETHOD(DAdvise) ( FORMATETC * pFormatetc, DWORD advf, IAdviseSink * pAdvSink, DWORD * pdwConnection ); STDMETHOD(DAdvise) ( FORMATETC * pFormatetc, DWORD advf, IAdviseSink * pAdvSink, DWORD * pdwConnection ) override;
STDMETHOD(DUnadvise) ( DWORD dwConnection ); STDMETHOD(DUnadvise) ( DWORD dwConnection ) override;
STDMETHOD(EnumDAdvise) ( IEnumSTATDATA ** ppenumAdvise ); STDMETHOD(EnumDAdvise) ( IEnumSTATDATA ** ppenumAdvise ) override;
/* IOleObject methods */ /* IOleObject methods */
STDMETHOD(SetClientSite) ( IOleClientSite* pSite ); STDMETHOD(SetClientSite) ( IOleClientSite* pSite ) override;
STDMETHOD(GetClientSite) ( IOleClientSite** pSite ); STDMETHOD(GetClientSite) ( IOleClientSite** pSite ) override;
STDMETHOD(SetHostNames) ( LPCOLESTR szContainerApp, LPCOLESTR szContainerObj ); STDMETHOD(SetHostNames) ( LPCOLESTR szContainerApp, LPCOLESTR szContainerObj ) override;
STDMETHOD(Close) ( DWORD dwSaveOption); STDMETHOD(Close) ( DWORD dwSaveOption) override;
STDMETHOD(SetMoniker) ( DWORD dwWhichMoniker, IMoniker *pmk ); STDMETHOD(SetMoniker) ( DWORD dwWhichMoniker, IMoniker *pmk ) override;
STDMETHOD(GetMoniker) ( DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk ); STDMETHOD(GetMoniker) ( DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk ) override;
STDMETHOD(InitFromData) ( IDataObject *pDataObject, BOOL fCreation, DWORD dwReserved ); STDMETHOD(InitFromData) ( IDataObject *pDataObject, BOOL fCreation, DWORD dwReserved ) override;
STDMETHOD(GetClipboardData) ( DWORD dwReserved, IDataObject **ppDataObject ); STDMETHOD(GetClipboardData) ( DWORD dwReserved, IDataObject **ppDataObject ) override;
STDMETHOD(DoVerb) ( LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect ); STDMETHOD(DoVerb) ( LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect ) override;
STDMETHOD(EnumVerbs) ( IEnumOLEVERB **ppEnumOleVerb ); STDMETHOD(EnumVerbs) ( IEnumOLEVERB **ppEnumOleVerb ) override;
STDMETHOD(Update) (); STDMETHOD(Update) () override;
STDMETHOD(IsUpToDate) (); STDMETHOD(IsUpToDate) () override;
STDMETHOD(GetUserClassID) ( CLSID *pClsid ); STDMETHOD(GetUserClassID) ( CLSID *pClsid ) override;
STDMETHOD(GetUserType) ( DWORD dwFormOfType, LPOLESTR *pszUserType ); STDMETHOD(GetUserType) ( DWORD dwFormOfType, LPOLESTR *pszUserType ) override;
STDMETHOD(SetExtent) ( DWORD dwDrawAspect, SIZEL *psizel ); STDMETHOD(SetExtent) ( DWORD dwDrawAspect, SIZEL *psizel ) override;
STDMETHOD(GetExtent) ( DWORD dwDrawAspect, SIZEL *psizel ); STDMETHOD(GetExtent) ( DWORD dwDrawAspect, SIZEL *psizel ) override;
STDMETHOD(Advise) ( IAdviseSink *pAdvSink, DWORD *pdwConnection ); STDMETHOD(Advise) ( IAdviseSink *pAdvSink, DWORD *pdwConnection ) override;
STDMETHOD(Unadvise) ( DWORD dwConnection ); STDMETHOD(Unadvise) ( DWORD dwConnection ) override;
STDMETHOD(EnumAdvise) ( IEnumSTATDATA **ppenumAdvise ); STDMETHOD(EnumAdvise) ( IEnumSTATDATA **ppenumAdvise ) override;
STDMETHOD(GetMiscStatus) ( DWORD dwAspect, DWORD *pdwStatus ); STDMETHOD(GetMiscStatus) ( DWORD dwAspect, DWORD *pdwStatus ) override;
STDMETHOD(SetColorScheme) ( LOGPALETTE *pLogpal ); STDMETHOD(SetColorScheme) ( LOGPALETTE *pLogpal ) override;
/* IOleInPlaceObject methods */ /* IOleInPlaceObject methods */
STDMETHOD(GetWindow)(HWND *); STDMETHOD(GetWindow)(HWND *) override;
STDMETHOD(ContextSensitiveHelp)(BOOL); STDMETHOD(ContextSensitiveHelp)(BOOL) override;
STDMETHOD(InPlaceDeactivate)(); STDMETHOD(InPlaceDeactivate)() override;
STDMETHOD(UIDeactivate)(); STDMETHOD(UIDeactivate)() override;
STDMETHOD(SetObjectRects)(LPCRECT, LPCRECT); STDMETHOD(SetObjectRects)(LPCRECT, LPCRECT) override;
STDMETHOD(ReactivateAndUndo)(); STDMETHOD(ReactivateAndUndo)() override;
/* IPersistFile methods */ /* IPersistFile methods */
STDMETHOD(Load) ( LPCOLESTR pszFileName, DWORD dwMode ); STDMETHOD(Load) ( LPCOLESTR pszFileName, DWORD dwMode ) override;
STDMETHOD(Save) ( LPCOLESTR pszFileName, BOOL fRemember ); STDMETHOD(Save) ( LPCOLESTR pszFileName, BOOL fRemember ) override;
STDMETHOD(SaveCompleted) ( LPCOLESTR pszFileName ); STDMETHOD(SaveCompleted) ( LPCOLESTR pszFileName ) override;
STDMETHOD(GetCurFile) ( LPOLESTR *ppszFileName ); STDMETHOD(GetCurFile) ( LPOLESTR *ppszFileName ) override;
/* IDispatch methods */ /* IDispatch methods */
STDMETHOD(GetTypeInfoCount) ( unsigned int FAR* pctinfo ); STDMETHOD(GetTypeInfoCount) ( unsigned int FAR* pctinfo ) override;
STDMETHOD(GetTypeInfo) ( unsigned int iTInfo, LCID lcid, ITypeInfo FAR* FAR* ppTInfo ); STDMETHOD(GetTypeInfo) ( unsigned int iTInfo, LCID lcid, ITypeInfo FAR* FAR* ppTInfo ) override;
STDMETHOD(GetIDsOfNames) ( REFIID riid, OLECHAR FAR* FAR* rgszNames, unsigned int cNames, LCID lcid, DISPID FAR* rgDispId ); STDMETHOD(GetIDsOfNames) ( REFIID riid, OLECHAR FAR* FAR* rgszNames, unsigned int cNames, LCID lcid, DISPID FAR* rgDispId ) override;
STDMETHOD(Invoke) ( DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR* pDispParams, VARIANT FAR* pVarResult, EXCEPINFO FAR* pExcepInfo, unsigned int FAR* puArgErr ); STDMETHOD(Invoke) ( DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR* pDispParams, VARIANT FAR* pVarResult, EXCEPINFO FAR* pExcepInfo, unsigned int FAR* puArgErr ) override;
/* IExternalConnection methods */ /* IExternalConnection methods */
virtual DWORD STDMETHODCALLTYPE AddConnection( DWORD extconn, DWORD reserved); virtual DWORD STDMETHODCALLTYPE AddConnection( DWORD extconn, DWORD reserved) override;
virtual DWORD STDMETHODCALLTYPE ReleaseConnection( DWORD extconn, DWORD reserved, BOOL fLastReleaseCloses); virtual DWORD STDMETHODCALLTYPE ReleaseConnection( DWORD extconn, DWORD reserved, BOOL fLastReleaseCloses) override;
// c++ - methods // c++ - methods
@@ -164,7 +164,7 @@ protected:
CComPtr< IStream > m_pExtStream; CComPtr< IStream > m_pExtStream;
GUID m_guid; GUID m_guid;
sal_Bool m_bIsDirty; bool m_bIsDirty;
CComPtr< IOleClientSite > m_pClientSite; CComPtr< IOleClientSite > m_pClientSite;
CComPtr< IDataAdviseHolder > m_pDAdviseHolder; CComPtr< IDataAdviseHolder > m_pDAdviseHolder;
@@ -174,23 +174,23 @@ protected:
::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl > m_xOwnAccess; ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl > m_xOwnAccess;
sal_Bool m_bIsInVerbHandling; bool m_bIsInVerbHandling;
}; };
class BooleanGuard_Impl class BooleanGuard_Impl
{ {
sal_Bool& m_bValue; bool& m_bValue;
public: public:
BooleanGuard_Impl( sal_Bool& bValue ) BooleanGuard_Impl( bool& bValue )
: m_bValue( bValue ) : m_bValue( bValue )
{ {
m_bValue = sal_True; m_bValue = true;
} }
~BooleanGuard_Impl() ~BooleanGuard_Impl()
{ {
m_bValue = sal_False; m_bValue = false;
} }
}; };

View File

@@ -41,19 +41,19 @@ public:
virtual ~CIIAObj(); virtual ~CIIAObj();
/* IUnknown methods */ /* IUnknown methods */
STDMETHODIMP QueryInterface(REFIID, LPVOID FAR * ppvObj); STDMETHODIMP QueryInterface(REFIID, LPVOID FAR * ppvObj) override;
STDMETHODIMP_(ULONG) AddRef(); STDMETHODIMP_(ULONG) AddRef() override;
STDMETHODIMP_(ULONG) Release(); STDMETHODIMP_(ULONG) Release() override;
/* IOleInPlaceActiveObject methods */ /* IOleInPlaceActiveObject methods */
STDMETHODIMP GetWindow(HWND *); STDMETHODIMP GetWindow(HWND *) override;
STDMETHODIMP ContextSensitiveHelp(BOOL); STDMETHODIMP ContextSensitiveHelp(BOOL) override;
STDMETHODIMP TranslateAccelerator(LPMSG); STDMETHODIMP TranslateAccelerator(LPMSG);
STDMETHODIMP OnFrameWindowActivate(BOOL); STDMETHODIMP OnFrameWindowActivate(BOOL) override;
STDMETHODIMP OnDocWindowActivate(BOOL); STDMETHODIMP OnDocWindowActivate(BOOL) override;
STDMETHODIMP ResizeBorder(LPCRECT, LPOLEINPLACEUIWINDOW STDMETHODIMP ResizeBorder(LPCRECT, LPOLEINPLACEUIWINDOW
, BOOL); , BOOL) override;
STDMETHODIMP EnableModeless(BOOL); STDMETHODIMP EnableModeless(BOOL) override;
private: private:

View File

@@ -46,9 +46,9 @@ public:
Interceptor( Interceptor(
const ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl >& xOleAccess, const ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl >& xOleAccess,
DocumentHolder* pDocH, DocumentHolder* pDocH,
sal_Bool bLink ); bool bLink );
~Interceptor(); ~Interceptor() override;
void DisconnectDocHolder(); void DisconnectDocHolder();
@@ -76,7 +76,7 @@ public:
dispatch( dispatch(
const css::util::URL& URL, const css::util::URL& URL,
const css::uno::Sequence< css::beans::PropertyValue >& Arguments ) const css::uno::Sequence< css::beans::PropertyValue >& Arguments )
throw (css::uno::RuntimeException); throw (css::uno::RuntimeException) override;
virtual void SAL_CALL virtual void SAL_CALL
addStatusListener( addStatusListener(
@@ -84,7 +84,7 @@ public:
const css::util::URL& URL ) const css::util::URL& URL )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
virtual void SAL_CALL virtual void SAL_CALL
removeStatusListener( removeStatusListener(
@@ -92,14 +92,14 @@ public:
const css::util::URL& URL ) const css::util::URL& URL )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
//XInterceptorInfo //XInterceptorInfo
virtual css::uno::Sequence< OUString > virtual css::uno::Sequence< OUString >
SAL_CALL getInterceptedURLs( ) SAL_CALL getInterceptedURLs( )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
//XDispatchProvider ( inherited by XDispatchProviderInterceptor ) //XDispatchProvider ( inherited by XDispatchProviderInterceptor )
@@ -111,7 +111,7 @@ public:
sal_Int32 SearchFlags ) sal_Int32 SearchFlags )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL
queryDispatches( queryDispatches(
@@ -119,7 +119,7 @@ public:
css::frame::DispatchDescriptor >& Requests ) css::frame::DispatchDescriptor >& Requests )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
//XDispatchProviderInterceptor //XDispatchProviderInterceptor
@@ -127,27 +127,27 @@ public:
getSlaveDispatchProvider( ) getSlaveDispatchProvider( )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
virtual void SAL_CALL virtual void SAL_CALL
setSlaveDispatchProvider( setSlaveDispatchProvider(
const css::uno::Reference< css::frame::XDispatchProvider >& NewDispatchProvider ) const css::uno::Reference< css::frame::XDispatchProvider >& NewDispatchProvider )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
virtual css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL virtual css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL
getMasterDispatchProvider( ) getMasterDispatchProvider( )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
virtual void SAL_CALL virtual void SAL_CALL
setMasterDispatchProvider( setMasterDispatchProvider(
const css::uno::Reference< css::frame::XDispatchProvider >& NewSupplier ) const css::uno::Reference< css::frame::XDispatchProvider >& NewSupplier )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
private: private:
@@ -168,7 +168,7 @@ private:
comphelper::OInterfaceContainerHelper2* m_pDisposeEventListeners; comphelper::OInterfaceContainerHelper2* m_pDisposeEventListeners;
StatusChangeListenerContainer* m_pStatCL; StatusChangeListenerContainer* m_pStatCL;
sal_Bool m_bLink; bool m_bLink;
}; };
#endif #endif

View File

@@ -35,7 +35,7 @@ class EmbedServer_Impl: public cppu::WeakImplHelper<css::lang::XServiceInfo>
{ {
public: public:
EmbedServer_Impl( const css::uno::Reference< css::lang::XMultiServiceFactory > &xFactory ); EmbedServer_Impl( const css::uno::Reference< css::lang::XMultiServiceFactory > &xFactory );
virtual ~EmbedServer_Impl(); virtual ~EmbedServer_Impl() override;
OUString SAL_CALL getImplementationName() OUString SAL_CALL getImplementationName()
throw (css::uno::RuntimeException, std::exception) override; throw (css::uno::RuntimeException, std::exception) override;
@@ -59,17 +59,17 @@ public:
EmbedProviderFactory_Impl( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory, const GUID* pGuid); EmbedProviderFactory_Impl( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory, const GUID* pGuid);
virtual ~EmbedProviderFactory_Impl(); virtual ~EmbedProviderFactory_Impl();
sal_Bool registerClass(); bool registerClass();
sal_Bool deregisterClass(); bool deregisterClass();
/* IUnknown methods */ /* IUnknown methods */
STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj); STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj) override;
STDMETHOD_(ULONG, AddRef)(); STDMETHOD_(ULONG, AddRef)() override;
STDMETHOD_(ULONG, Release)(); STDMETHOD_(ULONG, Release)() override;
/* IClassFactory methods */ /* IClassFactory methods */
STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv); STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv) override;
STDMETHOD(LockServer)(int fLock); STDMETHOD(LockServer)(int fLock) override;
protected: protected:

View File

@@ -94,7 +94,7 @@ namespace winwrap {
void GetTrueRect(LPRECT lpTrueRect) const; void GetTrueRect(LPRECT lpTrueRect) const;
BOOL SetCursor(HWND hWnd,UINT nHitTest) const; BOOL SetCursor(HWND hWnd,UINT nHitTest) const;
BOOL Track(HWND hWnd,POINT point,BOOL bAllowInvert = FALSE, BOOL Track(HWND hWnd,POINT point,BOOL bAllowInvert = FALSE,
HWND hWndClipTo = NULL); HWND hWndClipTo = nullptr);
// BOOL TrackRubberBand(HWND hWnd,POINT point,BOOL bAllowInvert = TRUE); // BOOL TrackRubberBand(HWND hWnd,POINT point,BOOL bAllowInvert = TRUE);
int HitTest(POINT point) const; int HitTest(POINT point) const;
int NormalizeHit(int nHandle) const; int NormalizeHit(int nHandle) const;
@@ -123,7 +123,7 @@ protected:
void GetHandleRect(int nHandle,RECT* pHandleRect) const; void GetHandleRect(int nHandle,RECT* pHandleRect) const;
void GetModifyPointers( void GetModifyPointers(
int nHandle,int**ppx, int**ppy, int* px, int*py); int nHandle,int**ppx, int**ppy, int* px, int*py);
virtual int GetHandleSize(LPRECT lpRect = NULL) const; virtual int GetHandleSize(LPRECT lpRect = nullptr) const;
BOOL TrackHandle(int nHandle,HWND hWnd,POINT point,HWND hWndClipTo); BOOL TrackHandle(int nHandle,HWND hWnd,POINT point,HWND hWndClipTo);
void Construct(); void Construct();
}; };

View File

@@ -38,7 +38,7 @@ public:
ContainerWindowWrapper(HWND aHwnd); ContainerWindowWrapper(HWND aHwnd);
~ ContainerWindowWrapper(); ~ ContainerWindowWrapper() override;
// XComponent // XComponent
@@ -48,7 +48,7 @@ public:
) )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
virtual void SAL_CALL virtual void SAL_CALL
addEventListener( addEventListener(
@@ -56,7 +56,7 @@ public:
) )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
virtual void SAL_CALL virtual void SAL_CALL
removeEventListener( removeEventListener(
@@ -64,7 +64,7 @@ public:
) )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
// XSystemDependentWindowPeer // XSystemDependentWindowPeer
@@ -76,7 +76,7 @@ public:
) )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
// XWindow // XWindow
@@ -89,14 +89,14 @@ public:
sal_Int16 Flags sal_Int16 Flags
) )
throw ( throw (
css::uno::RuntimeException); css::uno::RuntimeException) override;
virtual css::awt::Rectangle SAL_CALL virtual css::awt::Rectangle SAL_CALL
getPosSize( getPosSize(
) )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
virtual void SAL_CALL virtual void SAL_CALL
setVisible( setVisible(
@@ -104,7 +104,7 @@ public:
) )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
virtual void SAL_CALL virtual void SAL_CALL
setEnable( setEnable(
@@ -112,14 +112,14 @@ public:
) )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
virtual void SAL_CALL virtual void SAL_CALL
setFocus( setFocus(
) )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
virtual void SAL_CALL virtual void SAL_CALL
addWindowListener( addWindowListener(
@@ -127,7 +127,7 @@ public:
) )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
virtual void SAL_CALL virtual void SAL_CALL
removeWindowListener( removeWindowListener(
@@ -135,7 +135,7 @@ public:
) )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
virtual void SAL_CALL virtual void SAL_CALL
addFocusListener( addFocusListener(
@@ -143,7 +143,7 @@ public:
) )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
virtual void SAL_CALL virtual void SAL_CALL
removeFocusListener( removeFocusListener(
@@ -151,7 +151,7 @@ public:
) )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
virtual void SAL_CALL virtual void SAL_CALL
addKeyListener( addKeyListener(
@@ -160,7 +160,7 @@ public:
) )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
virtual void SAL_CALL virtual void SAL_CALL
removeKeyListener( removeKeyListener(
@@ -168,7 +168,7 @@ public:
) )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
virtual void SAL_CALL virtual void SAL_CALL
addMouseListener( addMouseListener(
@@ -176,7 +176,7 @@ public:
) )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
virtual void SAL_CALL virtual void SAL_CALL
removeMouseListener( removeMouseListener(
@@ -185,7 +185,7 @@ public:
) )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
virtual void SAL_CALL virtual void SAL_CALL
addMouseMotionListener( addMouseMotionListener(
@@ -194,7 +194,7 @@ public:
) )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
virtual void SAL_CALL virtual void SAL_CALL
removeMouseMotionListener( removeMouseMotionListener(
@@ -202,7 +202,7 @@ public:
) )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
virtual void SAL_CALL virtual void SAL_CALL
addPaintListener( addPaintListener(
@@ -210,7 +210,7 @@ public:
) )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
virtual void SAL_CALL virtual void SAL_CALL
removePaintListener( removePaintListener(
@@ -218,7 +218,7 @@ public:
) )
throw ( throw (
css::uno::RuntimeException css::uno::RuntimeException
); ) override;
private: private:

View File

@@ -28,7 +28,7 @@ namespace inprocserv
OleWrapperAdviseSink::OleWrapperAdviseSink() OleWrapperAdviseSink::OleWrapperAdviseSink()
: m_nRefCount( 0 ) : m_nRefCount( 0 )
, m_pFormatEtc( NULL ) , m_pFormatEtc( nullptr )
, m_nAspect( DVASPECT_CONTENT ) , m_nAspect( DVASPECT_CONTENT )
, m_nRegID( 0 ) , m_nRegID( 0 )
, m_bObjectAdvise( TRUE ) , m_bObjectAdvise( TRUE )
@@ -42,7 +42,7 @@ OleWrapperAdviseSink::OleWrapperAdviseSink()
OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener ) OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener )
: m_nRefCount( 0 ) : m_nRefCount( 0 )
, m_pListener( pListener ) , m_pListener( pListener )
, m_pFormatEtc( NULL ) , m_pFormatEtc( nullptr )
, m_nAspect( DVASPECT_CONTENT ) , m_nAspect( DVASPECT_CONTENT )
, m_nRegID( 0 ) , m_nRegID( 0 )
, m_bObjectAdvise( TRUE ) , m_bObjectAdvise( TRUE )
@@ -56,7 +56,7 @@ OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pList
OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener, FORMATETC* pFormatEtc, DWORD nDataRegFlag ) OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener, FORMATETC* pFormatEtc, DWORD nDataRegFlag )
: m_nRefCount( 0 ) : m_nRefCount( 0 )
, m_pListener( pListener ) , m_pListener( pListener )
, m_pFormatEtc( NULL ) , m_pFormatEtc( nullptr )
, m_nAspect( DVASPECT_CONTENT ) , m_nAspect( DVASPECT_CONTENT )
, m_nRegID( 0 ) , m_nRegID( 0 )
, m_bObjectAdvise( FALSE ) , m_bObjectAdvise( FALSE )
@@ -69,7 +69,7 @@ OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pList
{ {
m_pFormatEtc = new FORMATETC; m_pFormatEtc = new FORMATETC;
m_pFormatEtc->cfFormat = pFormatEtc->cfFormat; m_pFormatEtc->cfFormat = pFormatEtc->cfFormat;
m_pFormatEtc->ptd = NULL; m_pFormatEtc->ptd = nullptr;
m_pFormatEtc->dwAspect = pFormatEtc->dwAspect; m_pFormatEtc->dwAspect = pFormatEtc->dwAspect;
m_pFormatEtc->lindex = pFormatEtc->lindex; m_pFormatEtc->lindex = pFormatEtc->lindex;
m_pFormatEtc->tymed = pFormatEtc->tymed; m_pFormatEtc->tymed = pFormatEtc->tymed;
@@ -79,7 +79,7 @@ OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pList
OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener, DWORD nAspect, DWORD nViewRegFlag ) OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener, DWORD nAspect, DWORD nViewRegFlag )
: m_nRefCount( 0 ) : m_nRefCount( 0 )
, m_pListener( pListener ) , m_pListener( pListener )
, m_pFormatEtc( NULL ) , m_pFormatEtc( nullptr )
, m_nAspect( nAspect ) , m_nAspect( nAspect )
, m_nRegID( 0 ) , m_nRegID( 0 )
, m_bObjectAdvise( TRUE ) , m_bObjectAdvise( TRUE )
@@ -97,17 +97,17 @@ OleWrapperAdviseSink::~OleWrapperAdviseSink()
STDMETHODIMP OleWrapperAdviseSink::QueryInterface( REFIID riid , void** ppv ) STDMETHODIMP OleWrapperAdviseSink::QueryInterface( REFIID riid , void** ppv )
{ {
*ppv=NULL; *ppv=nullptr;
if ( riid == IID_IUnknown ) if ( riid == IID_IUnknown )
*ppv = (IUnknown*)this; *ppv = static_cast<IUnknown*>(this);
if ( riid == IID_IAdviseSink ) 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; return S_OK;
} }

View File

@@ -69,21 +69,21 @@ public:
FORMATETC* GetFormatEtc() { return m_pFormatEtc; } FORMATETC* GetFormatEtc() { return m_pFormatEtc; }
DWORD GetAspect() { return m_nAspect; } DWORD GetAspect() { return m_nAspect; }
ComSmart< IAdviseSink >& GetOrigAdvise() { return m_pListener; } ComSmart< IAdviseSink >& GetOrigAdvise() { return m_pListener; }
void DisconnectOrigAdvise() { m_pListener = NULL; } void DisconnectOrigAdvise() { m_pListener = nullptr; }
void SetClosed() { m_bClosed = TRUE; } void SetClosed() { m_bClosed = TRUE; }
void UnsetClosed() { m_bClosed = FALSE; } void UnsetClosed() { m_bClosed = FALSE; }
BOOL IsClosed() { return m_bClosed; } BOOL IsClosed() { return m_bClosed; }
STDMETHODIMP QueryInterface(REFIID, void**); STDMETHODIMP QueryInterface(REFIID, void**) override;
STDMETHODIMP_(ULONG) AddRef(); STDMETHODIMP_(ULONG) AddRef() override;
STDMETHODIMP_(ULONG) Release(); STDMETHODIMP_(ULONG) Release() override;
STDMETHODIMP_(void) OnDataChange(LPFORMATETC, LPSTGMEDIUM); STDMETHODIMP_(void) OnDataChange(LPFORMATETC, LPSTGMEDIUM) override;
STDMETHODIMP_(void) OnViewChange(DWORD, LONG); STDMETHODIMP_(void) OnViewChange(DWORD, LONG) override;
STDMETHODIMP_(void) OnRename(LPMONIKER); STDMETHODIMP_(void) OnRename(LPMONIKER) override;
STDMETHODIMP_(void) OnSave(); STDMETHODIMP_(void) OnSave() override;
STDMETHODIMP_(void) OnClose(); STDMETHODIMP_(void) OnClose() override;
}; };
}; // namespace advisesink }; // namespace advisesink

View File

@@ -42,7 +42,7 @@ static const GUID* guidList[ SUPPORTED_FACTORIES_NUM ] = {
&OID_MathOASISServer &OID_MathOASISServer
}; };
static HINSTANCE g_hInstance = NULL; static HINSTANCE g_hInstance = nullptr;
static ULONG g_nObj = 0; static ULONG g_nObj = 0;
static ULONG g_nLock = 0; static ULONG g_nLock = 0;
@@ -93,7 +93,7 @@ namespace {
HRESULT hRes = E_FAIL; HRESULT hRes = E_FAIL;
if ( pLibrary && nLen ) if ( pLibrary && nLen )
{ {
HKEY hKey = NULL; HKEY hKey = nullptr;
hRes = S_OK; hRes = S_OK;
for ( int nInd = 0; nInd < SUPPORTED_FACTORIES_NUM; nInd++ ) for ( int nInd = 0; nInd < SUPPORTED_FACTORIES_NUM; nInd++ )
@@ -109,14 +109,14 @@ namespace {
{ {
if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, pSubKey, &hKey ) ) if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, pSubKey, &hKey ) )
{ {
if ( ERROR_SUCCESS == RegSetValueEx( hKey, "", 0, REG_SZ, (const BYTE*)pLibrary, nLen ) ) if ( ERROR_SUCCESS == RegSetValueEx( hKey, "", 0, REG_SZ, reinterpret_cast<const BYTE*>(pLibrary), nLen ) )
bLocalSuccess = TRUE; bLocalSuccess = TRUE;
} }
if ( hKey ) if ( hKey )
{ {
RegCloseKey( hKey ); RegCloseKey( hKey );
hKey = NULL; hKey = nullptr;
} }
} }
@@ -144,13 +144,13 @@ public:
virtual ~InprocEmbedProvider_Impl(); virtual ~InprocEmbedProvider_Impl();
/* IUnknown methods */ /* IUnknown methods */
STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj); STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj) override;
STDMETHOD_(ULONG, AddRef)(); STDMETHOD_(ULONG, AddRef)() override;
STDMETHOD_(ULONG, Release)(); STDMETHOD_(ULONG, Release)() override;
/* IClassFactory methods */ /* IClassFactory methods */
STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv); STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv) override;
STDMETHOD(LockServer)(int fLock); STDMETHOD(LockServer)(int fLock) override;
protected: protected:
@@ -186,7 +186,7 @@ STDAPI INPROC_DLLPUBLIC DllGetClassObject( REFCLSID rclsid, REFIID riid, LPVOID*
return E_NOINTERFACE; return E_NOINTERFACE;
*ppv = new inprocserv::InprocEmbedProvider_Impl( rclsid ); *ppv = new inprocserv::InprocEmbedProvider_Impl( rclsid );
((LPUNKNOWN)*ppv)->AddRef(); static_cast<LPUNKNOWN>(*ppv)->AddRef();
return S_OK; return S_OK;
} }
@@ -270,17 +270,17 @@ STDMETHODIMP InprocEmbedProvider_Impl::QueryInterface( REFIID riid, void FAR* FA
if(IsEqualIID(riid, IID_IUnknown)) if(IsEqualIID(riid, IID_IUnknown))
{ {
AddRef(); AddRef();
*ppv = (IUnknown*) this; *ppv = static_cast<IUnknown*>(this);
return S_OK; return S_OK;
} }
else if (IsEqualIID(riid, IID_IClassFactory)) else if (IsEqualIID(riid, IID_IClassFactory))
{ {
AddRef(); AddRef();
*ppv = (IClassFactory*) this; *ppv = static_cast<IClassFactory*>(this);
return S_OK; return S_OK;
} }
*ppv = NULL; *ppv = nullptr;
return E_NOINTERFACE; return E_NOINTERFACE;
} }
@@ -307,18 +307,16 @@ STDMETHODIMP InprocEmbedProvider_Impl::CreateInstance(IUnknown FAR* punkOuter,
// TODO/LATER: should the aggregation be supported? // TODO/LATER: should the aggregation be supported?
// if ( punkOuter != NULL && riid != IID_IUnknown ) // if ( punkOuter != NULL && riid != IID_IUnknown )
// return E_NOINTERFACE; // return E_NOINTERFACE;
if ( punkOuter != NULL ) if ( punkOuter != nullptr )
return CLASS_E_NOAGGREGATION; return CLASS_E_NOAGGREGATION;
InprocEmbedDocument_Impl* pEmbedDocument = new InprocEmbedDocument_Impl( m_guid ); InprocEmbedDocument_Impl* pEmbedDocument = new InprocEmbedDocument_Impl( m_guid );
pEmbedDocument->AddRef(); pEmbedDocument->AddRef();
HRESULT hr = pEmbedDocument->Init(); HRESULT hr = pEmbedDocument->QueryInterface( riid, ppv );
if ( SUCCEEDED( hr ) )
hr = pEmbedDocument->QueryInterface( riid, ppv );
pEmbedDocument->Release(); pEmbedDocument->Release();
if ( !SUCCEEDED( hr ) ) if ( !SUCCEEDED( hr ) )
*ppv = NULL; *ppv = nullptr;
return hr; return hr;
} }

File diff suppressed because it is too large Load Diff

View File

@@ -101,22 +101,20 @@ class InprocEmbedDocument_Impl : public InprocCountedObject_Impl
virtual ~InternalCacheWrapper() {} virtual ~InternalCacheWrapper() {}
/* IUnknown methods */ /* IUnknown methods */
STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj); STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj) override;
STDMETHOD_(ULONG, AddRef)(); STDMETHOD_(ULONG, AddRef)() override;
STDMETHOD_(ULONG, Release)(); STDMETHOD_(ULONG, Release)() override;
/* IOleCache2 methods */ /* IOleCache2 methods */
STDMETHOD(Cache)( FORMATETC *pformatetc, DWORD advf, DWORD *pdwConnection); STDMETHOD(Cache)( FORMATETC *pformatetc, DWORD advf, DWORD *pdwConnection) override;
STDMETHOD(Uncache)( DWORD dwConnection); STDMETHOD(Uncache)( DWORD dwConnection) override;
STDMETHOD(EnumCache)( IEnumSTATDATA **ppenumSTATDATA); STDMETHOD(EnumCache)( IEnumSTATDATA **ppenumSTATDATA) override;
STDMETHOD(InitCache)( IDataObject *pDataObject); STDMETHOD(InitCache)( IDataObject *pDataObject) override;
STDMETHOD(SetData)( FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease); STDMETHOD(SetData)( FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease) override;
STDMETHOD(UpdateCache)( LPDATAOBJECT pDataObject, DWORD grfUpdf, LPVOID pReserved); STDMETHOD(UpdateCache)( LPDATAOBJECT pDataObject, DWORD grfUpdf, LPVOID pReserved) override;
STDMETHOD(DiscardCache)( DWORD dwDiscardOptions); STDMETHOD(DiscardCache)( DWORD dwDiscardOptions) override;
} m_aInternalCache; } m_aInternalCache;
DWORD InsertAdviseLinkToList( const ComSmart<OleWrapperAdviseSink>& pOwnAdvise, ComSmart< OleWrapperAdviseSink > pAdvises[] );
void Clean(); void Clean();
@@ -128,7 +126,7 @@ public:
, m_guid( guid ) , m_guid( guid )
, m_nInitMode( NOINIT ) , m_nInitMode( NOINIT )
, m_nFileOpenMode( 0 ) , m_nFileOpenMode( 0 )
, m_pFileName( NULL ) , m_pFileName( nullptr )
, m_nCallsOnStack( 0 ) , m_nCallsOnStack( 0 )
, m_aInternalCache( *this ) , m_aInternalCache( *this )
{} {}
@@ -136,99 +134,96 @@ public:
virtual ~InprocEmbedDocument_Impl() virtual ~InprocEmbedDocument_Impl()
{} {}
HRESULT Init();
void SetName( LPCOLESTR pszNameFromOutside, wchar_t*& pOwnName );
BOOL CheckDefHandler(); BOOL CheckDefHandler();
ComSmart< IUnknown >& GetDefHandler() { return m_pDefHandler; } ComSmart< IUnknown >& GetDefHandler() { return m_pDefHandler; }
/* IUnknown methods */ /* IUnknown methods */
STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj); STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj) override;
STDMETHOD_(ULONG, AddRef)(); STDMETHOD_(ULONG, AddRef)() override;
STDMETHOD_(ULONG, Release)(); STDMETHOD_(ULONG, Release)() override;
/* IOleObject methods */ /* IOleObject methods */
STDMETHOD(SetClientSite) ( IOleClientSite* pSite ); STDMETHOD(SetClientSite) ( IOleClientSite* pSite ) override;
STDMETHOD(GetClientSite) ( IOleClientSite** pSite ); STDMETHOD(GetClientSite) ( IOleClientSite** pSite ) override;
STDMETHOD(SetHostNames) ( LPCOLESTR szContainerApp, LPCOLESTR szContainerObj ); STDMETHOD(SetHostNames) ( LPCOLESTR szContainerApp, LPCOLESTR szContainerObj ) override;
STDMETHOD(Close) ( DWORD dwSaveOption); STDMETHOD(Close) ( DWORD dwSaveOption) override;
STDMETHOD(SetMoniker) ( DWORD dwWhichMoniker, IMoniker *pmk ); STDMETHOD(SetMoniker) ( DWORD dwWhichMoniker, IMoniker *pmk ) override;
STDMETHOD(GetMoniker) ( DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk ); STDMETHOD(GetMoniker) ( DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk ) override;
STDMETHOD(InitFromData) ( IDataObject *pDataObject, BOOL fCreation, DWORD dwReserved ); STDMETHOD(InitFromData) ( IDataObject *pDataObject, BOOL fCreation, DWORD dwReserved ) override;
STDMETHOD(GetClipboardData) ( DWORD dwReserved, IDataObject **ppDataObject ); STDMETHOD(GetClipboardData) ( DWORD dwReserved, IDataObject **ppDataObject ) override;
STDMETHOD(DoVerb) ( LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect ); STDMETHOD(DoVerb) ( LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect ) override;
STDMETHOD(EnumVerbs) ( IEnumOLEVERB **ppEnumOleVerb ); STDMETHOD(EnumVerbs) ( IEnumOLEVERB **ppEnumOleVerb ) override;
STDMETHOD(Update) (); STDMETHOD(Update) () override;
STDMETHOD(IsUpToDate) (); STDMETHOD(IsUpToDate) () override;
STDMETHOD(GetUserClassID) ( CLSID *pClsid ); STDMETHOD(GetUserClassID) ( CLSID *pClsid ) override;
STDMETHOD(GetUserType) ( DWORD dwFormOfType, LPOLESTR *pszUserType ); STDMETHOD(GetUserType) ( DWORD dwFormOfType, LPOLESTR *pszUserType ) override;
STDMETHOD(SetExtent) ( DWORD dwDrawAspect, SIZEL *psizel ); STDMETHOD(SetExtent) ( DWORD dwDrawAspect, SIZEL *psizel ) override;
STDMETHOD(GetExtent) ( DWORD dwDrawAspect, SIZEL *psizel ); STDMETHOD(GetExtent) ( DWORD dwDrawAspect, SIZEL *psizel ) override;
STDMETHOD(Advise) ( IAdviseSink *pAdvSink, DWORD *pdwConnection ); STDMETHOD(Advise) ( IAdviseSink *pAdvSink, DWORD *pdwConnection ) override;
STDMETHOD(Unadvise) ( DWORD dwConnection ); STDMETHOD(Unadvise) ( DWORD dwConnection ) override;
STDMETHOD(EnumAdvise) ( IEnumSTATDATA **ppenumAdvise ); STDMETHOD(EnumAdvise) ( IEnumSTATDATA **ppenumAdvise ) override;
STDMETHOD(GetMiscStatus) ( DWORD dwAspect, DWORD *pdwStatus ); STDMETHOD(GetMiscStatus) ( DWORD dwAspect, DWORD *pdwStatus ) override;
STDMETHOD(SetColorScheme) ( LOGPALETTE *pLogpal ); STDMETHOD(SetColorScheme) ( LOGPALETTE *pLogpal ) override;
/* IDataObject methods */ /* IDataObject methods */
STDMETHOD(GetData) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium ); STDMETHOD(GetData) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium ) override;
STDMETHOD(GetDataHere) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium ); STDMETHOD(GetDataHere) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium ) override;
STDMETHOD(QueryGetData) ( FORMATETC * pFormatetc ); STDMETHOD(QueryGetData) ( FORMATETC * pFormatetc ) override;
STDMETHOD(GetCanonicalFormatEtc) ( FORMATETC * pFormatetcIn, FORMATETC * pFormatetcOut ); STDMETHOD(GetCanonicalFormatEtc) ( FORMATETC * pFormatetcIn, FORMATETC * pFormatetcOut ) override;
STDMETHOD(SetData) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium, BOOL fRelease ); STDMETHOD(SetData) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium, BOOL fRelease ) override;
STDMETHOD(EnumFormatEtc) ( DWORD dwDirection, IEnumFORMATETC ** ppFormatetc ); STDMETHOD(EnumFormatEtc) ( DWORD dwDirection, IEnumFORMATETC ** ppFormatetc ) override;
STDMETHOD(DAdvise) ( FORMATETC * pFormatetc, DWORD advf, IAdviseSink * pAdvSink, DWORD * pdwConnection ); STDMETHOD(DAdvise) ( FORMATETC * pFormatetc, DWORD advf, IAdviseSink * pAdvSink, DWORD * pdwConnection ) override;
STDMETHOD(DUnadvise) ( DWORD dwConnection ); STDMETHOD(DUnadvise) ( DWORD dwConnection ) override;
STDMETHOD(EnumDAdvise) ( IEnumSTATDATA ** ppenumAdvise ); STDMETHOD(EnumDAdvise) ( IEnumSTATDATA ** ppenumAdvise ) override;
/* IPersistMethod */ /* IPersistMethod */
STDMETHOD(GetClassID)(CLSID *pClassID); STDMETHOD(GetClassID)(CLSID *pClassID) override;
/* IPersistStorage methods */ /* IPersistStorage methods */
STDMETHOD(IsDirty) (); STDMETHOD(IsDirty) () override;
STDMETHOD(InitNew) ( IStorage *pStg ); STDMETHOD(InitNew) ( IStorage *pStg ) override;
STDMETHOD(Load) ( IStorage* pStr ); STDMETHOD(Load) ( IStorage* pStr ) override;
STDMETHOD(Save) ( IStorage *pStgSave, BOOL fSameAsLoad ); STDMETHOD(Save) ( IStorage *pStgSave, BOOL fSameAsLoad ) override;
STDMETHOD(SaveCompleted) ( IStorage *pStgNew ); STDMETHOD(SaveCompleted) ( IStorage *pStgNew ) override;
STDMETHOD(HandsOffStorage) (void); STDMETHOD(HandsOffStorage) (void) override;
/* IPersistFile methods */ /* IPersistFile methods */
STDMETHOD(Load) ( LPCOLESTR pszFileName, DWORD dwMode ); STDMETHOD(Load) ( LPCOLESTR pszFileName, DWORD dwMode ) override;
STDMETHOD(Save) ( LPCOLESTR pszFileName, BOOL fRemember ); STDMETHOD(Save) ( LPCOLESTR pszFileName, BOOL fRemember ) override;
STDMETHOD(SaveCompleted) ( LPCOLESTR pszFileName ); STDMETHOD(SaveCompleted) ( LPCOLESTR pszFileName ) override;
STDMETHOD(GetCurFile) ( LPOLESTR *ppszFileName ); STDMETHOD(GetCurFile) ( LPOLESTR *ppszFileName ) override;
/* IRunnableObject methods */ /* IRunnableObject methods */
STDMETHOD(GetRunningClass) ( LPCLSID lpClsid); STDMETHOD(GetRunningClass) ( LPCLSID lpClsid) override;
STDMETHOD(Run) ( LPBINDCTX pbc); STDMETHOD(Run) ( LPBINDCTX pbc) override;
virtual BOOL STDMETHODCALLTYPE IsRunning( void); virtual BOOL STDMETHODCALLTYPE IsRunning( void) override;
STDMETHOD(LockRunning) ( BOOL fLock, BOOL fLastUnlockCloses ); STDMETHOD(LockRunning) ( BOOL fLock, BOOL fLastUnlockCloses ) override;
STDMETHOD(SetContainedObject) ( BOOL fContained); STDMETHOD(SetContainedObject) ( BOOL fContained) override;
/* IViewObject2 methods */ /* IViewObject2 methods */
STDMETHOD(Draw)( DWORD dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcTargetDev, HDC hdcDraw, LPCRECTL lprcBounds, LPCRECTL lprcWBounds, BOOL ( STDMETHODCALLTYPE *pfnContinue )( ULONG_PTR dwContinue ), ULONG_PTR dwContinue); STDMETHOD(Draw)( DWORD dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcTargetDev, HDC hdcDraw, LPCRECTL lprcBounds, LPCRECTL lprcWBounds, BOOL ( STDMETHODCALLTYPE *pfnContinue )( ULONG_PTR dwContinue ), ULONG_PTR dwContinue) override;
STDMETHOD(GetColorSet)( DWORD dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hicTargetDev, LOGPALETTE **ppColorSet); STDMETHOD(GetColorSet)( DWORD dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hicTargetDev, LOGPALETTE **ppColorSet) override;
STDMETHOD(Freeze)( DWORD dwDrawAspect, LONG lindex, void *pvAspect, DWORD *pdwFreeze); STDMETHOD(Freeze)( DWORD dwDrawAspect, LONG lindex, void *pvAspect, DWORD *pdwFreeze) override;
STDMETHOD(Unfreeze)( DWORD dwFreeze); STDMETHOD(Unfreeze)( DWORD dwFreeze) override;
STDMETHOD(SetAdvise)( DWORD aspects, DWORD advf, IAdviseSink *pAdvSink); STDMETHOD(SetAdvise)( DWORD aspects, DWORD advf, IAdviseSink *pAdvSink) override;
STDMETHOD(GetAdvise)( DWORD *pAspects, DWORD *pAdvf, IAdviseSink **ppAdvSink); STDMETHOD(GetAdvise)( DWORD *pAspects, DWORD *pAdvf, IAdviseSink **ppAdvSink) override;
STDMETHOD(GetExtent)( DWORD dwDrawAspect, LONG lindex, DVTARGETDEVICE *ptd, LPSIZEL lpsizel); STDMETHOD(GetExtent)( DWORD dwDrawAspect, LONG lindex, DVTARGETDEVICE *ptd, LPSIZEL lpsizel) override;
/* IOleWindow methods */ /* IOleWindow methods */
STDMETHOD(GetWindow)( HWND *phwnd); STDMETHOD(GetWindow)( HWND *phwnd) override;
STDMETHOD(ContextSensitiveHelp)( BOOL fEnterMode); STDMETHOD(ContextSensitiveHelp)( BOOL fEnterMode) override;
/* IOleInPlaceObject methods */ /* IOleInPlaceObject methods */
STDMETHOD(InPlaceDeactivate)( void); STDMETHOD(InPlaceDeactivate)( void) override;
STDMETHOD(UIDeactivate)( void); STDMETHOD(UIDeactivate)( void) override;
STDMETHOD(SetObjectRects)( LPCRECT lprcPosRect, LPCRECT lprcClipRect); STDMETHOD(SetObjectRects)( LPCRECT lprcPosRect, LPCRECT lprcClipRect) override;
STDMETHOD(ReactivateAndUndo)( void); STDMETHOD(ReactivateAndUndo)( void) override;
/*IDispatch methods*/ /*IDispatch methods*/
STDMETHOD(GetTypeInfoCount)( UINT *pctinfo); STDMETHOD(GetTypeInfoCount)( UINT *pctinfo) override;
STDMETHOD(GetTypeInfo)( UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo); STDMETHOD(GetTypeInfo)( UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) override;
STDMETHOD(GetIDsOfNames)( REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId); STDMETHOD(GetIDsOfNames)( REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) override;
STDMETHOD(Invoke)( DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr); STDMETHOD(Invoke)( DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) override;
}; };

View File

@@ -33,27 +33,27 @@ template< class T > class ComSmart
if ( m_pInterface ) if ( m_pInterface )
{ {
T* pInterface = m_pInterface; T* pInterface = m_pInterface;
m_pInterface = NULL; m_pInterface = nullptr;
pInterface->Release(); pInterface->Release();
} }
} }
public: public:
ComSmart() ComSmart()
: m_pInterface( NULL ) : m_pInterface( nullptr )
{} {}
ComSmart( const ComSmart<T>& rObj ) ComSmart( const ComSmart<T>& rObj )
: m_pInterface( rObj.m_pInterface ) : m_pInterface( rObj.m_pInterface )
{ {
if ( m_pInterface != NULL ) if ( m_pInterface != nullptr )
m_pInterface->AddRef(); m_pInterface->AddRef();
} }
explicit ComSmart( T* pInterface ) explicit ComSmart( T* pInterface )
: m_pInterface( pInterface ) : m_pInterface( pInterface )
{ {
if ( m_pInterface != NULL ) if ( m_pInterface != nullptr )
m_pInterface->AddRef(); m_pInterface->AddRef();
} }
@@ -68,7 +68,7 @@ public:
m_pInterface = rObj.m_pInterface; m_pInterface = rObj.m_pInterface;
if ( m_pInterface != NULL ) if ( m_pInterface != nullptr )
m_pInterface->AddRef(); m_pInterface->AddRef();
return *this; return *this;
@@ -80,7 +80,7 @@ public:
m_pInterface = pInterface; m_pInterface = pInterface;
if ( m_pInterface != NULL ) if ( m_pInterface != nullptr )
m_pInterface->AddRef(); m_pInterface->AddRef();
return *this; return *this;
@@ -100,7 +100,7 @@ public:
{ {
OwnRelease(); OwnRelease();
m_pInterface = NULL; m_pInterface = nullptr;
return &m_pInterface; return &m_pInterface;
} }