def sheetCopyToDoc(self, source, target, pos, rename, values): src_doc = self._get_doc(source.Doc) doc = target.Doc mode = 1 if values: mode = 2 index = pos if pos < 0: index = doc.getSheets().getCount() + pos + 1 if source.Sheet: names = self._get_sheets_names(source.Sheet, src_doc, False) else: names = self.getSheetsNames(src_doc) for name in names: new_name = name if rename: new_name = self._get_new_name(doc, name) doc.getSheets().insertNewByName(new_name, index) sheet = doc.getSheets().getByName(new_name) sheet.link(src_doc.URL, name, '', '', mode) sheet.setLinkMode(0) doc.getCurrentController().setActiveSheet(sheet) dp = sheet.getDrawPage() src_dp = src_doc.getSheets().getByName(name).getDrawPage() src_doc.getCurrentController().setFormDesignMode(True) for i in range(src_dp.getCount()): src_img = src_dp.getByIndex(i) src_doc.getCurrentController().select(src_img) comun.copy(src_doc) new = comun.paste(doc) new.getByIndex(0).setPosition(src_img.getPosition()) src_doc.getCurrentController().setFormDesignMode(False) doc.getCurrentController().setFormDesignMode(False) return
def copy(self, doc): comun.copy(doc) return