1Attribute VB_Name = "ApplicationSpecific"
2'/*************************************************************************
3' *
4' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5'
6' Copyright 2000, 2010 Oracle and/or its affiliates.
7'
8' OpenOffice.org - a multi-platform office productivity suite
9'
10' This file is part of OpenOffice.org.
11'
12' OpenOffice.org is free software: you can redistribute it and/or modify
13' it under the terms of the GNU Lesser General Public License version 3
14' only, as published by the Free Software Foundation.
15'
16' OpenOffice.org is distributed in the hope that it will be useful,
17' but WITHOUT ANY WARRANTY; without even the implied warranty of
18' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19' GNU Lesser General Public License version 3 for more details
20' (a copy is included in the LICENSE file that accompanied this code).
21'
22' You should have received a copy of the GNU Lesser General Public License
23' version 3 along with OpenOffice.org.  If not, see
24' <http://www.openoffice.org/license.html>
25' for a copy of the LGPLv3 License.
26'
27' ************************************************************************/
28
29Option Explicit
30
31'** Issue Categories
32Public Const CID_INFORMATION_REFS = 0
33Public Const CID_CHANGES_AND_REVIEWING = 1 'no issue logged
34Public Const CID_CONTENT_AND_DOCUMENT_PROPERTIES = 2
35Public Const CID_CONTROLS = 3 'no issue logged
36Public Const CID_FIELDS = 4
37Public Const CID_FORMAT = 5
38Public Const CID_INDEX_AND_REFERENCES = 6
39Public Const CID_OBJECTS_GRAPHICS_FRAMES = 7
40Public Const CID_PORTABILITY = 8
41Public Const CID_TABLES = 9
42Public Const CID_VBA_MACROS = 10
43Public Const CID_WRITING_AIDS = 11
44Public Const CTOTAL_CATEGORIES = 11
45
46'** Word - XML Issue and SubIssue strings
47Public Const CSTR_ISSUE_CHANGES_AND_REVIEWING = "ChangesAndReviewing"
48Public Const CSTR_ISSUE_CONTROLS = "Controls"
49Public Const CSTR_ISSUE_FIELDS = "Fields"
50Public Const CSTR_ISSUE_INDEX_AND_REFERENCES = "IndexesAndReferences"
51Public Const CSTR_ISSUE_TABLES = "Tables"
52
53Public Const CSTR_SUBISSUE_APPEARANCE = "Appearance"
54Public Const CSTR_SUBISSUE_BORDER_STYLES = "BorderStyles"
55Public Const CSTR_SUBISSUE_CELL_SPAN_PAGE = "CellSpanningPage"
56Public Const CSTR_SUBISSUE_COMMENT = "Comment"
57Public Const CSTR_SUBISSUE_CUSTOM_BULLET_LIST = "CustomBulletList"
58Public Const CSTR_SUBISSUE_FORM_FIELD = "FormField"
59Public Const CSTR_SUBISSUE_MAILMERGE_DATASOURCE = "MailMergeDatasource"
60Public Const CSTR_SUBISSUE_MAILMERGE_FIELD = "MailMergeField"
61Public Const CSTR_SUBISSUE_NESTED_TABLES = "NestedTables"
62Public Const CSTR_SUBISSUE_TABLE_OF_AUTHORITIES = "TableOfAuthorities"
63Public Const CSTR_SUBISSUE_TABLE_OF_AUTHORITIES_FIELD = "TableOfAuthoritiesField"
64Public Const CSTR_SUBISSUE_TABLE_OF_CONTENTS = "TableOfContents"
65'** END Word - XML Issue and SubIssue strings
66
67Public Const CAPPNAME_WORD = "Word"
68Public Const CAPPNAME_WORD_DOC = ".doc"
69Public Const CAPPNAME_WORD_DOT = ".dot"
70
71Public Const CAPPNAME_EXCEL = "Excel"
72Public Const CAPPNAME_EXCEL_DOC = ".xls"
73Public Const CAPPNAME_EXCEL_DOT = ".xlt"
74
75Public Const CAPPNAME_POWERPOINT = "PowerPoint"
76Public Const CAPPNAME_PP_DOC = ".ppt"
77Public Const CAPPNAME_PP_DOT = ".pot"
78
79Public CAPP_DOCPROP_LOCATION As String
80'Public Const CAPP_DOCPROP_LOCATION = RID_STR_COMMON_RESULTS_LOCATION_TYPE_WORKBOOK
81'Public Const CAPP_DOCPROP_LOCATION = RID_STR_COMMON_RESULTS_LOCATION_TYPE_PRESENTATION
82
83Public Const CAPP_XMLDOCPROP_LOCATION = "Document"
84'Public Const CAPP_XMLDOCPROP_LOCATION = "Workbook"
85'Public Const CAPP_XMLDOCPROP_LOCATION = "Presentation"
86
87Public Const CTHIS_DOCUMENT = "ThisDocument"
88Public Const CTOPLEVEL_PROJECT = "Project"
89
90Public Function getAppSpecificDocExt() As String
91    getAppSpecificDocExt = CAPPNAME_WORD_DOC
92End Function
93Public Function getAppSpecificTemplateExt() As String
94    getAppSpecificTemplateExt = CAPPNAME_WORD_DOT
95End Function
96Public Function getAppSpecificPath() As String
97    getAppSpecificPath = ActiveDocument.path
98End Function
99Public Function getAppSpecificApplicationName() As String
100    getAppSpecificApplicationName = CAPPNAME_WORD
101End Function
102
103Public Function getAppSpecificCustomDocProperties(currDoc As Document) As DocumentProperties
104    Set getAppSpecificCustomDocProperties = currDoc.CustomDocumentProperties
105End Function
106Public Function getAppSpecificCommentBuiltInDocProperty(currDoc As Document) As DocumentProperty
107    Set getAppSpecificCommentBuiltInDocProperty = currDoc.BuiltInDocumentProperties(wdPropertyComments)
108End Function
109
110Public Function getAppSpecificVBProject(currDoc As Document) As VBProject
111    Set getAppSpecificVBProject = currDoc.VBProject
112End Function
113
114Public Function getAppSpecificOLEClassType(aShape As Shape) As String
115    Dim objType As String
116
117    If aShape.OLEFormat.ProgID = "" Then
118        objType = aShape.OLEFormat.ClassType
119    Else
120        objType = aShape.OLEFormat.ProgID
121    End If
122
123    getAppSpecificOLEClassType = objType
124End Function
125
126Public Sub SetAppToMinimized()
127    Application.WindowState = wdWindowStateMinimize
128    Application.Visible = False
129End Sub
130
131Public Sub LocalizeResources()
132    Dim wrdStrings As StringDataManager
133    Set wrdStrings = New StringDataManager
134
135    wrdStrings.InitStringData (GetResourceDataFileName(ThisDocument.path))
136    LoadCommonStrings wrdStrings
137    LoadWordStrings wrdStrings
138    LoadResultsStrings wrdStrings
139    Set wrdStrings = Nothing
140
141    'SetWordDriverText
142End Sub
143
144' Set the loaded string variable into the fields in the document
145Private Sub SetWordDriverText()
146    On Error Resume Next
147    CAPP_DOCPROP_LOCATION = RID_STR_COMMON_RESULTS_LOCATION_TYPE_DOCUMENT
148    ThisDocument.FormFields.item("RID_STR_WDVR_SOANA").Result = RID_STR_WDVR_SOANA
149    ThisDocument.FormFields.item("RID_STR_WDVR_INTRO").Result = RID_STR_WDVR_INTRO
150    ThisDocument.FormFields.item("RID_STR_WDVR_TITLE").Result = RID_STR_WDVR_TITLE
151    ThisDocument.FormFields.item("RID_STR_WDVR_PURPO").Result = RID_STR_WDVR_PURPO
152    ThisDocument.FormFields.item("RID_STR_WDVR_PARA1").Result = RID_STR_WDVR_PARA1
153    ThisDocument.FormFields.item("RID_STR_WDVR_ISSUE").Result = RID_STR_WDVR_ISSUE
154    ThisDocument.FormFields.item("RID_STR_WDVR_PARA2").Result = RID_STR_WDVR_PARA2
155End Sub
156
157