-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58c6361
commit 781f88f
Showing
11 changed files
with
102 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<description xmlns="http://openoffice.org/extensions/description/2006" | ||
xmlns:dep="http://openoffice.org/extensions/description/2006" | ||
xmlns:xlink="http://www.w3.org/1999/xlink"> | ||
<identifier value="com.goosepirate.lox365.oxt" /> | ||
<icon><default xlink:href="icon.png" /></icon> | ||
<version value="4.3" /> | ||
<publisher><name xlink:href="https://github.com/goosepirate/lox365" lang="en">goosepirate</name></publisher> | ||
<display-name><name lang="en">Lox365</name></display-name> | ||
<extension-description><src xlink:href="extension-description.txt" lang="en"/></extension-description> | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<description xmlns="http://openoffice.org/extensions/description/2006" | ||
xmlns:dep="http://openoffice.org/extensions/description/2006" | ||
xmlns:xlink="http://www.w3.org/1999/xlink"> | ||
<identifier value="com.goosepirate.lox365.oxt" /> | ||
<icon><default xlink:href="icon.png" /></icon> | ||
<version value="5.0" /> | ||
<publisher><name xlink:href="https://github.com/goosepirate/lox365" lang="en">goosepirate</name></publisher> | ||
<display-name><name lang="en">Lox365</name></display-name> | ||
<extension-description><src xlink:href="extension-description.txt" lang="en"/></extension-description> | ||
</description> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from com.sun.star.awt import Size | ||
|
||
def IMAGE(doc, out_cell, url): | ||
drawpages = doc.DrawPages[int(out_cell.RangeAddress.Sheet)] | ||
existing_images = [] | ||
|
||
def get_existing_images_at_position(): | ||
for item in drawpages: | ||
if out_cell.Position != item.Position: continue | ||
existing_images.append(item) | ||
def remove_existing_images_at_position(): | ||
[item.dispose() for item in existing_images] | ||
|
||
get_existing_images_at_position() | ||
|
||
# Parse URL. | ||
if url == '': | ||
remove_existing_images_at_position() | ||
return '' | ||
elif ( | ||
not url.startswith('file://') | ||
and not url.startswith('http://') | ||
and not url.startswith('https://') | ||
): # Assume relative file path. | ||
current_dir = doc.URL.split('/')[:-1] | ||
url = '/'.join(current_dir) + '/' + url | ||
|
||
image = doc.createInstance('com.sun.star.drawing.GraphicObjectShape') | ||
image.Position = out_cell.Position | ||
image.GraphicURL = url | ||
image.Name = f'Generated image' | ||
try: | ||
drawpages.add(image) | ||
except: | ||
image.dispose() | ||
return '' | ||
size = Size() | ||
multiplier = 2540 * 15 / 1440 | ||
size.Width, size.Height = ( | ||
image.Graphic.Size.Width * multiplier, | ||
image.Graphic.Size.Height * multiplier, | ||
) | ||
image.setSize(size) | ||
remove_existing_images_at_position() | ||
return '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters