|
From: <got...@us...> - 2008-12-07 22:22:15
|
Revision: 131
http://scstudio.svn.sourceforge.net/scstudio/?rev=131&view=rev
Author: gotthardp
Date: 2008-12-07 21:53:49 +0000 (Sun, 07 Dec 2008)
Log Message:
-----------
Initial commit of the add-on for Microsoft Visio.
Added Paths:
-----------
trunk/src/view/visio/addon/
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/addon.h
trunk/src/view/visio/addon/dllmodule.cpp
trunk/src/view/visio/addon/dllmodule.def
trunk/src/view/visio/addon/dllmodule.h
trunk/src/view/visio/addon/dllmodule.rc
trunk/src/view/visio/addon/dllmodule.rgs
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/document.h
trunk/src/view/visio/addon/errors.cpp
trunk/src/view/visio/addon/errors.h
trunk/src/view/visio/addon/eventsink.idl
trunk/src/view/visio/addon/reportview.cpp
trunk/src/view/visio/addon/reportview.h
trunk/src/view/visio/addon/resource.h
trunk/src/view/visio/addon/scstudio.vcproj
trunk/src/view/visio/addon/stdafx.cpp
trunk/src/view/visio/addon/stdafx.h
trunk/src/view/visio/scstudio.sln
Property Changed:
----------------
trunk/src/view/visio/
Property changes on: trunk/src/view/visio
___________________________________________________________________
Added: svn:ignore
+ *.ncb
*.suo
Property changes on: trunk/src/view/visio/addon
___________________________________________________________________
Added: svn:ignore
+ Debug
Release
dlldata.c
eventsink.h
eventsink_i.c
eventsink_p.c
*.aps
*.vcproj.*
Added: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp (rev 0)
+++ trunk/src/view/visio/addon/addon.cpp 2008-12-07 21:53:49 UTC (rev 131)
@@ -0,0 +1,429 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2007-2008 Petr Gotthard <pet...@ce...>
+ *
+ * $Id$
+ */
+
+#include "stdafx.h"
+#include "dllmodule.h"
+#include "addon.h"
+#include "document.h"
+#include "errors.h"
+#include "resource.h"
+
+// include command line parsing library SimpleOpt
+// http://code.jellycan.com/simpleopt
+#include <SimpleOpt.h>
+
+// include libraries from the Microsoft Office Visio 2003 SDK
+// http://www.microsoft.com/downloads/details.aspx?familyid=557120bd-b0bb-46e7-936a-b8539898d44d
+extern "C"
+{
+#include <Vao.c>
+}
+#include <Vaddon.cpp>
+#include <Addsink.cpp>
+
+const int MIN_VISIO_VERSION = 11;
+const _bstr_t VST_FILE_NAME = _T("Flowchart (VSL).vst");
+
+CStudioAddon scstudio(_T(ADDON_NAME), IDS_ADDON_NAME);
+
+const short visEvtPageAdded = Visio::visEvtAdd | Visio::visEvtPage;
+const short visEvtBeforeDocumentClose = Visio::visEvtDel | Visio::visEvtDoc;
+const short visEvtConnectionsAdded = Visio::visEvtAdd | Visio::visEvtConnect;
+const short visEvtConnectionsDeleted = Visio::visEvtDel | Visio::visEvtConnect;
+
+CStudioAddon::CStudioAddon(LPCTSTR pName, UINT uIDLocalName)
+ : VAddon(VAO_AOATTS_ISACTION, VAO_ENABLEALWAYS, 0, 0, pName, uIDLocalName)
+{
+ m_pIAddonSink = NULL;
+};
+
+const int _FILE_PATH_SIZE = _MAX_PATH * 4;
+
+_bstr_t GetVisioModulePath()
+{
+ TCHAR szPath[_FILE_PATH_SIZE];
+ TCHAR szDrive[_MAX_PATH];
+ TCHAR szDir[_FILE_PATH_SIZE];
+ TCHAR szFileName[_MAX_PATH];
+ TCHAR szExt[_MAX_PATH];
+ std::basic_string<TCHAR> strDir;
+ std::basic_string<TCHAR>::size_type uiPosition;
+
+ // Get the full path including the Addon name.
+ GetModuleFileName(GetModuleHandle(LoadStringResource(IDS_VSL_NAME)),
+ szPath, sizeof(szPath) / sizeof(TCHAR));
+
+ // Extract the path name of the Addon.
+ if (szPath)
+ {
+ _tsplitpath(szPath, szDrive, szDir, szFileName, szExt);
+ strDir = szDrive;
+ strDir += szDir;
+
+ // Extract the source path from the path name, since the path name
+ // that was extracted will be for the Debug or Release version,
+ // based on the project settings.
+ uiPosition = strDir.rfind('\\');
+
+ // If this is the last character in the string,
+ // then find the next ('\\').
+ if ((uiPosition != -1) && (uiPosition == strDir.size() - 1))
+ {
+ uiPosition = strDir.rfind('\\', uiPosition - 1);
+ }
+
+ // If it was the last character, then the position will be
+ // next found ('\\'). If it was not the last character,
+ // then this is the end of the actual Add-on path.
+ if (uiPosition != -1)
+ {
+ // Include the last ('\\') in the path.
+ strDir.resize(uiPosition + 1);
+ }
+
+ } // end szPath
+
+ return _bstr_t(strDir.c_str());
+}
+
+VAORC CStudioAddon::Run(LPVAOV2LSTRUCT pV2L)
+{
+ TRACE("CStudioAddon::Run() called");
+ Visio::IVApplicationPtr vsoApp;
+
+ try
+ {
+ // get a Visio::IVApplicationPtr for the Visio application
+ if (!vsoApp.GetInterfacePtr())
+ {
+ // First try to attach to the currently running Visio application.
+ // If that fails launch a new Visio application.
+ if (pV2L != NULL && pV2L->lpApp != NULL)
+ vsoApp = pV2L->lpApp;
+ else
+ if (!SUCCEEDED(vsoApp.GetActiveObject(Visio::CLSID_Application)))
+ vsoApp.CreateInstance(Visio::CLSID_Application);
+ }
+
+ if (!vsoApp.GetInterfacePtr())
+ return VAORC_FAILURE;
+
+ // get the major version number for Visio
+ int majorVersion = 0;
+ BSTR bstrVersion = NULL;
+ if (SUCCEEDED(vsoApp->get_Version(&bstrVersion)))
+ majorVersion = _ttoi(_bstr_t(bstrVersion));
+
+ if (bstrVersion != NULL)
+ SysFreeString(bstrVersion);
+
+ // make sure that we're running against the correct version of Visio
+ if (majorVersion == 0 || majorVersion < MIN_VISIO_VERSION)
+ {
+ DisplayException(vsoApp,
+ LoadStringResource(IDS_ERROR_VISIO_VERSION), MB_OK | MB_ICONEXCLAMATION);
+
+ return VAORC_SUCCESS;
+ }
+
+ Visio::IVDocumentPtr vsoDocument = vsoApp->GetActiveDocument();
+
+ // If the command-line argument is NULL, this add-on was called
+ // by selecting the VSL from Visio Tools|Macros menu.
+ if(pV2L->lpCmdLineArgs == NULL)
+ {
+ TRACE("CStudioAddon::Run() args=NULL");
+
+ // when no document is active
+ if(vsoDocument == NULL)
+ {
+ // open a new document based on the add-on template
+ _bstr_t bstrVSTName = GetVisioModulePath();
+ bstrVSTName += VST_FILE_NAME;
+
+ // check if template file exists
+ _tfinddata_t stFileInfo;
+ TCHAR * pszVSTName = (TCHAR *)bstrVSTName;
+ if (_tfindfirst(pszVSTName, &stFileInfo) == -1)
+ {
+ DisplayException(vsoApp,
+ bstrVSTName + LoadStringResource(IDS_ERROR_FILE_NOT_EXISTS), MB_OK);
+ return VAORC_FAILURE;
+ }
+
+ vsoDocument = vsoApp->GetDocuments()->Add(bstrVSTName);
+ }
+
+ CDocumentMonitor *pDocumentMonitor = GetDocumentMonitor(vsoApp, vsoDocument);
+ return VAORC_SUCCESS;
+ }
+ else
+ {
+ TCHAR* cmdline = _tcsdup(pV2L->lpCmdLineArgs);
+ TRACE("CStudioAddon::Run() cmdline=\"" << cmdline << "\"");
+
+ static const TCHAR* seps = _T(" \t");
+ int argc = 0;
+ TCHAR* argv[100];
+ // read the command-line string
+ TCHAR* token = _tcstok(cmdline, seps);
+ while(argc < _countof(argv) && token != NULL)
+ {
+ argv[argc++] = token;
+ token = _tcstok(NULL, seps);
+ }
+
+ enum
+ {
+ OPT_VISIO,
+ OPT_EVENT,
+ OPT_DOC,
+ OPT_PAGE,
+ OPT_SHAPE
+ };
+
+ static CSimpleOpt::SOption const long_options[] =
+ {
+ { OPT_VISIO, _T("-visio"), SO_REQ_CMB },
+ { OPT_EVENT, _T("-event"), SO_REQ_CMB },
+ { OPT_DOC, _T("-doc"), SO_REQ_CMB },
+ { OPT_PAGE, _T("-page"), SO_REQ_CMB },
+ { OPT_SHAPE, _T("-shape"), SO_REQ_CMB },
+ SO_END_OF_OPTIONS
+ };
+
+ // Parse the command-line arguments.
+ CSimpleOpt args(argc, argv, long_options, SO_O_USEALL);
+
+ int iVisio = 0;
+ int iEvent = 0;
+ int iDocumentIndex = 0;
+ int iPageIndex = 0;
+ _bstr_t sShape;
+
+ while(args.Next())
+ {
+ if(args.LastError() != SO_SUCCESS)
+ {
+ TRACE("CStudioAddon::Run() bad command-line argument=" << args.OptionText());
+ continue;
+ }
+
+ switch(args.OptionId())
+ {
+ case OPT_VISIO:
+ iVisio = _tstol(args.OptionArg());
+ break;
+ case OPT_EVENT:
+ iEvent = _tstol(args.OptionArg());
+ break;
+ case OPT_DOC:
+ iDocumentIndex = _tstol(args.OptionArg());
+ break;
+ case OPT_PAGE:
+ iPageIndex = _tstol(args.OptionArg());
+ break;
+ case OPT_SHAPE:
+ sShape = args.OptionArg();
+ break;
+ default:
+ TRACE("CStudioAddon::Run() unexpected argument id=" << args.OptionId());
+ break;
+ }
+ }
+ free(cmdline);
+
+ CDocumentMonitor *pDocumentMonitor = GetDocumentMonitor(vsoApp, vsoDocument);
+ // execute the relevant event handler
+ switch(iEvent)
+ {
+ // to keep the stencil compatibility, the 1xx events must not be renumbered
+ case 100:
+ TRACE("CStudioAddon::Run() stencil event 'OnDrop'");
+ return VAORC_SUCCESS;
+
+ case 201:
+ TRACE("CStudioAddon::Run() menu item 'Check--Run'");
+ return pDocumentMonitor->OnMenuRun(vsoApp);
+ case 202:
+ TRACE("CStudioAddon::Run() menu item 'Check--Windows--Verification Report'");
+ return pDocumentMonitor->OnMenuWindowsReporter(vsoApp);
+
+ default:
+ TRACE("CStudioAddon::Run() unexpected event id=" << iEvent);
+ return VAORC_FAILURE;
+ }
+ }
+ }
+ catch (_com_error &err)
+ {
+ DisplayException(vsoApp, err.ErrorMessage(), MB_OK);
+ }
+
+ return VAORC_SUCCESS;
+}
+
+VAORC CStudioAddon::Unload(WORD wParam, LPVOID p)
+{
+ DocumentMonitorsMap::iterator documentsIter;
+ // clean up the monitored document map
+ while ((documentsIter = m_DocumentMonitors.begin()) != m_DocumentMonitors.end())
+ {
+ delete documentsIter->second;
+ m_DocumentMonitors.erase(documentsIter);
+ }
+
+ // delete the marker Event
+ if (m_vsoMarkerEvent != NULL)
+ m_vsoMarkerEvent->Delete();
+
+ // release the sink if there is one
+ if (m_pIAddonSink)
+ {
+ m_pIAddonSink->Release();
+ m_pIAddonSink = NULL;
+ }
+
+ return VAddon::Unload(wParam, p);
+}
+
+HRESULT CStudioAddon::HandleVisioEvent(
+ IUnknown *ipSink, short nEventCode, IDispatch *pSourceObj, long nEventID,
+ long nEventSeqNum, IDispatch *pSubjectObj, VARIANT vMoreInfo, VARIANT *pvResult)
+{
+ TRACE("CStudioAddon::HandleVisioEvent() called");
+ try
+ {
+ if (ipSink == NULL || pSourceObj == NULL || pSubjectObj == NULL || pvResult == NULL)
+ {
+ TRACE("CStudioAddon::HandleVisioEvent() unexpected NULL");
+ return E_FAIL;
+ }
+
+ switch (nEventCode)
+ {
+ case visEvtPageAdded:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtPageAdded");
+ break;
+
+ case visEvtBeforeDocumentClose:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtBeforeDocumentClose");
+ break;
+
+ case visEvtConnectionsAdded:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtConnectionsAdded");
+ break;
+
+ case visEvtConnectionsDeleted:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtConnectionsDeleted");
+ break;
+
+ default:
+ TRACE("CStudioAddon::HandleVisioEvent() unexpected event id=" << nEventCode);
+ break;
+ }
+
+ return NOERROR;
+ }
+ catch (_com_error &) // catch exceptions thrown by Visio
+ {
+ return E_FAIL;
+ }
+}
+
+CDocumentMonitor *CStudioAddon::GetDocumentMonitor(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument)
+{
+ CDocumentMonitor *pDocumentMonitor = NULL;
+
+ long nID = vsoDocument->GetID();
+
+ DocumentMonitorsMap::iterator documentIter = m_DocumentMonitors.find(nID);
+ if (documentIter != m_DocumentMonitors.end())
+ {
+ // the document monitor already exists
+ return documentIter->second;
+ }
+
+ try
+ {
+ Visio::IVEventPtr vsoEvent;
+ Visio::IVEventListPtr vsoApplicationEventList;
+
+ Visio::IVEventListPtr vsoDocumentEventList = vsoDocument->EventList;
+
+ // create a sink object which point back to this class as the event handler
+ if(m_pIAddonSink == NULL)
+ CoCreateAddonSinkForHandler(0, this, &m_pIAddonSink);
+
+ if(m_pIAddonSink)
+ {
+ _variant_t varSink = m_pIAddonSink;
+
+ // If the add-on is not already listening to the marker event,
+ // create an event object for marker events. Marker events are
+ // sourced from the Application object.
+ if (m_vsoMarkerEvent == NULL)
+ {
+ vsoApplicationEventList = vsoApp->EventList;
+ m_vsoMarkerEvent = vsoApplicationEventList->AddAdvise(visEvtApp|visEvtMarker, varSink, _T(""), _T(""));
+ }
+
+ // Create a monitor class to keep track of this document and the Events
+ // being monitored for this document.
+ pDocumentMonitor = new CDocumentMonitor(this, vsoDocument);
+ pDocumentMonitor->InitMenu(vsoApp);
+
+ // register PageAdded
+ vsoEvent = vsoDocumentEventList->AddAdvise(visEvtPageAdded, varSink, _T(""), _T(""));
+ pDocumentMonitor->m_vsoPageAddedEvent = vsoEvent;
+
+ // register BeforeDocumentClose
+ vsoEvent = vsoDocumentEventList->AddAdvise(visEvtBeforeDocumentClose, varSink, _T(""), _T(""));
+ pDocumentMonitor->m_vsoBeforeDocumentClosedEvent = vsoEvent;
+
+ vsoDocumentEventList->AddAdvise(visEvtConnectionsAdded, varSink, _T(""), _T(""));
+ vsoDocumentEventList->AddAdvise(visEvtConnectionsDeleted, varSink, _T(""), _T(""));
+
+ // add this document to our monitored documents list
+ m_DocumentMonitors.insert(DocumentMonitorsMap::value_type(nID, pDocumentMonitor));
+
+ return pDocumentMonitor;
+ }
+ }
+ catch (_com_error &) // catch exceptions thrown by Visio
+ {
+ delete pDocumentMonitor;
+ }
+
+ return NULL;
+}
+
+void CStudioAddon::StopDocumentMonitor(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument)
+{
+ long nID = vsoDocument->GetID();
+
+ // the document is closing so stop monitoring its events
+ DocumentMonitorsMap::iterator documentIter = m_DocumentMonitors.find(nID);
+ if (documentIter != m_DocumentMonitors.end())
+ {
+ delete documentIter->second;
+ m_DocumentMonitors.erase(documentIter);
+ }
+}
+
+// $Id$
Property changes on: trunk/src/view/visio/addon/addon.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/src/view/visio/addon/addon.h
===================================================================
--- trunk/src/view/visio/addon/addon.h (rev 0)
+++ trunk/src/view/visio/addon/addon.h 2008-12-07 21:53:49 UTC (rev 131)
@@ -0,0 +1,60 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2007-2008 Petr Gotthard <pet...@ce...>
+ *
+ * $Id$
+ */
+
+#pragma once
+
+#include "Vaddon.h"
+#include "AddSink.h"
+
+#include <map>
+
+class CReportView;
+class CDocumentMonitor;
+
+// internal add-on name
+#define ADDON_NAME "Sequence Chart Studio"
+
+class CStudioAddon : public VAddon, public VEventHandler
+{
+public:
+ CStudioAddon(LPCTSTR pNameU, UINT uIDLocalName);
+ virtual VAORC Run(LPVAOV2LSTRUCT pV2L);
+ virtual VAORC Unload(WORD wParam, LPVOID p);
+
+ virtual HRESULT HandleVisioEvent(
+ IUnknown *ipSink, // [in] ipSink [assert]
+ short nEventCode, // [in] code of event that's firing
+ IDispatch *pSourceObj, //! [in] object that is firing event
+ long nEventID, // [in] id of event that is firing
+ long nEventSeqNum, // [in] sequence number of event
+ IDispatch *pSubjectObj, // [in] subject of this event
+ VARIANT vMoreInfo, // [in] other info
+ VARIANT *pvResult); // [retval][out] return a value to Visio for query events
+
+ CDocumentMonitor *GetDocumentMonitor(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument);
+ void StopDocumentMonitor(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument);
+
+private:
+ IUnknown *m_pIAddonSink;
+ Visio::IVEventPtr m_vsoMarkerEvent;
+
+ typedef std::map<long, CDocumentMonitor*> DocumentMonitorsMap;
+ DocumentMonitorsMap m_DocumentMonitors;
+};
+
+// $Id$
Property changes on: trunk/src/view/visio/addon/addon.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/src/view/visio/addon/dllmodule.cpp
===================================================================
--- trunk/src/view/visio/addon/dllmodule.cpp (rev 0)
+++ trunk/src/view/visio/addon/dllmodule.cpp 2008-12-07 21:53:49 UTC (rev 131)
@@ -0,0 +1,90 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2007-2008 Petr Gotthard <pet...@ce...>
+ *
+ * $Id$
+ */
+
+// implementation of DLL Exports
+
+#include "stdafx.h"
+#include "resource.h"
+#include "eventsink.h"
+#include "dllmodule.h"
+
+namespace ATL
+{
+
+class CStudioDllModule : public CAtlDllModuleT< CStudioDllModule >
+{
+public :
+ DECLARE_LIBID(LIBID_SCStudioLib)
+ DECLARE_REGISTRY_APPID_RESOURCEID(IDR_SCSTUDIO, "{F0C700DB-9781-48DA-83D2-E537117E2784}")
+};
+
+}; // namespace ATL
+
+ATL::CStudioDllModule _AtlModule;
+
+_bstr_t LoadStringResource(UINT uiID)
+{
+ // Get the module instance.
+ HINSTANCE hInstance = ATL::_AtlBaseModule.GetModuleInstance();
+
+ TCHAR szBuffer[100];
+ // Load the string from the string table.
+ LoadString(hInstance, uiID, szBuffer, sizeof(szBuffer) / sizeof(TCHAR));
+ return _bstr_t(szBuffer);
+}
+
+#ifdef _MANAGED
+#pragma managed(push, off)
+#endif
+
+//! DLL Entry Point
+extern "C" BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD dwReason, LPVOID lpReserved)
+{
+ return _AtlModule.DllMain(dwReason, lpReserved);
+}
+
+#ifdef _MANAGED
+#pragma managed(pop)
+#endif
+
+//! Used to determine whether the DLL can be unloaded by OLE
+STDAPI DllCanUnloadNow(void)
+{
+ return _AtlModule.DllCanUnloadNow();
+}
+
+//! Returns a class factory to create an object of the requested type
+STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
+{
+ return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
+}
+
+//! Adds entries to the system registry
+STDAPI DllRegisterServer(void)
+{
+ // registers object, typelib and all interfaces in typelib
+ return _AtlModule.DllRegisterServer();
+}
+
+//! Removes entries from the system registry
+STDAPI DllUnregisterServer(void)
+{
+ return _AtlModule.DllUnregisterServer();
+}
+
+// $Id$
Property changes on: trunk/src/view/visio/addon/dllmodule.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/src/view/visio/addon/dllmodule.def
===================================================================
--- trunk/src/view/visio/addon/dllmodule.def (rev 0)
+++ trunk/src/view/visio/addon/dllmodule.def 2008-12-07 21:53:49 UTC (rev 131)
@@ -0,0 +1,9 @@
+; dllmodule.def : Declares the module parameters.
+
+LIBRARY "scstudio.vsl"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
Property changes on: trunk/src/view/visio/addon/dllmodule.def
___________________________________________________________________
Added: svn:eol-style
+ native
Added: trunk/src/view/visio/addon/dllmodule.h
===================================================================
--- trunk/src/view/visio/addon/dllmodule.h (rev 0)
+++ trunk/src/view/visio/addon/dllmodule.h 2008-12-07 21:53:49 UTC (rev 131)
@@ -0,0 +1,23 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2007-2008 Petr Gotthard <pet...@ce...>
+ *
+ * $Id$
+ */
+
+#pragma once
+
+_bstr_t LoadStringResource(UINT uiID);
+
+// $Id$
Property changes on: trunk/src/view/visio/addon/dllmodule.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc (rev 0)
+++ trunk/src/view/visio/addon/dllmodule.rc 2008-12-07 21:53:49 UTC (rev 131)
@@ -0,0 +1,124 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "winres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""winres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "1 TYPELIB ""scstudio.tlb""\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "080004e4"
+ BEGIN
+ VALUE "CompanyName", "Masaryk University Brno"
+ VALUE "FileDescription", "Microsoft Visio add-on for design and verification of Message Sequence Charts (MSC)."
+ VALUE "FileVersion", "1.0.0.1"
+ VALUE "InternalName", "scstudio.vsl"
+ VALUE "LegalCopyright", "(c) Petr Gotthard. All rights reserved."
+ VALUE "OriginalFilename", "scstudio.vsl"
+ VALUE "ProductName", "Sequence Chart Studio"
+ VALUE "ProductVersion", "1.0.0.1"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x800, 1252
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// REGISTRY
+//
+
+IDR_SCSTUDIO REGISTRY "dllmodule.rgs"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE
+BEGIN
+ IDS_ADDON_NAME "Sequence Chart Studio"
+ IDS_ERROR_VISIO_VERSION "This application requires Microsoft Office Visio 2003 or later."
+ IDS_ERROR_FILE_NOT_EXISTS " does not exist."
+ IDS_VSL_NAME "msc.vsl"
+ IDS_REPORT_VIEW "Verification Report"
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+1 TYPELIB "scstudio.tlb"
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
Property changes on: trunk/src/view/visio/addon/dllmodule.rc
___________________________________________________________________
Added: svn:eol-style
+ native
Added: trunk/src/view/visio/addon/dllmodule.rgs
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rgs (rev 0)
+++ trunk/src/view/visio/addon/dllmodule.rgs 2008-12-07 21:53:49 UTC (rev 131)
@@ -0,0 +1,11 @@
+HKCR
+{
+ NoRemove AppID
+ {
+ '%APPID%' = s 'scstudio'
+ 'scstudio.vsl'
+ {
+ val AppID = s '%APPID%'
+ }
+ }
+}
Property changes on: trunk/src/view/visio/addon/dllmodule.rgs
___________________________________________________________________
Added: svn:eol-style
+ native
Added: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp (rev 0)
+++ trunk/src/view/visio/addon/document.cpp 2008-12-07 21:53:49 UTC (rev 131)
@@ -0,0 +1,141 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2007-2008 Petr Gotthard <pet...@ce...>
+ *
+ * $Id$
+ */
+
+#include "stdafx.h"
+#include "dllmodule.h"
+#include "addon.h"
+#include "document.h"
+
+CDocumentMonitor::CDocumentMonitor(CStudioAddon *addon, Visio::IVDocumentPtr vsoDocument)
+{
+ m_addon = addon;
+ m_vsoDocument = vsoDocument;
+
+ m_reportVisible = false;
+ m_reportView = NULL;
+}
+
+CDocumentMonitor::~CDocumentMonitor()
+{
+ if (m_vsoBeforeDocumentClosedEvent != NULL)
+ m_vsoBeforeDocumentClosedEvent->Delete();
+
+ if (m_vsoPageAddedEvent != NULL)
+ m_vsoPageAddedEvent->Delete();
+}
+
+void CDocumentMonitor::InitMenu(Visio::IVApplicationPtr vsoApp)
+{
+ Visio::IVUIObjectPtr vsoMenus = NULL;
+
+ Visio::IVDocumentPtr vsoDocument = vsoApp->GetActiveDocument();
+ if(vsoDocument != NULL)
+ {
+ Visio::IVUIObjectPtr docMenus = vsoDocument->CustomMenus;
+ if(docMenus != NULL)
+ vsoMenus = docMenus->Clone;
+ }
+ if(vsoMenus == NULL)
+ {
+ Visio::IVUIObjectPtr appMenus = vsoApp->CustomMenus;
+ if(appMenus != NULL)
+ vsoMenus = appMenus->Clone;
+ }
+ if(vsoMenus == NULL)
+ vsoMenus = vsoApp->BuiltInMenus; // gets a clone
+
+ Visio::IVMenuSetPtr menuSet = vsoMenus->MenuSets->ItemAtID[Visio::visUIObjSetDrawing];
+
+ Visio::IVMenuPtr menu = menuSet->Menus->AddAt(5);
+ menu->Caption = "&Check";
+
+ Visio::IVMenuItemPtr menuItem1 = menu->MenuItems->Add();
+ menuItem1->Caption = "&Windows";
+ menuItem1->BeginGroup = true;
+ menuItem1->CmdNum = Visio::visCmdHierarchical;
+
+ Visio::IVMenuItemPtr menuItem2 = menu->MenuItems->Add();
+ menuItem2->Caption = "&Run";
+ menuItem2->AddOnName = ADDON_NAME;
+ menuItem2->AddOnArgs = "/event=201";
+ menuItem2->BeginGroup = true;
+
+ m_reportMenuItem = menuItem1->MenuItems->Add();
+ m_reportMenuItem->Caption = "Verification &Report";
+ m_reportMenuItem->AddOnName = ADDON_NAME;
+ m_reportMenuItem->AddOnArgs = "/event=202";
+
+ vsoDocument->SetCustomMenus(vsoMenus);
+}
+
+VAORC CDocumentMonitor::OnMenuRun(Visio::IVApplicationPtr vsoApp)
+{
+ if(!m_reportVisible)
+ ShowReportView(vsoApp);
+
+ m_reportView->Print("\\b No error detected.\\b0");
+
+ return VAORC_SUCCESS;
+}
+
+VAORC CDocumentMonitor::OnMenuWindowsReporter(Visio::IVApplicationPtr vsoApp)
+{
+ if(m_reportVisible)
+ // Close() --> CReportView::OnFinalMessage() --> CDocumentMonitor::OnHideReportView()
+ m_reportWindow->Close();
+ else
+ ShowReportView(vsoApp);
+
+ return VAORC_SUCCESS;
+}
+
+void CDocumentMonitor::ShowReportView(Visio::IVApplicationPtr vsoApp)
+{
+ if (m_reportView == NULL)
+ m_reportView = new CReportView(this);
+
+ Visio::IVWindowPtr vsoWindow = vsoApp->GetActiveWindow();
+
+ const int defWidth = 500;
+ const int defHeight = 200;
+ m_reportWindow = vsoWindow->Windows->Add(LoadStringResource(IDS_REPORT_VIEW),
+ Visio::visWSVisible | Visio::visWSAnchorLeft, Visio::visAnchorBarAddon, 1, 1, defWidth, defHeight);
+
+ LoadLibrary(CReportView::GetLibraryName());
+
+ RECT rc = {0, 0, defWidth, defHeight};
+ HWND hwndTV = m_reportView->Create(
+ (HWND)m_reportWindow->WindowHandle32,
+ rc, NULL,
+ WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL |
+ ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY,
+ WS_EX_STATICEDGE);
+
+ m_reportMenuItem->State = Visio::visButtonDown;
+ m_vsoDocument->CustomMenus->UpdateUI();
+ m_reportVisible = true;
+}
+
+void CDocumentMonitor::OnHideReportView()
+{
+ m_reportMenuItem->State = Visio::visButtonUp;
+ m_vsoDocument->CustomMenus->UpdateUI();
+ m_reportVisible = false;
+}
+
+// $Id$
Property changes on: trunk/src/view/visio/addon/document.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h (rev 0)
+++ trunk/src/view/visio/addon/document.h 2008-12-07 21:53:49 UTC (rev 131)
@@ -0,0 +1,54 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2007-2008 Petr Gotthard <pet...@ce...>
+ *
+ * $Id$
+ */
+
+#pragma once
+#include "reportview.h"
+
+class CStudioAddon;
+
+class CDocumentMonitor
+{
+public:
+ CDocumentMonitor(CStudioAddon *addon, Visio::IVDocumentPtr vsoDocument);
+ virtual ~CDocumentMonitor();
+
+ void InitMenu(Visio::IVApplicationPtr vsoApp);
+
+ VAORC OnMenuRun(Visio::IVApplicationPtr vsoApp);
+ VAORC OnMenuWindowsReporter(Visio::IVApplicationPtr vsoApp);
+
+ void ShowReportView(Visio::IVApplicationPtr vsoApp);
+ void OnHideReportView();
+
+ // event objects for this document
+ Visio::IVEventPtr m_vsoPageAddedEvent;
+ Visio::IVEventPtr m_vsoBeforeDocumentClosedEvent;
+
+private:
+ CDocumentMonitor(const CDocumentMonitor &other); // not implemented
+
+ CStudioAddon *m_addon;
+ Visio::IVDocumentPtr m_vsoDocument;
+
+ bool m_reportVisible;
+ Visio::IVWindowPtr m_reportWindow;
+ Visio::IVMenuItemPtr m_reportMenuItem;
+ CReportView *m_reportView;
+};
+
+// $Id$
Property changes on: trunk/src/view/visio/addon/document.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/src/view/visio/addon/errors.cpp
===================================================================
--- trunk/src/view/visio/addon/errors.cpp (rev 0)
+++ trunk/src/view/visio/addon/errors.cpp 2008-12-07 21:53:49 UTC (rev 131)
@@ -0,0 +1,36 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2007-2008 Petr Gotthard <pet...@ce...>
+ *
+ * $Id$
+ */
+
+#include "stdafx.h"
+#include "errors.h"
+#include "dllmodule.h"
+
+#include <string>
+
+void DisplayException(Visio::IVApplicationPtr vsoApp,
+ const _bstr_t& bstrMessage, UINT nFlags)
+{
+ if (vsoApp->GetAlertResponse() == 0)
+ {
+ MessageBox(GetActiveWindow(), bstrMessage, LoadStringResource(IDS_ADDON_NAME), nFlags);
+ }
+ else
+ OutputDebugString(bstrMessage);
+}
+
+// $Id$
Property changes on: trunk/src/view/visio/addon/errors.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/src/view/visio/addon/errors.h
===================================================================
--- trunk/src/view/visio/addon/errors.h (rev 0)
+++ trunk/src/view/visio/addon/errors.h 2008-12-07 21:53:49 UTC (rev 131)
@@ -0,0 +1,37 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2007-2008 Petr Gotthard <pet...@ce...>
+ *
+ * $Id$
+ */
+
+#pragma once
+
+#include <sstream>
+
+#ifdef DEBUG
+#define TRACE(message) \
+{ \
+ std::basic_stringstream<TCHAR> buffer; \
+ buffer << __FILE__ << ":" << __LINE__ << " " << message << std::endl; \
+ OutputDebugString(buffer.str().c_str()); \
+}
+#else
+#define TRACE(message) /* no operation */
+#endif
+
+void DisplayException(Visio::IVApplicationPtr vsoApp,
+ const _bstr_t& bstrMessage, UINT nFlags);
+
+// $Id$
Property changes on: trunk/src/view/visio/addon/errors.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/src/view/visio/addon/eventsink.idl
===================================================================
--- trunk/src/view/visio/addon/eventsink.idl (rev 0)
+++ trunk/src/view/visio/addon/eventsink.idl 2008-12-07 21:53:49 UTC (rev 131)
@@ -0,0 +1,56 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2007-2008 Petr Gotthard <pet...@ce...>
+ *
+ * $Id$
+ */
+
+// This file will be processed by the MIDL tool to
+// produce the type library (scstudio.tlb) and marshalling code.
+
+import "oaidl.idl";
+import "ocidl.idl";
+
+[
+ object,
+ uuid(85470DF7-41EE-4d18-8E55-458F3C6D3F6B),
+ dual,
+ helpstring("ITestEventSink Interface"),
+ pointer_default(unique)
+]
+interface ITestEventSink : IDispatch
+{
+};
+
+[
+ uuid(8295FFC9-6BB9-4C36-BD5F-FE5B8F0676DA),
+ version(1.0),
+ helpstring("Sequence Chart Studio 1.0 Type Library")
+]
+library SCStudioLib
+{
+ importlib("stdole2.tlb");
+
+ [
+ uuid(8E8B43E6-AB7C-4152-97A8-F9BDBFC8C4F1),
+ helpstring("ITestEventSink Class"),
+ noncreatable
+ ]
+ coclass TestEventSink
+ {
+ [default] interface ITestEventSink;
+ };
+};
+
+// $Id$
Property changes on: trunk/src/view/visio/addon/eventsink.idl
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/src/view/visio/addon/reportview.cpp
===================================================================
--- trunk/src/view/visio/addon/reportview.cpp (rev 0)
+++ trunk/src/view/visio/addon/reportview.cpp 2008-12-07 21:53:49 UTC (rev 131)
@@ -0,0 +1,92 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2007-2008 Petr Gotthard <pet...@ce...>
+ *
+ * $Id$
+ */
+
+#include "stdafx.h"
+#include "document.h"
+#include "reportview.h"
+#include "errors.h"
+#include <sstream>
+
+CReportView::CReportView(CDocumentMonitor *monitor)
+{
+ m_documentMonitor = monitor;
+}
+
+static DWORD CALLBACK
+EditStreamCallBack(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
+{
+ const char **ppstr = (const char**)dwCookie;
+
+ if(strlen(*ppstr) < cb)
+ {
+ *pcb = strlen(*ppstr);
+ memcpy(pbBuff, *ppstr, *pcb );
+ }
+ else
+ {
+ *pcb = cb;
+ memcpy(pbBuff, *ppstr, *pcb);
+ *ppstr = *ppstr + cb;
+ }
+ return 0;
+}
+
+int CReportView::Print(const std::string& message)
+{
+ static const char *rtfPrefix =
+ "{\\rtf1\\ansi"
+ "{\\colortbl;\\red255\\green0\\blue0;}"
+ "{\\fonttbl\\f0\\fswiss Helvetica;}\\f0\\fs16";
+ static const char *rtfSuffix =
+ "}";
+
+ // "\\cf1Red\\cf0"
+ // "\\i Italics\\i0"
+
+ std::stringstream rtfStream;
+ rtfStream
+ << rtfPrefix
+ << message << "\\line"
+ << rtfSuffix;
+
+ std::string sstr = rtfStream.str();
+ const char *pstr = sstr.c_str();
+
+ EDITSTREAM es = {(DWORD)&pstr, 0, EditStreamCallBack};
+ // append RTF to the list
+ StreamIn(SF_RTF | SFF_SELECTION, es);
+
+ LineScroll(1);
+
+ return 0;
+}
+
+LRESULT CReportView::OnLButtonDblClk(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+ TRACE("CReportView::OnLButtonDblClk() called");
+ return 1;
+}
+
+void CReportView::OnFinalMessage(HWND hWnd)
+{
+ TRACE("CReportView::OnFinalMessage() called");
+
+ m_documentMonitor->OnHideReportView();
+}
+
+// $Id$
Property changes on: trunk/src/view/visio/addon/reportview.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/src/view/visio/addon/reportview.h
===================================================================
--- trunk/src/view/visio/addon/reportview.h (rev 0)
+++ trunk/src/view/visio/addon/reportview.h 2008-12-07 21:53:49 UTC (rev 131)
@@ -0,0 +1,55 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2007-2008 Petr Gotthard <pet...@ce...>
+ *
+ * $Id$
+ */
+
+#pragma once
+#include "resource.h"
+#include "Vaddon.h"
+
+// Include libraries from the Windows Template Library (WTL).
+// http://wtl.sourceforge.net
+#include <atlctrls.h>
+
+#include <string>
+
+class CDocumentMonitor;
+
+class CReportView
+ : public ATL::CWindowImpl<CReportView, CRichEditCtrl, ATL::CControlWinTraits>
+{
+public:
+ CReportView(CDocumentMonitor *monitor);
+ int Print(const std::string& message);
+
+protected:
+BEGIN_MSG_MAP(CReportView)
+ MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDblClk)
+END_MSG_MAP()
+
+// Handler prototypes:
+// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+// LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
+// LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
+
+ LRESULT OnLButtonDblClk(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+ void OnFinalMessage(HWND hWnd);
+
+private:
+ CDocumentMonitor *m_documentMonitor;
+};
+
+// $Id$
Property changes on: trunk/src/view/visio/addon/reportview.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/src/view/visio/addon/resource.h
===================================================================
--- trunk/src/view/visio/addon/resource.h (rev 0)
+++ trunk/src/view/visio/addon/resource.h 2008-12-07 21:53:49 UTC (rev 131)
@@ -0,0 +1,21 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by dllmodule.rc
+//
+#define IDS_ADDON_NAME 100
+#define IDR_SCSTUDIO 101
+#define IDS_ERROR_VISIO_VERSION 101
+#define IDS_ERROR_FILE_NOT_EXISTS 102
+#define IDS_VSL_NAME 103
+#define IDS_REPORT_VIEW 104
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 203
+#define _APS_NEXT_COMMAND_VALUE 32768
+#define _APS_NEXT_CONTROL_VALUE 206
+#define _APS_NEXT_SYMED_VALUE 105
+#endif
+#endif
Property changes on: trunk/src/view/visio/addon/resource.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/src/view/visio/addon/scstudio.vcproj
===================================================================
--- trunk/src/view/visio/addon/scstudio.vcproj (rev 0)
+++ trunk/src/view/visio/addon/scstudio.vcproj 2008-12-07 21:53:49 UTC (rev 131)
@@ -0,0 +1,260 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="scstudio"
+ ProjectGUID="{0E00282C-F48B-4984-A274-5B59E1E2AD49}"
+ RootNamespace="scstudio"
+ Keyword="AtlProj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ UseOfATL="2"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\CPP\Include";"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\CPP\Source";"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\TypeLib";"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\WTL80\include""
+ PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0500;_WINDOWS;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ IgnoreImportLibrary="TRUE"
+ OutputFile="$(OutDir)\$(ProjectName).vsl"
+ LinkIncremental="2"
+ ModuleDefinitionFile=".\dllmodule.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ AdditionalIncludeDirectories=""C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\TypeLib""
+ MkTypLibCompatible="FALSE"
+ TargetEnvironment="1"
+ GenerateStublessProxies="TRUE"
+ TypeLibraryName="$(IntDir)/scstudio.tlb"
+ HeaderFileName="scstudio.h"
+ DLLDataFileName=""
+ InterfaceIdentifierFileName="scstudio_i.c"
+ ProxyFileName="scstudio_p.c"
+ ValidateParameters="FALSE"/>
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Signing code..."
+ CommandLine="signcode $(OutDir)\$(ProjectName).vsl"
+ ExcludedFromBuild="FALSE"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir)"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ UseOfATL="2"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\CPP\Include";"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\CPP\Source";"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\TypeLib";"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\WTL80\include""
+ PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0500;_WINDOWS;NDEBUG;_USRDLL"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ IgnoreImportLibrary="TRUE"
+ OutputFile="$(OutDir)\$(ProjectName).vsl"
+ LinkIncremental="1"
+ ModuleDefinitionFile=".\dllmodule.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ AdditionalIncludeDirectories=""C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\TypeLib""
+ MkTypLibCompatible="FALSE"
+ TargetEnvironment="1"
+ GenerateStublessProxies="TRUE"
+ TypeLibraryName="$(IntDir)/scstudio.tlb"
+ HeaderFileName="scstudio.h"
+ DLLDataFileName=""
+ InterfaceIdentifierFileName="scstudio_i.c"
+ ProxyFileName="scstudio_p.c"
+ ValidateParameters="FALSE"/>
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Signing code..."
+ CommandLine="signcode $(OutDir)\$(ProjectName).vsl"
+ ExcludedFromBuild="FALSE"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir)"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath=".\addon.cpp">
+ </File>
+ <File
+ RelativePath=".\addon.h">
+ </File>
+ <File
+ RelativePath=".\dllmodule.cpp">
+ </File>
+ <File
+ RelativePath=".\dllmodule.def">
+ </File>
+ <File
+ RelativePath=".\dllmodule.h">
+ </File>
+ <File
+ RelativePath=".\document.cpp">
+ </File>
+ <File
+ RelativePath=".\document.h">
+ </File>
+ <File
+ RelativePath=".\errors.cpp">
+ </File>
+ <File
+ RelativePath=".\errors.h">
+ </File>
+ <File
+ RelativePath=".\eventsink.idl">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCMIDLTool"
+ HeaderFileName="eventsink.h"
+ InterfaceIdentifierFileName="eventsink_i.c"
+ ProxyFileName="eventsink_p.c"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCMIDLTool"
+ HeaderFileName="eventsink.h"
+ InterfaceIdentifierFileName="eventsink_i.c"
+ ProxyFileName="eventsink_p.c"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\reportview.cpp">
+ </File>
+ <File
+ RelativePath=".\reportview.h">
+ </File>
+ <File
+ RelativePath=".\resource.h">
+ </File>
+ <File
+ RelativePath=".\stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+ <File
+ RelativePath=".\dllmodule.rc">
+ </File>
+ <File
+ RelativePath=".\dllmodule.rgs">
+ </File>
+ </Filter>
+ <Filter
+ Name="Generated Files"
+ Filter="">
+ <File
+ RelativePath=".\eventsink_i.c">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="RESOURCE_FILE"
+ Value="dllmodule.rc"/>
+ </Globals>
+</VisualStudioProject>
Property changes on: trunk/src/view/visio/addon/scstudio.vcproj
___________________________________________________________________
Added: svn:eol-style
+ native
Added: trunk/src/view/visio/addon/stdafx.cpp
===================================================================
--- trunk/src/view/visio/addon/stdafx.cpp (rev 0)
+++ trunk/src/view/visio/addon/stdafx.cpp 2008-12-07 21:53:49 UTC (rev 131)
@@ -0,0 +1,5 @@
+// stdafx.cpp : source file that includes just the standard includes
+// scstudio.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
Property changes on: trunk/src/view/visio/addon/stdafx.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/src/view/visio/addon/stdafx.h
===================================================================
--- trunk/src/view/visio/addon/stdafx.h (rev 0)
+++ trunk/src/view/visio/addon/stdafx.h 2008-12-07 21:53:49 UTC (rev 131)
@@ -0,0 +1,42 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently,
+// but are changed infrequently
+
+#pragma once
+
+#ifndef STRICT
+#define STRICT
+#endif
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef WINVER // Allow use of features specific to Windows XP or later.
+#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows.
+#endif
+
+#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
+#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
+#endif
+
+#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
+#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
+#endif
+
+#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later.
+#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE.
+#endif
+
+#define _ATL_APARTMENT_THREADED
+#define _ATL_NO_AUTOMATIC_NAMESPACE
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+
+#include "resource.h"
+
+#include <atlbase.h>
+#include <atlapp.h>
+
+// Import the Visio type library with named GUIDs for the type library entries.
+// The namespace is "Visio".
+#import "Visio.tlb" named_guids
Property changes on: trunk/src/view/visio/addon/stdafx.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/src/view/visio/scstudio.sln
===================================================================
--- trunk/src/view/visio/scstudio.sln (rev 0)
+++ trunk/src/view/visio/scstudio.sln 2008-12-07 21:53:49 UTC (rev 131)
@@ -0,0 +1,35 @@
+
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "scstudio", "addon\scstudio.vcproj", "{0E00282C-F48B-4984-A274-5B59E1E2AD49}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Release = Release
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {0E00282C-F48B-4984-A274-5B59E1E2AD49}.Debug.ActiveCfg = Debug|Win32
+ {0E00282C-F48B-4984-A274-5B59E1E2AD49}.Debug.Build.0 = Debug|Win32
+ {0E00282C-F48B-4984-A274-5B59E1E2AD49}.Release.ActiveCfg = Release|Win32
+ {0E00282C-F48B-4984-A274-5B59E1E2AD49}.Release.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {0E00282C-F48B-4984-A274-5B59E1E2AD49}.Debug|Win32.ActiveCfg = Debug|Win32
+ {0E00282C-F48B-4984-A274-5B59E1E2AD49}.Debug|Win32.Build.0 = Debug|Win32
+ {0E00282C-F48B-4984-A274-5B59E1E2AD49}.Release|Win32.ActiveCfg = Release|Win32
+ {0E00282C-F48B-4984-A274-5B59E1E2AD49}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
Property changes on: trunk/src/view/visio/scstudio.sln
___________________________________________________________________
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|