diff options
-rw-r--r-- | include/sfx2/app.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/appl/appdde.cxx | 30 | ||||
-rw-r--r-- | sfx2/source/appl/lnkbase2.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/appl/shutdownicon.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/appl/shutdowniconw32.cxx | 160 | ||||
-rw-r--r-- | sfx2/source/dialog/filedlghelper.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/graphhelp.cxx | 10 | ||||
-rw-r--r-- | sfx2/source/doc/syspath.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/doc/syspathw32.cxx | 10 | ||||
-rw-r--r-- | sfx2/source/doc/syspathw32.hxx | 33 | ||||
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 24 |
11 files changed, 146 insertions, 136 deletions
diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx index 99577e69194d..942d1baa6f32 100644 --- a/include/sfx2/app.hxx +++ b/include/sfx2/app.hxx @@ -141,7 +141,7 @@ public: // DDE #if defined(_WIN32) - long DdeExecute( const OUString& rCmd ); + static long DdeExecute( const OUString& rCmd ); #endif bool InitializeDde(); const DdeService* GetDdeService() const; diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx index 5c33b4d8a3b0..06569040d1f0 100644 --- a/sfx2/source/appl/appdde.cxx +++ b/sfx2/source/appl/appdde.cxx @@ -77,11 +77,11 @@ public: namespace { - sal_Bool lcl_IsDocument( const OUString& rContent ) + bool lcl_IsDocument( const OUString& rContent ) { using namespace com::sun::star; - sal_Bool bRet = sal_False; + bool bRet = false; INetURLObject aObj( rContent ); DBG_ASSERT( aObj.GetProtocol() != INetProtocol::NotValid, "Invalid URL!" ); @@ -121,7 +121,7 @@ bool ImplDdeService::MakeTopic( const OUString& rNm ) // The Topic rNm is sought, do we have it? // First only loop over the ObjectShells to find those // with the specific name: - sal_Bool bRet = sal_False; + bool bRet = false; OUString sNm( rNm.toAsciiLowerCase() ); SfxObjectShell* pShell = SfxObjectShell::GetFirst(); while( pShell ) @@ -145,17 +145,17 @@ bool ImplDdeService::MakeTopic( const OUString& rNm ) { // File exists? then try to load it: SfxStringItem aName( SID_FILE_NAME, aFile.GetMainURL( INetURLObject::NO_DECODE ) ); - SfxBoolItem aNewView(SID_OPEN_NEW_VIEW, sal_True); + SfxBoolItem aNewView(SID_OPEN_NEW_VIEW, true); - SfxBoolItem aSilent(SID_SILENT, sal_True); + SfxBoolItem aSilent(SID_SILENT, true); SfxDispatcher* pDispatcher = SfxGetpApp()->GetDispatcher_Impl(); const SfxPoolItem* pRet = pDispatcher->ExecuteList(SID_OPENDOC, SfxCallMode::SYNCHRON, { &aName, &aNewView, &aSilent }); if( pRet && dynamic_cast< const SfxViewFrameItem *>( pRet ) != nullptr && - ((SfxViewFrameItem*)pRet)->GetFrame() && - 0 != ( pShell = ((SfxViewFrameItem*)pRet) + static_cast<SfxViewFrameItem const *>(pRet)->GetFrame() && + nullptr != ( pShell = static_cast<SfxViewFrameItem const *>(pRet) ->GetFrame()->GetObjectShell() ) ) { SfxGetpApp()->AddDdeTopic( pShell ); @@ -190,7 +190,7 @@ OUString ImplDdeService::Topics() bool ImplDdeService::SysTopicExecute( const OUString* pStr ) { - return SfxGetpApp()->DdeExecute( *pStr ); + return SfxApplication::DdeExecute( *pStr ); } #endif @@ -243,7 +243,7 @@ namespace { rCmd = "Open(\"d:\doc\doc.sdw\")" rEvent = "Open" */ -sal_Bool SfxAppEvent_Impl( const OUString& rCmd, const OUString& rEvent, +bool SfxAppEvent_Impl( const OUString& rCmd, const OUString& rEvent, ApplicationEvent::Type eType ) { OUString sEvent(rEvent + "("); @@ -299,11 +299,11 @@ sal_Bool SfxAppEvent_Impl( const OUString& rCmd, const OUString& rEvent, } GetpApp()->AppEvent( ApplicationEvent(eType, aData) ); - return sal_True; + return true; } } - return sal_False; + return false; } } @@ -466,7 +466,7 @@ void SfxApplication::AddDdeTopic( SfxObjectShell* pSh ) // prevent double submit OUString sShellNm; - sal_Bool bFnd = sal_False; + bool bFnd = false; for (size_t n = pImpl->pDocTopics->size(); n;) { if( (*pImpl->pDocTopics)[ --n ]->pSh == pSh ) @@ -474,7 +474,7 @@ void SfxApplication::AddDdeTopic( SfxObjectShell* pSh ) // If the document is untitled, is still a new Topic is created! if( !bFnd ) { - bFnd = sal_True; + bFnd = true; sShellNm = pSh->GetTitle(SFX_TITLE_FULLNAME).toAsciiLowerCase(); } OUString sNm( (*pImpl->pDocTopics)[ n ]->GetName() ); @@ -534,13 +534,13 @@ DdeData* SfxDdeDocTopic_Impl::Get(SotClipboardFormatId nFormat) return &aData; } aSeq.realloc( 0 ); - return 0; + return nullptr; } bool SfxDdeDocTopic_Impl::Put( const DdeData* pData ) { aSeq = css::uno::Sequence< sal_Int8 >( - (sal_Int8*)pData->getData(), pData->getSize() ); + static_cast<sal_Int8 const *>(pData->getData()), pData->getSize() ); bool bRet; if( aSeq.getLength() ) { diff --git a/sfx2/source/appl/lnkbase2.cxx b/sfx2/source/appl/lnkbase2.cxx index d09823a74625..fd0d8fb21e30 100644 --- a/sfx2/source/appl/lnkbase2.cxx +++ b/sfx2/source/appl/lnkbase2.cxx @@ -152,7 +152,7 @@ SvBaseLink::SvBaseLink( SfxLinkUpdateMode nUpdateMode, SotClipboardFormatId nCon static DdeTopic* FindTopic( const OUString & rLinkName, sal_uInt16* pItemStt ) { if( rLinkName.isEmpty() ) - return 0; + return nullptr; OUString sNm( rLinkName ); sal_Int32 nTokenPos = 0; @@ -178,7 +178,7 @@ static DdeTopic* FindTopic( const OUString & rLinkName, sal_uInt16* pItemStt ) break; } } - return 0; + return nullptr; } SvBaseLink::SvBaseLink( const OUString& rLinkName, sal_uInt16 nObjectType, SvLinkSource* pObj ) diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index 86aa57c74d7a..d6326726688e 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -485,7 +485,7 @@ IMPL_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, /*unused*/, vo if ( SvtMiscOptions().UseSystemFileDialog() ) { delete m_pFileDlg; - m_pFileDlg = NULL; + m_pFileDlg = nullptr; } #endif diff --git a/sfx2/source/appl/shutdowniconw32.cxx b/sfx2/source/appl/shutdowniconw32.cxx index 89117e4c9c14..434006120012 100644 --- a/sfx2/source/appl/shutdowniconw32.cxx +++ b/sfx2/source/appl/shutdowniconw32.cxx @@ -74,9 +74,9 @@ using ::com::sun::star::beans::PropertyValue; #define SFX_TASKBAR_NOTIFICATION WM_USER+1 -static HWND aListenerWindow = NULL; -static HWND aExecuterWindow = NULL; -static HMENU popupMenu = NULL; +static HWND aListenerWindow = nullptr; +static HWND aExecuterWindow = nullptr; +static HMENU popupMenu = nullptr; static void OnMeasureItem(HWND hwnd, LPMEASUREITEMSTRUCT lpmis); static void OnDrawItem(HWND hwnd, LPDRAWITEMSTRUCT lpdis); @@ -89,7 +89,7 @@ typedef struct tagMYITEM } MYITEM; -static void addMenuItem( HMENU hMenu, UINT id, UINT iconId, const OUString& text, int& pos, int bOwnerdraw, const OUString& module ) +static void addMenuItem( HMENU hMenu, UINT id, UINT iconId, const OUString& text, int& pos, bool bOwnerdraw, const OUString& module ) { MENUITEMINFOW mi; memset( &mi, 0, sizeof( MENUITEMINFOW ) ); @@ -113,7 +113,7 @@ static void addMenuItem( HMENU hMenu, UINT id, UINT iconId, const OUString& text pMyItem->text = text; pMyItem->iconId = iconId; pMyItem->module = module; - mi.dwItemData = (DWORD_PTR) pMyItem; + mi.dwItemData = reinterpret_cast<DWORD_PTR>(pMyItem); } else { @@ -121,7 +121,7 @@ static void addMenuItem( HMENU hMenu, UINT id, UINT iconId, const OUString& text mi.fType=MFT_STRING; mi.fState=MFS_ENABLED; mi.wID = id; - mi.dwTypeData = (LPWSTR) text.getStr(); + mi.dwTypeData = const_cast<sal_Unicode *>(text.getStr()); mi.cch = text.getLength(); } @@ -144,7 +144,7 @@ static HMENU createSystrayMenu( ) OSL_ENSURE( pShutdownIcon, "ShutdownIcon instance empty!"); if( !pShutdownIcon ) - return NULL; + return nullptr; // collect the URLs of the entries in the File/New menu ::std::set< OUString > aFileNewAppsAvailable; @@ -194,7 +194,7 @@ static HMENU createSystrayMenu( ) continue; addMenuItem( hMenu, aMenuItems[i].nMenuItemID, aMenuItems[i].nMenuIconID, - pShutdownIcon->GetUrlDescription( sURL ), pos, true, "" ); + ShutdownIcon::GetUrlDescription( sURL ), pos, true, "" ); } @@ -202,7 +202,7 @@ static HMENU createSystrayMenu( ) addMenuItem( hMenu, IDM_TEMPLATE, ICON_TEMPLATE, pShutdownIcon->GetResString( STR_QUICKSTART_FROMTEMPLATE ), pos, true, ""); addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false, "" ); - addMenuItem( hMenu, IDM_OPEN, ICON_OPEN, pShutdownIcon->GetResString( STR_QUICKSTART_FILEOPEN ), pos, true, OUString("SHELL32")); + addMenuItem( hMenu, IDM_OPEN, ICON_OPEN, pShutdownIcon->GetResString( STR_QUICKSTART_FILEOPEN ), pos, true, "SHELL32"); addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false, "" ); addMenuItem( hMenu, IDM_INSTALL,0, pShutdownIcon->GetResString( STR_QUICKSTART_PRELAUNCH ), pos, false, "" ); addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false, "" ); @@ -228,7 +228,7 @@ static void deleteSystrayMenu( HMENU hMenu ) while( GetMenuItemInfoW( hMenu, pos++, true, &mi ) ) { - MYITEM *pMyItem = (MYITEM*) mi.dwItemData; + MYITEM *pMyItem = reinterpret_cast<MYITEM*>(mi.dwItemData); if( pMyItem ) { (pMyItem->text).clear(); @@ -247,9 +247,9 @@ static void addTaskbarIcon( HWND hWnd ) // add taskbar icon NOTIFYICONDATAW nid; - nid.hIcon = (HICON)LoadImageA( GetModuleHandle( NULL ), MAKEINTRESOURCE( ICON_LO_DEFAULT ), + nid.hIcon = static_cast<HICON>(LoadImageA( GetModuleHandle( nullptr ), MAKEINTRESOURCE( ICON_LO_DEFAULT ), IMAGE_ICON, GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ), - LR_DEFAULTCOLOR | LR_SHARED ); + LR_DEFAULTCOLOR | LR_SHARED )); wcsncpy( nid.szTip, reinterpret_cast<LPCWSTR>(strTip.getStr()), 64 ); @@ -281,7 +281,7 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP // create the menu if( !popupMenu ) - if( (popupMenu = createSystrayMenu( )) == NULL ) + if( (popupMenu = createSystrayMenu( )) == nullptr ) return -1; // and the icon @@ -289,16 +289,16 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP // disable shutdown ShutdownIcon::getInstance()->SetVeto( true ); - ShutdownIcon::getInstance()->addTerminateListener(); + ShutdownIcon::addTerminateListener(); } return 0; case WM_MEASUREITEM: - OnMeasureItem(hWnd, (LPMEASUREITEMSTRUCT) lParam); + OnMeasureItem(hWnd, reinterpret_cast<LPMEASUREITEMSTRUCT>(lParam)); return TRUE; case WM_DRAWITEM: - OnDrawItem(hWnd, (LPDRAWITEMSTRUCT) lParam); + OnDrawItem(hWnd, reinterpret_cast<LPDRAWITEMSTRUCT>(lParam)); return TRUE; case SFX_TASKBAR_NOTIFICATION: @@ -306,7 +306,7 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP { case WM_LBUTTONDBLCLK: { - BOOL const ret = PostMessage(aExecuterWindow, WM_COMMAND, IDM_TEMPLATE, (LPARAM)hWnd); + BOOL const ret = PostMessage(aExecuterWindow, WM_COMMAND, IDM_TEMPLATE, reinterpret_cast<LPARAM>(hWnd)); SAL_WARN_IF(0 == ret, "sfx.appl", "ERROR: PostMessage() failed!"); break; } @@ -324,7 +324,7 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP EnableMenuItem( popupMenu, IDM_OPEN, MF_BYCOMMAND | (ShutdownIcon::bModalMode ? MF_GRAYED : MF_ENABLED) ); EnableMenuItem( popupMenu, IDM_TEMPLATE, MF_BYCOMMAND | (ShutdownIcon::bModalMode ? MF_GRAYED : MF_ENABLED) ); int m = TrackPopupMenuEx( popupMenu, TPM_RETURNCMD|TPM_LEFTALIGN|TPM_RIGHTBUTTON, - pt.x, pt.y, hWnd, NULL ); + pt.x, pt.y, hWnd, nullptr ); BOOL const ret = PostMessage( hWnd, 0, 0, 0 ); SAL_WARN_IF(0 == ret, "sfx.appl", "ERROR: PostMessage() failed!"); switch( m ) @@ -351,7 +351,7 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP break; } - BOOL const ret2 = PostMessage(aExecuterWindow, WM_COMMAND, m, (LPARAM)hWnd); + BOOL const ret2 = PostMessage(aExecuterWindow, WM_COMMAND, m, reinterpret_cast<LPARAM>(hWnd)); SAL_WARN_IF(0 == ret2, "sfx.appl", "ERROR: PostMessage() failed!"); } break; @@ -377,7 +377,7 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP nid.uID = ID_QUICKSTART; Shell_NotifyIconA(NIM_DELETE, &nid); - BOOL const ret = PostMessage(aExecuterWindow, WM_COMMAND, IDM_EXIT, (LPARAM)hWnd); + BOOL const ret = PostMessage(aExecuterWindow, WM_COMMAND, IDM_EXIT, reinterpret_cast<LPARAM>(hWnd)); SAL_WARN_IF(0 == ret, "sfx.appl", "ERROR: PostMessage() failed!"); } else @@ -404,22 +404,22 @@ LRESULT CALLBACK executerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP ShutdownIcon::FileOpen(); break; case IDM_WRITER: - ShutdownIcon::OpenURL( OUString( WRITER_URL ), OUString( "_default" ) ); + ShutdownIcon::OpenURL( WRITER_URL, "_default" ); break; case IDM_CALC: - ShutdownIcon::OpenURL( OUString( CALC_URL ), OUString( "_default" ) ); + ShutdownIcon::OpenURL( CALC_URL, "_default" ); break; case IDM_IMPRESS: - ShutdownIcon::OpenURL( OUString( IMPRESS_WIZARD_URL ), OUString( "_default" ) ); + ShutdownIcon::OpenURL( IMPRESS_WIZARD_URL, "_default" ); break; case IDM_DRAW: - ShutdownIcon::OpenURL( OUString( DRAW_URL ), OUString( "_default" ) ); + ShutdownIcon::OpenURL( DRAW_URL, "_default" ); break; case IDM_BASE: - ShutdownIcon::OpenURL( OUString( BASE_URL ), OUString( "_default" ) ); + ShutdownIcon::OpenURL( BASE_URL, "_default" ); break; case IDM_MATH: - ShutdownIcon::OpenURL( OUString( MATH_URL ), OUString( "_default" ) ); + ShutdownIcon::OpenURL( MATH_URL, "_default" ); break; case IDM_TEMPLATE: if ( !ShutdownIcon::bModalMode ) @@ -456,15 +456,15 @@ DWORD WINAPI SystrayThread( LPVOID /*lpParam*/ ) CW_USEDEFAULT, // vertical position of window CW_USEDEFAULT, // window width CW_USEDEFAULT, // window height - (HWND) NULL, // handle to parent or owner window - NULL, // menu handle or child identifier - (HINSTANCE) GetModuleHandle( NULL ), // handle to application instance - NULL // window-creation data + nullptr, // handle to parent or owner window + nullptr, // menu handle or child identifier + GetModuleHandle( nullptr ), // handle to application instance + nullptr // window-creation data ); MSG msg; - while ( GetMessage( &msg, NULL, 0, 0 ) ) + while ( GetMessage( &msg, nullptr, 0, 0 ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); @@ -484,13 +484,13 @@ void win32_init_sys_tray() listenerClass.lpfnWndProc = listenerWndProc; listenerClass.cbClsExtra = 0; listenerClass.cbWndExtra = 0; - listenerClass.hInstance = (HINSTANCE) GetModuleHandle( NULL ); - listenerClass.hIcon = NULL; - listenerClass.hCursor = NULL; - listenerClass.hbrBackground = NULL; - listenerClass.lpszMenuName = NULL; + listenerClass.hInstance = GetModuleHandle( nullptr ); + listenerClass.hIcon = nullptr; + listenerClass.hCursor = nullptr; + listenerClass.hbrBackground = nullptr; + listenerClass.lpszMenuName = nullptr; listenerClass.lpszClassName = QUICKSTART_CLASSNAME; - listenerClass.hIconSm = NULL; + listenerClass.hIconSm = nullptr; RegisterClassExA(&listenerClass); @@ -500,13 +500,13 @@ void win32_init_sys_tray() executerClass.lpfnWndProc = executerWndProc; executerClass.cbClsExtra = 0; executerClass.cbWndExtra = 0; - executerClass.hInstance = (HINSTANCE) GetModuleHandle( NULL ); - executerClass.hIcon = NULL; - executerClass.hCursor = NULL; - executerClass.hbrBackground = NULL; - executerClass.lpszMenuName = NULL; + executerClass.hInstance = GetModuleHandle( nullptr ); + executerClass.hIcon = nullptr; + executerClass.hCursor = nullptr; + executerClass.hbrBackground = nullptr; + executerClass.lpszMenuName = nullptr; executerClass.lpszClassName = EXECUTER_WINDOWCLASS; - executerClass.hIconSm = NULL; + executerClass.hIconSm = nullptr; RegisterClassExA( &executerClass ); @@ -518,14 +518,14 @@ void win32_init_sys_tray() CW_USEDEFAULT, // vertical position of window CW_USEDEFAULT, // window width CW_USEDEFAULT, // window height - (HWND) NULL, // handle to parent or owner window - NULL, // menu handle or child identifier - (HINSTANCE) GetModuleHandle( NULL ), // handle to application instance - NULL // window-creation data + nullptr, // handle to parent or owner window + nullptr, // menu handle or child identifier + GetModuleHandle( nullptr ), // handle to application instance + nullptr // window-creation data ); DWORD dwThreadId; - CreateThread( NULL, 0, SystrayThread, NULL, 0, &dwThreadId ); + CreateThread( nullptr, 0, SystrayThread, nullptr, 0, &dwThreadId ); } } @@ -537,19 +537,19 @@ void win32_shutdown_sys_tray() if( IsWindow( aListenerWindow ) ) { DestroyWindow( aListenerWindow ); - aListenerWindow = NULL; + aListenerWindow = nullptr; DestroyWindow( aExecuterWindow ); - aExecuterWindow = NULL; + aExecuterWindow = nullptr; } - UnregisterClassA( QUICKSTART_CLASSNAME, GetModuleHandle( NULL ) ); - UnregisterClassA( EXECUTER_WINDOWCLASS, GetModuleHandle( NULL ) ); + UnregisterClassA( QUICKSTART_CLASSNAME, GetModuleHandle( nullptr ) ); + UnregisterClassA( EXECUTER_WINDOWCLASS, GetModuleHandle( nullptr ) ); } } void OnMeasureItem(HWND hwnd, LPMEASUREITEMSTRUCT lpmis) { - MYITEM *pMyItem = (MYITEM *) lpmis->itemData; + MYITEM *pMyItem = reinterpret_cast<MYITEM *>(lpmis->itemData); HDC hdc = GetDC(hwnd); SIZE size; @@ -557,12 +557,12 @@ void OnMeasureItem(HWND hwnd, LPMEASUREITEMSTRUCT lpmis) memset(&ncm, 0, sizeof(ncm)); ncm.cbSize = sizeof(ncm); - SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, (PVOID) &ncm, 0); + SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0); // Assume every menu item can be default and printed bold ncm.lfMenuFont.lfWeight = FW_BOLD; - HFONT hfntOld = (HFONT) SelectObject(hdc, (HFONT) CreateFontIndirect( &ncm.lfMenuFont )); + HFONT hfntOld = static_cast<HFONT>(SelectObject(hdc, CreateFontIndirect( &ncm.lfMenuFont ))); GetTextExtentPoint32W(hdc, reinterpret_cast<LPCWSTR>(pMyItem->text.getStr()), pMyItem->text.getLength(), &size); @@ -577,7 +577,7 @@ void OnMeasureItem(HWND hwnd, LPMEASUREITEMSTRUCT lpmis) void OnDrawItem(HWND /*hwnd*/, LPDRAWITEMSTRUCT lpdis) { - MYITEM *pMyItem = (MYITEM *) lpdis->itemData; + MYITEM *pMyItem = reinterpret_cast<MYITEM *>(lpdis->itemData); COLORREF clrPrevText, clrPrevBkgnd; HFONT hfntOld; HBRUSH hbrOld; @@ -601,7 +601,7 @@ void OnDrawItem(HWND /*hwnd*/, LPDRAWITEMSTRUCT lpdis) else clrPrevBkgnd = SetBkColor( lpdis->hDC, GetSysColor(COLOR_MENU) ); - hbrOld = (HBRUSH)SelectObject( lpdis->hDC, CreateSolidBrush( GetBkColor( lpdis->hDC ) ) ); + hbrOld = static_cast<HBRUSH>(SelectObject( lpdis->hDC, CreateSolidBrush( GetBkColor( lpdis->hDC ) ) )); // Fill background PatBlt(lpdis->hDC, aRect.left, aRect.top, aRect.right-aRect.left, aRect.bottom-aRect.top, PATCOPY); @@ -613,28 +613,28 @@ void OnDrawItem(HWND /*hwnd*/, LPDRAWITEMSTRUCT lpdis) int cx = GetSystemMetrics( SM_CXSMICON ); int cy = GetSystemMetrics( SM_CYSMICON ); - HICON hIcon( 0 ); - HMODULE hModule( GetModuleHandle( NULL ) ); + HICON hIcon( nullptr ); + HMODULE hModule( GetModuleHandle( nullptr ) ); if ( pMyItem->module.getLength() > 0 ) { LPCWSTR pModuleName = reinterpret_cast<LPCWSTR>( pMyItem->module.getStr() ); hModule = GetModuleHandleW( pModuleName ); - if ( hModule == NULL ) + if ( hModule == nullptr ) { LoadLibraryW( pModuleName ); hModule = GetModuleHandleW( pModuleName ); } } - hIcon = (HICON) LoadImageA( hModule, MAKEINTRESOURCE( pMyItem->iconId ), + hIcon = static_cast<HICON>(LoadImageA( hModule, MAKEINTRESOURCE( pMyItem->iconId ), IMAGE_ICON, cx, cy, - LR_DEFAULTCOLOR | LR_SHARED ); + LR_DEFAULTCOLOR | LR_SHARED )); HBRUSH hbrIcon = CreateSolidBrush( GetSysColor( COLOR_GRAYTEXT ) ); - DrawStateW( lpdis->hDC, (HBRUSH)hbrIcon, (DRAWSTATEPROC)NULL, (LPARAM)hIcon, (WPARAM)0, x, y+(height-cy)/2, 0, 0, DST_ICON | (fDisabled ? (fSelected ? DSS_MONO : DSS_DISABLED) : DSS_NORMAL) ); + DrawStateW( lpdis->hDC, hbrIcon, nullptr, reinterpret_cast<LPARAM>(hIcon), (WPARAM)0, x, y+(height-cy)/2, 0, 0, DST_ICON | (fDisabled ? (fSelected ? DSS_MONO : DSS_DISABLED) : DSS_NORMAL) ); DeleteObject( hbrIcon ); @@ -645,19 +645,19 @@ void OnDrawItem(HWND /*hwnd*/, LPDRAWITEMSTRUCT lpdis) memset(&ncm, 0, sizeof(ncm)); ncm.cbSize = sizeof(ncm); - SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, (PVOID) &ncm, 0); + SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0); // Print default menu entry with bold font if ( lpdis->itemState & ODS_DEFAULT ) ncm.lfMenuFont.lfWeight = FW_BOLD; - hfntOld = (HFONT) SelectObject(lpdis->hDC, (HFONT) CreateFontIndirect( &ncm.lfMenuFont )); + hfntOld = static_cast<HFONT>(SelectObject(lpdis->hDC, CreateFontIndirect( &ncm.lfMenuFont ))); SIZE size; GetTextExtentPointW( lpdis->hDC, reinterpret_cast<LPCWSTR>(pMyItem->text.getStr()), pMyItem->text.getLength(), &size ); - DrawStateW( lpdis->hDC, (HBRUSH)NULL, (DRAWSTATEPROC)NULL, (LPARAM)pMyItem->text.getStr(), (WPARAM)0, aRect.left, aRect.top + (height - size.cy)/2, 0, 0, DST_TEXT | (fDisabled && !fSelected ? DSS_DISABLED : DSS_NORMAL) ); + DrawStateW( lpdis->hDC, nullptr, nullptr, reinterpret_cast<LPARAM>(pMyItem->text.getStr()), (WPARAM)0, aRect.left, aRect.top + (height - size.cy)/2, 0, 0, DST_TEXT | (fDisabled && !fSelected ? DSS_DISABLED : DSS_NORMAL) ); // Restore the original font and colors. DeleteObject( SelectObject( lpdis->hDC, hbrOld ) ); @@ -670,7 +670,7 @@ void OnDrawItem(HWND /*hwnd*/, LPDRAWITEMSTRUCT lpdis) // code from setup2 project -void _SHFree( void *pv ) +void SHFree_( void *pv ) { IMalloc *pMalloc; if( NOERROR == SHGetMalloc(&pMalloc) ) @@ -680,14 +680,14 @@ void _SHFree( void *pv ) } } -#define ALLOC(type, n) ((type *) HeapAlloc(GetProcessHeap(), 0, sizeof(type) * n )) +#define ALLOC(type, n) static_cast<type *>(HeapAlloc(GetProcessHeap(), 0, sizeof(type) * n )) #define FREE(p) HeapFree(GetProcessHeap(), 0, p) -static OUString _SHGetSpecialFolder( int nFolderID ) +static OUString SHGetSpecialFolder( int nFolderID ) { LPITEMIDLIST pidl; - HRESULT hHdl = SHGetSpecialFolderLocation( NULL, nFolderID, &pidl ); + HRESULT hHdl = SHGetSpecialFolderLocation( nullptr, nFolderID, &pidl ); OUString aFolder; if( hHdl == NOERROR ) @@ -699,14 +699,14 @@ static OUString _SHGetSpecialFolder( int nFolderID ) aFolder = OUString( reinterpret_cast<const sal_Unicode*>(lpFolderA) ); FREE( lpFolderA ); - _SHFree( pidl ); + SHFree_( pidl ); } return aFolder; } OUString ShutdownIcon::GetAutostartFolderNameW32() { - return _SHGetSpecialFolder(CSIDL_STARTUP); + return SHGetSpecialFolder(CSIDL_STARTUP); } static HRESULT WINAPI SHCoCreateInstance( LPVOID lpszReserved, REFCLSID clsid, LPUNKNOWN pUnkUnknown, REFIID iid, LPVOID *ppv ) @@ -714,11 +714,11 @@ static HRESULT WINAPI SHCoCreateInstance( LPVOID lpszReserved, REFCLSID clsid, L HRESULT hResult = E_NOTIMPL; HMODULE hModShell = GetModuleHandle( "SHELL32" ); - if ( hModShell != NULL ) + if ( hModShell != nullptr ) { typedef HRESULT (WINAPI *SHCoCreateInstance_PROC)( LPVOID lpszReserved, REFCLSID clsid, LPUNKNOWN pUnkUnknwon, REFIID iid, LPVOID *ppv ); - SHCoCreateInstance_PROC lpfnSHCoCreateInstance = (SHCoCreateInstance_PROC)GetProcAddress( hModShell, MAKEINTRESOURCE(102) ); + SHCoCreateInstance_PROC lpfnSHCoCreateInstance = reinterpret_cast<SHCoCreateInstance_PROC>(GetProcAddress( hModShell, MAKEINTRESOURCE(102) )); if ( lpfnSHCoCreateInstance ) hResult = lpfnSHCoCreateInstance( lpszReserved, clsid, pUnkUnknown, iid, ppv ); @@ -734,10 +734,10 @@ BOOL CreateShortcut( const OUString& rAbsObject, const OUString& rAbsObjectPath, CLSID clsid_ShellLink = CLSID_ShellLink; CLSID clsid_IShellLink = IID_IShellLink; - hres = CoCreateInstance( clsid_ShellLink, NULL, CLSCTX_INPROC_SERVER, - clsid_IShellLink, (void**)&psl ); + hres = CoCreateInstance( clsid_ShellLink, nullptr, CLSCTX_INPROC_SERVER, + clsid_IShellLink, reinterpret_cast<void**>(&psl) ); if( FAILED(hres) ) - hres = SHCoCreateInstance( NULL, clsid_ShellLink, NULL, clsid_IShellLink, (void**)&psl ); + hres = SHCoCreateInstance( nullptr, clsid_ShellLink, nullptr, clsid_IShellLink, reinterpret_cast<void**>(&psl) ); if( SUCCEEDED(hres) ) { @@ -749,7 +749,7 @@ BOOL CreateShortcut( const OUString& rAbsObject, const OUString& rAbsObjectPath, psl->SetArguments( OUStringToOString(rParameter, osl_getThreadTextEncoding()).getStr() ); CLSID clsid_IPersistFile = IID_IPersistFile; - hres = psl->QueryInterface( clsid_IPersistFile, (void**)&ppf ); + hres = psl->QueryInterface( clsid_IPersistFile, reinterpret_cast<void**>(&ppf) ); if( SUCCEEDED(hres) ) { @@ -783,7 +783,7 @@ static bool FileExistsW( LPCWSTR lpPath ) bool ShutdownIcon::IsQuickstarterInstalled() { wchar_t aPath[_MAX_PATH]; - GetModuleFileNameW( NULL, aPath, _MAX_PATH-1); + GetModuleFileNameW( nullptr, aPath, _MAX_PATH-1); OUString aOfficepath( reinterpret_cast<const sal_Unicode*>(aPath) ); int i = aOfficepath.lastIndexOf((sal_Char) '\\'); @@ -799,7 +799,7 @@ bool ShutdownIcon::IsQuickstarterInstalled() void ShutdownIcon::EnableAutostartW32( const OUString &aShortcut ) { wchar_t aPath[_MAX_PATH]; - GetModuleFileNameW( NULL, aPath, _MAX_PATH-1); + GetModuleFileNameW( nullptr, aPath, _MAX_PATH-1); OUString aOfficepath( reinterpret_cast<const sal_Unicode*>(aPath) ); int i = aOfficepath.lastIndexOf((sal_Char) '\\'); diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 7f379f58cc1d..b24472d61694 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -1628,6 +1628,8 @@ void FileDialogHelper_Impl::verifyPath() maPath = SvtPathOptions().GetWorkPath(); mxFileDlg->setDisplayDirectory( maPath ); } +#else + (void) this; #endif } diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx index ba871c15a84c..542c8ff4aef2 100644 --- a/sfx2/source/doc/graphhelp.cxx +++ b/sfx2/source/doc/graphhelp.cxx @@ -94,7 +94,7 @@ void* GraphicHelper::getEnhMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta ) if ( pStream ) { Graphic aGraph( *pGDIMeta ); - sal_Bool bFailed = (sal_Bool)GraphicConverter::Export( *pStream, aGraph, ConvertDataFormat::EMF ); + bool bFailed = GraphicConverter::Export( *pStream, aGraph, ConvertDataFormat::EMF ); pStream->Flush(); delete pStream; @@ -120,7 +120,7 @@ void* GraphicHelper::getWinMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta, co { SvMemoryStream* pStream = new SvMemoryStream( 65535, 65535 ); Graphic aGraph( *pGDIMeta ); - sal_Bool bFailed = (sal_Bool)GraphicConverter::Export( *pStream, aGraph, ConvertDataFormat::WMF ); + bool bFailed = GraphicConverter::Export( *pStream, aGraph, ConvertDataFormat::WMF ); pStream->Flush(); if ( !bFailed ) { @@ -128,7 +128,7 @@ void* GraphicHelper::getWinMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta, co if ( nLength > 22 ) { HMETAFILE hMeta = SetMetaFileBitsEx( nLength - 22, - ( reinterpret_cast< const unsigned char*>( pStream->GetData() ) ) + 22 ); + ( static_cast< const unsigned char*>( pStream->GetData() ) ) + 22 ); if ( hMeta ) { @@ -136,7 +136,7 @@ void* GraphicHelper::getWinMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta, co if ( hMemory ) { - METAFILEPICT* pMF = (METAFILEPICT*)GlobalLock( hMemory ); + METAFILEPICT* pMF = static_cast<METAFILEPICT*>(GlobalLock( hMemory )); pMF->hMF = hMeta; pMF->mm = MM_ANISOTROPIC; @@ -159,7 +159,7 @@ void* GraphicHelper::getWinMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta, co } GlobalUnlock( hMemory ); - pResult = (void*)hMemory; + pResult = static_cast<void*>(hMemory); } else DeleteMetaFile( hMeta ); diff --git a/sfx2/source/doc/syspath.cxx b/sfx2/source/doc/syspath.cxx index 8b19b2b9da13..32094d331f39 100644 --- a/sfx2/source/doc/syspath.cxx +++ b/sfx2/source/doc/syspath.cxx @@ -18,10 +18,7 @@ */ #include "syspath.hxx" - -#if defined(_WIN32) -extern "C" bool GetUserTemplateLocation(sal_Unicode*, int nSize); -#endif +#include <syspathw32.hxx> bool SystemPath::GetUserTemplateLocation(sal_Unicode* pFolder, int nSize ) { diff --git a/sfx2/source/doc/syspathw32.cxx b/sfx2/source/doc/syspathw32.cxx index a6ec72d08acf..ce5839082f14 100644 --- a/sfx2/source/doc/syspathw32.cxx +++ b/sfx2/source/doc/syspathw32.cxx @@ -28,10 +28,12 @@ #include <shlobj.h> -static bool _SHGetSpecialFolderW32( int nFolderID, WCHAR* pszFolder, int nSize ) +#include <syspathw32.hxx> + +static bool SHGetSpecialFolderW32( int nFolderID, WCHAR* pszFolder, int nSize ) { LPITEMIDLIST pidl; - HRESULT hHdl = SHGetSpecialFolderLocation( NULL, nFolderID, &pidl ); + HRESULT hHdl = SHGetSpecialFolderLocation( nullptr, nFolderID, &pidl ); if( hHdl == NOERROR ) { @@ -65,10 +67,10 @@ typedef unsigned short sal_uInt16; typedef sal_uInt16 sal_Unicode; #endif -extern "C" bool GetUserTemplateLocation(sal_Unicode* pFolder, int nSize) +bool GetUserTemplateLocation(sal_Unicode* pFolder, int nSize) { #ifdef _WIN32 - return _SHGetSpecialFolderW32( CSIDL_TEMPLATES, reinterpret_cast<LPWSTR>(pFolder), nSize ); + return SHGetSpecialFolderW32( CSIDL_TEMPLATES, reinterpret_cast<LPWSTR>(pFolder), nSize ); #else (void)pFolder; (void)nSize; diff --git a/sfx2/source/doc/syspathw32.hxx b/sfx2/source/doc/syspathw32.hxx new file mode 100644 index 000000000000..5707a80cec00 --- /dev/null +++ b/sfx2/source/doc/syspathw32.hxx @@ -0,0 +1,33 @@ +/* -*- 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_SFX2_SOURCE_DOC_SYSPATHW32_HXX +#define INCLUDED_SFX2_SOURCE_DOC_SYSPATHW32_HXX + +#include <sal/config.h> + +#include <sal/types.h> + +#if defined _WIN32 +bool GetUserTemplateLocation(sal_Unicode *, int nSize); +#endif + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 54066676804a..9f024b5ab51f 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -212,30 +212,6 @@ bool SfxViewFrame::IsDowning_Impl() const return m_pImpl->bIsDowning; } -class SfxViewNotificatedFrameList_Impl : - public SfxListener, public SfxViewFrameArr_Impl -{ -public: - - void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; -}; - -void SfxViewNotificatedFrameList_Impl::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) -{ - switch( rHint.GetId() ) - { - case SFX_HINT_DYING: - SfxViewFrame* pFrame = dynamic_cast<SfxViewFrame*>(&rBC); - if( pFrame ) - { - iterator it = std::find( begin(), end(), pFrame ); - if( it != end() ) - erase( it ); - } - break; - } -} - void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) { SfxFrame *pParent = GetFrame().GetParentFrame(); |