Final touches

This commit is contained in:
Philip Ridout 2013-10-17 21:15:35 +01:00
parent 2e10a4b0ea
commit d6eb08c759
4 changed files with 21 additions and 79 deletions

View File

@ -90,7 +90,7 @@ class PptviewController(PresentationController):
u'presentations', u'lib', u'pptviewlib', u'pptviewlib.dll')
self.process = cdll.LoadLibrary(dllpath)
if log.isEnabledFor(logging.DEBUG):
self.process.SetDebug(0)
self.process.SetDebug(1)
def kill(self):
"""
@ -127,12 +127,11 @@ class PptviewDocument(PresentationDocument):
rect = renderer.screens.current[u'size']
rect = RECT(rect.x(), rect.y(), rect.right(), rect.bottom())
file_system_encoding = 'utf-16-le'
# Add a null char on the end otherwise we get spurious issues with
# the encoding.
file_path = os.path.normpath(self.filepath) + u'\0'
preview_path = os.path.join(self.get_temp_folder(), u'slide') + u'\0'
file_path = file_path.encode(file_system_encoding)
preview_path = preview_path.encode(file_system_encoding)
file_path = os.path.normpath(self.filepath)
preview_path = os.path.join(self.get_temp_folder(), u'slide')
# Ensure that the paths are null terminated
file_path = file_path.encode(file_system_encoding) + '\0'
preview_path = preview_path.encode(file_system_encoding) + '\0'
if not os.path.isdir(self.get_temp_folder()):
os.makedirs(self.get_temp_folder())
self.pptid = self.controller.process.OpenPPT(file_path, None, rect,

View File

@ -27,8 +27,9 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
import sys
import os
import sys
from PyQt4 import QtGui, QtCore
from ctypes import *
from ctypes.wintypes import RECT
@ -173,8 +174,8 @@ class PPTViewer(QtGui.QWidget):
oldid = self.pptid;
rect = RECT(int(self.xEdit.text()), int(self.yEdit.text()),
int(self.widthEdit.text()), int(self.heightEdit.text()))
filename = os.path.normpath(unicode(self.pptEdit.text())).encode('utf-16-le')
folder = os.path.normpath(unicode(self.folderEdit.text())).encode('utf-16-le')
filename = os.path.normpath(unicode(self.pptEdit.text())).encode('utf-16-le') + '\0'
folder = os.path.normpath(unicode(self.folderEdit.text())).encode('utf-16-le') + '\0'
self.pptid = self.pptdll.OpenPPT(filename, None, rect, folder)
print u'id: ' + unicode(self.pptid)
if oldid >= 0:

View File

@ -370,7 +370,7 @@ BOOL GetPPTViewerPath(wchar_t *pptViewerPath, int stringSize)
// upset those who like to put things somewhere else
// Viewer 2007 in 64bit Windows:
if(_access("C:\\Program Files (x86)\\Microsoft Office\\Office12\\PPTVIEW.EXE",
if(_waccess(L"C:\\Program Files (x86)\\Microsoft Office\\Office12\\PPTVIEW.EXE",
0) != -1)
{
wcscpy_s(
@ -380,7 +380,7 @@ BOOL GetPPTViewerPath(wchar_t *pptViewerPath, int stringSize)
return TRUE;
}
// Viewer 2007 in 32bit Windows:
if(_access("C:\\Program Files\\Microsoft Office\\Office12\\PPTVIEW.EXE", 0)
if(_waccess(L"C:\\Program Files\\Microsoft Office\\Office12\\PPTVIEW.EXE", 0)
!= -1)
{
wcscpy_s(L"C:\\Program Files\\Microsoft Office\\Office12\\PPTVIEW.EXE",
@ -411,17 +411,17 @@ BOOL GetPPTViewerPathFromReg(wchar_t *pptViewerPath, int stringSize)
// PPT Viewer 2003 (recent versions)
// PPT Viewer 2003 (older versions)
// PPT Viewer 97
if ((RegOpenKeyExA(HKEY_CLASSES_ROOT,
"PowerPointViewer.Show.12\\shell\\Show\\command", 0, KEY_READ, &hKey)
if ((RegOpenKeyExW(HKEY_CLASSES_ROOT,
L"PowerPointViewer.Show.12\\shell\\Show\\command", 0, KEY_READ, &hKey)
!= ERROR_SUCCESS)
&& (RegOpenKeyExA(HKEY_CLASSES_ROOT,
"PowerPointViewer.Show.11\\shell\\Show\\command", 0, KEY_READ, &hKey)
&& (RegOpenKeyExW(HKEY_CLASSES_ROOT,
L"PowerPointViewer.Show.11\\shell\\Show\\command", 0, KEY_READ, &hKey)
!= ERROR_SUCCESS)
&& (RegOpenKeyExA(HKEY_CLASSES_ROOT,
"Applications\\PPTVIEW.EXE\\shell\\open\\command", 0, KEY_READ, &hKey)
&& (RegOpenKeyExW(HKEY_CLASSES_ROOT,
L"Applications\\PPTVIEW.EXE\\shell\\open\\command", 0, KEY_READ, &hKey)
!= ERROR_SUCCESS)
&& (RegOpenKeyExA(HKEY_CLASSES_ROOT,
"Applications\\PPTVIEW.EXE\\shell\\Show\\command", 0, KEY_READ, &hKey)
&& (RegOpenKeyExW(HKEY_CLASSES_ROOT,
L"Applications\\PPTVIEW.EXE\\shell\\Show\\command", 0, KEY_READ, &hKey)
!= ERROR_SUCCESS))
{
return FALSE;

View File

@ -18,7 +18,7 @@
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
@ -162,64 +162,6 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="h|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>