summaryrefslogtreecommitdiff
path: root/pyuno/demo
diff options
context:
space:
mode:
authorAndreas Becker <atayoohoo@googlemail.com>2011-05-07 20:35:03 +0100
committerMichael Meeks <michael.meeks@novell.com>2011-05-07 20:35:03 +0100
commita09ce46818fd4d5e08b3af9a478501cd8ef5b4fe (patch)
tree187c9164d436201442794dee227627e2b9173124 /pyuno/demo
parent7cf799064f5d64bca62626dc73723c2c5e95ca00 (diff)
Port PyUno to support Python 3
Diffstat (limited to 'pyuno/demo')
-rw-r--r--pyuno/demo/biblioaccess.py25
-rw-r--r--pyuno/demo/hello_world_comp.py39
-rw-r--r--pyuno/demo/makefile.mk34
-rw-r--r--pyuno/demo/ooextract.py81
-rw-r--r--pyuno/demo/pyunoenv.tcsh8
-rw-r--r--pyuno/demo/swriter.py25
-rw-r--r--pyuno/demo/swritercomp.py132
-rw-r--r--pyuno/demo/swritercompclient.py6
8 files changed, 182 insertions, 168 deletions
diff --git a/pyuno/demo/biblioaccess.py b/pyuno/demo/biblioaccess.py
index ac9cf64044ad..59d843ad6c01 100644
--- a/pyuno/demo/biblioaccess.py
+++ b/pyuno/demo/biblioaccess.py
@@ -1,35 +1,36 @@
-import uno
+# -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+import uno
from com.sun.star.sdb.CommandType import COMMAND
def main():
-
connectionString = "socket,host=localhost,port=2002"
-
- url = "uno:"+connectionString + ";urp;StarOffice.ComponentContext"
-
+
+ url = "uno:" + connectionString + ";urp;StarOffice.ComponentContext"
+
localCtx = uno.getComponentContext()
localSmgr = localCtx.ServiceManager
resolver = localSmgr.createInstanceWithContext(
"com.sun.star.bridge.UnoUrlResolver", localCtx)
- ctx = resolver.resolve( url )
+ ctx = resolver.resolve(url)
smgr = ctx.ServiceManager
- rowset =smgr.createInstanceWithContext( "com.sun.star.sdb.RowSet", ctx )
+ rowset =smgr.createInstanceWithContext("com.sun.star.sdb.RowSet", ctx)
rowset.DataSourceName = "Bibliography"
rowset.CommandType = COMMAND
rowset.Command = "SELECT IDENTIFIER, AUTHOR FROM biblio"
rowset.execute();
- print "Identifier\tAuthor"
+ print("Identifier\tAuthor")
- id = rowset.findColumn( "IDENTIFIER" )
- author = rowset.findColumn( "AUTHOR" )
+ id = rowset.findColumn("IDENTIFIER")
+ author = rowset.findColumn("AUTHOR")
while rowset.next():
- print rowset.getString( id ) + "\t" + repr( rowset.getString( author ) )
-
+ print(rowset.getString(id) + "\t" + repr(rowset.getString(author)))
rowset.dispose();
main()
+
+# vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/pyuno/demo/hello_world_comp.py b/pyuno/demo/hello_world_comp.py
index a9bc488853ec..32f40562856d 100644
--- a/pyuno/demo/hello_world_comp.py
+++ b/pyuno/demo/hello_world_comp.py
@@ -1,3 +1,5 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+
import uno
import unohelper
@@ -5,36 +7,37 @@ from com.sun.star.task import XJobExecutor
# implement a UNO component by deriving from the standard unohelper.Base class
# and from the interface(s) you want to implement.
-class HelloWorldJob( unohelper.Base, XJobExecutor ):
- def __init__( self, ctx ):
+class HelloWorldJob(unohelper.Base, XJobExecutor):
+ def __init__(self, ctx):
# store the component context for later use
self.ctx = ctx
-
- def trigger( self, args ):
+
+ def trigger(self, args):
# note: args[0] == "HelloWorld", see below config settings
-
+
# retrieve the desktop object
desktop = self.ctx.ServiceManager.createInstanceWithContext(
- "com.sun.star.frame.Desktop", self.ctx )
-
+ "com.sun.star.frame.Desktop", self.ctx)
+
# get current document model
model = desktop.getCurrentComponent()
- # access the document's text property
- text = model.Text
+ # access the document's text property
+ text = model.Text
- # create a cursor
- cursor = text.createTextCursor()
+ # create a cursor
+ cursor = text.createTextCursor()
- # insert the text into the document
- text.insertString( cursor, "Hello World", 0 )
+ # insert the text into the document
+ text.insertString(cursor, "Hello World", 0)
# pythonloader looks for a static g_ImplementationHelper variable
g_ImplementationHelper = unohelper.ImplementationHelper()
-#
g_ImplementationHelper.addImplementation( \
- HelloWorldJob, # UNO object class
- "org.openoffice.comp.pyuno.demo.HelloWorld", # implemenation name
- ("com.sun.star.task.Job",),) # list of implemented services
- # (the only service)
+ HelloWorldJob, # UNO object class
+ "org.openoffice.comp.pyuno.demo.HelloWorld", # implemenation name
+ ("com.sun.star.task.Job",),) # list of implemented services
+ # (the only service)
+
+# vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/pyuno/demo/makefile.mk b/pyuno/demo/makefile.mk
index 7911048f8b0e..e369c8c06905 100644
--- a/pyuno/demo/makefile.mk
+++ b/pyuno/demo/makefile.mk
@@ -6,27 +6,25 @@ PRJ=..
ROOT=$(MISC)$/pyuno-doc
-
FILES=\
- $(ROOT)$/python-bridge.html \
- $(ROOT)$/customized_setup.png \
- $(ROOT)$/mode_component.png \
- $(ROOT)$/mode_ipc.png \
- $(ROOT)$/modes.sxd \
- $(ROOT)$/optional_components.png \
- $(ROOT)$/samples$/swriter.py \
- $(ROOT)$/samples$/swritercomp.py \
- $(ROOT)$/samples$/ooextract.py \
- $(ROOT)$/samples$/biblioaccess.py \
- $(ROOT)$/samples$/swritercompclient.py \
- $(ROOT)$/samples$/hello_world_pyuno.zip
-
-
-
-$(MISC)$/pyuno-doc.zip : dirs $(FILES)
+ $(ROOT)$/python-bridge.html \
+ $(ROOT)$/customized_setup.png \
+ $(ROOT)$/mode_component.png \
+ $(ROOT)$/mode_ipc.png \
+ $(ROOT)$/modes.sxd \
+ $(ROOT)$/optional_components.png \
+ $(ROOT)$/samples$/swriter.py \
+ $(ROOT)$/samples$/swritercomp.py \
+ $(ROOT)$/samples$/ooextract.py \
+ $(ROOT)$/samples$/biblioaccess.py \
+ $(ROOT)$/samples$/swritercompclient.py \
+ $(ROOT)$/samples$/hello_world_pyuno.zip
+
+
+$(MISC)$/pyuno-doc.zip : dirs $(FILES)
-rm -f $@
cd $(MISC) && zip -r pyuno-doc.zip pyuno-doc
-dirs .PHONY :
+dirs .PHONY :
-mkdir $(ROOT)
-mkdir $(ROOT)$/samples
diff --git a/pyuno/demo/ooextract.py b/pyuno/demo/ooextract.py
index 057fa04964eb..74e072feef5d 100644
--- a/pyuno/demo/ooextract.py
+++ b/pyuno/demo/ooextract.py
@@ -1,3 +1,5 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+
import getopt,sys
import uno
from unohelper import Base,systemPathToFileUrl, absolutize
@@ -8,26 +10,25 @@ from com.sun.star.beans.PropertyState import DIRECT_VALUE
from com.sun.star.uno import Exception as UnoException
from com.sun.star.io import IOException,XInputStream, XOutputStream
-class OutputStream( Base, XOutputStream ):
- def __init__( self ):
- self.closed = 0
-
- def closeOutput(self):
- self.closed = 1
+class OutputStream(Base, XOutputStream):
+ def __init__(self):
+ self.closed = 0
+
+ def closeOutput(self):
+ self.closed = 1
- def writeBytes( self, seq ):
- sys.stdout.write( seq.value )
+ def writeBytes(self, seq):
+ sys.stdout.write(seq.value)
- def flush( self ):
- pass
-
+ def flush(self):
+ pass
def main():
retVal = 0
doc = None
try:
- opts, args = getopt.getopt(sys.argv[1:], "hc:",["help", "connection-string=" , "html"])
+ opts, args = getopt.getopt(sys.argv[1:], "hc:", ["help", "connection-string=", "html"])
format = None
url = "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext"
filterName = "Text (Encoded)"
@@ -35,61 +36,61 @@ def main():
if o in ("-h", "--help"):
usage()
sys.exit()
- if o in ("-c", "--connection-string" ):
+ if o in ("-c", "--connection-string"):
url = "uno:" + a + ";urp;StarOffice.ComponentContext"
if o == "--html":
filterName = "HTML (StarWriter)"
-
- print filterName
- if not len( args ):
+
+ print(filterName)
+ if not len(args):
usage()
sys.exit()
-
+
ctxLocal = uno.getComponentContext()
smgrLocal = ctxLocal.ServiceManager
resolver = smgrLocal.createInstanceWithContext(
- "com.sun.star.bridge.UnoUrlResolver", ctxLocal )
- ctx = resolver.resolve( url )
+ "com.sun.star.bridge.UnoUrlResolver", ctxLocal)
+ ctx = resolver.resolve(url)
smgr = ctx.ServiceManager
- desktop = smgr.createInstanceWithContext("com.sun.star.frame.Desktop", ctx )
+ desktop = smgr.createInstanceWithContext("com.sun.star.frame.Desktop", ctx)
- cwd = systemPathToFileUrl( getcwd() )
+ cwd = systemPathToFileUrl(getcwd())
outProps = (
- PropertyValue( "FilterName" , 0, filterName , 0 ),
- PropertyValue( "OutputStream",0, OutputStream(),0))
- inProps = PropertyValue( "Hidden" , 0 , True, 0 ),
+ PropertyValue("FilterName" , 0, filterName, 0),
+ PropertyValue("OutputStream", 0, OutputStream(), 0))
+ inProps = PropertyValue("Hidden", 0 , True, 0),
for path in args:
try:
- fileUrl = uno.absolutize( cwd, systemPathToFileUrl(path) )
- doc = desktop.loadComponentFromURL( fileUrl , "_blank", 0,inProps)
+ fileUrl = uno.absolutize(cwd, systemPathToFileUrl(path))
+ doc = desktop.loadComponentFromURL(fileUrl , "_blank", 0, inProps)
if not doc:
- raise UnoException( "Couldn't open stream for unknown reason", None )
+ raise UnoException("Could not open stream for unknown reason", None)
- doc.storeToURL("private:stream",outProps)
- except IOException, e:
- sys.stderr.write( "Error during conversion: " + e.Message + "\n" )
+ doc.storeToURL("private:stream", outProps)
+ except IOException as e:
+ sys.stderr.write("Error during conversion: " + e.Message + "\n")
retVal = 1
- except UnoException, e:
- sys.stderr.write( "Error ("+repr(e.__class__)+") during conversion:" + e.Message + "\n" )
+ except UnoException as e:
+ sys.stderr.write("Error (" + repr(e.__class__) + ") during conversion: " + e.Message + "\n")
retVal = 1
if doc:
doc.dispose()
- except UnoException, e:
- sys.stderr.write( "Error ("+repr(e.__class__)+") :" + e.Message + "\n" )
+ except UnoException as e:
+ sys.stderr.write("Error (" + repr(e.__class__) + "): " + e.Message + "\n")
retVal = 1
- except getopt.GetoptError,e:
- sys.stderr.write( str(e) + "\n" )
+ except getopt.GetoptError as e:
+ sys.stderr.write(str(e) + "\n")
usage()
retVal = 1
sys.exit(retVal)
-
+
def usage():
- sys.stderr.write( "usage: ooextract.py --help |\n"+
+ sys.stderr.write("usage: ooextract.py --help |\n"+
" [-c <connection-string> | --connection-string=<connection-string>\n"+
" file1 file2 ...\n"+
"\n" +
@@ -106,4 +107,6 @@ def usage():
" Instead of the text filter, the writer html filter is used\n"
)
-main()
+main()
+
+# vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/pyuno/demo/pyunoenv.tcsh b/pyuno/demo/pyunoenv.tcsh
index 038cf2ddb45b..dbe69d0ec66c 100644
--- a/pyuno/demo/pyunoenv.tcsh
+++ b/pyuno/demo/pyunoenv.tcsh
@@ -18,13 +18,15 @@ setenv LD_LIBRARY_PATH
endif
if( "$PYTHONPATH" != "" ) then
- setenv PYTHONPATH $OOOHOME/program:$OOOHOME/program/pydemo:$OOOHOME/program/python/lib:$PYTHONPATH
+ setenv PYTHONPATH $OOOHOME/program:$OOOHOME/program/pydemo:$OOOHOME/program/python/lib:$PYTHONPATH
else
- setenv PYTHONPATH $OOOHOME/program:$OOOHOME/program/pydemo:$OOOHOME/program/python/lib
+ setenv PYTHONPATH $OOOHOME/program:$OOOHOME/program/pydemo:$OOOHOME/program/python/lib
endif
-
+
setenv LD_LIBRARY_PATH $OOOHOME/program:$LD_LIBRARY_PATH
if( $?PYTHONHOME ) then
setenv PATH $PYTHONHOME/bin:$PATH
endif
+
+# vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/pyuno/demo/swriter.py b/pyuno/demo/swriter.py
index 05ab332fd382..3fafcd603da6 100644
--- a/pyuno/demo/swriter.py
+++ b/pyuno/demo/swriter.py
@@ -1,8 +1,10 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
-# bootstrap uno component context
+# bootstrap uno component context
import uno
import unohelper
+from com.sun.star.lang import IllegalArgumentException
# a UNO struct later needed to create a document
from com.sun.star.text.ControlCharacter import PARAGRAPH_BREAK
@@ -17,9 +19,9 @@ def insertTextIntoCell( table, cellName, text, color ):
tableText.setString( text )
localContext = uno.getComponentContext()
-
+
resolver = localContext.ServiceManager.createInstanceWithContext(
- "com.sun.star.bridge.UnoUrlResolver", localContext )
+ "com.sun.star.bridge.UnoUrlResolver", localContext )
smgr = resolver.resolve( "uno:socket,host=localhost,port=2002;urp;StarOffice.ServiceManager" )
remoteContext = smgr.getPropertyValue( "DefaultContext" )
@@ -41,15 +43,15 @@ text.insertString( cursor, "Now we are in the second line\n" , 0 )
table = doc.createInstance( "com.sun.star.text.TextTable" )
# with 4 rows and 4 columns
-table.initialize( 4,4)
+table.initialize(4, 4)
text.insertTextContent( cursor, table, 0 )
rows = table.Rows
-table.setPropertyValue( "BackTransparent", uno.Bool(0) )
+table.setPropertyValue( "BackTransparent", False )
table.setPropertyValue( "BackColor", 13421823 )
row = rows.getByIndex(0)
-row.setPropertyValue( "BackTransparent", uno.Bool(0) )
+row.setPropertyValue( "BackTransparent", False )
row.setPropertyValue( "BackColor", 6710932 )
textColor = 16777215
@@ -60,8 +62,8 @@ insertTextIntoCell( table, "C1", "ThirdColumn", textColor )
insertTextIntoCell( table, "D1", "SUM", textColor )
values = ( (22.5,21.5,121.5),
- (5615.3,615.3,-615.3),
- (-2315.7,315.7,415.7) )
+ (5615.3,615.3,-615.3),
+ (-2315.7,315.7,415.7) )
table.getCellByName("A2").setValue(22.5)
table.getCellByName("B2").setValue(5615.3)
table.getCellByName("C2").setValue(-2315.7)
@@ -79,7 +81,7 @@ table.getCellByName("D4").setFormula("sum <A4:C4>")
cursor.setPropertyValue( "CharColor", 255 )
-cursor.setPropertyValue( "CharShadowed", uno.Bool(1) )
+cursor.setPropertyValue( "CharShadowed", True )
text.insertControlCharacter( cursor, PARAGRAPH_BREAK, 0 )
text.insertString( cursor, " This is a colored Text - blue with shadow\n" , 0 )
@@ -99,7 +101,8 @@ textInTextFrame.insertString( cursorInTextFrame, "\nWith this second line the he
text.insertControlCharacter( cursor, PARAGRAPH_BREAK, 0 )
cursor.setPropertyValue( "CharColor", 65536 )
-cursor.setPropertyValue( "CharShadowed", uno.Bool(0) )
+cursor.setPropertyValue( "CharShadowed", False )
-text.insertString( cursor, " That's all for now !!" , 0 )
+text.insertString( cursor, " That's all for now!" , 0 )
+# vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/pyuno/demo/swritercomp.py b/pyuno/demo/swritercomp.py
index 6f8f30607bd2..be3109c12b44 100644
--- a/pyuno/demo/swritercomp.py
+++ b/pyuno/demo/swritercomp.py
@@ -1,3 +1,5 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+
# just a simple copy of the swriter.py demo, but implemented as a component. The advantage is,
# that the component may run within the office process which may give a performance improvement.
@@ -21,92 +23,92 @@ def insertTextIntoCell( table, cellName, text, color ):
# implementing the interface com.sun.star.lang.XMain
# unohelper.Base implements the XTypeProvider interface
class SWriterComp(XMain,unohelper.Base):
- def __init__( self, ctx ):
- self.ctx = ctx
-
- # implementation for XMain.run( [in] sequence< any > )
- def run( self,args ):
+ def __init__( self, ctx ):
+ self.ctx = ctx
- ctx = self.ctx
- smgr = ctx.ServiceManager
- desktop = smgr.createInstanceWithContext( "com.sun.star.frame.Desktop",ctx)
+ # implementation for XMain.run( [in] sequence< any > )
+ def run( self,args ):
+ ctx = self.ctx
+ smgr = ctx.ServiceManager
+ desktop = smgr.createInstanceWithContext( "com.sun.star.frame.Desktop",ctx)
- # open a writer document
- doc = desktop.loadComponentFromURL( "private:factory/swriter","_blank", 0, () )
+ # open a writer document
+ doc = desktop.loadComponentFromURL( "private:factory/swriter","_blank", 0, () )
- text = doc.Text
- cursor = text.createTextCursor()
- text.insertString( cursor, "The first line in the newly created text document.\n", 0 )
- text.insertString( cursor, "Now we are in the second line\n" , 0 )
+ text = doc.Text
+ cursor = text.createTextCursor()
+ text.insertString( cursor, "The first line in the newly created text document.\n", 0 )
+ text.insertString( cursor, "Now we are in the second line\n" , 0 )
- # create a text table
- table = doc.createInstance( "com.sun.star.text.TextTable" )
+ # create a text table
+ table = doc.createInstance( "com.sun.star.text.TextTable" )
- # with 4 rows and 4 columns
- table.initialize( 4,4)
+ # with 4 rows and 4 columns
+ table.initialize( 4,4)
- text.insertTextContent( cursor, table, 0 )
- rows = table.Rows
+ text.insertTextContent( cursor, table, 0 )
+ rows = table.Rows
- table.setPropertyValue( "BackTransparent", uno.Bool(0) )
- table.setPropertyValue( "BackColor", 13421823 )
- row = rows.getByIndex(0)
- row.setPropertyValue( "BackTransparent", uno.Bool(0) )
- row.setPropertyValue( "BackColor", 6710932 )
+ table.setPropertyValue( "BackTransparent", uno.Bool(0) )
+ table.setPropertyValue( "BackColor", 13421823 )
+ row = rows.getByIndex(0)
+ row.setPropertyValue( "BackTransparent", uno.Bool(0) )
+ row.setPropertyValue( "BackColor", 6710932 )
- textColor = 16777215
+ textColor = 16777215
- insertTextIntoCell( table, "A1", "FirstColumn", textColor )
- insertTextIntoCell( table, "B1", "SecondColumn", textColor )
- insertTextIntoCell( table, "C1", "ThirdColumn", textColor )
- insertTextIntoCell( table, "D1", "SUM", textColor )
+ insertTextIntoCell( table, "A1", "FirstColumn", textColor )
+ insertTextIntoCell( table, "B1", "SecondColumn", textColor )
+ insertTextIntoCell( table, "C1", "ThirdColumn", textColor )
+ insertTextIntoCell( table, "D1", "SUM", textColor )
- values = ( (22.5,21.5,121.5),
- (5615.3,615.3,-615.3),
- (-2315.7,315.7,415.7) )
- table.getCellByName("A2").setValue(22.5)
- table.getCellByName("B2").setValue(5615.3)
- table.getCellByName("C2").setValue(-2315.7)
- table.getCellByName("D2").setFormula("sum <A2:C2>")
+ values = ( (22.5,21.5,121.5),
+ (5615.3,615.3,-615.3),
+ (-2315.7,315.7,415.7) )
+ table.getCellByName("A2").setValue(22.5)
+ table.getCellByName("B2").setValue(5615.3)
+ table.getCellByName("C2").setValue(-2315.7)
+ table.getCellByName("D2").setFormula("sum <A2:C2>")
- table.getCellByName("A3").setValue(21.5)
- table.getCellByName("B3").setValue(615.3)
- table.getCellByName("C3").setValue(-315.7)
- table.getCellByName("D3").setFormula("sum <A3:C3>")
+ table.getCellByName("A3").setValue(21.5)
+ table.getCellByName("B3").setValue(615.3)
+ table.getCellByName("C3").setValue(-315.7)
+ table.getCellByName("D3").setFormula("sum <A3:C3>")
- table.getCellByName("A4").setValue(121.5)
- table.getCellByName("B4").setValue(-615.3)
- table.getCellByName("C4").setValue(415.7)
- table.getCellByName("D4").setFormula("sum <A4:C4>")
+ table.getCellByName("A4").setValue(121.5)
+ table.getCellByName("B4").setValue(-615.3)
+ table.getCellByName("C4").setValue(415.7)
+ table.getCellByName("D4").setFormula("sum <A4:C4>")
- cursor.setPropertyValue( "CharColor", 255 )
- cursor.setPropertyValue( "CharShadowed", uno.Bool(1) )
+ cursor.setPropertyValue( "CharColor", 255 )
+ cursor.setPropertyValue( "CharShadowed", uno.Bool(1) )
- text.insertControlCharacter( cursor, PARAGRAPH_BREAK, 0 )
- text.insertString( cursor, " This is a colored Text - blue with shadow\n" , 0 )
- text.insertControlCharacter( cursor, PARAGRAPH_BREAK, 0 )
+ text.insertControlCharacter( cursor, PARAGRAPH_BREAK, 0 )
+ text.insertString( cursor, " This is a colored Text - blue with shadow\n" , 0 )
+ text.insertControlCharacter( cursor, PARAGRAPH_BREAK, 0 )
- textFrame = doc.createInstance( "com.sun.star.text.TextFrame" )
- textFrame.setSize( Size(15000,400))
- textFrame.setPropertyValue( "AnchorType" , AS_CHARACTER )
+ textFrame = doc.createInstance( "com.sun.star.text.TextFrame" )
+ textFrame.setSize( Size(15000,400))
+ textFrame.setPropertyValue( "AnchorType" , AS_CHARACTER )
- text.insertTextContent( cursor, textFrame, 0 )
+ text.insertTextContent( cursor, textFrame, 0 )
- textInTextFrame = textFrame.getText()
- cursorInTextFrame = textInTextFrame.createTextCursor()
- textInTextFrame.insertString( cursorInTextFrame, "The first line in the newly created text frame.", 0 )
- textInTextFrame.insertString( cursorInTextFrame, "\nWith this second line the height of the rame raises.",0)
- text.insertControlCharacter( cursor, PARAGRAPH_BREAK, 0 )
+ textInTextFrame = textFrame.getText()
+ cursorInTextFrame = textInTextFrame.createTextCursor()
+ textInTextFrame.insertString( cursorInTextFrame, "The first line in the newly created text frame.", 0 )
+ textInTextFrame.insertString( cursorInTextFrame, "\nWith this second line the height of the rame raises.",0)
+ text.insertControlCharacter( cursor, PARAGRAPH_BREAK, 0 )
- cursor.setPropertyValue( "CharColor", 65536 )
- cursor.setPropertyValue( "CharShadowed", uno.Bool(0) )
-
- text.insertString( cursor, " That's all for now !!" , 0 )
- return 0
+ cursor.setPropertyValue( "CharColor", 65536 )
+ cursor.setPropertyValue( "CharShadowed", uno.Bool(0) )
+ text.insertString( cursor, " That's all for now!" , 0 )
+ return 0
# pythonloader looks for a static g_ImplementationHelper variable
g_ImplementationHelper = unohelper.ImplementationHelper()
g_ImplementationHelper.addImplementation( \
- SWriterComp,"org.openoffice.comp.pyuno.swriter",("org.openoffice.demo.SWriter",),)
+ SWriterComp,"org.openoffice.comp.pyuno.swriter",("org.openoffice.demo.SWriter",),)
+
+# vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/pyuno/demo/swritercompclient.py b/pyuno/demo/swritercompclient.py
index 1076a69eb9b6..19ca6b5c1c46 100644
--- a/pyuno/demo/swritercompclient.py
+++ b/pyuno/demo/swritercompclient.py
@@ -1,9 +1,10 @@
-# instantiating
+# -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+
import uno
localContext = uno.getComponentContext()
resolver = localContext.ServiceManager.createInstanceWithContext(
- "com.sun.star.bridge.UnoUrlResolver", localContext )
+ "com.sun.star.bridge.UnoUrlResolver", localContext )
remoteContext = resolver.resolve( "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext" )
remoteSmgr = remoteContext.ServiceManager
@@ -11,3 +12,4 @@ pyComp = remoteSmgr.createInstanceWithContext( "org.openoffice.demo.SWriter" , r
pyComp.run( (), )
+# vim:set shiftwidth=4 softtabstop=4 expandtab: