Kaydet (Commit) 0ce5e664 authored tarafından Pedro Giffuni's avatar Pedro Giffuni

Python reindent.

üst 383d0ef2
......@@ -26,16 +26,16 @@ def getNewString( theString ) :
return ""
# should we tokenize on "."?
if theString[0].isupper() and len(theString)>=2 and theString[1].isupper() :
# first two chars are UC => first UC, rest LC
# first two chars are UC => first UC, rest LC
newString=theString[0:1].upper() + theString[1:].lower();
elif theString[0].isupper():
# first char UC => all to LC
# first char UC => all to LC
newString=theString.lower()
else: # all to UC.
newString=theString.upper()
return newString;
def capitalisePython( ):
def capitalisePython( ):
"""Change the case of a selection, or current word from upper case, to first char upper case, to all lower case to upper case..."""
import string
......@@ -51,7 +51,7 @@ def capitalisePython( ):
count = xIndexAccess.getCount();
if(count>=1): #ie we have a selection
i=0
while i < count :
while i < count :
xTextRange = xIndexAccess.getByIndex(i);
#print "string: " + xTextRange.getString();
theString = xTextRange.getString();
......@@ -74,7 +74,7 @@ def capitalisePython( ):
if newString:
xTextRange.setString(newString);
xSelectionSupplier.select(xTextRange);
i+= 1
i+= 1
# lists the scripts, that shall be visible inside OOo. Can be omited, if
......
......@@ -36,19 +36,19 @@ def insertTextIntoCell( table, cellName, text, color ):
def createTable():
"""creates a new writer document and inserts a table with some data (also known as the SWriter sample)"""
"""creates a new writer document and inserts a table with some data (also known as the SWriter sample)"""
ctx = uno.getComponentContext()
smgr = ctx.ServiceManager
desktop = smgr.createInstanceWithContext( "com.sun.star.frame.Desktop",ctx)
# 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 )
# create a text table
table = doc.createInstance( "com.sun.star.text.TextTable" )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment