+auf-libreoffice-extension (1204.5) precise; urgency=low
+
+ * calc2moin :
+ - gestion du gras (au niveau de la cellule)
+
+ -- Progfou <jean-christophe.andre@auf.org> Fri, 31 Oct 2014 15:20:01 -0400
+
auf-libreoffice-extension (1204.4) precise; urgency=low
- * calc2moin : gestion, au niveau d'une cellule, de la couleur du texte,
- du gras et début de gestion des cellules fusionnées
+ * calc2moin :
+ - gestion du texte multi-lignes (au niveau de la cellule)
+ - gestion de la couleur du texte (au niveau de la cellule)
+ - début de gestion des cellules fusionnées (horizontalement)
+ - meilleure gestion des positionnements horizontaux et verticaux
+ - usage de l'ancien style de balisage wiki par défaut (plus condensé)
-- Progfou <jean-christophe.andre@auf.org> Fri, 31 Oct 2014 12:36:25 -0400
def __init__(self, ctx):
self.ctx = ctx;
self.cp = self.ctx.ServiceManager.createInstanceWithContext(
- "com.sun.star.configuration.ConfigurationProvider",
- self.ctx)
+ "com.sun.star.configuration.ConfigurationProvider", self.ctx)
+ # options AUF
node = uno.createUnoStruct("com.sun.star.beans.PropertyValue")
node.Name = "nodepath"
- node.Value = "/org.openoffice.VCL/Settings/Transfer"
+ node.Value = "/org.auf.openoffice.macros/General"
self.node = node
- self.cfg_names = ("SelectionTimeout",)
+ self.cfg_names = ("MoinMoinOldStyle", "MoinMoinVertOnMulti", )
+ # options OpenOffice
+ node = uno.createUnoStruct("com.sun.star.beans.PropertyValue")
+ node.Name = "nodepath"
+ node.Value = "/org.openoffice.VCL/Settings/Transfer"
+ self.nodeVCL = node
+ self.cfg_namesVCL = ("SelectionTimeout",)
return
- # XContainerWindowEventHandler
- def callHandlerMethod(self, window, eventObject, method):
- if method == "external_event":
- try:
- self.handleExternalEvent(window, eventObject)
- except:
- pass
- return True
-
- # XContainerWindowEventHandler
- def getSupportedMethodNames(self):
- return ("external_event",)
-
+ # XServiceInfo
def supportsService(self, name):
return False
+ # XServiceInfo
def getImplementationName(self):
return "org.auf.openoffice.macros.DialogHandler"
+ # XServiceInfo
def getSupportedServiceNames(self):
return ()
+ # XContainerWindowEventHandler
+ def getSupportedMethodNames(self):
+ return ("external_event",)
+
+ # XContainerWindowEventHandler
+ def callHandlerMethod(self, window, eventObject, method):
+ if method == "external_event":
+ try:
+ self.handleExternalEvent(window, eventObject)
+ except:
+ pass
+ return True
+
def handleExternalEvent(self, window, eventName):
if eventName == "ok":
self.saveData(window)
settings = self.configreader()
if not settings:
return
+ # options AUF
for name in self.cfg_names:
+ window.getControl(name).setState(int(settings.get(name, True)))
+ # options OpenOffice
+ for name in self.cfg_namesVCL:
window.getControl(name).setValue(settings.get(name, ''))
return
name = window.getModel().Name
if name != "MacrosDialog":
return
- settings = []
+ settings = {}
+ # options AUF
for name in self.cfg_names:
- settings.append(str(int(window.getControl(name).Value)))
- self.configwriter(tuple(settings))
+ settings[name] = bool(window.getControl(name).State)
+ # options OpenOffice
+ for name in self.cfg_namesVCL:
+ settings[name] = str(int(window.getControl(name).Value))
+ self.configwriter(settings)
return
# read configuration
def configreader(self):
settings = {}
+ # options AUF
try:
ConfigReader = self.cp.createInstanceWithArguments(
"com.sun.star.configuration.ConfigurationAccess",
(self.node,))
- #cfg_values = ConfigReader.getPropertyValues(self.cfg_names)
- for i in range(len(self.cfg_names)):
- cfg_value = ConfigReader.getByName(self.cfg_names[i])
- settings[self.cfg_names[i]] = cfg_value
+ for name in self.cfg_names:
+ settings[name] = ConfigReader.getByName(name)
+ except:
+ pass
+ # options OpenOffice
+ try:
+ ConfigReader = self.cp.createInstanceWithArguments(
+ "com.sun.star.configuration.ConfigurationAccess",
+ (self.nodeVCL,))
+ for name in self.cfg_namesVCL:
+ settings[name] = ConfigReader.getByName(name)
except:
pass
return settings
- # write configuration, cfg_values: tuple
- # keep the order of the values
- def configwriter(self, cfg_values):
+ # write configuration
+ def configwriter(self, settings):
+ # options AUF
try:
ConfigWriter = self.cp.createInstanceWithArguments(
"com.sun.star.configuration.ConfigurationUpdateAccess",
(self.node,))
- #ConfigWriter.setPropertyValues(self.cfg_names, cfg_values)
- for i in range(len(self.cfg_names)):
- ConfigWriter.replaceByName(self.cfg_names[i], cfg_values[i])
+ for name in self.cfg_names:
+ ConfigWriter.replaceByName(name, settings[name])
+ ConfigWriter.commitChanges()
+ except:
+ pass
+ # options OpenOffice
+ try:
+ ConfigWriter = self.cp.createInstanceWithArguments(
+ "com.sun.star.configuration.ConfigurationUpdateAccess",
+ (self.nodeVCL,))
+ for name in self.cfg_namesVCL:
+ ConfigWriter.replaceByName(name, settings[name])
ConfigWriter.commitChanges()
except:
pass
<manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data" manifest:full-path="systemfiledialog.xcu"/>
<manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data" manifest:full-path="externalmailer.xcu"/>
<manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data" manifest:full-path="printing.xcu"/>
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-schema" manifest:full-path="OptionsSchema.xcs"/>
<manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data" manifest:full-path="OptionsDialog.xcu"/>
<manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=Python" manifest:full-path="DialogHandler.py"/>
<manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=Python" manifest:full-path="CODA.py"/>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<oor:component-schema xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" oor:name="macros" oor:package="org.auf.openoffice" xml:lang="en-US">
+ <info>
+ <author>Jean Christophe André</author>
+ <desc>Configuration pour les macros AUF.</desc>
+ </info>
+ <templates>
+ </templates>
+ <component>
+ <group oor:name="General">
+ <info><desc>Options générales des macros AUF</desc></info>
+ <prop oor:name="MoinMoinOldStyle" oor:type="xs:boolean" oor:localized="false">
+ <info><desc>Active ou désactive l'ancienne façon de styler les tables dans MoinMoin</desc></info>
+ <value>true</value>
+ </prop>
+ <prop oor:name="MoinMoinVertOnMulti" oor:type="xs:boolean" oor:localized="false">
+ <info><desc>Conditionne l'ajustement vertical au fait qu'au moins une des cellules d'une même rangée contienne plusieurs lignes de texte</desc></info>
+ <value>true</value>
+ </prop>
+ </group>
+ </component>
+</oor:component-schema>
from com.sun.star.table.CellVertJustify import STANDARD, TOP, CENTER as MIDDLE, BOTTOM
from com.sun.star.awt.FontWeight import DONTKNOW, NORMAL, BOLD
-moinmoin_old_style = True
+_settings = {
+ 'MoinMoinOldStyle': True,
+ 'MoinMoinVertOnMulti': True,
+}
def getRangeSize(sheet, cursor):
r = cursor.getRangeAddress()
return (r.StartColumn + column, r.StartRow + row)
def cell2moin(cell):
- return cell.getString().replace('\n','<<BR>>')
+ global _settings
+ cell_string = cell.getString()
+ if not cell_string: return ''
+ cell_string = cell_string.replace('\n','<<BR>>')
+ if _settings['MoinMoinOldStyle']:
+ if hasattr(cell, 'CharWeight') and cell.CharWeight == BOLD:
+ cell_string = "'''%s'''" % cell_string
+ return cell_string
def calc2moin(ctx):
+ global _settings
data = list()
# récupération du document en cours, vérification du type Spreadsheet
raise RuntimeError, u"Ce n'est pas un document de type Spreadsheet (Calc)."
controller = curdoc.getCurrentController()
sheet = controller.getActiveSheet()
+ #open('/tmp/calc2moin.log','a').write('sheet=[%s]\n' % ', '.join(dir(sheet)))
# localisation de la la zone déjà utilisée
cursor = sheet.createCursor()
columns, rows = getRangeSize(sheet, cursor)
for row in range(rows):
row_data = list()
+ row_has_multiline_cell = False
column = 0
while column < columns:
cell = cursor.getCellByPosition(column, row)
cell_type = cell.getType()
cell_string = cell.getString()
+ if not row_has_multiline_cell:
+ row_has_multiline_cell = '\n' in cell_string
# calcul de l'étendue de la cellule courante
if cell.getIsMerged():
c, r = getCellRealPosition(cursor, column, row)
cursor2 = sheet.createCursorByRange(cellRange)
cursor2.collapseToMergedArea()
cell_colspan, cell_rowspan = getRangeSize(sheet, cursor2)
+ #open('/tmp/calc2moin.log','a').write('Merged(%d,%d)=[%d,%d]\n' % (column,row,cell_colspan,cell_rowspan))
else:
cell_colspan, cell_rowspan = 1, 1
# traitement des attributs et styles de la cellule
text_align_old = ')'
else:
if cell_type == TEXT:
- text_align = 'left'
- text_align_old = '('
+ if cell_colspan > 1 or cell_rowspan > 1:
+ text_align = 'left'
+ text_align_old = '('
+ else:
+ text_align = '' # left par défaut si span == 1
+ text_align_old = ''
elif cell_type != EMPTY:
text_align = 'right'
text_align_old = ')'
if text_align:
- if moinmoin_old_style:
+ if _settings['MoinMoinOldStyle']:
cell_attributes.append(text_align_old)
else:
cell_styles.append('text-align: ' + text_align)
- if cell_string and hasattr(cell, 'VertJustify'):
+ if cell_string and hasattr(cell, 'VertJustify') and \
+ (row_has_multiline_cell or not _settings['MoinMoinVertOnMulti']):
vertJustify = cell.getPropertyValue('VertJustify')
if vertJustify == 1: #TOP(1)
vertical_align = 'top'
vertical_align = 'bottom'
vertical_align_old = 'v'
if vertical_align:
- if moinmoin_old_style:
+ if _settings['MoinMoinOldStyle']:
cell_attributes.append(vertical_align_old)
else:
cell_styles.append('vertical-align: ' + vertical_align)
if cell_string and hasattr(cell, 'CharWeight'):
charWeight = cell.getPropertyValue('CharWeight')
- if charWeight == BOLD:
- if moinmoin_old_style:
- # FIXME: pas utilisé ensuite !!
- cell_string = "'''%s'''" % cell_string
- else:
- cell_styles.append('font-weight: bold')
+ if charWeight == BOLD and not _settings['MoinMoinOldStyle']:
+ cell_styles.append('font-weight: bold')
if cell_rowspan > 1:
cell_attributes.append('|%d' % cell_rowspan)
if cell_colspan > 1:
if hasattr(cell, 'CellBackColor'):
color = cell.getPropertyValue('CellBackColor')
if color >= 0:
- if moinmoin_old_style:
+ if _settings['MoinMoinOldStyle']:
cell_attributes.append('#%06x' % color)
else:
cell_styles.append('background: #%06x' % color)
class CopierJob(unohelper.Base, XJobExecutor):
def __init__(self, context):
self._context = context
+ self._readConfig()
+
+ def _readConfig(self):
+ cfgprov = self._context.ServiceManager.createInstanceWithContext(
+ "com.sun.star.configuration.ConfigurationProvider", self._context)
+ node = PropertyValue()
+ node.Name = "nodepath"
+ node.Value = "/org.auf.openoffice.macros/General"
+ ConfigReader = cfgprov.createInstanceWithArguments(
+ "com.sun.star.configuration.ConfigurationAccess", (node,))
+ cfgnames = ("MoinMoinOldStyle", "MoinMoinVertOnMulti", )
+ cfgvalues = ConfigReader.getPropertyValues(cfgnames)
+ if not cfgvalues:
+ raise RuntimeError("Unable to read the configuration.")
+ global _settings
+ _settings = dict(zip(cfgnames, cfgvalues))
def trigger(self, args):
calc2moin(self._context)
<description xmlns="http://openoffice.org/extensions/description/2006" xmlns:d="http://openoffice.org/extensions/description/2006" xmlns:xlink="http://www.w3.org/1999/xlink">
<identifier value="org.auf.openoffice.macros" />
- <version value="1204.4" />
+ <version value="1204.5" />
<platform value="all" />
<dependencies>
<dlg:titledbox dlg:id="FrameControl1" dlg:tab-index="0" dlg:left="10" dlg:top="10" dlg:width="240" dlg:height="60" dlg:help-text="&2.MacrosDialog.FrameControl1.HelpText">
<dlg:title dlg:value="&3.MacrosDialog.FrameControl1.Label"/>
</dlg:titledbox>
- <dlg:text dlg:id="SelectionTimeoutLabel" dlg:tab-index="0" dlg:left="15" dlg:top="20" dlg:width="70" dlg:height="12" dlg:help-text="&4.MacrosDialog.SelectionTimeoutLabel.HelpText" dlg:value="&5.MacrosDialog.SelectionTimeoutLabel.Label"/>
- <dlg:numericfield dlg:id="SelectionTimeout" dlg:tab-index="1" dlg:left="90" dlg:top="18" dlg:width="20" dlg:height="12" dlg:help-text="&6.MacrosDialog.SelectionTimeout.HelpText" dlg:value="&7.MacrosDialog.SelectionTimeout.Label" dlg:decimal-accuracy="0" dlg:value-min="3"/>
+ <dlg:checkbox dlg:id="MoinMoinOldStyle" dlg:tab-index="1" dlg:left="15" dlg:top="20" dlg:width="200" dlg:height="12" dlg:help-text="&8.MacrosDialog.MoinMoinOldStyle.HelpText" dlg:value="&9.MacrosDialog.MoinMoinOldStyle.Label" dlg:checked="true"/>
+ <dlg:checkbox dlg:id="MoinMoinVertOnMulti" dlg:tab-index="2" dlg:left="15" dlg:top="35" dlg:width="200" dlg:height="12" dlg:help-text="&10.MacrosDialog.MoinMoinVertOnMulti.HelpText" dlg:value="&11.MacrosDialog.MoinMoinVertOnMulti.Label" dlg:checked="true"/>
+ <dlg:text dlg:id="SelectionTimeoutLabel" dlg:tab-index="0" dlg:left="10" dlg:top="80" dlg:width="95" dlg:height="12" dlg:help-text="&4.MacrosDialog.SelectionTimeoutLabel.HelpText" dlg:value="&5.MacrosDialog.SelectionTimeoutLabel.Label"/>
+ <dlg:numericfield dlg:id="SelectionTimeout" dlg:tab-index="3" dlg:left="110" dlg:top="78" dlg:width="15" dlg:height="12" dlg:help-text="&6.MacrosDialog.SelectionTimeout.HelpText" dlg:value="&7.MacrosDialog.SelectionTimeout.Label" dlg:decimal-accuracy="0" dlg:value-min="3"/>
</dlg:bulletinboard>
</dlg:window>
0.MacrosDialog.HelpText=
1.MacrosDialog.Title=
2.MacrosDialog.FrameControl1.HelpText=
-3.MacrosDialog.FrameControl1.Label=
+3.MacrosDialog.FrameControl1.Label=MoinMoin
4.MacrosDialog.SelectionTimeoutLabel.HelpText=
-5.MacrosDialog.SelectionTimeoutLabel.Label=D\u00e9lai pour le copier/coller :
+5.MacrosDialog.SelectionTimeoutLabel.Label=D\u00e9lai maximum pour le copier/coller :
6.MacrosDialog.SelectionTimeout.HelpText=D\u00e9lai maximum, en secondes, pour le copier/coller (conseil : 30)
7.MacrosDialog.SelectionTimeout.Label=30
+8.MacrosDialog.MoinMoinOldStyle.HelpText=Active ou d\u00e9sactive l'ancienne fa\u00e7on de styler les tables dans MoinMoin
+9.MacrosDialog.MoinMoinOldStyle.Label=Anciens styles pour les tables
+10.MacrosDialog.MoinMoinVertOnMulti.HelpText=Conditionne l'ajustement vertical au fait qu'au moins une des cellules d'une m\u00eame rang\u00e9e contienne plusieurs lignes de texte
+11.MacrosDialog.MoinMoinVertOnMulti.Label=Ajustement vertical uniquement en cas de cellule multi-lignes
EXTENSION = ImagesEmbedder-1.0.0.oxt
+EXTDIR = /usr/lib/libreoffice/share/extensions
+
+obsolete:
+ @echo ""
+ @echo "*** Cette extension est obsolete depuis LibreOffice 4.2."
+ @echo ""
+ @exit 1
+
all: build
build:
install:
- install -m 0755 -d $(DESTDIR)/usr/lib/libreoffice/share/extensions/$(PACKAGE)
- unzip $(EXTENSION) -d $(DESTDIR)/usr/lib/libreoffice/share/extensions/$(PACKAGE)/
+ install -m 0755 -d $(DESTDIR)$(EXTDIR)/$(PACKAGE)
+ unzip $(EXTENSION) -d $(DESTDIR)$(EXTDIR)/$(PACKAGE)/
clean: