Home of site


Macroの杜
(OpenOffice.org/LibreOffice Basic編)

General No.6

###【 Continued from General No.5 】###


**********************【 Index 】**********************

UNO(Universal Network Objects)


Tips


Other












**********************【 Macro Code 】**********************

Text

[ Text ]

GTxt-)[General]DummyのText fileを作成

Sub Main
	name_html="C:/OOo_test/test2/test_html"		 
	dim args2(1) as new com.sun.star.beans.PropertyValue
	dim Dummy()
		args1(2).Name="FilterOption"
			oDoc = StarDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, Dummy())
			document   = ThisComponent.CurrentController.Frame
		dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
			args2(0).Name="FileName"
			args2(0).Value="file:///" & name_html
			args2(1).Name="Filteroption"
			args2(1).Value="text"
		dispatcher.executeDispatch(document, ".uno:SaveAs", "", 0, args2())
	oDoc.Close(false)
End Sub

GTxt-)[General]Text fileの読み込み

Sub Main
	Dim FileNo As Integer
	Dim CurrentLine As String
	Dim outdata as String
	Dim TxtFile,oTxtF As String
		TxtFile="c:\OOo_test\test.txt"
		oTxtF=ConvertToUrl(TxtFile)
		fileNo=Freefile
		Open oTxtF For Input As FileNo
			Do While not eof(FileNo)
				' Read line 
				Line Input #FileNo, CurrentLine   
				If CurrentLine <>"" then
					outdata = outdata & CurrentLine & Chr(13)
				end if
			Loop
		Close #fileNo
	Msgbox(outdata)
End Sub


GTxt-)[General]HTML fileをTextfileに変換

Global sPath As String
Global sDoc As Object
Sub Main
'現在のfile名の絶対Path
		sDoc = ThisComponent
		sUrl = sDoc.getLocation()
		sPath = ConvertFromURL(sUrl) ':msgbox(spath)
	'現ファイル名を取得
		GlobalScope.BasicLibraries.LoadLibrary("Tools")
		nUrl = ThisComponent.getURL
		nFile=FileNameOutOfPath(nUrl) ':msgbox(nFile)
		
		oNum=Len(spath)-Len(nFile)
	'現在のフォルダまでのPath
		osPath=Left(sPath,oNum) ': msgbox osPath		
	'
		Cfolder="C:\OOo_test"
		ofname="8test_html.html"
		fText=Left(ofname,InStr(1,ofname,".")-1)

	'batコマンド実行
		bat_file=osPath & "Type1.bat" &" "& Cfolder & " " & ofname & " " & fText & ".txt" & " " & osPath
	msgbox bat_file
	Shell(bat_file)
	'TextファイルOpen
		Dim args1(1) as new com.sun.star.beans.PropertyValue
		Textfile=ConvertToUrl(Cfolder & "\" & fText & ".txt")
		wait 1000
		args1(0).Name="Hidden"
 		args1(0).value=false
 		args1(1).Name="Readonly"
 		args1(1).Value=false
 	 	oDoc = StarDesktop.loadComponentFromURL(Textfile, "_blank", 0, args1())
 		oDoc.close(false)
End Sub

GTxt-)[General]Text Fileへ出力


Sub oTextFileMacro
	Dim oPath as String
	Dim oFileName as String
	Dim oFileNumber as Integer
	Dim oFullFileName as String
	Dim oPntData as String
	Dim oJp() as String
	Dim oEn() as String
		oJp = Array("日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日")
		oEn = Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
		'
		oPath = "c:\temp\"
		oFileName = "oTextMacro.txt"
		'
		oPntData = "----- [ Text Fileへの出力 ] -----" & Chr$(10) & Chr$(10)
		for i = 0 to UBound(oEn)
			oPntData = oPntData & i & ") " & oEn(i) & Chr$(9) & oJp(i) & Chr$(10)
		next i
	' Text Fileへの出力
		oFileNumber = FreeFile()
		oFullFileName = oPath & oFileName
		
		Open oFullFileName for Append as oFileNumber
			print #oFileNumber, oPntData		' Data Into File 
		Close #oFileNumber
		'
		msgbox "Success"
End Sub
'
' << File Open時のMode >>
 '[ For Append ]
  'Text Fileの書き出し位置	: End
  '同名Fileがある時		: Open
  '指定Fileが無い時		: Create
  'Data Read 可否			: Yes 
  'Data Write 可否		: Yes
  'Comment				: Sequential Access
  'Mode CheckのReturn		: 8
'
 '[ For Imput ]
  'Text Fileの書き出し位置	: Start
  '同名Fileがある時		: Open
  '指定Fileが無い時		: Error
  'Data Read 可否			: Yes 
  'Data Write 可否		: No
  'Comment				: Sequential Access
  'Mode CheckのReturn		: 1
'
 '[ For Output ]
  'Text Fileの書き出し位置	: Start
  '同名Fileがある時		: Delete
  '指定Fileが無い時		: Create
  'Data Read 可否			: Yes 
  'Data Write 可否		: Yes
  'Comment				: Sequential Access
  'Mode CheckのReturn		: 2
'
 '[ For Binart ]
  'Text Fileの書き出し位置	: Start
  '同名Fileがある時		: Delet
  '指定Fileが無い時		: Create
  'Data Read 可否			: Yes 
  'Data Write 可否		: Yes
  'Comment				: Random Access
  'Mode CheckのReturn		: 16
 '[ For random ]
  'Text Fileの書き出し位置	: Start
  '同名Fileがある時		: Delete
  '指定Fileが無い時		: Create
  'Data Read 可否			: Yes 
  'Data Write 可否		: Yes
  'Comment				: Random Access
  'Mode CheckのReturn		: 4

[ Read / Write ]

GRW-)[General]OpenFileRead


Sub oOpenFileReadSFA
	Dim oSimpleFileAccess as Object
	Dim oFile as String
	Dim oOpenFileRead as Object
	Dim oOFRTypes(100) as Long
	Dim oOFRID(100) as Long
	Dim oOFRPos as Long
	Dim oOFRLen as Long
		oSimpleFileAccess = createUnoService("com.sun.star.ucb.SimpleFileAccess")
		oFile = "C:\temp\oTextMacro.txt"
		If oSimpleFileAccess.Exists(oFile) then
			oOpenFileRead = oSimpleFileAccess.openFileRead(oFile)
			'oA = oOpenFileRead.dbg_methods	: msgbox(oA)	: 'Exit Sub
			'oB = oOpenFileRead.dbg_properties	: msgbox(oB)	: 'Exit Sub
			'
			oOFRTypes = oOpenFileRead.Types
			oOFRID = oOpenFileRead.ImplementationID
			oOFRPos = oOpenFileRead.Position
			oOFRLen = oOpenFileRead.Length
			'
			oDisp = "File Name :   " &	oFile & Chr$(10)
			oDisp = oDisp & "<< OpenFileRead >>" & Chr$(10)  
			oDisp = oDisp & "[ Types数 ] = " & UBound(oOFRTypes) & Chr$(10)
			oDisp = oDisp & "[ ImplementationID数 ] = " & UBound(oOFRID) & Chr$(10)
			oDisp = oDisp & "[ Position ] = " & oOFRPos & Chr$(10)
			oDisp = oDisp & "[ Length ] = " & oOFRLen & " bytes"
			MsgBox( oDisp, 0, "OpenFileRead")
			'
			oOpenFileRead.closeInput()
		else
			MsgBox( oFile & " は存在しません", 0, "Caution !!")
			Exit Sub
		End If
End Sub
'[ Note ]
'「1」=1, 「,」=1, 「2」=2,「坂本龍馬」=8, 「ア」=1,「a」=1,「A」=1,「a」=2,「A」=2
'1+1*6+2+8+1+1+1+2+2+2(改行1回) ⇒ 26 bytes

GRW-)[General]OpenFileWrite


Sub oOpenFileWriteSFA
	Dim oSimpleFileAccess as object
	Dim oFile as String
	Dim oOpenFileWrite as Object
	Dim oOFWTypes(100) as Long
	Dim oOFWID(100) as Long
	Dim oOFWPos as Long
	Dim oOFWLen as Long
		oSimpleFileAccess = createUnoService("com.sun.star.ucb.SimpleFileAccess")
		oFile = "C:\temp\test.csv"
		If oSimpleFileAccess.Exists(oFile) then
			oOpenFileWrite = oSimpleFileAccess.openFileWrite(oFile)
			'oA = oOpenFileRead.dbg_methods	: msgbox(oA)	: 'Exit Sub
			'oB = oOpenFileWrite.dbg_properties	: msgbox(oB)	: 'Exit Sub
			oOFWTypes = oOpenFileWrite.Types
			oOFWID = oOpenFileWrite.ImplementationID
			oOFWPos = oOpenFileWrite.Position
			oOFWLen = oOpenFileWrite.Length
			oDisp = "File Name :   " &	oFile & Chr$(10)
			oDisp = oDisp & "<< OpenFile Write >>" & Chr$(10)  
			oDisp = oDisp & "[ Types数 ] = " & UBound(oOFWTypes) & Chr$(10)
			oDisp = oDisp & "[ ImplementationID数 ] = " & UBound(oOFWID) & Chr$(10)
			oDisp = oDisp & "[ Position ] = " & oOFWPos & Chr$(10)
			oDisp = oDisp & "[ Length ] = " & oOFWLen & " bytes"
			MsgBox( oDisp, 0, "OpenFileWrite")
			'
			oOpenFileWrite.closeOutput()
			' oOpenFileWrite.closeInput()		' closeInput()でも動作する
		else
			MsgBox( oFile & " は存在しません", 0, "Caution !!")
			Exit Sub
		End If
End Sub

GRW-)[General]OpenFileReadWrite


Sub oOpenFileReadWriteSFA
	Dim oSimpleFileAccess as Object
	Dim oFile as String
	Dim oOpenFileReadWrite as Object
	Dim oOFRWTypes(100) as Long
	Dim oOFRWID(100) as Long
	Dim oOFRWPos as Long
	Dim oOFRWLen as Long
		oSimpleFileAccess = createUnoService("com.sun.star.ucb.SimpleFileAccess")
		oFile = "C:\temp\test.csv"
		If oSimpleFileAccess.Exists(oFile) then
			oOpenFileReadWrite = oSimpleFileAccess.openFileReadWrite(oFile)
			oOFRWTypes = oOpenFileReadWrite.Types
			oOFRWID = oOpenFileReadWrite.ImplementationID
			oOFRWPos = oOpenFileReadWrite.Position
			oOFRWLen = oOpenFileReadWrite.Length
			oDisp = "File Name :   " &	oFile & Chr$(10)
			oDisp = oDisp & "<< OpenFileReadWrite >>" & Chr$(10)  
			oDisp = oDisp & "[ Types数 ] = " & UBound(oOFRWTypes) & Chr$(10)
			oDisp = oDisp & "[ ImplementationID数 ] = " & UBound(oOFRWID) & Chr$(10)
			oDisp = oDisp & "[ Position ] = " & oOFRWPos & Chr$(10)
			oDisp = oDisp & "[ Length ] = " & oOFRWLen & " bytes"
			MsgBox( oDisp, 0, "OpenFileReadWrite")
			'
			oOpenFileReadWrite.closeInput()
			' oOpenFileReadWrite.closeoutput()		' closeoutput()でも動作する。
		else
			MsgBox( oFile & " は存在しません", 0, "Caution !!")
			Exit Sub
		End If
End Sub

XML

GXML-)[General]XML Fileの構文解析


Sub NetDom()
	Dim oDocBuilder as Object
	Dim oDom as Object
	Dim oFile as String, oURL as String
	Dim oDmElmt as Object
	Dim oTopItem as String
	Dim oChdNode1 as Object, oChdNode2 as Object
	Dim oNodeItem1 as Object, oNodeItem2 as Object
		oFile = "c:\temp\PythonMacroTest.xml"
		oURL = ConvertToUrl( oFile )
		oDocBuilder = createUnoService("com.sun.star.xml.dom.DocumentBuilder")
		oDom = oDocBuilder.parseURI(oURL)
		oDom.normalize()
		'
		oDmElmt = oDom.getDocumentElement()
		oTopItem = oDmElmt.TagName
		oDisp = oTopItem & Chr$(10)
		'
		oChdNode1 = oDmElmt.getChildNodes()
		for i = 0 to oChdNode1.getLength() -1
			oNodeItem1 = oChdNode1.item(i)		' item : method / not property
			if oNodeItem1.HasChildNodes() = true then
				oDisp = oDisp & Chr$(9) & oNodeItem1.LocalName & Chr$(10)
				oChdNode2 = oNodeItem1.getChildNodes()
				for k = 0 to oChdNode2.getLength() -1
					oNodeItem2 = oChdNode2.item(k)
					if oNodeItem2.HasChildNodes() = true then
						oDisp = oDisp & Chr$(9) & Chr$(9) & oNodeItem2.LocalName & Chr$(10)
					end if
				next k
			end if
		next i
		msgbox oDisp,0,"Node Name of XML"
End Sub

GXML-)[General]











Library / Module

GLyMd-)[General]Module Source取得


Sub Library()
	Dim oLibry as Object
	Dim oSrc as String
		oLibry = GlobalScope.basicLibraries.getByName("Standard")
		oSrc = oLibry.getByName("Module1")
	msgbox oSrc,0,"Module Source"
End Sub

GLyMd-)[General]Library List取得


Sub Library()
	Dim oLibry as Object
	Dim oDisp as String
		oLibry = GlobalScope.basicLibraries.getElementNames()
		oDisp = "[ Library List ]" & Chr(10)
		for i = 0 to UBound(oLibry)
			oDisp = oDisp & oLibry(i) & Chr(10)
		next i
	msgbox oDisp,0,"Library List"
End Sub








GLyMd-)[General]Module List取得


Sub LibraryModule()
	Dim oBLibrys as Object
	Dim oLibry as Object
	Dim oLibName as String
	Dim oMdle() as String
		oBLibrys = GlobalScope.basicLibraries
		oLibName = "Gimmicks"
		'
		oDisp = "[ Module List ]" & Chr$(10)
		if oBLibrys.hasByName(oLibName) then
			oMdle = oBLibrys.getByName(oLibName).getElementNames()
			for i = 0 to UBound(oMdle)
				oDisp = oDisp & oMdle(i) & Chr$(10)
			next i
		else
			oDisp = oDisp & " Library  : " & oLibName & " does not exist."
		end if
	msgbox oDisp,0,"Module List"
End Sub

GLyMd-)[General]任意のLibrary / Moduleの有無Check


Sub Library()
	Dim oLibry as Object
	Dim oLibName as String
	Dim oMdleName as String
		oLibry = GlobalScope.basicLibraries
		oLibName = "Gimmicks"
		oMdleName = "AutoText"
		'
		oDisp = "[ Library and Moduleの有無Check ]" & Chr$(10)
		if oLibry.hasByName(oLibName) then
			if oLibry.getByName(oLibName).hasByName(oMdleName) then
				oDisp = oDisp & Chr$(9) & oMdleName & " of " & oLibName & " exists."
			else
				oDisp = oDisp & Chr$(9) & oMdleName & " of " & oLibName & " does not exist."
			end if
		else
			oDisp = oDisp & " Library  : " & oLibName & " does not exist."
		end if
	msgbox oDisp,0,"Library / Modueの有無"
End Sub

GLyMd-)[General]











・UNO(Universal Network Objects)

GU-1)[General]Typeの定義

Type PersonType
	FirstName As String
	LastName As String
End Type
Sub oPerson
	Dim oP As PersonType
		oP.FirstName = "坂本"
		oP.LastName = "竜馬"
		oMe = createObject("PersonType")
		oMe.FirstName = "OpenOffice.org"
		oMe.LastName = "Macro"
	msgbox(oP.FirstName & oP.LastName  & chr$(10) & oMe.FirstName & " " & oMe.LastName)
End Sub

GU-)[General]Create UNO structure

Type PersonType
	FirstName As String
	LastName As String
End Type
Sub oCObj
	Dim oP(0) As new com.sun.star.beans.PropertyValue
	Dim oProp(0)
		oPS = createObject("com.sun.star.beans.PropertyValue")
		oProp(0) = createObject("com.sun.star.beans.PropertyValue")
		oProp(0).Name = "FirstName"
		oProp(0).Value = "織田"
		oP(0).Name = "LastName"
		oP(0).Value = "信長"
		oPS.Name = "FirstName"
		oPS.Value = "野茂"
		oTy1 = TypeName(oProp)
		oTy2 = TypeName(oP)
		oTy3 = TypeName(oPS)
	oUSt1 = IsUnoStruct(oProp)
	oUSt2 = IsUnoStruct(oP)
	oUSt3 = IsUnoStruct(oPS)
	msgbox(oProp(0).Value  & "Type oProp(0) : " & oTy1 & "Is UNO ? : " & oUSt1 & Chr$(10) & oP(0).Name  & "Type oP(0) : " & _
	 oTy2 & "Is UNO ? : " & oUSt2 & Chr$(10) & oPS.Value  & "Type oPS : " & oTy3 & "Is UNO ? : " & oUSt3 )
	Dim oPU(0) As Object
	On Error GoTo eM
		oPU(0).Name = "LastName"
		oPU(0).Value = "英雄"
		oTy4 = TypeName(oPU)
		oUSt4 = IsUnoStruct(oPU)
	eM:
		Print Error
