├── .gitignore ├── .gitmodules ├── .travis.yml ├── COPYING ├── README.md ├── build ├── template │ ├── Zotero.dotm │ │ ├── customUI │ │ │ ├── customUI.xml │ │ │ └── images │ │ │ │ ├── addEditZoteroBibliography-small.png │ │ │ │ ├── addEditZoteroBibliography.png │ │ │ │ ├── addEditZoteroCitation-small.png │ │ │ │ ├── addEditZoteroCitation0.png │ │ │ │ ├── addZoteroNote.png │ │ │ │ ├── setZoteroDocPrefs-small.png │ │ │ │ ├── setZoteroDocPrefs.png │ │ │ │ └── zotero-z-16.png │ │ └── word │ │ │ └── vbaProject.bin │ │ │ ├── ThisDocument.cls │ │ │ ├── Zotero.bas │ │ │ └── ZoteroRibbon.bas │ ├── check_template_src.sh │ └── unpack_templates.sh └── zoteroWinWordIntegration │ ├── CApplication.h │ ├── CBookmark0.h │ ├── CBookmarks.h │ ├── CCustomProperties.h │ ├── CCustomProperty.h │ ├── CDocument0.h │ ├── CEndnote.h │ ├── CEndnoteOptions.h │ ├── CEndnotes.h │ ├── CField.h │ ├── CFields.h │ ├── CFont0.h │ ├── CFootnote.h │ ├── CFootnoteOptions.h │ ├── CFootnotes.h │ ├── CHyperlink.h │ ├── CHyperlinks.h │ ├── CParagraphFormat.h │ ├── CRange.h │ ├── CRevisionsFilter.h │ ├── CSelection.h │ ├── CStoryRanges.h │ ├── CStyle.h │ ├── CStyles.h │ ├── CTabStop.h │ ├── CTabStops.h │ ├── CUndoRecord.h │ ├── CView0.h │ ├── CWindow0.h │ ├── document.cpp │ ├── field.cpp │ ├── stdafx.h │ ├── targetver.h │ ├── utilities.cpp │ ├── zoteroWinWordIntegration.h │ ├── zoteroWinWordIntegration.sln │ ├── zoteroWinWordIntegration.suo │ ├── zoteroWinWordIntegration.vcxproj │ └── zoteroWinWordIntegration.vcxproj.filters ├── chrome.manifest ├── components └── zoteroWinWordIntegration.mjs ├── defaults └── preferences │ └── zoteroWinWordIntegration.js ├── install ├── Zotero.dotm ├── libzoteroWinWordIntegration.dll ├── libzoteroWinWordIntegration_ARM64.dll └── libzoteroWinWordIntegration_x64.dll └── resource ├── installer.jsm └── version.txt /.gitignore: -------------------------------------------------------------------------------- 1 | build/zoteroWinWordIntegration/.vs 2 | build/zoteroWinWordIntegration/**/Release 3 | build/zoteroWinWordIntegration/**/Debug 4 | build/zoteroWinWordIntegration/**/x64 5 | build/zoteroWinWordIntegration/**/ARM64 6 | build/zoteroWinWordIntegration/**/zoteroWinWordIntegration.log 7 | *.vcxproj.user 8 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "build/tools/officeparser"] 2 | path = build/tools/officeparser 3 | url = https://github.com/unixfreak0037/officeparser.git 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: generic 2 | notifications: 3 | email: false 4 | script: build/template/unpack_templates.sh && build/template/check_template_src.sh 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Zotero Word for Windows Integration 2 | 3 | This is a Firefox add-on that consists of a library written in C++ that communicates with Microsoft Word out of process using OLE Automation, a js-ctypes wrapper for said library, and a template that is installed into Microsoft Word to communicate with Zotero. 4 | 5 | ## C++ Library Build Requirements 6 | - Visual Studio (currently 2017) 7 | - Windows XP C++ libraries (install in VS by right-clicking the project and selecting "Install Missing Features") 8 | - Microsoft Office (previously build with 2010, but newer versions should work) 9 | 10 | ## To Build the C++ Library 11 | - Open `build/zoteroWinWordIntegration/zoteroWinWordIntegration.sln` 12 | - Change `imports.h `to point to the appropriate files (may be in different places with newer Office) 13 | - Set to Release configuration in the dropdown in the toolbar 14 | - Set to Win32 target in dropdown to the right of Release dropdown 15 | - Build->Build Solution 16 | - Set to x64 target in dropdown 17 | - Build->Build Solution 18 | 19 | ## Template Build Requirements 20 | - Templates should be built with the oldest version of Word to be supported. Otherwise older versions of Word may fail to function properly. This is currently: 21 | - Word 2007 (for the ribbonized dotm template) 22 | - Word 2003 (for the old dot template) 23 | 24 | ## To Modify/Build the Templates 25 | - Open the template from inside Microsoft Word 26 | - Go to View->Macros->View Macros (Ribbonized Word) or Tools->Macros->View Macros (Word 2003) and click "Edit" for one of the Zotero macros 27 | - Edit/replace code as desired 28 | - Go to Debug->Compile Project to ensure there are no code errors 29 | - Run `build/template/unpack_templates.sh` 30 | 31 | ## Development Starter's Guide 32 | 33 | Start by opening the dotm/dot template in Word. Word templates have support for custom macros 34 | and adding UI elements to call the macros, which is how the extension is implemented on Word. 35 | RibbonUI can be edited by extracting the dotm file or using the [Custom UI editor](http://openxmldeveloper.org/blog/b/openxmldeveloper/archive/2009/08/06/7293.aspx). 36 | To edit the .dot template UI Word for Windows 2003 is needed. 37 | In VBA macro code you will find that [SendMessage](https://msdn.microsoft.com/en-us/library/windows/desktop/ms644950(v=vs.85).aspx) 38 | protocol is used to issue commands to Zotero process from Word. These commands are received in [zotero-service.js](https://github.com/zotero/zotero/blob/eaf8d3696359dcea0edaa2fd9bc1e4cf5d985014/components/zotero-service.js#L516-L516) 39 | where they are passed to integration.js. 40 | 41 | Zotero talks to Word via [js-ctype bindings](https://github.com/zotero/zotero-word-for-windows-integration/blob/4f07be4bfaa3f37897a5af5371ea20353214f23e/components/zoteroWinWordIntegration.js#L52-L52) 42 | to a C++ OLE Automation based [library](https://github.com/zotero/zotero-word-for-windows-integration/blob/8d1807584d02f3b10715dd9895413c04349d45e8/build/zoteroWinWordIntegration/zoteroWinWordIntegration.h). 43 | To generate new interfaces for Word interop communications you should use the Add New Class wizard in 44 | Visual Studio and select 'MFC Class from Typelib'. The interop API docs can be found in the [MSDN](https://docs.microsoft.com/en-us/dotnet/api/microsoft.office.interop.word._document?view=word-pia). 45 | The plugin should technically work with Word versions starting with 2003, but we have stopped supporting everything below Word 2010 46 | due to impossible to fix bugs cropping up as time goes on and Microsoft drops compatibility themselves. 47 | Some API calls are on a deprecation path, so we may be inevitably be forced to move 48 | away or split the library into multiple DLLs. 49 | -------------------------------------------------------------------------------- /build/template/Zotero.dotm/customUI/customUI.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |