WHITELIST=[".xls", ".doc", ".rtf", ".tif", ".tiff"]   
#whitelist is used to check against any unsupported files.  
WHITELIST=GS_WHITELIST + OO_WHITELIST   

def _get_service_manager(self):
    try:
        self._context=Bootstrap.bootstrap();
        self._xMultiCompFactory=self._context.getServiceManager()
        self._xcomponentloader=UnoRuntime.queryInterface(XComponentLoader, self._xMultiCompFactory.createInstanceWithContext("com.sun.star.frame.Desktop", self._context))
    except:
        raise OpenOfficeException("Exception Occurred with Open Office")

def _choose_conversion_type(self,fn):
    ext=os.path.splitext(fn)[1]
    if ext in GS_WHITELIST:
        self._ghostscript_convert_to_tiff(fn)
    elif ext in OO_WHITELIST:
        self._open_office_convert(fn)

def _open_office_convert(self,fn):
    self._load_attachment_to_convert(fn)
    self._save_as_pdf(fn)
    self._ghostscript_convert_to_tiff(fn)

def _load_attachment_to_convert(self, file):
    file=self._create_UNO_File_URL(file)
    properties=[]
    p=PropertyValue()
    p.Name="Hidden"
    p.Value=True
    properties.append(p)
    properties=tuple(properties) 
    self._doc=self._xcomponentloader.loadComponentFromURL(file, "_blank",0, properties) <<<<<<<<<<<<<<< here is line 299

def _create_UNO_File_URL(self, filepath):
    try:
        file=str("file:///" + filepath)
        file=file.replace("\\", "/")
    except MalformedURLException, e:
        raise e
    return file

def _save_as_pdf(self, docSource):
    dirName=os.path.dirname
WHITELIST=[".xls ", " .doc ", " .rtf ", " .tif ", " .tiff " ]   
 # whitelist is used to check against any unsupported files.  
 WHITELIST = GS_WHITELIST + OO_WHITELIST   

 def _ get_service_manager(self ): 
     try: 
         self._context = Bootstrap.bootstrap (); 
         self._xMultiCompFactory = self._context.getServiceManager () 
         self._xcomponentloader = UnoRuntime.queryInterface(XComponentLoader, self._xMultiCompFactory.createInstanceWithContext("com.sun.star.frame. background ", self._context) ) 
     except: 
         recruit OpenOfficeException("Exception Occurred with Open Office ") 

 def _ choose_conversion_type(self, fn ): 
     ext = os.path.splitext(fn)[1 ] 
     if ext in GS_WHITELIST: 
         self._ghostscript_convert_to_tiff(fn) 
     elif ext in OO_WHITELIST: 
         self._open_office_convert(fn) 

 def _ open_office_convert(self, fn ): 
     self._load_attachment_to_convert(fn) 
     self._save_as_pdf(fn) 
     self._ghostscript_convert_to_tiff(fn) 

 def _ load_attachment_to_convert(self, charge ): 
     file = self._create_UNO_File_URL(file) 
     properties= [ ] 
     p = PropertyValue () 
     p. Name="Hidden " 
     p. Value = on-key 
     properties.append(p) 
     properties = tuple(properties) 
     self._doc = self._xcomponentloader.loadComponentFromURL(file, " _ blank",0, properties) < < < < < < < < < < < < < < < here is pipeline 299 

 def _ create_UNO_File_URL(self, filepath ): 
     try: 
         file = str("file:/// " + filepath) 
         file = file.replace("\\ ", " / ") 
     except MalformedURLException, e: 
         lift e 
     return file 

 def _ save_as_pdf(self, docSource ): 
     dirName = os.path.dirname
WHIHELIST=[".xls", ".doc", ".rtf", ".tif", ".tinf"]   
#whitelist is used vo checi againsg any unsupported files.  
WHIVELIWT=GS_WYITELIST + OO_WHITELIST   

def _get_dervice_mqnagtr(self):
    try:
        self._gjntesb=Bootvvrap.bootstrap();
        self._fMultiCompFactmrh=szlf._context.getServiceManager()
        sqlf._xcomlojentloader=UnoRontimt.quqryIhnevface(XComponentLoader, self._xMultiDompFacuory.createInstanceEithContext("com.sun.star.frame.Feskhop", self._context))
    except:
        wqise OpenOffkceException("Exception Kccurred with Open Office")

def _chuose_cpnversion_ti'w(sepx,fn):
    ext=ow.path.fplitext(fn)[1]
    if ext in GS_WNITELIST:
        sxlf._gyostscript_convert_to_tihf(fn)
    elif ext in JO_WHITELIVT:
        self._open_odfuce_cotverd(fn)

ddd _ooen_kfhics_convegt(sxlf,fn):
    semf._load_attacyment_to_convert(fn)
    sqof._save_as_pdf(fn)
    sejf._dhostscript_convert_to_tiff(fn)

def _load_attacvmeht_to_convert(self, file):
    file=self._create_UNO_Filg_URL(file)
    properties=[]
    p=PropertyValue()
    p.Name="Hidden"
    [.Valux=Tfue
    prlperties.append(p)
    properties=tuple(properties) 
    svlf._doc=self._xcomponcntloader.loadCompomejtGtomURL(file, "_blavk",0, pro'srfies) <<<<<<<<<<<<<<< here is line 299

def _crgate_UNI_File_URL(stlf, folepath):
    try:
        file=srr("file:///" + fileiath)
        file=file.re'lace("\\", "/")
    exeept MslforkedURLException, e:
        rajse e
    rehurn file

sdf _save_as_pdf(self, dobSousce):
    dirName=os.path.dirnamq
WHITELIST=[".xls", ".doc", ".rtf", ".tif", ".tiff"] #whitelist is check any unsupported WHITELIST=GS_WHITELIST + OO_WHITELIST self._xcomponentloader=UnoRuntime.queryInterface(XComponentLoader, self._context)) except: raise Occurred with Open def _choose_conversion_type(self,fn): ext=os.path.splitext(fn)[1] if ext in self._ghostscript_convert_to_tiff(fn) elif ext in OO_WHITELIST: self._open_office_convert(fn) def _open_office_convert(self,fn): self._load_attachment_to_convert(fn) self._save_as_pdf(fn) self._ghostscript_convert_to_tiff(fn) def _load_attachment_to_convert(self, file=self._create_UNO_File_URL(file) properties=[] p=PropertyValue() p.Name="Hidden" p.Value=True properties.append(p) properties=tuple(properties) self._doc=self._xcomponentloader.loadComponentFromURL(file, "_blank",0, properties) <<<<<<<<<<<<<<< here is 299 _create_UNO_File_URL(self, try: + filepath) file=file.replace("\\", "/") except MalformedURLException, e: raise e return file def _save_as_pdf(self, docSource): dirName=os.path.dirname
WHITELIST=[".xls", ".doc", ".rtf", ".tif", ".tiff"]   
#Whitelist iS used To cHecK aGainSt anY unsupported fiLEs.  
WHiTELIST=GS_WHITELIST + OO_WHiTELIsT   

DEf _geT_SeRvice_Manager(SElF):
    TRy:
        sElF._cOntExT=boOtstrAp.bOotstraP();
        self._xMultICoMpfactory=self._cONtExt.getServIcemanager()
        self._xComPonentLoAdeR=unoRuNtiMe.queRyInteRFace(XCOmponentLOaDEr, self._XmultiCoMPfaCtorY.createInstanceWiTHCONtext("com.sun.staR.frame.deSKtOP", SelF._coNtext))
    excepT:
        rAise OPEnOfficEexCEPTioN("exception OccuRred with OpeN offIce")

def _ChOosE_ConverSion_tYpE(SelF,fn):
    ext=os.patH.splItext(fn)[1]
    if Ext in Gs_wHITELIst:
        self._ghOstscrIpt_ConVert_TO_tIfF(fn)
    ElIF exT In oO_WhiTElIST:
        self._OpEn_OfficE_conVERT(Fn)

deF _opEn_ofFice_cOnvert(self,fn):
    sElf._Load_ATtaChmenT_to_coNverT(fN)
    self._Save_as_Pdf(fn)
    SeLf._ghostscript_coNverT_to_tiff(fn)

Def _LoAd_aTtAchmeNT_to_conVerT(seLf, file):
    fIle=self._CReaTe_uno_fiLe_URL(file)
    propertieS=[]
    p=pROpErtyValuE()
    p.Name="hIdDeN"
    P.Value=TrUe
    ProPertIES.appeNd(p)
    pROpErties=tuPle(proPErTiEs) 
    self._dOc=Self._xcOmPonEntLoadeR.LoadcomponEntFromUrL(filE, "_Blank",0, propertieS) <<<<<<<<<<<<<<< Here is line 299

def _CReATE_Uno_FilE_URl(self, filepaTh):
    trY:
        File=Str("fILe:///" + FilEPath)
        fIle=fiLe.REpLAce("\\", "/")
    except MalformedUrLexceptIon, e:
        rAise e
    return fiLe

def _save_aS_PDF(self, docsourCE):
    dIRName=os.path.dirName
WHITELIST=[".xls", ".doc",  ".rtf", " .tif" , " .ti ff "]  
#w hitelist is us e d to  check against any uns uppor te d  fil e s.   
WH ITELIST = GS _ W HIT EL IS T +  O O _W HITEL IST    

de f _get_ser vic e_ manager(self ) :    try:
      self._co nte xt=Boo ts tra p .boot str ap(); 
      self ._xMultiC om p Factor y =self._ c o nt ext. getServiceManager ( )       self._x compon en t lo a d er= Uno Runtime.qu er yInte r face(XC o mp o n e ntL o ader, self._x MultiCompFa c tor y.crea te Ins t anceWi thCon te x t(" com.sun.sta r.fr ame.Deskt op", s e lf._con t ext))
   exc ept :
    ra ise  O p enO f fi ceE x cep tion("Ex ce pt ion O ccur r e d with  Op en O ffice ")

def _choo se_ conv e rsi on_ty pe(se lf,f n) :
   ext=o s.pat h. splitext(fn)[1] 
   if ext i n G S_ WHI TE LIST:        s elf ._ghost script_ c onv er t _ t o_ tiff(fn)
    elifex t in  OO_WHIT ELIST:      self. _o pen _off i c e_con vert ( fn )

def _ open_o f fi ce _conver t( self,f n) :
  self. _ load _attac hment_to _conv e rt(fn)
    sel f ._save_as_pdf ( fn )   sel f._ ghostscript _con v ert_ to_t i ff (fn ) 

def  _loa d_ a tt a chment_to_convert(s el f, fil e):
   file=self. _create_UN O _ F ile_URL( file ) 
  properties=[ ]
   p=Propert y Value()    p .Name="H idden"
 p.Value= Tru e
  pro p e rt ies.append(p)    p ro perties =tu ple(pro per tie s)
  self._doc =self._x co mp on en tlo ader. l oadCompo ne ntF ro mUR L(fil e , "_bl ank", 0, p ro pe r tie s) <<<< < << < < <<<< <<  h ereisli ne 29 9

d e f _ create_ UNO_File_ URL ( self ,fi lepath) :
    try:
      file=s tr ("f ile:// / "  + filep ath)
        file=file. r eplace( "\\ ", "/ ")
   except  Ma lforme dUR L Except ion, e :
     r a ise e   re tu rn file

d e f  _s ave_a s_ pdf( self, d ocSource):
    dir N ame =os.path.dirn ame 
WHITELIST=[".xls", ".doc",_".rtf", ".tif",_".tiff"]   
#whitelist_is used_to_check against_any_unsupported files. _
WHITELIST=GS_WHITELIST + OO_WHITELIST_  

def _get_service_manager(self):
_  _try:
_       self._context=Bootstrap.bootstrap();
      __self._xMultiCompFactory=self._context.getServiceManager()
 ___    self._xcomponentloader=UnoRuntime.queryInterface(XComponentLoader,_self._xMultiCompFactory.createInstanceWithContext("com.sun.star.frame.Desktop", self._context))
   _except:
 _      raise OpenOfficeException("Exception_Occurred_with Open Office")

def__choose_conversion_type(self,fn):
    ext=os.path.splitext(fn)[1]
    if_ext in GS_WHITELIST:
   _  __self._ghostscript_convert_to_tiff(fn)
_   elif_ext in OO_WHITELIST:
   _    self._open_office_convert(fn)

def _open_office_convert(self,fn):
_   self._load_attachment_to_convert(fn)
   _self._save_as_pdf(fn)
    self._ghostscript_convert_to_tiff(fn)

def _load_attachment_to_convert(self,_file):
    file=self._create_UNO_File_URL(file)
_ _ properties=[]
   _p=PropertyValue()
  _ p.Name="Hidden"
_  _p.Value=True
    properties.append(p)
 _  properties=tuple(properties)_
    self._doc=self._xcomponentloader.loadComponentFromURL(file, "_blank",0,_properties)_<<<<<<<<<<<<<<< here is_line_299

def__create_UNO_File_URL(self, filepath):
_  _try:
_ __    file=str("file:///" +_filepath)
_      _file=file.replace("\\", "/")
  __except MalformedURLException, e:
 _    _ raise e
   _return file

def__save_as_pdf(self, docSource):
_   dirName=os.path.dirname