End Sub

GU-)[General]UNO Interfaceの確認

Sub GnUnoInterface()
	Dim oDoc as Object, oSheet as Object
	Dim oChk as Boolean
		oDoc = ThisComponent
		oSheet = oDoc.getSheets().getByName("sheet1")
		oChk = HasUnoInterfaces( oSheet, "com.sun.star.sheet.XSpreadsheet" )
		msgbox oChk,0,"Interface"
End Sub

GU-)[General]file Access及びType取得

Sub oFileAccess_Type
	Dim oFA
	Dim oName, oURL, oText As String
	Dim oManager
		oName ="C:\Temp\Witer_Macro.odt"
		oURL = ConvertToUrl(oName)
		oManager = GetProcessServiceManager()
		oFA = oManager.CreateInstance("com.sun.star.ucb.SimpleFileAccess")
		oFTy = oFA.getContentType(oURL)
	Print oFTy
End Sub

GU-4)[General]UNO Service数の取得

Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		sNum = UBound(uService)
	MsgBox("SupportされているUNO module Service数は " & Chr$(10) & sNum & "です。")
End Sub

GU-)[General]sheetに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,5) 	':	print otmp
			If otmp = "sheet" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]beansに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,5) 	':	print otmp
			If otmp = "beans" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]ucbに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,3) 	':	print otmp
			If otmp = "ucb" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]configurationに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,13) 	':	print otmp
			If otmp = "configuration" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]textに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,4) 	':	print otmp
			If otmp = "text" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]drawingに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,7) 	':	print otmp
			If otmp = "drawing" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]presentationに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,12) 	':	print otmp
			If otmp = "presentation" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]formulaに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,7) 	':	print otmp
			If otmp = "formula" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]linguisticに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,10) 	':	print otmp
			If otmp = "linguistic" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]comp.Writerに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,11) 	':	print otmp
			If otmp = "comp.Writer" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]comp.documentに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,13) 	':	print otmp
			If otmp = "comp.document" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]comp.Calcに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,9) 	':	print otmp
			If otmp = "comp.Calc" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]comp.Chartに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,10) 	':	print otmp
			If otmp = "comp.Chart" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]comp.Drawに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,9) 	':	print otmp
			If otmp = "comp.Draw" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]comp.Impressに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,12) 	':	print otmp
			If otmp = "comp.Impress" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]comp.sdに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,7) 	':	print otmp
			If otmp = "comp.sd" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]comp.Mathに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,9) 	':	print otmp
			If otmp = "comp.Math" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]comp.ooxに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,8) 	':	print otmp
			If otmp = "comp.oox" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]comp.embedに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,10) 	':	print otmp
			If otmp = "comp.embed" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]comp.deploymentに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,15) 	':	print otmp
			If otmp = "comp.deployment" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]langに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,4) 	':	print otmp
			If otmp = "lang" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]i18nに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,4) 	':	print otmp
			If otmp = "i18n" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]awt.Unoに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,7) 	':	print otmp
			If otmp = "awt.Uno" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]awt.Dialogに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,10) 	':	print otmp
			If otmp = "awt.Dialog" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]awt.Displayに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,11) 	':	print otmp
			If otmp = "awt.Display" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]awt.gridに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,8) 	':	print otmp
			If otmp = "awt.grid" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]awt.Imageに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,9) 	':	print otmp
			If otmp = "awt.Image" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]awt.Layoutに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,10) 	':	print otmp
			If otmp = "awt.Layout" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]awt.Pointerに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,11) 	':	print otmp
			If otmp = "awt.Pointer" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]awt.Printerに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)
			otmp = mid(uService(i),14,11) 	':	print otmp
			If otmp = "awt.Printer" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]awt.Propertyに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)			
		otmp = mid(uService(i),14,12) 	':	print otmp
			If otmp = "awt.Property" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]awt.Tabに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)			
		otmp = mid(uService(i),14,7) 	':	print otmp
			If otmp = "awt.Tab" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]awt.Toolkitに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)			
		otmp = mid(uService(i),14,11) 	':	print otmp
			If otmp = "awt.Toolkit" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]awt.treeに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)			
		otmp = mid(uService(i),14,8) 	':	print otmp
			If otmp = "awt.tree" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]awt.XProgressに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)			
		otmp = mid(uService(i),14,13) 	':	print otmp
			If otmp = "awt.XProgress" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]awt.Menuに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)			
		otmp = mid(uService(i),14,8) 	':	print otmp
			If otmp = "awt.Menu" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]uiに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)			
		otmp = mid(uService(i),14,2) 	':	print otmp
			If otmp = "ui" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]frameに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i = 0 to UBound(uService)			
		otmp = mid(uService(i),14,5) 	':	print otmp
			If otmp = "frame" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]accessibilityに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,13) 	':	print otmp
			If otmp = "accessibility" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]animationsに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,10) 	':	print otmp
			If otmp = "animations" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]bridgeに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,6) 	':	print otmp
			If otmp = "bridge" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]chart2に関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,6) 	':	print otmp
			If otmp = "chart2" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]configに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,7) 	':	print otmp
			If otmp = "config." then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]configurationに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,13) 	':	print otmp
			If otmp = "configuration" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]connectionに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,10) 	':	print otmp
			If otmp = "connection" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]datatransferに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,12) 	':	print otmp
			If otmp = "datatransfer" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]deployに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,6) 	':	print otmp
			If otmp = "deploy" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]form.bindingに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,12) 	':	print otmp
			If otmp = "form.binding" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]form.componentに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,14) 	':	print otmp
			If otmp = "form.component" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]form.controlに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,12) 	':	print otmp
			If otmp = "form.control" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]form.Formに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,9) 	':	print otmp
			If otmp = "form.Form" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]form.inspectionに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,15) 	':	print otmp
			If otmp = "form.inspection" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]form.Masterに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,11) 	':	print otmp
			If otmp = "form.Master" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]form.Propertyに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,13) 	':	print otmp
			If otmp = "form.Property" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]form.runtimeに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,12) 	':	print otmp
			If otmp = "form.runtime" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]form.uiに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,7) 	':	print otmp
			If otmp = "form.ui" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]galleryに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,7) 	':	print otmp
			If otmp = "gallery" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]graphicに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,7) 	':	print otmp
			If otmp = "graphic" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]Handlerに関するUNO Service


