Add writer cursor move
This commit is contained in:
parent
33c86dcd56
commit
f597411d3e
|
@ -1,3 +1,7 @@
|
||||||
|
v 0.18.0 [29-aug-2021]
|
||||||
|
- Writer. Move cursor: start, end, left, right
|
||||||
|
|
||||||
|
|
||||||
v 0.17.0 [10-jul-2021]
|
v 0.17.0 [10-jul-2021]
|
||||||
- Add insert math in writer
|
- Add insert math in writer
|
||||||
|
|
||||||
|
|
|
@ -30,9 +30,9 @@ IBAN: BE60 9671 0556 5870
|
||||||
SWIFT / BIC: TRWIBEB1XXX
|
SWIFT / BIC: TRWIBEB1XXX
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* BCH: `qztd3l00xle5tffdqvh2snvadkuau2ml0uqm4n875d`
|
||||||
* FairCoin: `fJ7emvtyGfvcMuxk1nHSnS7gmeScdcZXL5`
|
* FairCoin: `fJ7emvtyGfvcMuxk1nHSnS7gmeScdcZXL5`
|
||||||
* Monero: `43H43TpQKYdYcw2ZCnn2nbjDh3imNQg8RGYS4oP4p7Z8aeBHg6VpeaFfBoMzDTUUDdQBiGkiQUSydJB96m6MqiEuEeyoopQ`
|
* Monero: `43H43TpQKYdYcw2ZCnn2nbjDh3imNQg8RGYS4oP4p7Z8aeBHg6VpeaFfBoMzDTUUDdQBiGkiQUSydJB96m6MqiEuEeyoopQ`
|
||||||
* BCH: `qztd3l00xle5tffdqvh2snvadkuau2ml0uqm4n875d`
|
|
||||||
|
|
||||||
* ETH: `0x61a4f614a30ff686445751ed8328b82b77ecfc69`
|
* ETH: `0x61a4f614a30ff686445751ed8328b82b77ecfc69`
|
||||||
* XRP: `rLSn6Z3T8uCxbcd1oxwfGQN1Fdn5CyGujK` Tag: `6643162`
|
* XRP: `rLSn6Z3T8uCxbcd1oxwfGQN1Fdn5CyGujK` Tag: `6643162`
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
rsync -ravz --delete build/ elmau.net:/opt/www/doc/zaz/
|
rsync -ravz --delete build/ 152.89.107.109:/opt/doc.cuates.net/zaz/
|
||||||
|
|
|
@ -3223,6 +3223,7 @@ class LOWriterTextRange(object):
|
||||||
self._is_paragraph = self.obj.ImplementationName == 'SwXParagraph'
|
self._is_paragraph = self.obj.ImplementationName == 'SwXParagraph'
|
||||||
self._is_table = self.obj.ImplementationName == 'SwXTextTable'
|
self._is_table = self.obj.ImplementationName == 'SwXTextTable'
|
||||||
self._is_text = self.obj.ImplementationName == 'SwXTextPortion'
|
self._is_text = self.obj.ImplementationName == 'SwXTextPortion'
|
||||||
|
self._is_section = not self.obj.TextSection is None
|
||||||
self._parts = []
|
self._parts = []
|
||||||
if self._is_paragraph:
|
if self._is_paragraph:
|
||||||
self._parts = [LOWriterTextRange(p, doc) for p in obj]
|
self._parts = [LOWriterTextRange(p, doc) for p in obj]
|
||||||
|
@ -3288,6 +3289,10 @@ class LOWriterTextRange(object):
|
||||||
def is_text(self):
|
def is_text(self):
|
||||||
return self._is_text
|
return self._is_text
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_section(self):
|
||||||
|
return self._is_section
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def text(self):
|
def text(self):
|
||||||
return self.obj.Text
|
return self.obj.Text
|
||||||
|
@ -3296,15 +3301,63 @@ class LOWriterTextRange(object):
|
||||||
def cursor(self):
|
def cursor(self):
|
||||||
return self.text.createTextCursorByRange(self.obj)
|
return self.text.createTextCursorByRange(self.obj)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def text_cursor(self):
|
||||||
|
return self.text.createTextCursor()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dp(self):
|
def dp(self):
|
||||||
return self._doc.dp
|
return self._doc.dp
|
||||||
|
|
||||||
def delete(self):
|
@property
|
||||||
|
def paragraph(self):
|
||||||
cursor = self.cursor
|
cursor = self.cursor
|
||||||
cursor.gotoStartOfParagraph(False)
|
cursor.gotoStartOfParagraph(False)
|
||||||
cursor.gotoNextParagraph(True)
|
cursor.gotoNextParagraph(True)
|
||||||
cursor.String = ''
|
return LOWriterTextRange(cursor, self._doc)
|
||||||
|
|
||||||
|
def goto_start(self):
|
||||||
|
if self.is_section:
|
||||||
|
rango = self.obj.TextSection.Anchor.Start
|
||||||
|
else:
|
||||||
|
rango = self.obj.Start
|
||||||
|
return LOWriterTextRange(rango, self._doc)
|
||||||
|
|
||||||
|
def goto_end(self):
|
||||||
|
if self.is_section:
|
||||||
|
rango = self.obj.TextSection.Anchor.End
|
||||||
|
else:
|
||||||
|
rango = self.obj.End
|
||||||
|
return LOWriterTextRange(rango, self._doc)
|
||||||
|
|
||||||
|
def goto_previous(self, expand=True):
|
||||||
|
cursor = self.cursor
|
||||||
|
cursor.gotoPreviousParagraph(expand)
|
||||||
|
return LOWriterTextRange(cursor, self._doc)
|
||||||
|
|
||||||
|
def goto_next(self, expand=True):
|
||||||
|
cursor = self.cursor
|
||||||
|
cursor.gotoNextParagraph(expand)
|
||||||
|
return LOWriterTextRange(cursor, self._doc)
|
||||||
|
|
||||||
|
def go_left(self, from_self=True, count=1, expand=False):
|
||||||
|
cursor = self.cursor
|
||||||
|
if not from_self:
|
||||||
|
cursor = self.text_cursor
|
||||||
|
cursor.gotoRange(self.obj, False)
|
||||||
|
cursor.goLeft(count, expand)
|
||||||
|
return LOWriterTextRange(cursor, self._doc)
|
||||||
|
|
||||||
|
def go_right(self, from_self=True, count=1, expand=False):
|
||||||
|
cursor = self.cursor
|
||||||
|
if not from_self:
|
||||||
|
cursor = self.text_cursor
|
||||||
|
cursor.gotoRange(self.obj, False)
|
||||||
|
cursor.goRight(count, expand)
|
||||||
|
return LOWriterTextRange(cursor, self._doc)
|
||||||
|
|
||||||
|
def delete(self):
|
||||||
|
self.value = ''
|
||||||
return
|
return
|
||||||
|
|
||||||
def offset(self):
|
def offset(self):
|
||||||
|
@ -3332,7 +3385,7 @@ class LOWriterTextRange(object):
|
||||||
cursor = self.cursor
|
cursor = self.cursor
|
||||||
for i in range(count):
|
for i in range(count):
|
||||||
self.text.insertControlCharacter(cursor, PARAGRAPH_BREAK, False)
|
self.text.insertControlCharacter(cursor, PARAGRAPH_BREAK, False)
|
||||||
return self._doc.selection
|
return LOWriterTextRange(cursor, self._doc)
|
||||||
|
|
||||||
def insert_table(self, data):
|
def insert_table(self, data):
|
||||||
table = self._doc.create_instance(SERVICES['TEXT_TABLE'])
|
table = self._doc.create_instance(SERVICES['TEXT_TABLE'])
|
||||||
|
@ -6707,8 +6760,12 @@ class Paths(object):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def read(cls, path, encoding='utf-8'):
|
def read(cls, path, get_lines=False, encoding='utf-8'):
|
||||||
data = Path(path).read_text(encoding=encoding)
|
if get_lines:
|
||||||
|
with Path(path).open(encoding=encoding) as f:
|
||||||
|
data = f.readlines()
|
||||||
|
else:
|
||||||
|
data = Path(path).read_text(encoding=encoding)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
@ -793,8 +793,8 @@ def main(args):
|
||||||
|
|
||||||
|
|
||||||
def _process_command_line_arguments():
|
def _process_command_line_arguments():
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(description='Make LibreOffice extensions')
|
||||||
description='Make LibreOffice extensions')
|
|
||||||
parser.add_argument('-new', '--new', dest='new', action='store_true',
|
parser.add_argument('-new', '--new', dest='new', action='store_true',
|
||||||
default=False, required=False)
|
default=False, required=False)
|
||||||
parser.add_argument('-t', '--target', dest='target', default='')
|
parser.add_argument('-t', '--target', dest='target', default='')
|
||||||
|
@ -813,6 +813,7 @@ def _process_command_line_arguments():
|
||||||
default=False, required=False)
|
default=False, required=False)
|
||||||
parser.add_argument('-oc', '--only_compress', dest='only_compress',
|
parser.add_argument('-oc', '--only_compress', dest='only_compress',
|
||||||
action='store_true', default=False, required=False)
|
action='store_true', default=False, required=False)
|
||||||
|
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue