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

View File

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

View File

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

View File

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

View File

@@ -24,6 +24,8 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <guid.hxx>
OUString getStorageTypeFromGUID_Impl( GUID* guid )
{
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)
{
*ppv=NULL;
*ppv=nullptr;
if(IID_IUnknown==riid ||
IID_IOleWindow==riid ||
@@ -45,9 +45,9 @@ STDMETHODIMP CIIAObj::QueryInterface(REFIID riid, LPVOID FAR *ppv)
*ppv=this;
//AddRef any interface we'll return.
if (NULL!=*ppv)
if (nullptr!=*ppv)
{
((LPUNKNOWN)*ppv)->AddRef();
static_cast<LPUNKNOWN>(*ppv)->AddRef();
return NOERROR;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -94,7 +94,7 @@ namespace winwrap {
void GetTrueRect(LPRECT lpTrueRect) const;
BOOL SetCursor(HWND hWnd,UINT nHitTest) const;
BOOL Track(HWND hWnd,POINT point,BOOL bAllowInvert = FALSE,
HWND hWndClipTo = NULL);
HWND hWndClipTo = nullptr);
// BOOL TrackRubberBand(HWND hWnd,POINT point,BOOL bAllowInvert = TRUE);
int HitTest(POINT point) const;
int NormalizeHit(int nHandle) const;
@@ -123,7 +123,7 @@ protected:
void GetHandleRect(int nHandle,RECT* pHandleRect) const;
void GetModifyPointers(
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);
void Construct();
};

View File

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

View File

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

View File

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

View File

@@ -42,7 +42,7 @@ static const GUID* guidList[ SUPPORTED_FACTORIES_NUM ] = {
&OID_MathOASISServer
};
static HINSTANCE g_hInstance = NULL;
static HINSTANCE g_hInstance = nullptr;
static ULONG g_nObj = 0;
static ULONG g_nLock = 0;
@@ -93,7 +93,7 @@ namespace {
HRESULT hRes = E_FAIL;
if ( pLibrary && nLen )
{
HKEY hKey = NULL;
HKEY hKey = nullptr;
hRes = S_OK;
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 == 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;
}
if ( hKey )
{
RegCloseKey( hKey );
hKey = NULL;
hKey = nullptr;
}
}
@@ -144,13 +144,13 @@ public:
virtual ~InprocEmbedProvider_Impl();
/* IUnknown methods */
STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj);
STDMETHOD_(ULONG, AddRef)();
STDMETHOD_(ULONG, Release)();
STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj) override;
STDMETHOD_(ULONG, AddRef)() override;
STDMETHOD_(ULONG, Release)() override;
/* IClassFactory methods */
STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv);
STDMETHOD(LockServer)(int fLock);
STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv) override;
STDMETHOD(LockServer)(int fLock) override;
protected:
@@ -186,7 +186,7 @@ STDAPI INPROC_DLLPUBLIC DllGetClassObject( REFCLSID rclsid, REFIID riid, LPVOID*
return E_NOINTERFACE;
*ppv = new inprocserv::InprocEmbedProvider_Impl( rclsid );
((LPUNKNOWN)*ppv)->AddRef();
static_cast<LPUNKNOWN>(*ppv)->AddRef();
return S_OK;
}
@@ -270,17 +270,17 @@ STDMETHODIMP InprocEmbedProvider_Impl::QueryInterface( REFIID riid, void FAR* FA
if(IsEqualIID(riid, IID_IUnknown))
{
AddRef();
*ppv = (IUnknown*) this;
*ppv = static_cast<IUnknown*>(this);
return S_OK;
}
else if (IsEqualIID(riid, IID_IClassFactory))
{
AddRef();
*ppv = (IClassFactory*) this;
*ppv = static_cast<IClassFactory*>(this);
return S_OK;
}
*ppv = NULL;
*ppv = nullptr;
return E_NOINTERFACE;
}
@@ -307,18 +307,16 @@ STDMETHODIMP InprocEmbedProvider_Impl::CreateInstance(IUnknown FAR* punkOuter,
// TODO/LATER: should the aggregation be supported?
// if ( punkOuter != NULL && riid != IID_IUnknown )
// return E_NOINTERFACE;
if ( punkOuter != NULL )
if ( punkOuter != nullptr )
return CLASS_E_NOAGGREGATION;
InprocEmbedDocument_Impl* pEmbedDocument = new InprocEmbedDocument_Impl( m_guid );
pEmbedDocument->AddRef();
HRESULT hr = pEmbedDocument->Init();
if ( SUCCEEDED( hr ) )
hr = pEmbedDocument->QueryInterface( riid, ppv );
HRESULT hr = pEmbedDocument->QueryInterface( riid, ppv );
pEmbedDocument->Release();
if ( !SUCCEEDED( hr ) )
*ppv = NULL;
*ppv = nullptr;
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() {}
/* IUnknown methods */
STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj);
STDMETHOD_(ULONG, AddRef)();
STDMETHOD_(ULONG, Release)();
STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj) override;
STDMETHOD_(ULONG, AddRef)() override;
STDMETHOD_(ULONG, Release)() override;
/* IOleCache2 methods */
STDMETHOD(Cache)( FORMATETC *pformatetc, DWORD advf, DWORD *pdwConnection);
STDMETHOD(Uncache)( DWORD dwConnection);
STDMETHOD(EnumCache)( IEnumSTATDATA **ppenumSTATDATA);
STDMETHOD(InitCache)( IDataObject *pDataObject);
STDMETHOD(SetData)( FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease);
STDMETHOD(UpdateCache)( LPDATAOBJECT pDataObject, DWORD grfUpdf, LPVOID pReserved);
STDMETHOD(DiscardCache)( DWORD dwDiscardOptions);
STDMETHOD(Cache)( FORMATETC *pformatetc, DWORD advf, DWORD *pdwConnection) override;
STDMETHOD(Uncache)( DWORD dwConnection) override;
STDMETHOD(EnumCache)( IEnumSTATDATA **ppenumSTATDATA) override;
STDMETHOD(InitCache)( IDataObject *pDataObject) override;
STDMETHOD(SetData)( FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease) override;
STDMETHOD(UpdateCache)( LPDATAOBJECT pDataObject, DWORD grfUpdf, LPVOID pReserved) override;
STDMETHOD(DiscardCache)( DWORD dwDiscardOptions) override;
} m_aInternalCache;
DWORD InsertAdviseLinkToList( const ComSmart<OleWrapperAdviseSink>& pOwnAdvise, ComSmart< OleWrapperAdviseSink > pAdvises[] );
void Clean();
@@ -128,7 +126,7 @@ public:
, m_guid( guid )
, m_nInitMode( NOINIT )
, m_nFileOpenMode( 0 )
, m_pFileName( NULL )
, m_pFileName( nullptr )
, m_nCallsOnStack( 0 )
, m_aInternalCache( *this )
{}
@@ -136,99 +134,96 @@ public:
virtual ~InprocEmbedDocument_Impl()
{}
HRESULT Init();
void SetName( LPCOLESTR pszNameFromOutside, wchar_t*& pOwnName );
BOOL CheckDefHandler();
ComSmart< IUnknown >& GetDefHandler() { return m_pDefHandler; }
/* IUnknown methods */
STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj);
STDMETHOD_(ULONG, AddRef)();
STDMETHOD_(ULONG, Release)();
STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj) override;
STDMETHOD_(ULONG, AddRef)() override;
STDMETHOD_(ULONG, Release)() override;
/* IOleObject methods */
STDMETHOD(SetClientSite) ( IOleClientSite* pSite );
STDMETHOD(GetClientSite) ( IOleClientSite** pSite );
STDMETHOD(SetHostNames) ( LPCOLESTR szContainerApp, LPCOLESTR szContainerObj );
STDMETHOD(Close) ( DWORD dwSaveOption);
STDMETHOD(SetMoniker) ( DWORD dwWhichMoniker, IMoniker *pmk );
STDMETHOD(GetMoniker) ( DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk );
STDMETHOD(InitFromData) ( IDataObject *pDataObject, BOOL fCreation, DWORD dwReserved );
STDMETHOD(GetClipboardData) ( DWORD dwReserved, IDataObject **ppDataObject );
STDMETHOD(DoVerb) ( LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect );
STDMETHOD(EnumVerbs) ( IEnumOLEVERB **ppEnumOleVerb );
STDMETHOD(Update) ();
STDMETHOD(IsUpToDate) ();
STDMETHOD(GetUserClassID) ( CLSID *pClsid );
STDMETHOD(GetUserType) ( DWORD dwFormOfType, LPOLESTR *pszUserType );
STDMETHOD(SetExtent) ( DWORD dwDrawAspect, SIZEL *psizel );
STDMETHOD(GetExtent) ( DWORD dwDrawAspect, SIZEL *psizel );
STDMETHOD(Advise) ( IAdviseSink *pAdvSink, DWORD *pdwConnection );
STDMETHOD(Unadvise) ( DWORD dwConnection );
STDMETHOD(EnumAdvise) ( IEnumSTATDATA **ppenumAdvise );
STDMETHOD(GetMiscStatus) ( DWORD dwAspect, DWORD *pdwStatus );
STDMETHOD(SetColorScheme) ( LOGPALETTE *pLogpal );
STDMETHOD(SetClientSite) ( IOleClientSite* pSite ) override;
STDMETHOD(GetClientSite) ( IOleClientSite** pSite ) override;
STDMETHOD(SetHostNames) ( LPCOLESTR szContainerApp, LPCOLESTR szContainerObj ) override;
STDMETHOD(Close) ( DWORD dwSaveOption) override;
STDMETHOD(SetMoniker) ( DWORD dwWhichMoniker, IMoniker *pmk ) override;
STDMETHOD(GetMoniker) ( DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk ) override;
STDMETHOD(InitFromData) ( IDataObject *pDataObject, BOOL fCreation, DWORD dwReserved ) override;
STDMETHOD(GetClipboardData) ( DWORD dwReserved, IDataObject **ppDataObject ) override;
STDMETHOD(DoVerb) ( LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect ) override;
STDMETHOD(EnumVerbs) ( IEnumOLEVERB **ppEnumOleVerb ) override;
STDMETHOD(Update) () override;
STDMETHOD(IsUpToDate) () override;
STDMETHOD(GetUserClassID) ( CLSID *pClsid ) override;
STDMETHOD(GetUserType) ( DWORD dwFormOfType, LPOLESTR *pszUserType ) override;
STDMETHOD(SetExtent) ( DWORD dwDrawAspect, SIZEL *psizel ) override;
STDMETHOD(GetExtent) ( DWORD dwDrawAspect, SIZEL *psizel ) override;
STDMETHOD(Advise) ( IAdviseSink *pAdvSink, DWORD *pdwConnection ) override;
STDMETHOD(Unadvise) ( DWORD dwConnection ) override;
STDMETHOD(EnumAdvise) ( IEnumSTATDATA **ppenumAdvise ) override;
STDMETHOD(GetMiscStatus) ( DWORD dwAspect, DWORD *pdwStatus ) override;
STDMETHOD(SetColorScheme) ( LOGPALETTE *pLogpal ) override;
/* IDataObject methods */
STDMETHOD(GetData) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium );
STDMETHOD(GetDataHere) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium );
STDMETHOD(QueryGetData) ( FORMATETC * pFormatetc );
STDMETHOD(GetCanonicalFormatEtc) ( FORMATETC * pFormatetcIn, FORMATETC * pFormatetcOut );
STDMETHOD(SetData) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium, BOOL fRelease );
STDMETHOD(EnumFormatEtc) ( DWORD dwDirection, IEnumFORMATETC ** ppFormatetc );
STDMETHOD(DAdvise) ( FORMATETC * pFormatetc, DWORD advf, IAdviseSink * pAdvSink, DWORD * pdwConnection );
STDMETHOD(DUnadvise) ( DWORD dwConnection );
STDMETHOD(EnumDAdvise) ( IEnumSTATDATA ** ppenumAdvise );
STDMETHOD(GetData) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium ) override;
STDMETHOD(GetDataHere) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium ) override;
STDMETHOD(QueryGetData) ( FORMATETC * pFormatetc ) override;
STDMETHOD(GetCanonicalFormatEtc) ( FORMATETC * pFormatetcIn, FORMATETC * pFormatetcOut ) override;
STDMETHOD(SetData) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium, BOOL fRelease ) override;
STDMETHOD(EnumFormatEtc) ( DWORD dwDirection, IEnumFORMATETC ** ppFormatetc ) override;
STDMETHOD(DAdvise) ( FORMATETC * pFormatetc, DWORD advf, IAdviseSink * pAdvSink, DWORD * pdwConnection ) override;
STDMETHOD(DUnadvise) ( DWORD dwConnection ) override;
STDMETHOD(EnumDAdvise) ( IEnumSTATDATA ** ppenumAdvise ) override;
/* IPersistMethod */
STDMETHOD(GetClassID)(CLSID *pClassID);
STDMETHOD(GetClassID)(CLSID *pClassID) override;
/* IPersistStorage methods */
STDMETHOD(IsDirty) ();
STDMETHOD(InitNew) ( IStorage *pStg );
STDMETHOD(Load) ( IStorage* pStr );
STDMETHOD(Save) ( IStorage *pStgSave, BOOL fSameAsLoad );
STDMETHOD(SaveCompleted) ( IStorage *pStgNew );
STDMETHOD(HandsOffStorage) (void);
STDMETHOD(IsDirty) () override;
STDMETHOD(InitNew) ( IStorage *pStg ) override;
STDMETHOD(Load) ( IStorage* pStr ) override;
STDMETHOD(Save) ( IStorage *pStgSave, BOOL fSameAsLoad ) override;
STDMETHOD(SaveCompleted) ( IStorage *pStgNew ) override;
STDMETHOD(HandsOffStorage) (void) override;
/* IPersistFile methods */
STDMETHOD(Load) ( LPCOLESTR pszFileName, DWORD dwMode );
STDMETHOD(Save) ( LPCOLESTR pszFileName, BOOL fRemember );
STDMETHOD(SaveCompleted) ( LPCOLESTR pszFileName );
STDMETHOD(GetCurFile) ( LPOLESTR *ppszFileName );
STDMETHOD(Load) ( LPCOLESTR pszFileName, DWORD dwMode ) override;
STDMETHOD(Save) ( LPCOLESTR pszFileName, BOOL fRemember ) override;
STDMETHOD(SaveCompleted) ( LPCOLESTR pszFileName ) override;
STDMETHOD(GetCurFile) ( LPOLESTR *ppszFileName ) override;
/* IRunnableObject methods */
STDMETHOD(GetRunningClass) ( LPCLSID lpClsid);
STDMETHOD(Run) ( LPBINDCTX pbc);
virtual BOOL STDMETHODCALLTYPE IsRunning( void);
STDMETHOD(LockRunning) ( BOOL fLock, BOOL fLastUnlockCloses );
STDMETHOD(SetContainedObject) ( BOOL fContained);
STDMETHOD(GetRunningClass) ( LPCLSID lpClsid) override;
STDMETHOD(Run) ( LPBINDCTX pbc) override;
virtual BOOL STDMETHODCALLTYPE IsRunning( void) override;
STDMETHOD(LockRunning) ( BOOL fLock, BOOL fLastUnlockCloses ) override;
STDMETHOD(SetContainedObject) ( BOOL fContained) override;
/* 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(GetColorSet)( DWORD dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hicTargetDev, LOGPALETTE **ppColorSet);
STDMETHOD(Freeze)( DWORD dwDrawAspect, LONG lindex, void *pvAspect, DWORD *pdwFreeze);
STDMETHOD(Unfreeze)( DWORD dwFreeze);
STDMETHOD(SetAdvise)( DWORD aspects, DWORD advf, IAdviseSink *pAdvSink);
STDMETHOD(GetAdvise)( DWORD *pAspects, DWORD *pAdvf, IAdviseSink **ppAdvSink);
STDMETHOD(GetExtent)( DWORD dwDrawAspect, LONG lindex, DVTARGETDEVICE *ptd, LPSIZEL lpsizel);
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) override;
STDMETHOD(Freeze)( DWORD dwDrawAspect, LONG lindex, void *pvAspect, DWORD *pdwFreeze) override;
STDMETHOD(Unfreeze)( DWORD dwFreeze) override;
STDMETHOD(SetAdvise)( DWORD aspects, DWORD advf, IAdviseSink *pAdvSink) override;
STDMETHOD(GetAdvise)( DWORD *pAspects, DWORD *pAdvf, IAdviseSink **ppAdvSink) override;
STDMETHOD(GetExtent)( DWORD dwDrawAspect, LONG lindex, DVTARGETDEVICE *ptd, LPSIZEL lpsizel) override;
/* IOleWindow methods */
STDMETHOD(GetWindow)( HWND *phwnd);
STDMETHOD(ContextSensitiveHelp)( BOOL fEnterMode);
STDMETHOD(GetWindow)( HWND *phwnd) override;
STDMETHOD(ContextSensitiveHelp)( BOOL fEnterMode) override;
/* IOleInPlaceObject methods */
STDMETHOD(InPlaceDeactivate)( void);
STDMETHOD(UIDeactivate)( void);
STDMETHOD(SetObjectRects)( LPCRECT lprcPosRect, LPCRECT lprcClipRect);
STDMETHOD(ReactivateAndUndo)( void);
STDMETHOD(InPlaceDeactivate)( void) override;
STDMETHOD(UIDeactivate)( void) override;
STDMETHOD(SetObjectRects)( LPCRECT lprcPosRect, LPCRECT lprcClipRect) override;
STDMETHOD(ReactivateAndUndo)( void) override;
/*IDispatch methods*/
STDMETHOD(GetTypeInfoCount)( UINT *pctinfo);
STDMETHOD(GetTypeInfo)( UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo);
STDMETHOD(GetIDsOfNames)( REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId);
STDMETHOD(Invoke)( DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
STDMETHOD(GetTypeInfoCount)( UINT *pctinfo) override;
STDMETHOD(GetTypeInfo)( UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) override;
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) override;
};

View File

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