本文整理汇总了Python中uno.createUnoStruct函数的典型用法代码示例。如果您正苦于以下问题:Python createUnoStruct函数的具体用法?Python createUnoStruct怎么用?Python createUnoStruct使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createUnoStruct函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: createNewDocument
def createNewDocument(self, frame, sDocumentType, preview, readonly):
loadValues = list(range(2))
loadValues[0] = uno.createUnoStruct(
'com.sun.star.beans.PropertyValue')
loadValues[0].Name = "ReadOnly"
if readonly:
loadValues[0].Value = True
else:
loadValues[0].Value = False
loadValues[1] = uno.createUnoStruct(
'com.sun.star.beans.PropertyValue')
loadValues[1].Name = "Preview"
if preview:
loadValues[1].Value = True
else:
loadValues[1].Value = False
sURL = "private:factory/" + sDocumentType
xComponent = None
try:
xComponent = frame.loadComponentFromURL(
sURL, "_self", 0, tuple(loadValues))
except Exception:
traceback.print_exc()
return xComponent
开发者ID:RaghavBhardwaj,项目名称:eisenvault_updated_source,代码行数:27,代码来源:OfficeDocument.py
示例2: store
def store(self, xMSF, xComponent, StorePath, FilterName):
try:
if len(FilterName):
oStoreProperties = list(range(2))
oStoreProperties[0] = uno.createUnoStruct(
'com.sun.star.beans.PropertyValue')
oStoreProperties[0].Name = "FilterName"
oStoreProperties[0].Value = FilterName
oStoreProperties[1] = uno.createUnoStruct(
'com.sun.star.beans.PropertyValue')
oStoreProperties[1].Name = "InteractionHandler"
oStoreProperties[1].Value = xMSF.createInstance(
"com.sun.star.comp.uui.UUIInteractionHandler")
else:
oStoreProperties = list(range(0))
StorePath = systemPathToFileUrl(StorePath)
sPath = StorePath[:(StorePath.rfind("/") + 1)]
sFile = StorePath[(StorePath.rfind("/") + 1):]
xComponent.storeToURL(
absolutize(sPath, sFile), tuple(oStoreProperties))
return True
except ErrorCodeIOException:
#Throw this exception when trying to save a file
#which is already opened in Libreoffice
#TODO: handle it properly
return True
pass
except Exception:
traceback.print_exc()
return False
开发者ID:rohanKanojia,项目名称:core,代码行数:31,代码来源:OfficeDocument.py
示例3: conditional_format
def conditional_format():
ctx = XSCRIPTCONTEXT.getComponentContext()
serviceManager = ctx.ServiceManager
desktop = XSCRIPTCONTEXT.getDesktop()
doc = desktop.getCurrentComponent()
sheets = doc.getSheets() #XSpreadSheets
sheet = sheets.getByIndex(0)
### Aquí empieza el ejercicio de traducción del ejemplo de formateado condicional
xCellRange = sheet.getCellRangeByName("A1:B10");
xEntries = xCellRange.getPropertyValue("ConditionalFormat");
cond1 = uno.createUnoStruct("com.sun.star.beans.PropertyValue")
cond2 = uno.createUnoStruct("com.sun.star.beans.PropertyValue")
cond3 = uno.createUnoStruct("com.sun.star.beans.PropertyValue")
cond1.Name = "Operator";
cond1.Value = uno.getConstantByName("com.sun.star.sheet.ConditionOperator.GREATER")
cond2.Name = "Formula"
cond2.Value = "1"
cond3.Name = "StyleName"
cond3.Value = "Heading"
xEntries.addNew((cond1, cond2, cond3))
xCellRange.setPropertyValue("ConditionalFormat", xEntries);
开发者ID:luisperlaz,项目名称:curso_python_ayto_2013,代码行数:25,代码来源:conditional_format.py
示例4: loadAsPreview
def loadAsPreview(self, sDefaultTemplate, asTemplate):
loadValues = list(range(3))
# open document in the Preview mode
loadValues[0] = uno.createUnoStruct(
'com.sun.star.beans.PropertyValue')
loadValues[0].Name = "ReadOnly"
loadValues[0].Value = True
loadValues[1] = uno.createUnoStruct(
'com.sun.star.beans.PropertyValue')
loadValues[1].Name = "AsTemplate"
if asTemplate:
loadValues[1].Value = True
else:
loadValues[1].Value = False
loadValues[2] = uno.createUnoStruct(
'com.sun.star.beans.PropertyValue')
loadValues[2].Name = "Preview"
loadValues[2].Value = True
self.xTextDocument = OfficeDocument.load(
self.xFrame, sDefaultTemplate, "_self", loadValues)
self.DocSize = self.getPageSize()
try:
self.xTextDocument.CurrentController.ViewSettings.ZoomType = ENTIRE_PAGE
except Exception:
traceback.print_exc()
myFieldHandler = TextFieldHandler(self.xMSF, self.xTextDocument)
myFieldHandler.updateDocInfoFields()
return self.xTextDocument
开发者ID:CaoMomo,项目名称:core,代码行数:32,代码来源:TextDocument.py
示例5: test_createUnoStruct
def test_createUnoStruct(self):
from com.sun.star.awt import Rectangle
rect1 = uno.createUnoStruct("com.sun.star.awt.Rectangle")
self.assertTrue(isinstance(rect1, Rectangle))
rect2 = uno.createUnoStruct("com.sun.star.awt.Rectangle", 100, 200, 50, 1)
self.assertEqual(rect2.X, 100)
rect3 = uno.createUnoStruct("com.sun.star.awt.Rectangle", rect2)
开发者ID:hanya,项目名称:pyuno3,代码行数:7,代码来源:test.py
示例6: setUp
def setUp(self):
# the testcomponent from the testtools project
self.tobj = self.ctx.ServiceManager.createInstanceWithContext(
'com.sun.star.test.bridge.CppTestObject' , self.ctx )
self.tobj.Bool = 1
self.tobj.Char = 'h'
self.tobj.Byte = 43
self.tobj.Short = -42
self.tobj.UShort = 44
self.tobj.Long = 42
self.tobj.ULong = 41
self.tobj.Hyper = 46
self.tobj.UHyper = 47
self.tobj.Float = 4.3
self.tobj.Double = 4.2
self.tobj.Enum = 4
self.tobj.String = "yabadabadoo"
self.tobj.Interface = self.ctx
self.tobj.Any = self.tobj.String
mystruct = uno.createUnoStruct( "test.testtools.bridgetest.TestData" )
assign( mystruct, 1, 'h', 43, -42,44,42,41,46,47,4.3,4.2,4,"yabadabadoo",self.ctx,"yabadabadoo")
self.tobj.Struct = mystruct
self.testElement = uno.createUnoStruct( "test.testtools.bridgetest.TestElement" )
self.testElement.String = "foo"
self.testElement2 = uno.createUnoStruct( "test.testtools.bridgetest.TestElement" )
self.testElement2.String = "42"
self.tobj.Sequence = (self.testElement,self.testElement2)
开发者ID:Flatta,项目名称:LibreOffice-core,代码行数:29,代码来源:core.py
示例7: createListBox
def createListBox(ctx,width,height,x,y):
smgr = ctx.ServiceManager
Rectangle=uno.createUnoStruct("com.sun.star.awt.Rectangle")
Rectangle.Width =width
Rectangle.Height=height
Rectangle.X=x
Rectangle.Y=y
WindowDescriptor = uno.createUnoStruct("com.sun.star.awt.WindowDescriptor")
WindowClass = uno.Enum("com.sun.star.awt.WindowClass","MODALTOP")
VclWindowPeerAttribute = uno.getConstantByName("com.sun.star.awt.VclWindowPeerAttribute.OK")
开发者ID:tmtlakmal,项目名称:EasyTuteLO,代码行数:10,代码来源:DialogBox.py
示例8: testStruct
def testStruct( self ):
mystruct = uno.createUnoStruct( "test.testtools.bridgetest.TestData" )
assign( mystruct, 1, 'h', 43, -42,44,42,41,46,47,4.3,4.2,4,"yabadabadoo",self.ctx,"yabadabadoo")
self.tobj.Struct = mystruct
aSecondStruct = self.tobj.Struct
self.failUnless( self.tobj.Struct == mystruct, "struct roundtrip for equality test" )
self.failUnless( aSecondStruct == mystruct, "struct roundtrip for equality test2" )
aSecondStruct.Short = 720
self.failUnless( not aSecondStruct == mystruct , "different structs equality test" )
self.failUnless( not self.ctx == mystruct , "object is not equal to struct test" )
self.failUnless( mystruct == self.tobj.transportAny( mystruct ), "struct roundtrip with any test" )
my2ndstruct = uno.createUnoStruct( "test.testtools.bridgetest.TestData", \
1, 'h', 43, -42,44,42,41,46,47,4.3,4.2,4,"yabadabadoo",self.ctx,"yabadabadoo",())
self.failUnless( my2ndstruct == mystruct, "struct non-default ctor test" )
开发者ID:Flatta,项目名称:LibreOffice-core,代码行数:15,代码来源:core.py
示例9: createRectangle
def createRectangle(self,height,width,xPos,yPos):
Rectangle =uno.createUnoStruct("com.sun.star.awt.Rectangle")
Rectangle.Width =width
Rectangle.Height=height
Rectangle.X=xPos
Rectangle.Y=yPos
return Rectangle
开发者ID:tmtlakmal,项目名称:EasyTuteLO,代码行数:7,代码来源:FormulaListDialog.py
示例10: getDoubleOf
def getDoubleOf(data):
'''Simple demo-function duplicating plain cell values 1->2, "A"->"AA"
Thanks to the c.s.s.script.ArrayWrapper it works in array context as well. To be called through a
StarBasic wrapper.'''
# cheap msgbox in scripting context:
# raise Exception(repr(data))
if hasattr(data[0], '__iter__'):
# two lists:
rows = []
wrapper = uno.createUnoStruct('com.sun.star.script.ArrayWrapper')
# =A1:B2 passes a one-based array to a Basic function. Let's assume the same here:
# (Apparently it makes no difference if IsZeroIndex or not)
wrapper.IsZeroIndex = False
for row in data:
column = []
for val in row:
try:
column.append(val * 2)
except:
column.append(None)
rows.append(tuple(column))
# returning the mere list of list fails:
# return tuple(rows)
# here comes the wrapper into play:
wrapper.Array = tuple(rows)
return wrapper
elif hasattr(data, '__abs__'):
return data *2
else:
return None
开发者ID:UBunt14,项目名称:mpFormulaPy,代码行数:31,代码来源:sheetFunction.py
示例11: doProofreading
def doProofreading(self, nDocId, rText, rLocale, nStartOfSentencePos, \
nSuggestedSentenceEndPos, rProperties):
aRes = uno.createUnoStruct( "com.sun.star.linguistic2.ProofreadingResult" )
aRes.aDocumentIdentifier = nDocId
aRes.aText = rText
aRes.aLocale = rLocale
aRes.nStartOfSentencePosition = nStartOfSentencePos
aRes.nStartOfNextSentencePosition = nSuggestedSentenceEndPos
l = rText[nSuggestedSentenceEndPos:nSuggestedSentenceEndPos+1]
while l == " ":
aRes.nStartOfNextSentencePosition = aRes.nStartOfNextSentencePosition + 1
l = rText[aRes.nStartOfNextSentencePosition:aRes.nStartOfNextSentencePosition+1]
if aRes.nStartOfNextSentencePosition == nSuggestedSentenceEndPos and l!="":
aRes.nStartOfNextSentencePosition = nSuggestedSentenceEndPos + 1
aRes.nBehindEndOfSentencePosition = aRes.nStartOfNextSentencePosition
try:
aRes.aErrors = proofread( nDocId, rText, rLocale, \
nStartOfSentencePos, aRes.nBehindEndOfSentencePosition, rProperties)
except:
traceback.print_exc(file=sys.stdout)
aRes.aErrors = ()
aRes.aProperties = ()
aRes.xProofreader = self
return aRes
开发者ID:arnotixe,项目名称:lp-nor,代码行数:25,代码来源:Lightproof.py
示例12: proofread
def proofread( nDocId, TEXT, LOCALE, nStartOfSentencePos, nSuggestedSentenceEndPos, rProperties ):
global ignore
aErrs = []
s = TEXT[nStartOfSentencePos:nSuggestedSentenceEndPos]
for i in get_rule(LOCALE):
if i[0] and not str(i[0]) in ignore:
for m in i[0].finditer(s):
if not i[3] or eval(i[3]):
aErr = uno.createUnoStruct( "com.sun.star.linguistic2.SingleProofreadingError" )
aErr.nErrorStart = nStartOfSentencePos + m.start(0) # nStartOfSentencePos
aErr.nErrorLength = m.end(0) - m.start(0)
aErr.nErrorType = PROOFREADING
aErr.aRuleIdentifier = str(i[0])
iscap = (i[4] and m.group(0)[0:1].isupper())
if i[1][0:1] == "=":
aErr.aSuggestions = tuple(cap(eval(i[1][1:]).split("\n"), iscap, LOCALE))
else:
aErr.aSuggestions = tuple(cap(m.expand(i[1]).split("\n"), iscap, LOCALE))
comment = i[2]
if comment[0:1] == "=":
comment = eval(comment[1:])
aErr.aShortComment = comment.split("\n")[0]
aErr.aFullComment = comment.split("\n")[-1]
aErr.aProperties = ()
aErrs = aErrs + [aErr]
return tuple(aErrs)
开发者ID:arnotixe,项目名称:lp-nor,代码行数:26,代码来源:Lightproof.py
示例13: createRectangle
def createRectangle(self,height,width,xPos,yPos): #create a rectangle according to the parameters
Rectangle =uno.createUnoStruct("com.sun.star.awt.Rectangle")
Rectangle.Width =width
Rectangle.Height=height
Rectangle.X=xPos
Rectangle.Y=yPos
return Rectangle
开发者ID:tmtlakmal,项目名称:EasyTuteLO,代码行数:7,代码来源:FormulaListDialog.py
示例14: add
def add(self, name, value, sheet, column, row, type=0):
"""
Not implemented yet. FIXME
Adds a new field (named range) to the collection.
@type name: string
@param name: the new name of the named range.
@type value: string
@param value: the formula expression.
@type sheet: int
@param sheet: the formula expression.
@type column: int
@param column: the formula expression.
@type row: int
@param row: the formula expression.
@type type: int
@param type: a combination of flags that specify the type of a named \
range, as defined in NamedRangeFlag. This parameter \
will be zero for any common named range.
@rtype: bool
@return: Operation result
"""
cell_address = uno.createUnoStruct("com.sun.star.table.CellAddress")
cell_address.Sheet = sheet
cell_address.Column = column
cell_address.Row = row
if self._oNamedRanges:
self._oNamedRanges.addNewByName(name, value, cell_address, 0)
return None
开发者ID:ASP96,项目名称:pyloo,代码行数:35,代码来源:pyloo.py
示例15: _getPropertyValue
def _getPropertyValue(self, nodepath):
args = []
arg = uno.createUnoStruct("com.sun.star.beans.PropertyValue")
arg.Name = "nodepath"
arg.Value = nodepath
args.append(arg)
return tuple(args)
开发者ID:prrvchr,项目名称:gMailOOo,代码行数:7,代码来源:mailmerge.py
示例16: createWindow
def createWindow(ctx,parentWin,height,width,positionX,positionY,serviceName):
smgr = ctx.ServiceManager
Rectangle =uno.createUnoStruct("com.sun.star.awt.Rectangle")
Rectangle.Width =width
Rectangle.Height=height
Rectangle.X=positionX
Rectangle.Y=positionY
WindowDescriptor = uno.createUnoStruct("com.sun.star.awt.WindowDescriptor")
WindowClass = uno.Enum("com.sun.star.awt.WindowClass","MODALTOP")
aDescriptor = WindowDescriptor
aDescriptor.Type = WindowClass
aDescriptor.WindowServiceName = serviceName
aDescriptor.ParentIndex = -1
aDescriptor.Parent = parentWin
aDescriptor.Bounds = Rectangle
tk = aDescriptor.Parent.getToolkit()
return tk.createWindow(aDescriptor)
开发者ID:tmtlakmal,项目名称:EasyTuteLO,代码行数:17,代码来源:DialogBox.py
示例17: createProps
def createProps(**args):
props = []
for key in args:
prop = uno.createUnoStruct('com.sun.star.beans.PropertyValue')
prop.Name = key
prop.Value = args[key]
props.append(prop)
return tuple(props)
开发者ID:greg42,项目名称:openOfficeMarkup,代码行数:8,代码来源:OOoBackend.py
示例18: attachEventCall
def attachEventCall(self, xComponent, EventName, EventType, EventURL):
try:
oEventProperties = list(range(2))
oEventProperties[0] = uno.createUnoStruct(
'com.sun.star.beans.PropertyValue')
oEventProperties[0].Name = "EventType"
oEventProperties[0].Value = EventType
# "Service", "StarBasic"
oEventProperties[1] = uno.createUnoStruct(
'com.sun.star.beans.PropertyValue')
oEventProperties[1].Name = "Script" #"URL";
oEventProperties[1].Value = EventURL
uno.invoke(xComponent.Events, "replaceByName",
(EventName, uno.Any("[]com.sun.star.beans.PropertyValue",
tuple(oEventProperties))))
except Exception:
traceback.print_exc()
开发者ID:rohanKanojia,项目名称:core,代码行数:17,代码来源:OfficeDocument.py
示例19: create_struct
def create_struct(self, type_name, *args, **kwds):
_args, _any = self.extract_args(args)
struct = uno.createUnoStruct(type_name, *_args)
if "nocode" in kwds: return struct
entry = self.engine.create(self, type_name, struct)
entry.code_entry = self.code(
type=CGType.STRUCT, key=type_name, value_type=entry.type, idl=entry.type, args=args)
return entry
开发者ID:kikili,项目名称:MRI,代码行数:8,代码来源:__init__.py
示例20: testInvoke
def testInvoke( self ):
self.failUnless( 5 == uno.invoke( self.tobj , "transportAny" , (uno.Any("byte", 5),) ) )
self.failUnless( 5 == uno.invoke(
PythonTransporter(), "transportAny" , (uno.Any( "byte", 5 ),) ) )
t = uno.getTypeByName( "long" )
mystruct = uno.createUnoStruct(
"com.sun.star.beans.PropertyValue", "foo",0,uno.Any(t,2),0 )
mystruct.Value = uno.Any(t, 1)
开发者ID:Flatta,项目名称:LibreOffice-core,代码行数:8,代码来源:core.py
注:本文中的uno.createUnoStruct函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论