/************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: DocumentMerger.java,v $ * $Revision: 1.4 $ * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 * only, as published by the Free Software Foundation. * * OpenOffice.org 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 Lesser General Public License version 3 for more details * (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU Lesser General Public License * version 3 along with OpenOffice.org. If not, see * * for a copy of the LGPLv3 License. * ************************************************************************/ package org.openoffice.xmerge; /** *

A DocumentMerger can merge changes from a modified * "Device" Document to the assigned original * "Office" Document.

* *

Merge is useful when an OfficeDocument * is converted to a "Device" Document format, * and the "Device" Document version is modified. * Those changes can be merged back into the original * OfficeDocument with the merger. The merger is capable * of doing this even if the "Device" format is lossy in * comparison to the OfficeDocument format.

* *

The ConverterCapabilities object is what the * DocumentMerger utilizes to know how the "Office" * Document tags are supported in the "Device" * format.

* *

The DocumentMerger object is created by a * the DocumentMergerFactory {@link * org.openoffice.xmerge.DocumentMergerFactory#createDocumentMerger * createDocumenMerger} method. When it is constructed, the * "Original Office" Document object is * passed in to be used as input.

* * @author Herbie Ong * @see org.openoffice.xmerge.PluginFactory * @see org.openoffice.xmerge.DocumentMergerFactory * @see org.openoffice.xmerge.ConverterCapabilities */ public interface DocumentMerger { /** *

This method will find the changes that had happened * in the modifiedDoc Document * object given the designated original Document.

* *

Note that this process may need the knowledge of the * conversion process since some conversion process are lossy. * Items/Data that are lost during the conversion process are not * classified as changes. The main target of this method * is to apply the changes done in modifiedDoc * into the assigned original Document object, thus * it also will try to preserve items that were originally in * the original Document, but never got transferred * during the * {@link org.openoffice.xmerge.DocumentSerializer#serialize * serialize} process/method call. After this method call, the * original Document object will contain the changes * applied.

* *

This method may or may not be thread-safe. * Also, it is expected that the user uses only one instance * of a DocumentMerger object per merge process. * Create another DocumentMerger object for another * merge process.

* * @param modifiedDoc device Document object. * * @throws MergeException If any merge error occurs. */ public void merge(Document modifiedDoc) throws MergeException; }