Sub UnoHandler()
	Dim oPreSrvMng as Object
	Dim oUnoAvailSrv() as String
	Dim oDisp as String
		oPreSrvMng = GetProcessServiceManager()
		oUnoAvailSrv = oPreSrvMng.AvailableServiceNames
		oDisp = "[ UNO Service / Handler ]"
		for i = 0 to UBound(oUnoAvailSrv)
			if InStr(1, oUnoAvailSrv(i), "Handler") then
				oDisp = oDisp & Chr$(10) & oUnoAvailSrv(i)
			end if
		next i
		msgbox(oDisp, 0,"UNO Service")
End Sub





















GU-)[General]helpに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,4) 	':	print otmp
			If otmp = "help" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]inspectionに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,10) 	':	print otmp
			If otmp = "inspection" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]ioに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,2) 	':	print otmp
			If otmp = "io" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]javaに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,4) 	':	print otmp
			If otmp = "java" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]loaderに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,6) 	':	print otmp
			If otmp = "loader" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]loggingに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,7) 	':	print otmp
			If otmp = "logging" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]migrationに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,9) 	':	print otmp
			If otmp = "migration" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]mozillaに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,7) 	':	print otmp
			If otmp = "mozilla" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]officeに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,6) 	':	print otmp
			If otmp = "office" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]oooimprovementに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,14) 	':	print otmp
			If otmp = "oooimprovement" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]packagesに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,8) 	':	print otmp
			If otmp = "packages" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]pluginに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,6) 	':	print otmp
			If otmp = "plugin" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]rdfに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,3) 	':	print otmp
			If otmp = "rdf" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]reflectに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,7) 	':	print otmp
			If otmp = "reflect" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]registryに関するUNO Service


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,8) 	':	print otmp
			If otmp = "registry" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]rendering


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,9) 	':	print otmp
			If otmp = "rendering" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]report


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,6) 	':	print otmp
			If otmp = "report" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]resource


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,8) 	':	print otmp
			If otmp = "resource" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]scanner


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,7) 	':	print otmp
			If otmp = "scanner" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]script


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,6) 	':	print otmp
			If otmp = "script" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]sdb


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,3) 	':	print otmp
			If otmp = "sdb" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]sdbc


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,4) 	':	print otmp
			If otmp = "sdbc" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]security


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,8) 	':	print otmp
			If otmp = "security" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]setup


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,5) 	':	print otmp
			If otmp = "setup" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]style


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,5) 	':	print otmp
			If otmp = "style" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]task


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,4) 	':	print otmp
			If otmp = "task" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]ui


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,2) 	':	print otmp
			If otmp = "ui" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]uri


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,3) 	':	print otmp
			If otmp = "uri" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]uti


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,4) 	':	print otmp
			If otmp = "util" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]uui


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,3) 	':	print otmp
			If otmp = "uui" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]wizards


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,7) 	':	print otmp
			If otmp = "wizards" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]xforms


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,6) 	':	print otmp
			If otmp = "xforms" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]xml


Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		for i =0 to UBound(uService)			
		otmp = mid(uService(i),14,3) 	':	print otmp
			If otmp = "xml" then
				oDisp = oDisp & uService(i) & Chr$(10)
			End If
		next i
		msgbox(oDisp,0,"Uno Service")
End Sub

GU-)[General]UNO Service一覧1

Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
	Dim oUno(1500)
	Dim oDummy()
	Dim oArray(0) As new com.sun.star.beans.PropertyValue 
		On Error Goto oBad
		oManager = GetProcessServiceManager()
		uService = oManager.GetAvailableServiceNames()
		sNum = UBound(uService)
		for i = 0 to sNum
			oUno(i) = uService(i)
		next i
		oFile = "c:\temp\oUno.ods"
		oURL = convertToUrl(oFile)
		oDoc=StarDesktop.loadComponentFromUrl(oURL, "_blank", 0, oDummy())
		for i = 0 to sNum
			oDoc.Sheets(0).getCellByPosition(0,i).String= oUno(i)
		next i
			oArray(0).Name = "Overwrite"
			oArray(0).Value = true
		oDoc.StoreAsURL(oURL,oArray())
		oDoc.dispose
	MsgBox("Finish" ,0,"Uno service 一覧")
	Exit Sub
	oBad: 
		mErr = Error
		eline = Erl
		msgbox("Line : " & eline & Chr$(10) & mErr & Chr$(10) &" : i = " & i, 0,"Error Message" )
		oDoc.dispose
End Sub

GU-)[General]UNO Service一覧2

Sub oHowmanyServiceSupported
	Dim oManager
	Dim uService
	Dim oUno(1500)
	Dim oDummy()
	Dim oArray(0) As new com.sun.star.beans.PropertyValue
		On Error Goto oBad
		sName = "c:\temp\oAuthor.ods"
		sURL = ConvertToUrl(sName)
		oDoc = StarDesktop.loadComponentFromURL(sURL, "_blank", 0, oDummy)
		Wait(10)
		'uSurvice = oDoc.GetAvailableServiceNames()
		uService=oDoc.getAvailableServiceNames()
		msgbox(uService(0))
		'sNum = UBound(uService)
		sNum=UBound(uService)
		for i = 0 to sNum
			oUno(i) = uService(i)
		next i
		oFile = "c:\temp\oUno.ods"
		oURL = convertToUrl(oFile)
		oDoc1=StarDesktop.loadComponentFromUrl(oURL, "_blank", 0, oDummy())
		for i = 0 to sNum
			oDoc.Sheets(0).getCellByPosition(1,i).String= oUno(i)
		next i
			oArray(0).Name = "Overwrite"
			oArray(0).Value = true
		oDoc1.StoreAsURL(oURL,oArray())
		oDoc1.dispose
		oDoc.dispose
	MsgBox("Finish" ,0,"Uno service 一覧")
	Exit Sub
	oBad: 
		mErr = Error
		eline = Erl
		msgbox("Line : " & eline & Chr$(10) & mErr & Chr$(10) &" : i = " & i, 0,"Error Message" )
		oDoc.dispose
		oDoc1.dispose
End Sub

GU-)[General]Active FileのUNO Property(属性)取得

Sub oInspect_TextTable
	Dim oDoc
	Dim oIspt
	dim Dummy()
		oDoc = StarDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, Dummy())
		oInspt = oDoc.getTextTables()
			Print IsObject(oInspt)
			Print IsNull(oInspt)
			Print IsEmpty(oInspt)
			Print IsArray(oInspt)
			Print IsUnoStruct(oInspt)
			Print TypeName(oInspt)
		MsgBox oInspt.dbg_methods
		oDoc.dispose
End Sub

GU-)[General]Active FileのUNO情報取得及びActive Objectの確認

Sub oXServiceInfo
	Dim oDoc
	Dim oUnoType As New com.sun.star.beans.PropertyValue
	dim Dummy()
		On Error Goto oErr
		oDoc = StarDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, Dummy())
		vObj = ThisComponent
			'Check UNO Structure?
			Print "Is oUnoType UNO Structure? : " + IsUnoStruct(oUnoType)
			Print "Is ThisComponent UNO Structure? : " + IsUnoStruct(ThisComponent)
			'Check UNO Interface?
			Print "Is oUnoType UNO Interfaces? : " + HasUnoInterfaces(oUnoType, "com.sun.star.uno.XInterface")		
			Print "Is ThisComponent  UNO Interfaces? : " + HasUnoInterfaces(ThisComponent, "com.sun.star.uno.XInterface")
			'Check Active Object?
			Print "Is oUnoType Active Object? : " + EqualUnoObjects(vObj, oUnoType)		
			Print "Is ThisComponent Active Object? : " + EqualUnoObjects(vObj, ThisComponent)		
			'XService Info
			Print "getImplementaionName of THisComponent : " + oDoc.getImplementationName()
			oDocType =  oDoc.SupportsService("com.sun.star.sheet.SpreadsheetDocument") 
			msgbox(oDocType)
			If  oDoc.SupportsService("com.sun.star.sheet.SpreadsheetDocument") then
				oDocType = "Calc"
			ElseIf  oDoc.SupportsService("com.sun.star.drawing.DrawingDocument") then
					oDocType = "Draw"
			ElseIf  oDoc.SupportsService("com.sun.star.presentation.PresentationDocument") then
						oDocType = "Impress"
			ElseIf  oDoc.SupportsService("com.sun.star.formula.FormulaProperties") then
							oDocType = "Math"
			ElseIf  oDoc.SupportsService("com.sun.star.text.TextDocument") then
								oDocType = "Writer"
			End If
		Print oDocType
		oDoc.dispose
		oErr:
			If Err <> 0 then 
				oDocType="Unknown Type Document"
			End If
			On Error Goto 0		'Turn off error handling after checking for a error
End Sub

GU-)[General]Active Fileで使用可能なFunction、Method、Interfaceの取得

Sub odbg
	Dim oDoc
	Dim oIspt
	dim Dummy()
		oDoc = StarDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, Dummy())
		oInspt = oDoc.getTextTables()
		MsgBox oInspt.dbg_properties
		MsgBox oInspt.dbg_methods
		MsgBox oInspt.dbg_supportedInterfaces
	oDoc.dispose
End Sub

GU-)[General]Active fileにて使用可能なStyle及びStyle番号取得

Sub oAvailableStyle
	Dim oDoc
	Dim oSFamily As Variant
	Dim oSNames As Variant
		oDoc =ThisComponent
		oSFamily = oDoc.StyleFamilies
		oFNames = oSFamily.getElementNames()
		for n = LBound(oFNames) to UBound(oFNames)
			s=""
			aStyles = oSFamily.getByName(oFNames(n))
			aSN= aStyles.getElementNames()
			for i = LBound(aSN) to UBound(aSN)
				s = S & i & " : " & aSN(i) & Chr$(13)
				If ((i + 1) mod 35 = 0) then
					Msgbox(s, 0, oFNames(n))
					s=""
				End If
			next i
			If Len(s) > 0 then
				Msgbox(s, 0, oFNames(n))
			End If
		next n
End Sub

	[ Writer ]
		・Charactor
		・Paragraph
		・Page
		・Numbering
		・Frame
	[ Calc ]
		・Cell
		・Page
	[ Draw ]
		・Graphics
		・Cell
		・Table
		・Standard		
	[ Impress ]
		・Graphics
		・Cell
		・Table
		・Standard

GU-)[General]現在OpenしているOOo file(Component)を全て取得(OOo以外は無視)

Sub oCurrentDoc
	On Error Resume Next	'OOo以外のfileは無視する。
	Dim oComp As Object
	Dim oDocume As Object
	Dim oDoc As Object
	Dim oInfo As String
	GlobalScope.BasicLibraries.LoadLibrary("Tools")
		oComp = StarDesktop.getComponents()			'com.sun.star.container.XEnumerationAccess
		If NOT oComp.hasElements() then
			Print "There are no components"
			Exit Sub
		End If
		oEnumerate = oComp.createEnumeration()	'com.sun.star.container.XEnumeration
		Do  while oEnumerate.hasMoreElements()
			aDoc = oEnumerate.nextElement()
			oInfo = oInfo & getDocumentType(aDoc) & "    "
			oInfo = oInfo & FileNameOutOfPath(aDoc.getURL())
			oInfo = oInfo & Chr$(10)
		Loop
		MsgBox(oInfo, 0, "Current Open Components")	
End Sub

GU-)[General]Current Documentにて有効なDialog名、数及びBasic Module名、数の取得

Sub oDocLib
	Dim oLibs
	Dim bLibs
	Dim oDia
	Dim oMod
	Dim oNumDia
	Dim oNumMod
	Dim oDs
	Dim oMs
		oLibs = DialogLibraries.getElementNames()
		oDs = "*** Dialog Libraries ***" & Chr$(10)
		For i = LBound(oLibs) to UBound(oLibs)
			oDia = DialogLibraries.getByName(oLibs(i))
			oNumDia = UBound(oDia.getElementNames())+1
			oDs = oDs & "Libs [" & oLibs(i) & "]  has  " & oNumDia & " dialogs"		
		next i
		bLibs = BasicLibraries.getElementNames()
		oMs = "*** Basic Libraries ***" & Chr$(10)
		For i =  i = LBound(bLibs) to UBound(bLibs)
			oMod = BasicLibraries.getByName(bLibs(i))
			oNumMod = UBound(oMod.getElementNames())+1
			oMs = oMs & "Libs [" & oLibs(i) & "]  has  " & oNumMod & " modules"	
		next i
	Msgbox(oDs & Chr$(10) & oMs, 0, "Dialog and Basic libraries in the current document")
End Sub

GU-)[General]UNO変数の作成

Sub oUnoValue
	Dim oUv1,oUv2,oUv3
		oUv1 = CreateUnoValue("unsigned long", 10)
		oUv2 = CreateUnoValue("string", "Hello. This is UNO Value")
		oUv3 = CreateUnoValue("byte", 10)		'10 ⇒ 0 to 255
		oUv4 = CreateUnoValue("[]byte", Array(3,2,1))
		Print IsEmpty(oUv1) & IsEmpty(oUv2) & IsEmpty(oUv3) & IsEmpty(oUv4)
		Print IsNull(oUv1) & IsNull(oUv2) & IsNull(oUv3) & IsNull(oUv4)
		Print IsMissing(oUv1) & IsMissing(oUv2) & IsMissing(oUv3) & IsMissing(oUv4)
		Print TypeName(oUv1) + TypeName(oUv2) + TypeName(oUv3) + TypeName(oUv4)
		Print IsUnoStruct(oUv1) & IsUnoStruct(oUv2) & IsUnoStruct(oUv3) & IsUnoStruct(oUv4)
		Print IsUnoStruct(oUv1) + IsUnoStruct(oUv2) + IsUnoStruct(oUv3) + IsUnoStruct(oUv4)
End Sub

GU-)[General]Current fileが目的のObjectと同じか調べる

Sub oFindObj
	Dim oDoc
	Dim oTest
		oTest = FindObject("ThisComponent")
		If oTest IS oDoc then
			Msgbox("oDocはCurrent Objectです。")
		else
			Msgbox("oDocはCurrent Objectではありません。")
		End If
	Rem Load the Gimmicks library
	GlobalScope.BasicLibraries.LoadLibrary("Gimmicks")
		oDoc = FindObject("Gimmicks")
		oTest = FindPropertyObject(oDoc, "Userfields")
End Sub


Tips

GTip-1)[General]com.sun.star.PropertyValue

ProprtyValeのName及びValueの形式はCodeを見る必要がある。
OnlinでOpenOffice.orgのCode内を検索する為のTool「 {OpenGrok 」 にて調べる。
URL : {OpenGrok
Uno Commandとそれについての情報Uno関係は「 sdi 」 に記載されています。 [ Sample1 ] Application : Writer 調査対象 : Uno:SendOutlineToStarImpress の場合 1)Full Search欄に「SendOutlineToStarImpress」を入力、「search」click 2)今回はWriterなので、検索結果から「 swriter.sdi 」を選択 3)File中のCodeから「 SendOutlineToStarImpress 」を検索 4)結果から、「()」が空白なので、「com.sun.star.PropertyValue」にて 指定できる項目は無い事が分かる。



Application : Writer
調査対象 : Uno:GoUp の場合
	上記1)~3)は同じ。
	しかし、()内が以下の様に記されている。
		
	(Sfx  Int16 Item  Count  FN_PARAM_MOVE_COUNT,Sfx Bool Item  Select  FN_PARAM_MOVE_SELECTION)
	
	Arg値
	Name  : Count / Valueの型 : Int16
	Name  : Select / Valueの型 :  Boolean
	である事が分かる。
	
その他「browsable and searchable source tree 」から探す事もできる。









Other

GO-)[General]「About LibreOffice」Logo表示


Sub GnOther()
	Dim oDoc as Object, oCtrl as Object, oFrame as Object
    Dim oDispatcher as Object
    Dim oProp(0) as new com.sun.star.beans.PropertyValue
    	oDoc = ThisComponent
		oCtrl = oDoc.getCurrentController()
		oFrame = oCtrl.Frame
		oDispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
    	oDispatcher.executeDispatch(oFrame, ".uno:About", "", 0, oProp())
    	'
    msgbox "Success"
End Sub

GO-)[General]各種宣言

Option Compatible
Global
Private

GO-)[General]File Routines

