1Attribute VB_Name = "ApplicationSpecific"
2'*************************************************************************
3'
4'  Licensed to the Apache Software Foundation (ASF) under one
5'  or more contributor license agreements.  See the NOTICE file
6'  distributed with this work for additional information
7'  regarding copyright ownership.  The ASF licenses this file
8'  to you under the Apache License, Version 2.0 (the
9'  "License"); you may not use this file except in compliance
10'  with the License.  You may obtain a copy of the License at
11'
12'    http://www.apache.org/licenses/LICENSE-2.0
13'
14'  Unless required by applicable law or agreed to in writing,
15'  software distributed under the License is distributed on an
16'  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17'  KIND, either express or implied.  See the License for the
18'  specific language governing permissions and limitations
19'  under the License.
20'
21'*************************************************************************
22Option Explicit
23
24'** Issue Categories
25Public Const CID_INFORMATION_REFS = 0
26Public Const CID_CHANGES_AND_REVIEWING = 1 'no issue logged
27Public Const CID_CONTENT_AND_DOCUMENT_PROPERTIES = 2
28Public Const CID_CONTROLS = 3 'no issue logged
29Public Const CID_FIELDS = 4
30Public Const CID_FORMAT = 5
31Public Const CID_INDEX_AND_REFERENCES = 6
32Public Const CID_OBJECTS_GRAPHICS_FRAMES = 7
33Public Const CID_PORTABILITY = 8
34Public Const CID_TABLES = 9
35Public Const CID_VBA_MACROS = 10
36Public Const CID_WRITING_AIDS = 11
37Public Const CTOTAL_CATEGORIES = 11
38
39'** Word - XML Issue and SubIssue strings
40Public Const CSTR_ISSUE_CHANGES_AND_REVIEWING = "ChangesAndReviewing"
41Public Const CSTR_ISSUE_CONTROLS = "Controls"
42Public Const CSTR_ISSUE_FIELDS = "Fields"
43Public Const CSTR_ISSUE_INDEX_AND_REFERENCES = "IndexesAndReferences"
44Public Const CSTR_ISSUE_TABLES = "Tables"
45
46Public Const CSTR_SUBISSUE_APPEARANCE = "Appearance"
47Public Const CSTR_SUBISSUE_BORDER_STYLES = "BorderStyles"
48Public Const CSTR_SUBISSUE_CELL_SPAN_PAGE = "CellSpanningPage"
49Public Const CSTR_SUBISSUE_COMMENT = "Comment"
50Public Const CSTR_SUBISSUE_CUSTOM_BULLET_LIST = "CustomBulletList"
51Public Const CSTR_SUBISSUE_FORM_FIELD = "FormField"
52Public Const CSTR_SUBISSUE_MAILMERGE_DATASOURCE = "MailMergeDatasource"
53Public Const CSTR_SUBISSUE_MAILMERGE_FIELD = "MailMergeField"
54Public Const CSTR_SUBISSUE_NESTED_TABLES = "NestedTables"
55Public Const CSTR_SUBISSUE_TABLE_OF_AUTHORITIES = "TableOfAuthorities"
56Public Const CSTR_SUBISSUE_TABLE_OF_AUTHORITIES_FIELD = "TableOfAuthoritiesField"
57Public Const CSTR_SUBISSUE_TABLE_OF_CONTENTS = "TableOfContents"
58'** END Word - XML Issue and SubIssue strings
59
60Public Const CAPPNAME_WORD = "Word"
61Public Const CAPPNAME_WORD_DOC = ".doc"
62Public Const CAPPNAME_WORD_DOT = ".dot"
63
64Public Const CAPPNAME_EXCEL = "Excel"
65Public Const CAPPNAME_EXCEL_DOC = ".xls"
66Public Const CAPPNAME_EXCEL_DOT = ".xlt"
67
68Public Const CAPPNAME_POWERPOINT = "PowerPoint"
69Public Const CAPPNAME_PP_DOC = ".ppt"
70Public Const CAPPNAME_PP_DOT = ".pot"
71
72Public CAPP_DOCPROP_LOCATION As String
73'Public Const CAPP_DOCPROP_LOCATION = RID_STR_COMMON_RESULTS_LOCATION_TYPE_WORKBOOK
74'Public Const CAPP_DOCPROP_LOCATION = RID_STR_COMMON_RESULTS_LOCATION_TYPE_PRESENTATION
75
76Public Const CAPP_XMLDOCPROP_LOCATION = "Document"
77'Public Const CAPP_XMLDOCPROP_LOCATION = "Workbook"
78'Public Const CAPP_XMLDOCPROP_LOCATION = "Presentation"
79
80Public Const CTHIS_DOCUMENT = "ThisDocument"
81Public Const CTOPLEVEL_PROJECT = "Project"
82
83Public Function getAppSpecificDocExt() As String
84    getAppSpecificDocExt = CAPPNAME_WORD_DOC
85End Function
86Public Function getAppSpecificTemplateExt() As String
87    getAppSpecificTemplateExt = CAPPNAME_WORD_DOT
88End Function
89Public Function getAppSpecificPath() As String
90    getAppSpecificPath = ActiveDocument.path
91End Function
92Public Function getAppSpecificApplicationName() As String
93    getAppSpecificApplicationName = CAPPNAME_WORD
94End Function
95
96Public Function getAppSpecificCustomDocProperties(currDoc As Document) As DocumentProperties
97    Set getAppSpecificCustomDocProperties = currDoc.CustomDocumentProperties
98End Function
99Public Function getAppSpecificCommentBuiltInDocProperty(currDoc As Document) As DocumentProperty
100    Set getAppSpecificCommentBuiltInDocProperty = currDoc.BuiltInDocumentProperties(wdPropertyComments)
101End Function
102
103Public Function getAppSpecificVBProject(currDoc As Document) As VBProject
104    Set getAppSpecificVBProject = currDoc.VBProject
105End Function
106
107Public Function getAppSpecificOLEClassType(aShape As Shape) As String
108    Dim objType As String
109
110    If aShape.OLEFormat.ProgID = "" Then
111        objType = aShape.OLEFormat.ClassType
112    Else
113        objType = aShape.OLEFormat.ProgID
114    End If
115
116    getAppSpecificOLEClassType = objType
117End Function
118
119Public Sub SetAppToMinimized()
120    Application.WindowState = wdWindowStateMinimize
121    Application.Visible = False
122End Sub
123
124Public Sub LocalizeResources()
125    Dim wrdStrings As StringDataManager
126    Set wrdStrings = New StringDataManager
127
128    wrdStrings.InitStringData (GetResourceDataFileName(ThisDocument.path))
129    LoadCommonStrings wrdStrings
130    LoadWordStrings wrdStrings
131    LoadResultsStrings wrdStrings
132    Set wrdStrings = Nothing
133
134    'SetWordDriverText
135End Sub
136
137' Set the loaded string variable into the fields in the document
138Private Sub SetWordDriverText()
139    On Error Resume Next
140    CAPP_DOCPROP_LOCATION = RID_STR_COMMON_RESULTS_LOCATION_TYPE_DOCUMENT
141    ThisDocument.FormFields.item("RID_STR_WDVR_SOANA").Result = RID_STR_WDVR_SOANA
142    ThisDocument.FormFields.item("RID_STR_WDVR_INTRO").Result = RID_STR_WDVR_INTRO
143    ThisDocument.FormFields.item("RID_STR_WDVR_TITLE").Result = RID_STR_WDVR_TITLE
144    ThisDocument.FormFields.item("RID_STR_WDVR_PURPO").Result = RID_STR_WDVR_PURPO
145    ThisDocument.FormFields.item("RID_STR_WDVR_PARA1").Result = RID_STR_WDVR_PARA1
146    ThisDocument.FormFields.item("RID_STR_WDVR_ISSUE").Result = RID_STR_WDVR_ISSUE
147    ThisDocument.FormFields.item("RID_STR_WDVR_PARA2").Result = RID_STR_WDVR_PARA2
148End Sub
149
150