debian/ 0000755 0000000 0000000 00000000000 12213151754 007167 5 ustar debian/menu 0000644 0000000 0000000 00000000305 11134714710 010052 0 ustar ?package(bibus):needs="X11" \
section="Applications/Data Management"\
title="Bibus" \
longtitle="Bibus bibliographic database" \
command="/usr/bin/bibus" \
icon="/usr/share/pixmaps/bibus.xpm"
debian/bibus.docs 0000644 0000000 0000000 00000000076 11134714710 011146 0 ustar Docs/importantNote.txt
Docs/README.txt
Docs/release_notes.txt
debian/copyright 0000644 0000000 0000000 00000011341 12213151130 011106 0 ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Bibus
Upstream-Contact: Pierre Martineau
Source: http://sourceforge.net/projects/bibus-biblio/files/bibus-biblio/
Files: *
Copyright: 2004-2009 Pierre Martineau
License: GPL-2+
On Debian systems, the complete text of the GNU General Public License (GPL)
version 2 can be found in the `/usr/share/common-licenses/GPL-2' file.
Files: ClientForm.py
Copyright: 2002-2005 John J. Lee
1998-2000 Gisle Aas
License: BSD
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Files: Import/BibTeX.py
Copyright: 2005 Nigel Sim
License: GPL-2+
Files: Import/EndNoteXML.py bibMSW/*
Copyright: 2006 Mounir Errami
License: GPL-2+
Files: Import/ISI.py
Copyright: 2004-2005 Pierre Martineau
2004-2005 Jouke Postma
License: GPL-2+
Files: LyX/* lyx_remote.py
Copyright: 2005 Günter Milde
License: GPL-2+
Files: Utilities/open_url.py
Copyright: 2007 Antonia Valentino
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Files: Utilities/title_case.py
Copyright: 2008 Jordan Sherer
2008 John Gruber
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Files: debian/*
Copyright: 2008-2012 Jan Beyer
License: GPL-2+
debian/bibOOoBase.py 0000644 0000000 0000000 00000135153 12213147766 011525 0 ustar # Copyright 2004,2005 Pierre Martineau
# This file is part of bibOOo, a python package to manipulate
# bibliography in an OpenOffice.org writer document.
#
# bibOOo is part of Bibus a free software;
# you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#/home/pmartino/Desktop/Bibus/bibus-cvs/bibus/bibOOo/bibOOoBase.py
# bibOOo is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Bibus; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# this class implements basic interaction between a biliographic software and OOo
# py2.2, to be removed in python 2.3
import sys, os
import uno
# below we commented the normal way to call the class/constants
# the form used is to be compatible with cx_freeze
#from com.sun.star.connection import NoConnectException
NoConnectException = uno.getClass("com.sun.star.connection.NoConnectException")
#from com.sun.star.uno import RuntimeException
RuntimeException = uno.getClass("com.sun.star.uno.RuntimeException")
#from com.sun.star.lang import IllegalArgumentException, DisposedException
IllegalArgumentException = uno.getClass("com.sun.star.lang.IllegalArgumentException")
DisposedException = uno.getClass("com.sun.star.lang.DisposedException")
#from com.sun.star.io import IOException
IOException = uno.getClass("com.sun.star.io.IOException")
#from com.sun.star.container import NoSuchElementException
NoSuchElementException = uno.getClass("com.sun.star.container.NoSuchElementException")
#from com.sun.star.util import URL
URL = uno.getClass("com.sun.star.util.URL")
#from com.sun.star.text.ControlCharacter import PARAGRAPH_BREAK
PARAGRAPH_BREAK = uno.getConstantByName("com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK")
#from com.sun.star.beans import PropertyValue
PropertyValue = uno.getClass("com.sun.star.beans.PropertyValue")
#from com.sun.star.beans.PropertyState import DIRECT_VALUE
# DIRECT_VALUE = uno.getConstantByName("com.sun.star.beans.PropertyState.DIRECT_VALUE")
DIRECT_VALUE = uno.Enum("com.sun.star.beans.PropertyState","DIRECT_VALUE")
#from com.sun.star.lang import Locale
Locale = uno.getClass("com.sun.star.lang.Locale")
# Styles
#from com.sun.star.awt.FontSlant import ITALIC, NONE
#FontSlantNone = NONE
#ITALIC = uno.getConstantByName("com.sun.star.awt.FontSlant.ITALIC")
ITALIC = uno.Enum("com.sun.star.awt.FontSlant","ITALIC")
#FontSlantNone = uno.getConstantByName("com.sun.star.awt.FontSlant.NONE")
FontSlantNone = uno.Enum("com.sun.star.awt.FontSlant","NONE")
#from com.sun.star.awt.FontWeight import BOLD, NORMAL
BOLD = uno.getConstantByName("com.sun.star.awt.FontWeight.BOLD")
NORMAL = uno.getConstantByName("com.sun.star.awt.FontWeight.NORMAL")
#from com.sun.star.awt.FontUnderline import SINGLE, NONE
#FontUnderlineNone = NONE
SINGLE = uno.getConstantByName("com.sun.star.awt.FontUnderline.SINGLE")
FontUnderlineNone = uno.getConstantByName("com.sun.star.awt.FontUnderline.NONE")
#from com.sun.star.style.CaseMap import UPPERCASE,SMALLCAPS, NONE
#CaseMapNone = NONE
UPPERCASE = uno.getConstantByName("com.sun.star.style.CaseMap.UPPERCASE")
SMALLCAPS = uno.getConstantByName("com.sun.star.style.CaseMap.SMALLCAPS")
CaseMapNone = uno.getConstantByName("com.sun.star.style.CaseMap.NONE")
#
from bibOOo.CONST import *
class bibOOo_Error(Exception):
"""Main error class
bibOOo_Error--|
|-----bibOOo_NoConnect-----|
| |----bibOOo_NoOffice
| |----bibOOo_NoWriter
|
|-----bibOOo_ExecError-----|
|----bibOOo_PositionError
|----bibOOo_StyleError
|----bibOOo_IOError
"""
msg = ''
def __init__(self,OOo=''):
self.OOo = OOo # we propagate the OOo error message in this attribute or an additional information
class bibOOo_NoConnect(bibOOo_Error):
"""Global class for connection error"""
msg = _("Cannot connect to Openoffice. See Documentation.")
class bibOOo_NoOffice(bibOOo_NoConnect):
"""We were not able to connect to a OOo instance"""
msg = _("Cannot connect to Openoffice. See Documentation.")
class bibOOo_NoWriter(bibOOo_NoConnect):
"""The top most OOo document is not a writer doc"""
msg = _("The front document in OOo must be a Writer document.")
class bibOOo_ExecError(bibOOo_Error):
"""Parent class for all error related to bibOOo specific problems"""
msg = _("Non allowed operation""")
class bibOOo_PositionError(bibOOo_ExecError):
"""We are trying to apply a function at a non suited position"""
msg = _("Incorrect position")
class bibOOo_StyleError(bibOOo_ExecError):
"""Error in the style file"""
msg = _("Style format Error")
class bibOOo_IOError(bibOOo_ExecError):
"""File error operation"""
msg = _("File error operation")
class bibOOo_Ref(object):
"""This class is a wrapper for OOo in-text citations
You can access the citation
as attributes : bibRef.Author etc...
Can be used to set or read citations in the current doc"""
def __init__(self,bibOOo_instance,OOoRef=None,ref=(),dbdict={}):
"""
model is the document model in which we want to create the citation.
bibOOo_instance is needed only if OOoRef == None
OORef = "com.sun.star.text.TextField.Bibliography"
if OORef == None, we create a "com.sun.star.text.TextField.Bibliography"
from
a list/tuple = (identifier,BibliographicType,....,ISBN)
or
dbdict = dictionary = {'Identifier':'toto', 'BibliographicType':1, 'Address':'NY', 'Annote':'Note', ...}
the dbdict.keys() may be incomplete => Absent fields will be set to '', BibliographicType to 1 = ARTICLE
or an empty reference of type = 1 (ARTICLE)
then in all cases we wrap the OOo object
"""
if not OOoRef:
self.OOoRef = bibOOo_instance.model.createInstance("com.sun.star.text.TextField.Bibliography")
if ref:
self.setRef(ref)
#tmp = [ PropertyValue(field,0,ref[OO_BIBLIOGRAPHIC_FIELDS[field]],DIRECT_VALUE) for field in OO_BIB_FIELDS ]
elif dbdict:
tmp=[]
for field in OO_BIB_FIELDS:
try: tmp.append( PropertyValue(field,0,dbdict[field],DIRECT_VALUE) )
except KeyError: tmp.append( PropertyValue(field,0,'',DIRECT_VALUE) )
if 'BibliographicType' in list(dbdict.keys()):
tmp[1] = PropertyValue('BibiliographicType',0,dbdict['BibliographicType'],DIRECT_VALUE) # to correct spelling error in OOo
if tmp[1].Value == '':
tmp[1] = PropertyValue('BibiliographicType',0,1,DIRECT_VALUE) # default type == ARTICLE
self.OOoRef.Fields = tuple(tmp)
else:
#tmp = [ PropertyValue(field,0,'',DIRECT_VALUE) for field in OO_BIB_FIELDS ]
#tmp[1] = PropertyValue('BibiliographicType',0,1,DIRECT_VALUE) # ARTICLE
self.setRef( ('', 1, '', '', '','', '', '', '', '', '','', '', '', '', '', '', '','', '', '', '', '', '', '', '','', '', '', '', '') )
#self.OOoRef.Fields = tuple(tmp)
else:
self.OOoRef = OOoRef
#def __eq__(self,other): # suppressed because it did not work in Ubuntu 7.10
# return self.Identifier == other.Identifier
#def __ne__(self,other):
# return self.Identifier != other.Identifier
def __getattr__(self,attr):
""" If it is a BIBLIOGRAPHIC_FIELDS, we return the value
otherwise, we return the attribute of the OORef
This way we can directly access the method of the OOo ref object """
if attr in OO_BIB_FIELDS:
return self.OOoRef.Fields[OO_BIBLIOGRAPHIC_FIELDS[attr]].Value
elif attr == 'BibliographicType': # spelling error in OOo
return self.OOoRef.Fields[1].Value
else:
return getattr(self.OOoRef,attr)
def __setattr__(self,attr,value):
if attr in OO_BIB_FIELDS:
tmp = list(self.OOoRef.Fields)
tmp[OO_BIBLIOGRAPHIC_FIELDS[attr]] = PropertyValue(attr,0,value,DIRECT_VALUE)
self.OOoRef.Fields = tuple(tmp)
elif attr == 'BibliographicType': # spelling error in OOo
tmp = list(self.OOoRef.Fields)
tmp[1] = PropertyValue('BibiliographicType',0,value,DIRECT_VALUE)
self.OOoRef.Fields = tuple(tmp)
elif attr == 'OOoRef':
object.__setattr__(self,'OOoRef',value)
else:
raise AttributeError
def setRef(self,ref):
"""
Set the values of the reference using the data in
ref which is a list/tuple.
This is much faster than setting field by field
"""
tmp = [ PropertyValue(field,0,ref[OO_BIBLIOGRAPHIC_FIELDS[field]],DIRECT_VALUE) for field in OO_BIB_FIELDS ]
self.OOoRef.Fields = tuple(tmp)
class bibOOoBase(object):
"""This is the main class to interact with OOo"""
# ------------------------ Connection setup ------------------------------
def __init__(self,con_type=1,host='localhost',port=8100,pipe='OOo_pipe'):
"""We connect to the running OOo instance
con_type = connection_type = 1 if pipe ; 0 if TCP
host = host for TCP
port = port for TCP
pipe = pipe name
"""
if con_type == 0:
OO_CON_STR = "uno:socket,host=%s,port=%s;urp;StarOffice.ComponentContext"%(host,port)
else:
OO_CON_STR = "uno:pipe,name=%s;urp;StarOffice.ComponentContext"%pipe
# get the uno component context from the PyUNO runtime
localContext = uno.getComponentContext()
# create the UnoUrlResolver
resolver = localContext.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", localContext )
try:
# connect to the running office
ctx = resolver.resolve( OO_CON_STR )
self.smgr = ctx.ServiceManager
# get the central desktop object
self.desktop = self.smgr.createInstanceWithContext( "com.sun.star.frame.Desktop",ctx)
# some utilities
self.transformer = MagicTransformer( ctx ) # this is to force PropertyValue.Value to the desired type because of a python bug
self.oTrans = self.smgr.createInstanceWithContext("com.sun.star.util.URLTransformer", ctx ) # used in __freezeBib to format URL
#
except NoConnectException as e:
raise bibOOo_NoOffice(e.Message)
except IllegalArgumentException as e:
#print "The url is invalid (%s)" % e.Message
raise bibOOo_NoOffice(e.Message)
except RuntimeException as e:
#print "An unknown error occured (%s)" % e.Message
raise bibOOo_NoOffice(e.Message)
def connectToWriter(self, hilight = False, backColor = 0x00FFFF00, createBib = True, end = True):
"""connect to the top OOo document if it is a writer doc"""
self.bib = None # bibliographic index
try:
self.model = self.desktop.getCurrentComponent()
if self.model and self.model.getImplementationName() == 'SwXTextDocument': # this is a text document
self.controller = self.model.getCurrentController()
self.cursor = self.controller.getViewCursor() # Current ViewCursor
# access the document's text property
self.text = self.model.Text
# look for the first bibliography index or create a new one at the end if no biblio index present
bibFound = False
for i in range(self.model.getDocumentIndexes().getCount()):
self.bib = self.model.getDocumentIndexes().getByIndex(i)
if self.bib.getServiceName() == 'com.sun.star.text.Bibliography':
bibFound = True
break
if not bibFound and createBib:
# we create the bibliography index at the end of the document
self.createIndex(end)
# we get the com.sun.star.text.FieldMaster.Bibliography after eventually creating it
try:
self.tfm = self.model.getTextFieldMasters().getByName('com.sun.star.text.FieldMaster.Bibliography') # the biblio TextFieldMaster
except NoSuchElementException:
self.tfm = self.model.createInstance("com.sun.star.text.FieldMaster.Bibliography")
self.stylesList = self.model.getStyleFamilies() # styles set XIndexAccess (XStyleFamiliesSupplier interface)
self.__createBaseStyles() # create the styles if needed
self.hilightCitations(hilight, background = backColor) # hilight citations if required. Just change the CharStyle
#self.setIndexFormat() # set the biblio format REMOVED BECAUSE IT IS TOO SLOW !!!!
else:
#print "You must have a text document opened in OpenOffice.org in oder to be able to use this menu"
raise bibOOo_NoWriter
except DisposedException as e:
raise bibOOo_NoOffice(e.Message)
# ------------------------ iteration ------------------------------
def __iter__(self):
for cit in self.getCitations(None):
yield cit
# functions to get a sorted list of citations
def __isFused(self,x,y,cursor):
"""Return True if the two citations x & y are separated only by spaces => can be fused"""
try:
cursor.gotoRange(x.Anchor.End,False)
if not x.Anchor.Text.compareRegionStarts(cursor,y.Anchor):
return True # we should not need it but it does not work if the two ranges start at the same position
cursor.gotoRange(y.Anchor.Start,True)
return not bool(cursor.String.strip(' ')) # if only white spaces between citations => we fuse them
#except IllegalArgumentException:
except:
return False # we are not in the same Text or something goes wrong
def groupCitations(self,refs):
"""We group the citations in refs list.
We return a list of list.
Each list is a group of citations
i.e. citations separated by blank spaces"""
refs_out=[]
if refs:
lastref = refs[0]
tmp_range=[lastref]
tmpcursor = lastref.Anchor.Text.createTextCursor()
for ref in refs[1:]:
if self.__isFused(lastref,ref,tmpcursor):
tmp_range.append(ref)
else:
refs_out.append(tmp_range)
tmp_range = [ref]
tmpcursor = ref.Anchor.Text.createTextCursor()
lastref = ref
refs_out.append(tmp_range)
return refs_out
def getCitations(self,order=None):
"""Return a list of the citations ordered as
order == None : unsorted
order == index : order of the bibliographic index
order == document : order in the document
order == group : list of list. Order as document. When citations are consecutives they are in a sub-list.
Exemple: "Start doc [1] [2] continue [3] continue [4][5]" will give: [[1,2],[3],[4,5]]
"""
# we first update the index and references.
#updateRef() # we update the references to be up-to-date
#refs = list(self.tfm.getPropertyValue('DependentTextFields')) # we get the references
refs = [ bibOOo_Ref(self,ref) for ref in self.tfm.getPropertyValue('DependentTextFields') ] # we get the references and wrap them in bibOOo_Ref objects
lbb = len(self.tfm.BracketBefore) # used later to get the numbers without the brackets
lba = -len(self.tfm.BracketAfter)
if order == None:
return refs
elif order == 'index':
SavedState = self.tfm.IsNumberEntries
self.tfm.IsNumberEntries = True # we number citations to get the order of them
self.model.getTextFields().refresh()
#
tmplist = [(int(x.getPresentation(False)[lbb:len(x.getPresentation(False))+lba]), x) for x in refs]
tmplist.sort()
refs = [x for (key, x) in tmplist]
#
self.tfm.IsNumberEntries = SavedState # we reverse to the original state
return refs
else:
# to sort by document:
# 1) We put for each ref a unique identifier (a number)
# 2) We ask OOo to sort by doc + numbers. As identifiers are uniques => each ref has its own number = order
# 3) We sort using the getPresentation(False)
# 4) We put back the correct identifiers
# 1)
savedIdentifiers=[]
i = 0
for ref in refs:
savedIdentifiers.append(ref.Identifier)
ref.Identifier = repr(i)
i = i+1
# 2)
SavedState = self.tfm.IsNumberEntries, self.tfm.IsSortByPosition
self.tfm.IsNumberEntries = True
self.tfm.IsSortByPosition = True
self.model.getTextFields().refresh()
# 3)
tmplist = [(int(x.getPresentation(False)[lbb:len(x.getPresentation(False))+lba]), x) for x in refs]
tmplist.sort()
refs = [x for (key, x) in tmplist]
# 4)
for ref in refs:
ref.Identifier = savedIdentifiers[int(ref.Identifier)]
#
self.model.getTextFields().refresh()
self.tfm.IsNumberEntries, self.tfm.IsSortByPosition = SavedState
if order == 'document': return refs
if order == 'group' : return self.groupCitations(refs) # order = 'group'
raise ValueError('What are we doing here? bibOOo line 357. order = %r is not a correct value.'%order)
# end of functions to get a sorted list of citations
# ------------------------ Index ------------------------------
def createIndex(self,end = True):
"""create bibliographic index at the end if True, or at the current cursor position if False"""
cursor = self.text.createTextCursor()
if end: cursor.gotoEnd(False) # we create at the end of the doc
else: cursor.gotoRange(self.cursor,False) # or at the view cursor
self.text.insertControlCharacter(cursor,PARAGRAPH_BREAK,False)
self.bib = self.model.createInstance("com.sun.star.text.Bibliography")
self.text.insertTextContent(cursor,self.bib,False)
if self.text.compareRegionEnds(self.cursor,cursor) == 0: # the viewcursor was at the end of the doc
self.cursor.gotoRange(self.bib.getAnchor().getStart(),False) # we must relocate it before the index
self.cursor.goLeft(1,False) # we are now just before the index
self.bib.update() # update the new index (title, etc.)
def updateIndex(self):
"""Update bibliography index"""
self.model.getTextFields().refresh() # refresh the fields in case citation format has changed
if self.bib: self.bib.update() # update de la biblio if it exists
def setIndexFormat(self,format):
"""
set the format of the bibliographic index
format is a dictionary:
format.keys() = ['SortKeys', 'Title', 'Locale', 'IsNumberEntries', 'SortAlgorithm', 'IsSortByPosition', 'Bracket']
exemples:
format['index']['Locale'] = 'en_US'
format['index']['Title'] = 'Bibliography'
format['index']['IsNumberEntries'] = True | False
format['index']['SortAlgorithm'] = 'alphanumeric'
format['index']['IsSortByPosition'] = True | False True = sorted in doc order ; False = sorted as in defined in SortKeys
format['index']['Bracket'] = '[]'
format['index']['SortKeys'] = ((4, True), (23, True)) = ( (field1,ascending),(field2,ascending), ... )
field1, field2 = zero based index of the field in CONST.OO_BIB_FIELDS ( 4 = Author ; 23 = Year )
ascending = True
descending = False
format['ordering']['ARTICLE'] = tuple of tuple = ('text',text,style) | ('field',field_name,style) | ('tab',value,TabStopFillCharacter) | ('tab',None,TabStopFillCharacter)
where style = bibOOo_italic | bibOOo_bold ...
for tabs, if value = None => right aligned
exemple : ( ('field', u'Author', 0), ('text', u' (', 0), ('field', u'Year', 0), ('text', u')', 0) ) = Einstein (1920)
this must be defined for all the references types = BIB_TYPE
you can use format['ordering']['JOURNAL'] = format['ordering']['ARTICLE'] etc.. to save space
"""
if not self.bib: return # if no bib, we it will crash
# set Bibliography service
self.bib.Locale = Locale(format['index']['Locale'][:2],format['index']['Locale'][-2:],'')
self.bib.SortAlgorithm = format['index']['SortAlgorithm']
self.bib.Title = format['index']['Title']
# set Bibliography FieldMaster
self.tfm.IsNumberEntries = bool(format['index']['IsNumberEntries'])
self.tfm.IsSortByPosition = bool(format['index']['IsSortByPosition'])
if format['index']['Bracket']:
self.tfm.BracketBefore = format['index']['Bracket'][0]
self.tfm.BracketAfter = format['index']['Bracket'][1]
else:
self.tfm.BracketBefore = ''
self.tfm.BracketAfter = ''
# set Bibliography FieldMaster SortKeys
tmp = [ ( PropertyValue('SortKey',0,i[0],DIRECT_VALUE) , PropertyValue('IsSortAscending',0,bool(i[1]),DIRECT_VALUE) ) for i in format['index']['SortKeys'] ]
self.tfm.SortKeys = tuple(tmp)
# set Bibliography service LevelFormat (=fields ordering)
for reftype in BIB_TYPE:
tmp=[]
for token in tuple(format['ordering'][reftype]):
if token[0] == 'text':
tmp.append((PropertyValue("TokenType",0,"TokenText",DIRECT_VALUE),\
PropertyValue("CharacterStyleName",0,self.__setStyleName(token[2]),DIRECT_VALUE),\
PropertyValue("Text",0,token[1],DIRECT_VALUE)))
elif token[0] == 'field':
tmp.append((PropertyValue("TokenType",0,"TokenBibliographyDataField",DIRECT_VALUE),\
PropertyValue("CharacterStyleName",0,self.__setStyleName(token[2]),DIRECT_VALUE),\
PropertyValue("BibliographyDataField",0,OO_BIBLIOGRAPHIC_FIELDS[token[1]],DIRECT_VALUE)))
elif token[0] == 'tab':
if token[1] != None:
# PropertyValue("TabStopPosition",0,uno.Any('long',token[1]),DIRECT_VALUE), # does not work!
# the two following lines are a workaround for this bug.
special = PropertyValue("TabStopPosition",0,token[1],DIRECT_VALUE)
special = self.transformer.transform( special, "Value" , uno.Any( "long", token[1] ) )
tmp.append((PropertyValue("TokenType",0,"TokenTabStop",DIRECT_VALUE),\
special,\
PropertyValue("TabStopFillCharacter",0,token[2],DIRECT_VALUE),\
PropertyValue("CharacterStyleName",0,"",DIRECT_VALUE)))
else:
tmp.append((PropertyValue("TokenType",0,"TokenTabStop",DIRECT_VALUE),\
PropertyValue("TabStopRightAligned",0,True,DIRECT_VALUE),\
PropertyValue("TabStopFillCharacter",0,token[2],DIRECT_VALUE),\
PropertyValue("CharacterStyleName",0,"",DIRECT_VALUE)))
else:
raise bibOOo_StyleError("Error in the style file: I can't understand a token like %r" %token.__repr__())
# the following two lines are a work around for bug #12504. See python-uno FAQ.
# since self.bib.LevelFormat.replaceByIndex(OO_BIBLIOGRAPHIC_TYPE[reftype]+1,tuple(tmp)) does not work
unoseq = uno.Any("[][]com.sun.star.beans.PropertyValue",tuple(tmp))
uno.invoke(self.bib.LevelFormat,"replaceByIndex",(BIBLIOGRAPHIC_TYPE[reftype]+1,unoseq))
# remark: +1 in the previous line since Index=1=ARTICLE, etc...
# ------------------------ CharStyles ------------------------------
def __createBaseStyles(self):
"""create base CharStyle for citations and index"""
charStyles = self.stylesList.getByName('CharacterStyles')
if not charStyles.hasByName(bibOOo_cit_baseCharStyleName):
self.createCharacterStyle(bibOOo_cit_baseCharStyleName,bibOOo_regular,bibOOo_normal,'')
if not charStyles.hasByName(bibOOo_index_baseCharStyleName):
self.createCharacterStyle(bibOOo_index_baseCharStyleName,bibOOo_regular,bibOOo_normal,'')
def __setStyleName(self,charstyle):
"""create a charStyle corresponding to charStyle if needed
return the style name as:
bibOOo_base<''|i><''|b><''|u><''|s|c> where i=italic, b=bold, u=underline, s=smallcaps, c=caps"""
# calculating style name
italic,bold,underline,caps = '','','',''
if charstyle & bibOOo_italic: italic = 'i'
if charstyle & bibOOo_bold: bold = 'b'
if charstyle & bibOOo_underline: underline = 'u'
if charstyle & bibOOo_caps: caps = 'c'
elif charstyle & bibOOo_smallcaps: caps = 's'
stylename = ''.join( (bibOOo_index_baseCharStyleName,italic,bold,underline,caps) ) # bibOOo_index_base ; bibOOo_index_basei ; etc...
# creating style if needed based on bibus_base
charStyles = self.stylesList.getByName('CharacterStyles')
if not charStyles.hasByName(stylename):
self.createCharacterStyle(stylename,charstyle,bibOOo_normal,bibOOo_index_baseCharStyleName)
return stylename
def createCharacterStyle(self,charstylename,charstyle,position,parentstylename=''):
"""
create an OOo CharacterStyle "com.sun.star.style.CharacterStyle" with the name charstylename if it does not exist
set its parent charstyle to parentstylename
set its value to style
where style is a combination of
from bibOOo_CONST import bibOOo_regular,bibOOo_italic,bibOOo_bold,bibOOo_caps,bibOOo_smallcaps,bibOOo_underline
from bibOOo_CONST import bibOOo_normal,bibOOo_exposant,bibOOo_indice
style = bibOOo_italic | bibOOo_bold = italic + bold
position = bibOOo_normal (=0) OR bibOOo_exposant (=1) OR bibOOo_indice (= -1)
"""
charStyles = self.stylesList.getByName('CharacterStyles')
if not charStyles.hasByName(charstylename):
tmp_style = self.model.createInstance('com.sun.star.style.CharacterStyle') # create a char style
charStyles.insertByName(charstylename,tmp_style) # insert the style in the document
if parentstylename: tmp_style.setParentStyle(parentstylename) # set parent charstyle
# we save the default values default from newly created style
basePosture,baseWeight,baseUnderline,baseCaps = tmp_style.CharPosture, tmp_style.CharWeight, tmp_style.CharUnderline, tmp_style.CharCaseMap
# setting only the specific attributes
if charstyle & bibOOo_italic and basePosture != ITALIC: tmp_style.CharPosture = ITALIC
elif not charstyle & bibOOo_italic and basePosture == ITALIC: tmp_style.CharPosture = FontSlantNone
#
if charstyle & bibOOo_bold and baseWeight != BOLD: tmp_style.CharWeight = BOLD
elif not charstyle & bibOOo_bold and baseWeight == BOLD: tmp_style.CharWeight = NORMAL
#
if charstyle & bibOOo_underline and baseUnderline != SINGLE: tmp_style.CharUnderline = SINGLE
elif not charstyle & bibOOo_underline and baseUnderline == SINGLE: tmp_style.CharUnderline = FontUnderlineNone
#
if charstyle & bibOOo_caps and baseCaps != UPPERCASE: tmp_style.CharCaseMap = UPPERCASE
elif charstyle & bibOOo_smallcaps and baseCaps != SMALLCAPS: tmp_style.CharCaseMap = SMALLCAPS
elif not charstyle & bibOOo_caps and not charstyle & bibOOo_smallcaps and baseCaps!=CaseMapNone: tmp_style.CharCaseMap = CaseMapNone
# CharEscapement = 101 means automatique exposant ; -101 indice ; 0 normal
tmp_style.CharEscapement = 101 * position # automatic
if tmp_style.CharEscapement:
tmp_style.CharEscapementHeight = 58 # value ok in French. Other languages ?
else:
tmp_style.CharEscapementHeight = 100
def updateCharacterStyle(self,charstylename,charstyle,position,parentstylename=''):
"""Reset values of style charstylename"""
charStyles = self.stylesList.getByName('CharacterStyles')
if charStyles.hasByName(charstylename):
tmp_style = charStyles.getByName(charstylename)
# reset all properties to default. Property list must be on alphabetical order!!!!
tmp_style.setPropertiesToDefault( ('CharCaseMap','CharEscapement','CharEscapementHeight','CharPosture','CharUnderline','CharWeight') )
if parentstylename: tmp_style.setParentStyle(parentstylename) # set parent charstyle
# we save the default values default from newly created style
basePosture,baseWeight,baseUnderline,baseCaps = tmp_style.CharPosture, tmp_style.CharWeight, tmp_style.CharUnderline, tmp_style.CharCaseMap
# setting only the specific attributes
if charstyle & bibOOo_italic and basePosture != ITALIC: tmp_style.CharPosture = ITALIC
elif not charstyle & bibOOo_italic and basePosture == ITALIC: tmp_style.CharPosture = FontSlantNone
#
if charstyle & bibOOo_bold and baseWeight != BOLD: tmp_style.CharWeight = BOLD
elif not charstyle & bibOOo_bold and baseWeight == BOLD: tmp_style.CharWeight = NORMAL
#
if charstyle & bibOOo_underline and baseUnderline != SINGLE: tmp_style.CharUnderline = SINGLE
elif not charstyle & bibOOo_underline and baseUnderline == SINGLE: tmp_style.CharUnderline = FontUnderlineNone
#
if charstyle & bibOOo_caps and baseCaps != UPPERCASE: tmp_style.CharCaseMap = UPPERCASE
elif charstyle & bibOOo_smallcaps and baseCaps != SMALLCAPS: tmp_style.CharCaseMap = SMALLCAPS
elif not charstyle & bibOOo_caps and not charstyle & bibOOo_smallcaps and baseCaps!=CaseMapNone: tmp_style.CharCaseMap = CaseMapNone
# CharEscapement = 101 means automatique exposant ; -101 indice ; 0 normal
tmp_style.CharEscapement = 101 * position # automatic
if tmp_style.CharEscapement:
tmp_style.CharEscapementHeight = 58 # value ok in French. Other languages ?
else:
tmp_style.CharEscapementHeight = 100
def styleRef(self,ref,charstylename = bibOOo_cit_baseCharStyleName):
"""Set the CharStyle of the bibOOo_Ref object to charstylename"""
c = ref.Anchor.Text.createTextCursorByRange(ref.Anchor)
c.CharStyleName = charstylename
def hilightCitations(self,hilight = True, citStyleName = bibOOo_cit_baseCharStyleName, background = 0x00FFFF00):
"""
Set the background of charStyle bibOOo_cit_baseCharStyleName
to background (default = yellow)
if hilight = True
elif hilight = False => background = Default
"""
charStyles = self.stylesList.getByName('CharacterStyles')
tmp_style = charStyles.getByName(bibOOo_cit_baseCharStyleName)
if hilight:
tmp_style.CharBackColor = background # background (default = yellow)
else:
tmp_style.setPropertyToDefault('CharBackColor') # normal background
def resetCitationStyle(self,charstylename = bibOOo_cit_baseCharStyleName):
"""
Reset the style of all the citations to bibOOo_cit_baseCharStyleName
This is needed if some citations have been inserted by another means than
bibOOo, for instance when the user has used the classical OOo interface.
"""
for ref in self:
c = ref.Anchor.Text.createTextCursorByRange(ref.Anchor)
c.CharStyleName = charstylename # reset the style it case it has changed
# ------------------------ Citations ------------------------------
def insertRef(self,ref,charstylename = bibOOo_cit_baseCharStyleName):
"""bibOOo_Ref object => insert at the current cursor position
using CharStyle charstylename
"""
if self.notInBibIndex(self.cursor):
c = self.cursor.Text.createTextCursorByRange(self.cursor) # Add at cursor location (replace selection)
c.CharStyleName = charstylename
c.Text.insertTextContent(c,ref.OOoRef,True)
self.cursor.setPropertyToDefault('CharStyleName') # reset cursor to default
else:
raise bibOOo_PositionError("Try to insert a reference in the Bibliographic index")
def createRef(self,ref=(),dbdict={}):
"""
create a bibOOo_Ref object from
a tuple/list = (identifier,BibliographicType,....,ISBN)
return an empty ARTICLE if ref=()
"""
return bibOOo_Ref(self,None,ref,dbdict)
# ------------------------ Freezing ------------------------------
def __fuse_range(self,numbers,cit_rangesep='-'):
"""numbers is a sorted list of integers.
We return a list of strings where 1,2,3 => '1(cit_rangesep)3' """
tmpranges,tmp = [],[]
tmp = [numbers[0]]
for i in range(1,len(numbers)):
if numbers[i] == numbers[i-1] + 1:
tmp.append(numbers[i])
continue
else:
if len(tmp) >=3:
tmpranges.append("%s-%s"%(tmp[0],tmp[-1])) # we fuse
else:
tmpranges.extend([repr(x) for x in tmp])
tmp = [numbers[i]]
if len(tmp) >=3:
tmpranges.append("%s%s%s"%(tmp[0],cit_rangesep,tmp[-1])) # we fuse
else:
tmpranges.extend([repr(x) for x in tmp])
return tmpranges
def __freezeNumberedCitations(self,messages = lambda i,x:sys.stdout.write('%s\n'%x),cit_sort=True,cit_fuse=True,cit_range=True,cit_separator='; ',cit_rangesep='-'):
"""
format the in-text citations (sort,range,style, etc..)
for numbers:
depending on cit_sort,cit_fuse,cit_range we replace
[1] [3][2][5] => [1-3,5] etc...
"""
messages(*(.7,msg7 ))
if not cit_fuse and not cit_sort:
for ref in self: # we don't mind about the order
c = ref.Anchor.Text.createTextCursorByRange(ref.Anchor.End)
ref.Anchor.Text.insertString(c,ref.getPresentation(0),True)
else:
refranges = self.getCitations(order='group')
for refs in refranges:
c = refs[0].Anchor.Text.createTextCursorByRange(refs[0].Anchor.End) # cursor at end
bb = self.tfm.BracketBefore
ba = self.tfm.BracketAfter
lbb = len(bb)
lba = -len(ba)
numbers = [ int(x.getPresentation(False)[lbb:len(x.getPresentation(False))+lba]) for x in refs ]
numbers.sort()
if cit_range:
ranges = self.__fuse_range(numbers,cit_rangesep) # calculate ranges
elif cit_sort:
ranges = [repr(x) for x in numbers]
else:
print("What are we doing here. bibOOo line 492")
# we insert in the text
refs[0].Anchor.Text.insertString(c,"%s%s%s" %(bb,cit_separator.join(ranges),ba),True)
def __freezeIdentifierCitations(self,messages = lambda i,x:sys.stdout.write('%s\n'%x),cit_fuse=True,cit_separator='; '):
"""
for identifiers:
we just copy/paste the identifiers with fusion if cit_fuse = True
"""
messages(*(.7,msg7 ))
if not cit_fuse:
for ref in self: # we don't mind about the order
c = ref.Anchor.Text.createTextCursorByRange(ref.Anchor.End)
ref.Anchor.Text.insertString(c,ref.getPresentation(0),True)
else:
refranges = self.getCitations(order='group')
for refs in refranges:
c = refs[0].Anchor.Text.createTextCursorByRange(refs[0].Anchor.End) # cursor at end
bb = self.tfm.BracketBefore
ba = self.tfm.BracketAfter
lbb = len(bb)
lba = -len(ba)
identifiers = [x.getPresentation(False)[lbb:len(x.getPresentation(False))+lba] for x in refs]
# we insert in the text
refs[0].Anchor.Text.insertString(c,"%s%s%s" %(bb,cit_separator.join(identifiers),ba),True)
def freezeCitations(self,messages = lambda i,x:sys.stdout.write('%s\n'%x),cit_sort=True,cit_fuse=True,cit_range=True,cit_separator='; ',cit_rangesep='-'):
"""
format the in-text citations (sort,range,style, etc..)
for numbers:
depending on cit_sort,cit_fuse,cit_range we replace
[1] [3][2][5] => [1-3,5] etc...
for identifiers:
we just copy/paste the identifiers with fusion if cit_fuse = True
"""
# we first freeze the citations
if self.tfm.IsNumberEntries:
self.__freezeNumberedCitations(messages,cit_sort,cit_fuse,cit_range,cit_separator,cit_rangesep)
else:
self.__freezeIdentifierCitations(messages,cit_fuse,cit_separator)
self.freezeIndex() # we freeze the index
self.tfm.dispose() # we remove all the citations
def freezeIndex(self):
"""
make a copy of the bibliographic index, then remove the index
Freeze the index by copying then pasting it.
"""
#Cut = '.uno:Cut' # 'slot:5710' # slot values. May change in the future ?
Copy = '.uno:Copy' # 'slot:5711'
Paste = '.uno:Paste' # 'slot:5712'
self.cursor.gotoRange(self.bib.Anchor,False) # select the bib
oUrl = URL()
oUrl.Complete = Copy # copy the current selection
countOfUrls,parsedUrl = self.oTrans.parseSmart( oUrl, ".uno" )
oDisp = self.controller.queryDispatch( parsedUrl, "", 0 )
if oDisp != None:
oDisp.dispatch(parsedUrl,())
# Move The cursor After the index
self.cursor.collapseToEnd()
self.cursor.goRight(1,False)
# Then paste the index
oUrl.Complete = Paste # paste the clipboard
countOfUrls,parsedUrl = self.oTrans.parseSmart( oUrl, ".uno" )
oDisp = self.controller.queryDispatch( parsedUrl, "", 0 )
if oDisp != None:
oDisp.dispatch(parsedUrl,())
self.text.insertControlCharacter(self.cursor,PARAGRAPH_BREAK,False)
# Dispose the index
self.bib.dispose()
def __newDoc(self):
"""Save the current doc if needed, then create a new one = copy"""
if self.model.isModified():
raise bibOOo_IOError("You must first save the current document")
if self.model.hasLocation():
self.model.store()
else:
raise bibOOo_IOError("Impossible to save the current document")
# we store the old name
name = self.model.getURL()
oURL=URL()
oURL.Complete=name
countOfUrls,parsedUrl = self.oTrans.parseSmart( oURL, "http" )
if countOfUrls:
name = os.path.splitext(parsedUrl.Name)[0]
else:
name = 'text'
#try:
# self.model.storeAsURL(self.model.getLocation(),())
#except IOException:
# raise bibOOo_IOError,"Impossible to save the current document"
"""We open a copy"""
fa = self.smgr.createInstance('com.sun.star.ucb.SimpleFileAccess')
inputstream = fa.openFileRead(self.model.getLocation())
pvDescriptor=(PropertyValue('InputStream',0,inputstream,DIRECT_VALUE),
PropertyValue('Hidden',0,True,DIRECT_VALUE))
self.model = self.desktop.loadComponentFromURL('private:stream', "_default",0,pvDescriptor) # reload the document from stream
self.controller = self.model.getCurrentController()
self.cursor = self.controller.getViewCursor() # Current ViewCursor
self.text = self.model.Text
# look for the first bibliography index or create a new one at the end if no biblio index present
for i in range(self.model.getDocumentIndexes().getCount()):
self.bib = self.model.getDocumentIndexes().getByIndex(i)
if self.bib.getServiceName() == 'com.sun.star.text.Bibliography':
break
# we get the com.sun.star.text.FieldMaster.Bibliography after eventually creating it
try:
self.tfm = self.model.getTextFieldMasters().getByName('com.sun.star.text.FieldMaster.Bibliography') # the biblio TextFieldMaster
except NoSuchElementException:
self.tfm = self.model.createInstance("com.sun.star.text.FieldMaster.Bibliography")
self.stylesList = self.model.getStyleFamilies() # styles XIndexAccess (XStyleFamiliesSupplier interface)
# we define a name and we but it in the DocumentInfo Title => in the Windows title
self.model.Title='%s-formatted' %name
#
return True
def finalize(self,messages = lambda i,x:sys.stdout.write('%s\n'%x),**kwds):
"""
finalize(self,cit_sort=True,cit_fuse=True,cit_range=True,cit_separator='; ')
make a copy of the current doc
make a copy of the bibliographic index, then remove the index
format the in-text citations (sort,range,style, etc..)
we print formatting messages in it
Default = None = stdout
"""
messages(*(.1,msg1))
if not self.__newDoc(): # we try to open a copy of the current doc.
raise bibOOo_IOError("Cannot save the current document") # error if not possible
messages(*(.2,msg2))
self.__createBaseStyles() # create the citation base style if needed
messages(*(.3,msg3))
self.hilightCitations(False) # we don't want to hilight for the final format
self.resetCitationStyle() # reset the style for the citations
# needed to 'freeze' the Anchors because of a bug in OOo ?
#fixAnchors = [ref.Anchor for ref in self.getCitations(order=None)] # bug OOo ?
#
# self.updateRef() # make ref uptodate
messages(*(.4,msg4))
if not self.bib: self.createIndex() # we create the index if needed
self.updateIndex() # update index
self.freezeCitations(messages = messages,**kwds)
messages(*(.9,msg5))
self.controller.Frame.ContainerWindow.setVisible(True) # make the new frame visible
self.controller.Frame.ComponentWindow.setVisible(True) # make the new doc visible
self.model.setModified(False) # disable the save button/toolbar icon
messages(*(1.0,msg6))
# ------------------------ Divers ------------------------------
def saveDoc(self,url=None):
"""
Store the current doc.
if url != None, we use it
Otherwise we save using the current location
"""
if not url:
if self.model.hasLocation():
self.model.store()
else:
raise bibOOo_IOError("Impossible to save the current document")
else:
if url.endswith(".sxw"):
pd = (PropertyValue("FilterName",0,"StarOffice XML (Writer)",DIRECT_VALUE),)
elif url.endswith(".odt"):
pd = (PropertyValue("FilterName",0,"writer8",DIRECT_VALUE),)
else: # default format
pd = ()
try:
self.model.storeAsURL(uno.systemPathToFileUrl(url),pd)
except IOException:
self.model.storeAsURL(uno.systemPathToFileUrl(url),()) # if it fails, we use default format
def activate(self):
"""Give focus to the current OOo document"""
frame = self.desktop.getCurrentFrame().getContainerWindow()
frame.setFocus()
def notInBibIndex(self,cursor):
"Return True if the range does not intercept with the Bibliographic index"
if self.bib != None and cursor.Text == self.bib.Anchor.Text: # must be in the same Text to be compared
curs = cursor.Text.createTextCursorByRange(cursor)
curs.goLeft(1,True)
b=cursor.Text.compareRegionStarts(curs.Start,self.bib.Anchor.End) != 1 # cursor after Bibliography index
curs.collapseToEnd()
curs.goRight(1,False)
a=cursor.Text.compareRegionEnds(curs.End,self.bib.Anchor.Start) != -1 # cursor before Bibliography index
return (a or b)
else:
return True # it is not in the same Text and cannot be compared
# the following code is a workaround to a python-uno bug that makes PropertyValue().Value=uno.Any('long',100) not possible.
# many thanks to Joerg Budischewski for this code.
# this is used to set "TabStopPosition" in the Bibliographic index
class MagicTransformer:
def __init__( self , ctx ):
self.inv = ctx.ServiceManager.createInstanceWithContext(
"com.sun.star.script.Invocation", ctx )
self.insp = ctx.ServiceManager.createInstanceWithContext(
"com.sun.star.beans.Introspection", ctx )
def transform( self, struct , propName, value ):
myinv = self.inv.createInstanceWithArguments( (struct,) )
access = self.insp.inspect( myinv )
method = access.getMethod( "setValue" , -1 )
uno.invoke( method, "invoke", ( myinv, ( propName , value ) ))
method = access.getMethod( "getMaterial" , -1 )
ret,dummy = method.invoke(myinv,() )
return ret
debian/patches/ 0000755 0000000 0000000 00000000000 12213151753 010615 5 ustar debian/patches/series 0000644 0000000 0000000 00000000111 12150457436 012032 0 ustar fix-img-tags.patch
install-screenshots.patch
fix-finalize-with-LO4.patch
debian/patches/fix-img-tags.patch 0000644 0000000 0000000 00000005351 11161432221 014127 0 ustar Author: Jan Beyer
Copyright: Copyright 2009 Jan Beyer
License: The same as the Bibus packaging.
Description: Remove width= and height= properties of all img-tags to avoid
distorted images.
--- bibus-1.4.3.2.orig/Docs/html/en/usingOOo.html
+++ bibus-1.4.3.2/Docs/html/en/usingOOo.html
@@ -36,8 +36,7 @@
Inserting citations
and bibliography
-
+
Inserting a citation
You just have to select your citation(s) and insert them
directly at the cursor location. Further explanation shouldnt be
@@ -137,7 +136,7 @@
Creating or editing a new style is very easy. When you select New
the following 'Style editor' will pop up.

+ border="0">
You
start with a style corresponding to the 'default' style of the style
menu. This is a fairly reasonable style and most of the time you just
@@ -152,7 +151,7 @@
easy to understand and correspond to the available choices in
OpenOffice.org.

+ border="0">
Fieds formatting
This Tab controls the filters that are applied to the record
fields before insertion in OpenOffice.org.
@@ -164,7 +163,7 @@
or
Marx G., Marx H., Marx Z., Marx Z. and Marx G.

+ alt="style_fields" border="0">
On
the left, there is a list of all the available reference types that
@@ -221,7 +220,7 @@
Authors. Title. Journal (Year) Volume: pages.
This can be done in this Tab.

+ alt="style_ordering" border="0">
Citation
Starting with Bibus pre1.0.0, there is a new tab called
citation.
@@ -234,8 +233,7 @@
of your current document.

+ name="Graphic10" alt="citation_formatting" border="0">
Here
is a short description:
debian/patches/install-screenshots.patch 0000644 0000000 0000000 00000001072 11252260625 015643 0 ustar Author: Jan Beyer
Copyright: Copyright 2009 Jan Beyer
License: The same as the Bibus packaging.
Description: Adds lines to Makefile to install the screenshots for the
documentation.
--- bibus-1.4.3.2.orig/Setup/Makefile
+++ bibus-1.4.3.2/Setup/Makefile
@@ -64,6 +64,8 @@
# copying docs in from Docs/html/en/ for bibus-doc-en
cd Docs;\
find html/en/* -type f -exec install -m644 '{}' -D $(datadir)/doc/bibus/'{}' ';'
+ cd Docs;\
+ find html/ScreenShots/* -type f -exec install -m644 '{}' -D $(datadir)/doc/bibus/'{}' ';'
endef
define compile
debian/patches/fix-finalize-with-LO4.patch 0000644 0000000 0000000 00000001410 12150457436 015573 0 ustar Author: Pierre Martineau (pmartino)
Copyright: Copyright 2013 Pierre Martineau
License: The same as the Bibus packaging.
Description: Make bibus' finalize work with LibreOffice 4
--- bibus-1.5.2/bibOOo/bibOOoBase.py 2011-11-28 20:26:19.000000000 +0000
+++ bibus-1.5.3/bibOOo/bibOOoBase.py 2013-05-03 22:20:38.000000000 +0000
@@ -764,7 +764,7 @@
self.tfm = self.model.createInstance("com.sun.star.text.FieldMaster.Bibliography")
self.stylesList = self.model.getStyleFamilies() # styles XIndexAccess (XStyleFamiliesSupplier interface)
# we define a name and we but it in the DocumentInfo Title => in the Windows title
- self.model.DocumentInfo.Title='%s-formatted' %name
+ self.model.Title='%s-formatted' %name
#
return True
debian/bibus.1 0000644 0000000 0000000 00000004030 11555346014 010355 0 ustar .\" Hey, EMACS: -*- nroff -*-
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH BIBUS 1 "April 25, 2011"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.SH NAME
bibus \- Bibus is a bibliographic database
.SH SYNOPSIS
.B bibus
.SH DESCRIPTION
The
.B bibus
command does not take any arguments or options at the moment.
.PP
.\" TeX users may be more comfortable with the \fB\fP and
.\" \fI\fP escape sequences to invoke bold face and italics,
.\" respectively.
\fBbibus\fP is a bibliographic database compatible with two database engines:
.br
- MySQL
.br
- SQLite .
.br
It features
.br
* hierarchical organization of the references with user-defined keys
.br
* multiuser-environment design (share databases between many users)
.br
* a search engine supporting live queries
.br
* on-line PubMed access
.br
* OpenOffice.org/LibreOffice connectivity: You can
.br
- insert references in an opened OpenOffice.org/LibreOffice text document
.br
- format the bibliography directly in Bibus
.br
- format the citations in Bibus.
.br
* foreign language support through unicode and gettext
.br
* import of PubMed (Medline), EndNote/Refer, RIS and BibTeX records.
.SH SEE ALSO
.BR libreoffice (1)
.br
.SH AUTHOR
\fBbibus\fP was written by Pierre Martineau
.PP
This manual page was written by Pierre Martineau
and updated by Jan Beyer for the Debian project
(but may be used by others).
debian/changelog 0000644 0000000 0000000 00000011451 12213151472 011040 0 ustar bibus (1.5.2-3) unstable; urgency=low
* bibOOo/bibOOoBase.py
- install patched upstream version to support LibreOffice 4.1.1
* Standards-Version 3.9.4
- updated debian/copyright format
-- Jan Beyer Sun, 08 Sep 2013 21:10:33 +0200
bibus (1.5.2-2) unstable; urgency=low
* Add a patch from upstream to enable finalizing with LibreOffice 4
-- Jan Beyer Sat, 25 May 2013 20:37:05 +0200
bibus (1.5.2-1) unstable; urgency=low
* New upstream release
- does not raise Python string exceptions any longer (Closes: #585214)
* Removed do-not-import-SearcheTBlast-py.patch, as functionality seems
fixed upstream
-- Jan Beyer Sun, 12 Feb 2012 17:33:09 +0100
bibus (1.5.1-5) unstable; urgency=low
* debian/control:
- Mention LibreOffice also here as an alternative to OpenOffice.org
-- Jan Beyer Fri, 30 Sep 2011 22:39:36 +0200
bibus (1.5.1-4) unstable; urgency=low
* Switch to dpkg-source 3.0 (quilt) format (debian/compat + control)
* Bumped Standards-Version to 3.9.2 (no changes needed)
* Switched to dh_python2 (Closes: #616745)
* debian/control:
- Added libreoffice-writer to Recommends (Closes: #637638)
* Adapting bibus.1 and bibus.cfg to LibreOffice
* Moved bibus-doc-en from Recommends to Suggests, as it is outdated
* debian/rules:
- Added recommended build-arch and build-indep targets
-- Jan Beyer Fri, 30 Sep 2011 21:39:32 +0200
bibus (1.5.1-3) unstable; urgency=low
* Added patch do-not-import-SearcheTBlast-py.patch to finally avoid any calls
to ClientForm.py (thanks to Jonathan Schultz for noticing and reporting the
problem)
-- Jan Beyer Sat, 12 Dec 2009 22:53:48 +0100
bibus (1.5.1-2) unstable; urgency=low
* Remove mentioning of eTBlast access from long description
-- Jan Beyer Sat, 28 Nov 2009 21:55:04 +0100
bibus (1.5.1-1) unstable; urgency=low
[ Jan Beyer ]
* New upstream release
- disables eTBlast search, as it stopped working due to an eTBlast-website
restructuring
* Removed ClientForm.py as it is not needed any longer (Closes: #555332)
* Installing patched man-page, where mention of eTBlast search capability is
removed
* Added lintian override for the script-not-executable warning on the
examples in /usr/share/bibus/LyX/examples
[ Charles Plessy ]
* Depend on python-wxgtk2.8 only as Bibus does not accept 2.6 anymore
-- Jan Beyer Sat, 28 Nov 2009 21:40:50 +0100
bibus (1.5.0-1) unstable; urgency=low
* New upstream release
- patch fix-BibTeXImport.patch dropped, as it is incorporated upstream
- patch fix-finalizing-issue.patch dropped, as it is incorporated upstream
- man-page debian/bibus.1 dropped, as it is incorporated upstream
-- Jan Beyer Mon, 12 Oct 2009 22:44:05 +0200
bibus (1.4.3.2-5) unstable; urgency=low
* Installing our own, updated, manpage again, which got lost in the previous
upload.
-- Jan Beyer Thu, 10 Sep 2009 22:06:41 +0200
bibus (1.4.3.2-4) unstable; urgency=low
* debian/rules:
- removed dh_desktop call, as it's deprecated
* Bumped standards version to 3.8.3 (no changes needed)
* Added two patches from upstream:
- fix-BibTeXImport.patch to improve BibTeX import
- fix-finalizing-issue.patch to make finalizing work with OOo 3.1
-- Jan Beyer Thu, 10 Sep 2009 21:27:13 +0200
bibus (1.4.3.2-3) unstable; urgency=low
[ Jan Beyer ]
* debian/control:
- bibus recommends no longer openoffice.org, but only openoffice.org-writer
(LP: #382448).
- bibus-doc-en now depends on w3m instead of lynx, which has a lower
priority.
[ Charles Plessy ]
* debian/control:
- Allow Jan to upload bibus (DM-Upload-Allowed: yes)
* Simplified debian/copyright according to the latest format draft.
-- Charles Plessy Sun, 07 Jun 2009 00:28:22 +0900
bibus (1.4.3.2-2) unstable; urgency=low
[ Jan Beyer ]
* Install also screenshots for documentation.
* Fix
tags in the documentation to no longer distort images.
* New standards version 3.8.1 needed addition of README.source.
* Changes in debian/control to follow new Python packaging policy:
- versioned build-dependencies for debhelper and python-central
- added current keyword to XS-Python-Version
* Removed debian/bibus.postinst, as its content was unnecessary.
[ Charles Plessy ]
* Corrected the Subversion URL in debian/control.
-- Charles Plessy Mon, 30 Mar 2009 10:40:05 +0900
bibus (1.4.3.2-1) unstable; urgency=low
[ Jan Beyer ]
* Initial release (Closes: #470887)
[ Charles Plessy ]
* Upload for Jan, who did all the work.
-- Charles Plessy Fri, 30 Jan 2009 13:14:38 +0900
debian/source/ 0000755 0000000 0000000 00000000000 12213151753 010466 5 ustar debian/source/format 0000644 0000000 0000000 00000000014 11331362316 011673 0 ustar 3.0 (quilt)
debian/rules 0000755 0000000 0000000 00000003464 12213151742 010253 0 ustar #!/usr/bin/make -f
# -*- makefile -*-
#export DH_VERBOSE=1
BIBUSDESTDIR = $(CURDIR)/debian/bibus
BIBUSDOCDESTDIR = $(CURDIR)/debian/bibus-doc-en
build: build-arch build-indep
build-arch: build-stamp
build-indep: build-stamp
build-stamp: configure
#dh_testdir
#touch build-stamp
clean:
dh_testdir
dh_testroot
find . -name '*.py[co]' -exec rm {} \;
dh_clean
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs usr/bin etc usr/share/applications usr/share/icons/hicolor/48x48/apps
# Add here commands to install the package into debian/bibus.
$(MAKE) -f Setup/Makefile install-files DESTDIR=$(BIBUSDESTDIR)/usr sysconfdir=$(BIBUSDESTDIR)/etc
chmod 755 $(BIBUSDESTDIR)/usr/share/bibus/bibus.py
rm -f $(BIBUSDESTDIR)/usr/share/bibus/bibusStart.py
rm -f $(BIBUSDESTDIR)/usr/share/doc/bibus/*
rm -f $(BIBUSDESTDIR)/usr/share/man/man1/bibus.1
dh_install -pbibus debian/bibus.cfg usr/share/bibus/
dh_install -pbibus Pixmaps/bibus.xpm usr/share/pixmaps/
dh_install -pbibus debian/bibOOoBase.py usr/share/bibus/bibOOo/
# installing bibus-doc-en
dh_installdirs -pbibus-doc-en usr/share/doc/bibus/html
$(MAKE) -f Setup/Makefile install-doc-en DESTDIR=$(BIBUSDOCDESTDIR)/usr
dh_link -pbibus-doc-en usr/share/common-licenses/GPL-2 usr/share/doc/bibus/html/en/license.txt
binary-indep: build install
dh_testdir -i
dh_testroot -i
dh_installchangelogs -i Docs/CHANGELOG
dh_installdocs -i
dh_installmenu -i
dh_installman -i debian/bibus.1
dh_lintian -i
dh_link -i usr/share/bibus/bibus.py usr/bin/bibus
dh_strip -i
dh_compress -i
dh_fixperms -i
dh_python2 -i
dh_installdeb -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i
# Build architecture-dependent files here.
binary-arch: build install
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
debian/bibus-doc-en.doc-base 0000644 0000000 0000000 00000000533 11137147064 013041 0 ustar Document: bibus
Title: Debian Bibus Manual
Author: Pierre Martineau
Abstract: This manual describes what Bibus is and how it can be used to
manage your bibliography on Debian systems.
Section: Data Management
Format: HTML
Index: /usr/share/doc/bibus/html/en/index.html
Files: /usr/share/doc/bibus/html/en/*.html
debian/bibus.cfg 0000644 0000000 0000000 00000000270 11555346071 010761 0 ustar [PATH]
docdir = /usr/share/doc/bibus/html
licence = /usr/share/common-licenses/GPL-2
localedir = /usr/share/locale
oopath = /usr/lib/libreoffice/program
systemconf = /etc/bibus.config
debian/watch 0000644 0000000 0000000 00000000101 11715765652 010226 0 ustar version=3
http://sf.net/bibus-biblio/bibus_(.+)\.orig\.tar\.gz
debian/compat 0000644 0000000 0000000 00000000002 11547415702 010372 0 ustar 6
debian/README.Debian 0000644 0000000 0000000 00000001664 11140406532 011232 0 ustar Bibus for Debian
================
Bibus uses by default the SQLite3 module which is contained in Python >= 2.5.
If you want to use older SQLite databases (version 2.x) you have to convert
these databases first.
You can check the version of your SQLite database by simply looking at the file
with your favourite text editor. Bibus' database files are saved in
~/.bibus/Databases/ and named something like DB_.sqlite.
The beginning of the file will tell you the database version. If it's a version
2.x database, then you can convert it by installing both sqlite and sqlite3
Debian packages and after that running the following command (being inside
~/.bibus/Databases/):
$ sqlite .dump | sqlite3 newSQLite3database.sqlite
This will create the file newSQLite3database.sqlite. You can then connect to
your database in Bibus via File/Connect.
-- Jan Beyer Mon, 26 Jan 2009 21:56:00 +0100
debian/control 0000644 0000000 0000000 00000004027 12213151472 010572 0 ustar Source: bibus
Section: science
Priority: optional
Maintainer: Debian Science Maintainers
Uploaders: Jan Beyer , Charles Plessy
Build-Depends: debhelper (>= 6.0.7~)
Build-Depends-Indep: python (>= 2.6.6-3~)
Standards-Version: 3.9.4
Homepage: http://bibus-biblio.sourceforge.net/
Vcs-Svn: svn://svn.debian.org/svn/debian-science/packages/bibus/trunk/
Vcs-Browser: http://svn.debian.org/viewsvn/debian-science/packages/bibus/trunk/
X-Python-Version: >= 2.5
Package: bibus
Architecture: all
Depends: ${misc:Depends}, ${python:Depends}, python-wxgtk2.8
Recommends: libreoffice-writer | openoffice.org-writer, python-uno
Suggests: python-mysqldb, unixodbc, odbcinst1 | odbcinst1debian2, libmyodbc | libsqliteodbc, bibus-doc-en
Description: bibliographic database
Bibus is a bibliographic database which has been developed with LibreOffice/
OpenOffice.org in mind. It can directly insert citations and format the
bibliographic index in an open OpenOffice.org Writer document. The main
features are
* hierarchical organization of the references with user-defined keys
* designed for multiuser-environments (share databases between users)
* a search engine supporting live queries
* on-line PubMed access
* import of PubMed (Medline), EndNote/Refer, RIS and BibTeX records.
.
Bibus will use an SQLite-database by default for storage (via the SQLite3
module available in Python >2.5). But it also supports MySQL-databases.
If you want to use a MySQL-database, make sure, that you have the
python-mysqldb package installed.
Package: bibus-doc-en
Architecture: all
Section: doc
Depends: w3m | www-browser, ${misc:Depends}
Suggests: bibus
Description: Bibus bibliographic database documentation
Bibus is a bibliographic database which has been developed with LibreOffice/
OpenOffice.org in mind and can directly insert citations and format the
bibliographic index in an open LibreOffice/OpenOffice.org Writer document.
.
This package contains the Bibus documentation.
debian/lintian/ 0000755 0000000 0000000 00000000000 12213151753 010624 5 ustar