Advertisement
eeperry

LO Basic Determine Type Doc Loaded

Sep 10th, 2014
712
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function fnWhichComponent(oDoc) as string
  2.     if HasUnoInterfaces(oDoc, "com.sun.star.lang.XServiceInfo") then
  3.         if oDoc.supportsService ("com.sun.star.text.GenericTextDocument") then
  4.                 fnWhichComponent = "Text"
  5.         elseif oDoc.supportsService("com.sun.star.sheet.SpreadsheetDocument") then
  6.                 fnWhichComponent = "Spreadsheet"
  7.         elseif oDoc.supportsService("com.sun.star.presentation.PresentationDocument") then
  8.                 fnWhichComponent = "Presentation"
  9.         elseif oDoc.supportsService("com.sun.star.drawing.GenericDrawingDocument") then
  10.                 fnWhichComponent = "Drawing"
  11.         else
  12.                 fnWhichComponent = "Oops current document something else"
  13.         end if
  14.     else
  15.         fnWhichComponent = "Not a document"
  16.     end if
  17. End function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement