'''
Name: wordConstants.py

Overview: Set of Word constants used in Win32 programming

Description:
    
Notes:

Author: Doug Crane
        Nov, 2009

Modifications:

'''

import pdb
import os
import sys
import win32com.client

__author__ = 'Doug Crane'
__version__ = '1.0'

__all__ = ['microsoftWordConstants']


# ----------------------------------------------------------
class microsoftWordConstants(object):
    '''
    The following constants can be used when referencing Microsoft
    Word documents using Win32 functions.

    Example:
        wordConstantObj = microsofWordConstants()
        wordRangeObj.Collapse(wordConstantObj.wdCollapseEnd)
        
    '''
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def __init__(self):


        # wdOrientation
        self.wdOrientLandscape = 1 
        self.wdOrientPortrait = 0 

        # wdParagraphAlignment
        self.wdAlignParagraphCenter = 1 
        self.wdAlignParagraphDistribute = 4 
        self.wdAlignParagraphJustify = 3 
        self.wdAlignParagraphJustifyHi = 7 
        self.wdAlignParagraphJustifyLow = 8 
        self.wdAlignParagraphJustifyMed = 5 
        self.wdAlignParagraphLeft = 0 
        self.wdAlignParagraphRight = 2 
        self.wdAlignParagraphThaiJustify = 9 


        # wdAlignRow style
        self.wdAlignRowCenter = 1 
        self.wdAlignRowLeft = 0 
        self.wdAlignRowRight = 2 


        # wdLineStyle type
        self.wdLineStyleDashDot = 5 
        self.wdLineStyleDashDotDot = 6 
        self.wdLineStyleDashDotStroked = 20 
        self.wdLineStyleDashLargeGap = 4 
        self.wdLineStyleDashSmallGap = 3 
        self.wdLineStyleDot = 2 
        self.wdLineStyleDouble = 7 
        self.wdLineStyleDoubleWavy = 19 
        self.wdLineStyleEmboss3D = 21 
        self.wdLineStyleEngrave3D = 22 
        self.wdLineStyleInset = 24 
        self.wdLineStyleNone = 0 
        self.wdLineStyleOutset = 23 
        self.wdLineStyleSingle = 1 
        self.wdLineStyleSingleWavy = 18 
        self.wdLineStyleThickThinLargeGap = 16 
        self.wdLineStyleThickThinMedGap = 13 
        self.wdLineStyleThickThinSmallGap = 10 
        self.wdLineStyleThinThickLargeGap = 15 
        self.wdLineStyleThinThickMedGap = 12 
        self.wdLineStyleThinThickSmallGap = 9 
        self.wdLineStyleThinThickThinLargeGap = 17 
        self.wdLineStyleThinThickThinMedGap = 14 
        self.wdLineStyleThinThickThinSmallGap = 11 
        self.wdLineStyleTriple = 8 

        # wdSeekView Type
        self.wdSeekMainDocument = 0,
        self.wdSeekPrimaryHeader = 1,
        self.wdSeekFirstPageHeader = 2,
        self.wdSeekEvenPagesHeader = 3,
        self.wdSeekPrimaryFooter = 4,
        self.wdSeekFirstPageFooter = 5,
        self.wdSeekEvenPagesFooter = 6,
        self.wdSeekFootnotes = 7,
        self.wdSeekEndnotes = 8,
        self.wdSeekCurrentPageHeader = 9,
        self.wdSeekCurrentPageFooter = 10

        #  WdSaveOptions
        self.wdDoNotSaveChanges = 0
        self.wdPromptToSaveChanges = -2
        self.wdSaveChanges = -1

        #  WdConstants
        self.wdAutoPosition = 0
        self.wdFirst = 1
        self.wdToggle = 9999998
        self.wdUndefined = 9999999
        self.wdForward = 1073741823
        self.wdBackward = -1073741823
        self.wdCreatorCode = 1297307460

        #  WdLanguageID
        self.wdDanish = 1030
        self.wdGerman = 1031
        self.wdGreek = 1032
        self.wdEnglishUS = 1033
        self.wdSpanish = 1034
        self.wdFinnish = 1035
        self.wdFrench = 1036
        self.wdBelgianDutch = 2067
        self.wdBelgianFrench = 2060
        self.wdDutch = 1043
        self.wdEnglishUK = 2057
        self.wdItalian = 1040
        self.wdNoProofing = 1024
        self.wdPortuguese = 2070
        self.wdSpanishModernSort = 3082
        self.wdSwedish = 1053

        #  WdCountry
        self.wdUS = 1
        self.wdNetherlands = 31
        self.wdFrance = 33
        self.wdSpain = 34
        self.wdItaly = 39
        self.wdUK = 44
        self.wdDenmark = 45
        self.wdSweden = 46
        self.wdGermany = 49
        self.wdFinland = 358

        #  WdDictionaryType
        self.wdSpelling = 0
        self.wdGrammar = 1
        self.wdThesaurus = 2
        self.wdHyphenation = 3
        self.wdSpellingComplete = 4
        self.wdSpellingCustom = 5
        self.wdSpellingLegal = 6
        self.wdSpellingMedical = 7

        #  WdDocumentType
        self.wdTypeDocument = 0
        self.wdTypeTemplate = 1

        #  WdBuiltInProperty
        self.wdPropertyTitle = 1
        self.wdPropertySubjec = 2
        self.wdPropertyAuthor = 3
        self.wdPropertyConstants = 4
        self.wdPropertyComments = 5
        self.wdPropertyTemplate = 6
        self.wdPropertyLastAuthor = 7
        self.wdPropertyRevision = 8
        self.wdPropertyAppName = 9
        self.wdPropertyTimeLastPrinted = 10
        self.wdPropertyTimeCreated = 11
        self.wdPropertyTimeLastSaved = 12
        self.wdPropertyVBATotalEdit = 13
        self.wdPropertyPages = 14
        self.wdPropertyWords = 15
        self.wdPropertyCharacters = 16
        self.wdPropertySecurity = 17
        self.wdPropertyCategory = 18
        self.wdPropertyFormat = 19
        self.wdPropertyManager = 20
        self.wdPropertyCompany = 21
        self.wdPropertyBytes = 22
        self.wdPropertyLines = 23
        self.wdPropertyParas = 24
        self.wdPropertySlides = 25
        self.wdPropertyNotes = 26
        self.wdPropertyHiddenSlides = 27
        self.wdPropertyMMClips = 28
        self.wdPropertyHyperlinkBase = 29
        self.wdPropertyCharsWSpaces = 30

        #  WdAlertLevel
        self.wdAlertsAll = -1
        self.wdAlertsMessageBox = -2
        self.wdAlertsNone = 0

        #  WdArrangeStyle
        self.wdIcons = 1
        self.wdTiled = 0

        #  WdBookmarkSortBy
        self.wdSortByLocation = 1
        self.wdSortByName = 0

        #  WdBreakType
        self.wdSectionBreakNextPage = 2
        self.wdSectionBreakContinuous = 3
        self.wdSectionBreakEvenPage = 4
        self.wdSectionBreakOddPage = 5
        self.wdLineBreak = 6
        self.wdPageBreak = 7
        self.wdColumnBreak = 8

        #  WdBrowseTarget
        self.wdBrowsePage = 1
        self.wdBrowseSection = 2
        self.wdBrowseComment = 3
        self.wdBrowseFootnote = 4
        self.wdBrowseEndnote = 5
        self.wdBrowseField = 6
        self.wdBrowseTable = 7
        self.wdBrowseGraphic = 8
        self.wdBrowseHeading = 9
        self.wdBrowseEdit = 10
        self.wdBrowseFind = 11
        self.wdBrowseGoTo = 12

        #  WdCharacterCase
        self.wdLowerCase = 0 
        self.wdUpperCase = 1
        self.wdTitleWord = 2
        self.wdTitleSentence = 4
        self.wdToggleCase = 5
        self.wdNextCase = -1

        #  WdCollapseDirection
        self.wdCollapseEnd = 0
        self.wdCollapseStart = 1

        #  WdInternationalIndex
        self.wdProductLanguageID = 26

        #  wdWindowState
        self.wdWindowStateNormal = 0
        self.wdWindowStateMaximize = 1
        self.wdWindowStateMinimize = 2

        #  wdGoToDirection
        self.wdGoToAbsolute = 1
        self.wdGoToFirst = 1
        self.wdGoToLast = -1
        self.wdGoToNext = 2
        self.wdGoToPrevious = 3
        self.wdGoToRelative = 2

        #  wdGoToItem
        self.wdGoToBookmark = -1
        self.wdGoToSection = 0
        self.wdGoToPage = 1
        self.wdGoToTable = 2
        self.wdGoToLine = 3
        self.wdGoToFootNote = 4
        self.wdGoToEndNote = 5
        self.wdGoToComment = 6
        self.wdGoToField = 7
        self.wdGoToGraphic = 8
        self.wdGoToObject = 9
        self.wdGoToEquation = 10
        self.wdGoToHeading = 11
        self.wdGoToPercent = 12
        self.wdGoToSpellingError = 13
        self.wdGoToGrammaticalError = 14
        self.wdGoToProofReadingError = 15

        #  wdMovementType
        self.wdMove = 0
        self.wdExtend = 1

        #  wdUnits
        self.wdCharacter = 1
        self.wdWord = 2
        self.wdSentence = 3
        self.wdLine = 5
        self.wdStory = 6
        self.wdColumn = 9
        self.wdRow = 10
        self.wdCell = 12

        # wdViewType
        self.wdNormalView = 1
        self.wdOutlineView = 2
        self.wdPageView = 3
        self.wdPrintView = 3
        self.wdPrintPreview = 4
        self.wdMasterView = 5
        self.wdOnlineView = 6
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def inchesToPoints(self, inches):
        return inches * 72.0