Sub oFile_Routines	
	oFree=FreeFile()
	'oMkDir = MkDir("c:\temp\OOoMacro") 	'Windows
	'oMkDir = MkDir("/home/OOoMacro") 	'Linux
	'oRmDir = RmDir("c:\temp\OOoMacro")	'Windows
	'oRmDir = RmDir("/home/OOoMacro") 	'Linux
	'Kill("C:\Temp\Maco_test.txt")
	'FileCopy("C:\Temp\OOo_test.txt", "C:\Temp\Macro_test.txt")	'File Copy
	'FileCopy("C:\temp","C:\Test")	'Directory Copy
	'Name "C:\temp\OOo_test.txt" As "C:\Temp\Macro_test.txt"		'Rename a file
	'Name "C:\temp" As "C:\temp_test"	'Rename a directory
	'Name "C:\temp\OOo_test.txt" As "C:\OOo_test.txt"			'Move the file
	'Name "C:\temp" As "C:\OOo_temp"	'Move the directory
	'EOF
	'Get #1
	'Put #1
	'Input #
	'Line Input #
	'Loc()
	'LOF()
	'Reset
	'Seek #
	'Write #
	'FileAttr()
	'[ File Attributes ]
	'1		:	Read-Only 
	'2		:	Hidden
	'4		:	System
	'8		:	Volume
	'16	:	Directory
	'32	:	Archive bit(file changed since last backed up)
End Sub

GO-)[General]Display解像度

Sub oResolutionDisplay
	Dim oDisplayAccess
	Dim oDisplay
	Dim oScreen
		oDisplayAccess = CreateUnoService("com.sun.star.awt.DisplayAccess")
		oDisplay = oDisplayAccess.getByIndex(0)
		oScreen = oDisplay.ScreenArea
			oDx = oScreen.Width
			oDy = oScreen.Height
			msgbox( "Width :" & oDx & "pixcel" & Chr$(10) & "Height :" & oDy & "pixcel", , "画面解像度") 
End Sub

GO-16)[General]IIFの使用法

Sub oIIF
Dim oAge As Variant
	oA_age=20
	oB_age=18
	oComp_age = IIF(oA_age >= oB_age, "A is older than B", "B is older than A")
	msgbox oComp_age
	Wait(3000)	'milliseconds
	msgbox("3秒待ったでしょ?")
End Sub

GO-17)[General]DLL fileの宣言

Declare Sub MyMessageBeep Lib "user32.dll" Alias "MessageBeep" ( Long )
Declare Function CharUpper Lib "user32.dll" Alias "CharUpperA" ( ByVal lpsz As String) As String
Sub oDeclare
Dim nBeepLen As Long
	strIn = "i Have Upper and Lower"
	strOut = CharUpper(strIn)
	Msgbox(strIn & "から" & strOut &"に変換しました。")
	nBeepLen =5000
	MymessageBeep(nBeepLen)
	FreeLibrary("user32.dll")
	MsgBox("音が鳴ったでしょ?")
End Sub

GO-)マウスのボタン判定(左/右 & Shift/Ctrl/Alt)
【AddinBox/VBAユーザーの為のOpenOffice.org 備忘録より抜粋】
引用元URL:
http://blog.livedoor.jp/addinbox/archives/51271806.html

Sub MouseListener_mouseReleased( oEvent As com.sun.star.awt.MouseEvent )
Dim blnShift As Boolean
Dim blnCtrl As Boolean
Dim blnAlt As Boolean
Dim strMsg As String

  With oEvent
    Select Case .Buttons
      Case com.sun.star.awt.MouseButton.LEFT
        strMsg = "Left Button" & chr(13)
      Case com.sun.star.awt.MouseButton.RIGHT
        strMsg = "Right Button" & chr(13)
    End Select

    blnShift = ((.Modifiers And com.sun.star.awt.KeyModifier.SHIFT)= com.sun.star.awt.KeyModifier.SHIFT)
    blnCtrl = ((.Modifiers And com.sun.star.awt.KeyModifier.MOD1)= com.sun.star.awt.KeyModifier.MOD1)
    blnAlt  = ((.Modifiers And com.sun.star.awt.KeyModifier.MOD2)= com.sun.star.awt.KeyModifier.MOD2)

    strMsg = strMsg & "Shift(" & CStr(blnShift) & ")" & chr(13) & _
                      "Ctrl(" & CStr(blnCtrl) & ")" & chr(13) & _
                      "Alt (" & CStr(blnAlt) & ")"
    MsgBox strMsg
  End With 
End Sub
'~~~~~~~~~~~~~~~~~~~~~~
'blnShift = ((.Modifiers And com.sun.star.awt.KeyModifier.SHIFT)= com.sun.star.awt.KeyModifier.SHIFT)
'                    ↓下記でもOKです
'blnShift = CBool(.Modifiers And com.sun.star.awt.KeyModifier.SHIFT)

'[ .Buttons ] [ .Modifires ] は以下のイベントリスナーのどれも共通です。
'== Dialog Control ==
'com.sun.star.awt.XMouseListener
'com.sun.star.awt.XMouseMotionListener
'== Sheet ==
'com.sun.star.awt.XMouseClickHandler
'com.sun.star.awt.XEnhancedMouseClickHandler
'== Key Board ==
'com.sun.star.awt.XKeyListener
'(注意点)
  'XEnhancedMouseClickHandler には、Modifiers の値が常にゼロで返るというバグのあることが判りました。
  つまり、XEnhancedMouseClickHandlerでは Shift/Ctrl/Alt の識別が不可能です。 ( Issue 91439 )
  '
  'XMouseClickHandler では、oEvent.Source からクリックしたオブジェクトを取得する事ができません
  (Source インターフェースはありますが、オブジェクトが設定されません)。
  したがって、クリックセルを取得するには Selectionを利用するしか方法がありませんが、pressed 時点では
  未だクリックセルにSelection が移動していません(クリック前の選択セルのまま)。
   releasedで処理するようにしなければなりません。
   尚、[左+Alt] [右+Shift/Ctrl/Alt]ではセルが選択されませんので『 Selection でクリックセルを取得』という
   方法が取れません。
  '
  'XEnhancedMouseClickHandler では oEvent.Target でクリックしたセルが取得できます
  ( pressed/released 共にクリック前の選択セルではなくクリックしたセルが取得できます)。


Top of Page

inserted by FC2 system