summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vogelheim <dvo@openoffice.org>2001-01-19 18:58:53 +0000
committerDaniel Vogelheim <dvo@openoffice.org>2001-01-19 18:58:53 +0000
commit050037d06fc85bcc928d39fd1baf6d7b39723cdb (patch)
tree8d8e3e48bbcc16e2fb0df55ad1773c6a14d7b089
parent2cda7630c20c98633749ad54757dadc5e67a3b10 (diff)
- finished Redline im/export
-rw-r--r--sw/source/filter/xml/XMLRedlineImportHelper.cxx374
-rw-r--r--sw/source/filter/xml/XMLRedlineImportHelper.hxx35
-rw-r--r--sw/source/filter/xml/xmlexp.cxx6
-rw-r--r--sw/source/filter/xml/xmlfmte.cxx5
-rw-r--r--sw/source/filter/xml/xmltbli.cxx7
-rw-r--r--sw/source/filter/xml/xmltexti.cxx32
-rw-r--r--sw/source/filter/xml/xmltexti.hxx18
7 files changed, 376 insertions, 101 deletions
diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
index 4b7a0d2bd545..11f7f6152995 100644
--- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx
+++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XMLRedlineImportHelper.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dvo $ $Date: 2001-01-10 21:01:48 $
+ * last change: $Author: dvo $ $Date: 2001-01-19 19:58:53 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -106,15 +106,25 @@
#include <com/sun/star/text/XWordCursor.hpp>
#endif
+#ifndef _COM_SUN_STAR_FRAME_XMODEL_HPP_
+#include <com/sun/star/frame/XModel.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_TEXT_XTEXTDOCUMENT_HPP_
+#include <com/sun/star/text/XTextDocument.hpp>
+#endif
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using ::rtl::OUString;
+using ::com::sun::star::frame::XModel;
using ::com::sun::star::text::XTextCursor;
using ::com::sun::star::text::XTextRange;
using ::com::sun::star::text::XText;
+using ::com::sun::star::text::XTextDocument;
using ::com::sun::star::text::XWordCursor;
using ::com::sun::star::lang::XUnoTunnel;
// collision with tools/DateTime: use UNO DateTime as util::DateTime
@@ -122,6 +132,139 @@ using ::com::sun::star::lang::XUnoTunnel;
//
+// a few helper functions
+//
+
+SwDoc* lcl_GetDocViaTunnel( Reference<XTextCursor> & rCursor )
+{
+ Reference<XUnoTunnel> xTunnel( rCursor, UNO_QUERY);
+ DBG_ASSERT( xTunnel.is(), "missing XUnoTunnel for Cursor" );
+ SwXTextCursor* pSwXCursor =
+ (SwXTextCursor*)xTunnel->getSomething(SwXTextCursor::getUnoTunnelId());
+ DBG_ASSERT( NULL != pSwXCursor, "SwXTextCursor missing" );
+ return pSwXCursor->GetDoc();
+}
+
+SwDoc* lcl_GetDocViaTunnel( Reference<XTextRange> & rRange )
+{
+ Reference<XUnoTunnel> xTunnel(rRange, UNO_QUERY);
+ DBG_ASSERT(xTunnel.is(), "Can't tunnel XTextRange");
+ SwXTextRange *pRange =
+ (SwXTextRange*)xTunnel->getSomething(SwXTextRange::getUnoTunnelId());
+ DBG_ASSERT( NULL != pRange, "SwXTextRange missing" );
+ return pRange->GetDoc();
+}
+
+
+//
+// XTextRangeOrNodeIndexPosition: store a position into the text
+// *either* as an XTextRange or as an SwNodeIndex. The reason is that
+// me must store either pointers to StartNodes (because redlines may
+// start on start nodes) or to a text position, and there appears to
+// be no existing type that could do both. Things are complicated by
+// the matter that (e.g in section import) we delete a few characters,
+// which may cause bookmarks (as used by XTextRange) to be deleted.
+//
+
+class XTextRangeOrNodeIndexPosition
+{
+ Reference<XTextRange> xRange;
+ SwNodeIndex* pIndex;
+
+public:
+ XTextRangeOrNodeIndexPosition();
+ ~XTextRangeOrNodeIndexPosition();
+
+ void Set( Reference<XTextRange> & rRange );
+ void Set( SwNodeIndex& rIndex );
+ void SetAsNodeIndex( Reference<XTextRange> & rRange );
+
+ void GetPosition(SwPosition& rPos);
+ SwDoc* GetDoc();
+
+ sal_Bool IsValid();
+};
+
+XTextRangeOrNodeIndexPosition::XTextRangeOrNodeIndexPosition() :
+ xRange(NULL),
+ pIndex(NULL)
+{
+}
+
+XTextRangeOrNodeIndexPosition::~XTextRangeOrNodeIndexPosition()
+{
+ delete pIndex;
+}
+
+void XTextRangeOrNodeIndexPosition::Set( Reference<XTextRange> & rRange )
+{
+ xRange = rRange;
+ if (NULL != pIndex)
+ {
+ delete pIndex;
+ pIndex = NULL;
+ }
+}
+
+void XTextRangeOrNodeIndexPosition::Set( SwNodeIndex& rIndex )
+{
+ if (NULL != pIndex)
+ delete pIndex;
+
+ pIndex = new SwNodeIndex(rIndex);
+ xRange = NULL;
+}
+
+void XTextRangeOrNodeIndexPosition::SetAsNodeIndex(
+ Reference<XTextRange> & rRange )
+{
+ // XTextRange -> XTunnel -> SwXTextRange
+ SwDoc* pDoc = lcl_GetDocViaTunnel(rRange);
+
+ // SwXTextRange -> PaM
+ SwUnoInternalPaM aPaM(*pDoc);
+ sal_Bool bSuccess = SwXTextRange::XTextRangeToSwPaM( aPaM, rRange);
+ DBG_ASSERT(bSuccess, "illegal range");
+
+ // PaM -> Index
+ Set(aPaM.GetPoint()->nNode);
+}
+
+void XTextRangeOrNodeIndexPosition::GetPosition(SwPosition& rPos)
+{
+ DBG_ASSERT(IsValid(), "Can't get Position");
+
+ // create PAM from start cursor (if no node index is present)
+ if (NULL == pIndex)
+ {
+ SwUnoInternalPaM aUnoPaM(*GetDoc());
+ sal_Bool bSuccess = SwXTextRange::XTextRangeToSwPaM(aUnoPaM, xRange);
+ DBG_ASSERT(bSuccess, "illegal range");
+
+ rPos = *aUnoPaM.GetPoint();
+ }
+ else
+ {
+ rPos.nNode = *pIndex;
+ rPos.nContent.Assign( rPos.nNode.GetNode().GetCntntNode(), 0 );
+ }
+}
+
+SwDoc* XTextRangeOrNodeIndexPosition::GetDoc()
+{
+ DBG_ASSERT(IsValid(), "Can't get Doc");
+
+ return (NULL != pIndex) ? pIndex->GetNodes().GetDoc() : lcl_GetDocViaTunnel(xRange);
+}
+
+sal_Bool XTextRangeOrNodeIndexPosition::IsValid()
+{
+ return ( xRange.is() || (pIndex != NULL) );
+}
+
+
+
+//
// RedlineInfo: temporary storage for redline data
//
@@ -139,10 +282,13 @@ public:
OUString sComment; /// change comment string
util::DateTime aDateTime; /// change DateTime
- /// start pos of anchor (may be empty)
- Reference<XTextRange> xAnchorStartPos;
- /// end pos of anchor (may be empty)
- Reference<XTextRange> xAnchorEndPos;
+ // each position can may be either empty, an XTextRange, or an SwNodeIndex
+
+ // start pos of anchor (may be empty)
+ XTextRangeOrNodeIndexPosition aAnchorStart;
+
+ // end pos of anchor (may be empty)
+ XTextRangeOrNodeIndexPosition aAnchorEnd;
/// index of content node (maybe NULL)
SwNodeIndex* pContentIndex;
@@ -156,8 +302,8 @@ RedlineInfo::RedlineInfo() :
sAuthor(),
sComment(),
aDateTime(),
- xAnchorStartPos(),
- xAnchorEndPos(),
+ aAnchorStart(),
+ aAnchorEnd(),
pContentIndex(NULL),
pNextRedline(NULL)
{
@@ -170,17 +316,19 @@ RedlineInfo::~RedlineInfo()
}
-
//
// XMLRedlineImportHelper
//
-XMLRedlineImportHelper::XMLRedlineImportHelper() :
- sEmpty(),
- sInsertion(RTL_CONSTASCII_USTRINGPARAM(sXML_insertion)),
- sDeletion(RTL_CONSTASCII_USTRINGPARAM(sXML_deletion)),
- sFormatChange(RTL_CONSTASCII_USTRINGPARAM(sXML_format_change)),
- aRedlineMap()
+XMLRedlineImportHelper::XMLRedlineImportHelper(
+ sal_Bool bNoRedlinesPlease) :
+ sEmpty(),
+ sInsertion(RTL_CONSTASCII_USTRINGPARAM(sXML_insertion)),
+ sDeletion(RTL_CONSTASCII_USTRINGPARAM(sXML_deletion)),
+ sFormatChange(RTL_CONSTASCII_USTRINGPARAM(sXML_format_change)),
+ aRedlineMap(),
+ bIgnoreRedlines(bNoRedlinesPlease),
+ pSaveDoc(NULL)
{
}
@@ -196,6 +344,17 @@ XMLRedlineImportHelper::~XMLRedlineImportHelper()
delete pInfo;
}
aRedlineMap.clear();
+
+ // set redline mode; first set bogus redline mode with
+ // SetRedlineMode_intern(), so that the subsequent
+ // SetRedlineMode() is forced to update the data structures
+ if (NULL != pSaveDoc)
+ {
+ // TODO: get "real" Redline mode from the saved document
+ sal_uInt16 nRedlineMode = REDLINE_ON | REDLINE_SHOW_MASK;
+ pSaveDoc->SetRedlineMode_intern(~nRedlineMode);
+ pSaveDoc->SetRedlineMode(nRedlineMode);
+ }
}
void XMLRedlineImportHelper::Add(
@@ -275,12 +434,7 @@ Reference<XTextCursor> XMLRedlineImportHelper::CreateRedlineTextSection(
if (aRedlineMap.end() != aFind)
{
// get document from old cursor (via tunnel)
- Reference<XUnoTunnel> xTunnel( xOldCursor, UNO_QUERY);
- DBG_ASSERT( xTunnel.is(), "missing XUnoTunnel for Cursor" );
- SwXTextCursor* pOldCursor = (SwXTextCursor*)xTunnel->getSomething(
- SwXTextCursor::getUnoTunnelId());
- DBG_ASSERT( NULL != pOldCursor, "SwXTextCursor missing" );
- SwDoc* pDoc = pOldCursor->GetDoc();
+ SwDoc* pDoc = lcl_GetDocViaTunnel(xOldCursor);
// create text section for redline
SwTxtFmtColl *pColl = pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD);
@@ -313,20 +467,29 @@ Reference<XTextCursor> XMLRedlineImportHelper::CreateRedlineTextSection(
void XMLRedlineImportHelper::SetCursor(
const OUString& rId,
sal_Bool bStart,
- Reference<XTextRange> & rRange)
+ Reference<XTextRange> & rRange,
+ sal_Bool bIsOutsideOfParagraph)
{
RedlineMapType::iterator aFind = aRedlineMap.find(rId);
if (aRedlineMap.end() != aFind)
{
// RedlineInfo found; now set Cursor
RedlineInfo* pInfo = aFind->second;
- if (bStart)
+ if (bIsOutsideOfParagraph)
{
- pInfo->xAnchorStartPos = rRange;
+ // outside of paragraph: remember SwNodeIndex
+ if (bStart)
+ pInfo->aAnchorStart.SetAsNodeIndex(rRange);
+ else
+ pInfo->aAnchorEnd.SetAsNodeIndex(rRange);
}
else
{
- pInfo->xAnchorEndPos = rRange;
+ // inside of a paragraph: use regular XTextRanges (bookmarks)
+ if (bStart)
+ pInfo->aAnchorStart.Set(rRange);
+ else
+ pInfo->aAnchorEnd.Set(rRange);
}
// if this Cursor was the last missing info, we insert the
@@ -342,9 +505,78 @@ void XMLRedlineImportHelper::SetCursor(
// else: unknown Id -> ignore
}
+void XMLRedlineImportHelper::AdjustStartNodeCursor(
+ const OUString& rId, /// ID used in RedlineAdd() call
+ sal_Bool bStart,
+ Reference<XTextRange> & rRange)
+{
+ DBG_ASSERT(bStart,"End nodes not supported. Can't happen anyway, can it?");
+ if (!bStart)
+ return;
+
+ RedlineMapType::iterator aFind = aRedlineMap.find(rId);
+ if (aRedlineMap.end() != aFind)
+ {
+ // RedlineInfo found; now set Cursor
+ RedlineInfo* pInfo = aFind->second;
+
+ DBG_ASSERT(pInfo->aAnchorStart.IsValid(),
+ "AdjustStartNodeCursor may only be called after SetCursor");
+ if (!pInfo->aAnchorStart.IsValid())
+ return;
+
+ SwDoc* pDoc = pInfo->aAnchorStart.GetDoc();
+
+
+ // OK, we have the redline. Now find the proper start node for
+ // the range and do the necessary sanity checking. If
+ // successful, set the start node as the new redline start.
+ SwUnoInternalPaM aUnoPaM(*pDoc);
+ sal_Bool bSuccess = SwXTextRange::XTextRangeToSwPaM(aUnoPaM, rRange);
+ DBG_ASSERT(bSuccess, "illegal range");
+
+ // adjustment only supported for tables and sections
+ SwNode& rNode = aUnoPaM.GetPoint()->nNode.GetNode();
+ SwNode* pTblNode = rNode.FindTableNode();
+ SwNode* pSctnNode = rNode.FindSectionNode();
+ if ((NULL != pTblNode) || (NULL != pSctnNode))
+ {
+ // find the closest
+ SwNode* pStartNode = NULL;
+ if (pTblNode == NULL)
+ {
+ pStartNode = pSctnNode;
+ }
+ else if (pSctnNode == NULL)
+ {
+ pStartNode = pTblNode;
+ }
+ else
+ {
+ pStartNode = (pSctnNode->GetIndex() > pTblNode->GetIndex()) ?
+ pSctnNode : pTblNode;
+ }
+
+ // pStartNode is our start node candidate. Now check for distance
+ // between previous start node
+ // ...skip for now
+
+ SwNodeIndex aIndex(pStartNode->GetDoc()->GetNodes(),
+ pStartNode->GetIndex());
+ pInfo->aAnchorStart.Set(aIndex);
+ }
+ // else: we are neither inside a table nor a section -> ignore
+
+
+ }
+ // else: can't find redline -> ignore
+}
+
+
inline sal_Bool XMLRedlineImportHelper::IsReady(RedlineInfo* pRedline)
{
- return pRedline->xAnchorEndPos.is() && pRedline->xAnchorStartPos.is();
+ return ( pRedline->aAnchorEnd.IsValid() &&
+ pRedline->aAnchorStart.IsValid() );
}
void XMLRedlineImportHelper::InsertIntoDocument(RedlineInfo* pRedlineInfo)
@@ -352,55 +584,57 @@ void XMLRedlineImportHelper::InsertIntoDocument(RedlineInfo* pRedlineInfo)
DBG_ASSERT(NULL != pRedlineInfo, "need redline info");
DBG_ASSERT(IsReady(pRedlineInfo), "redline info not complete yet!");
- // get the document (from the XTextRange implementation object)
- Reference<XUnoTunnel> xTunnel(pRedlineInfo->xAnchorStartPos, UNO_QUERY);
- DBG_ASSERT(xTunnel.is(), "Can't tunnel -> can't get document");
- SwXTextRange *pRange = (SwXTextRange*)xTunnel->getSomething(
- SwXTextRange::getUnoTunnelId());
- SwDoc *pDoc = pRange->GetDoc();
-
- // create PAM from start+end cursors
- SwUnoInternalPaM aStartPaM(*pDoc);
- sal_Bool bSuccess =
- SwXTextRange::XTextRangeToSwPaM( aStartPaM,
- pRedlineInfo->xAnchorStartPos);
- DBG_ASSERT(bSuccess, "illegal range");
- SwUnoInternalPaM aEndPaM(*pDoc);
- bSuccess =
- SwXTextRange::XTextRangeToSwPaM( aEndPaM,
- pRedlineInfo->xAnchorEndPos);
- DBG_ASSERT(bSuccess, "illegal range");
+ // Insert the Redline as described by pRedlineInfo into the
+ // document. If we are in insert mode, don't insert any redlines
+ // (and delete 'deleted' inline redlines)
- // now create the PaM for the redline
- SwPaM aPaM(*aStartPaM.GetPoint(), *aEndPaM.GetPoint());
-
- // create redline (using redline data, which gets copied in SwRedline())
- SwRedlineData* pRedlineData = ConvertRedline(pRedlineInfo, pDoc);
- SwRedline* pRedline = new SwRedline(*pRedlineData, aPaM);
- delete pRedlineData;
+ // get the document (from one of the positions)
+ SwDoc* pDoc = pRedlineInfo->aAnchorStart.GetDoc();
- // set content node (if necessary)
- if (NULL != pRedlineInfo->pContentIndex)
+ // now create the PaM for the redline
+ SwPaM aPaM(pDoc->GetNodes().GetEndOfContent());
+ pRedlineInfo->aAnchorStart.GetPosition(*aPaM.GetPoint());
+ aPaM.SetMark();
+ pRedlineInfo->aAnchorEnd.GetPosition(*aPaM.GetPoint());
+
+ // check for:
+ // a) bIgnoreRedline (e.g. insert mode)
+ // b) illegal PaM range (CheckNodesRange())
+ if ( bIgnoreRedlines ||
+ !CheckNodesRange( aPaM.GetPoint()->nNode,
+ aPaM.GetMark()->nNode,
+ sal_True ) )
{
- pRedline->SetContentIdx(pRedlineInfo->pContentIndex);
+ // ignore redline (e.g. file loaded in insert mode):
+ // delete 'deleted' redlines and forget about the whole thing
+ if (REDLINE_DELETE == pRedlineInfo->eType)
+ {
+ pDoc->Delete(aPaM);
+ }
}
+ else
+ {
+ // regular file loading: insert redline
-// HACK: DO NOT COMMIT!
-// HACK: DO NOT COMMIT!
-// HACK: DO NOT COMMIT!
-// HACK: DO NOT COMMIT!
-// HACK: DO NOT COMMIT!
-// HACK: DO NOT COMMIT!
-// HACK: DO NOT COMMIT!
-// HACK: DO NOT COMMIT!
-// HACK: DO NOT COMMIT!
- pDoc->SetRedlineMode(REDLINE_ON);
- pDoc->AppendRedline(pRedline);
- pDoc->SetRedlineMode(REDLINE_IGNORE);
-
-// instead of:
- // and insert into document
- // pDoc->AppendRedline(pRedline);
+ // create redline (using pRedlineData which gets copied in SwRedline())
+ SwRedlineData* pRedlineData = ConvertRedline(pRedlineInfo, pDoc);
+ SwRedline* pRedline = new SwRedline(*pRedlineData, aPaM);
+ delete pRedlineData;
+
+ // set content node (if necessary)
+ if (NULL != pRedlineInfo->pContentIndex)
+ {
+ pRedline->SetContentIdx(pRedlineInfo->pContentIndex);
+ }
+
+ // set redline mode (withou doing the associated book-keeping)
+ pDoc->SetRedlineMode_intern(REDLINE_ON);
+ pDoc->AppendRedline(pRedline);
+ pDoc->SetRedlineMode_intern(REDLINE_NONE);
+
+ // also: save document
+ pSaveDoc = pDoc;
+ }
}
SwRedlineData* XMLRedlineImportHelper::ConvertRedline(
diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.hxx b/sw/source/filter/xml/XMLRedlineImportHelper.hxx
index 4e3179da863a..613522fd5adc 100644
--- a/sw/source/filter/xml/XMLRedlineImportHelper.hxx
+++ b/sw/source/filter/xml/XMLRedlineImportHelper.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XMLRedlineImportHelper.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dvo $ $Date: 2001-01-10 21:01:48 $
+ * last change: $Author: dvo $ $Date: 2001-01-19 19:58:53 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -90,6 +90,7 @@ class SwDoc;
namespace com { namespace sun { namespace star {
namespace text { class XTextCursor; }
namespace text { class XTextRange; }
+ namespace frame { class XModel; }
} } }
@@ -104,9 +105,17 @@ class XMLRedlineImportHelper
RedlineMapType aRedlineMap;
+ /// if sal_True, no redlines should be inserted into document
+ /// (This typically happen when a document is loaded in 'insert'-mode.)
+ sal_Bool bIgnoreRedlines;
+
+ /// save the document (for destructor)
+ SwDoc* pSaveDoc;
+
public:
- XMLRedlineImportHelper();
+ XMLRedlineImportHelper(
+ sal_Bool bIgnoreRedlines); /// ignore redlines mode
virtual ~XMLRedlineImportHelper();
/// create a redline object
@@ -130,9 +139,27 @@ public:
/// Set start or end position for a redline in the text body.
/// Accepts XTextRange objects.
void SetCursor(
- const ::rtl::OUString& rId, /// ID used to RedlineAdd() call
+ const ::rtl::OUString& rId, /// ID used in RedlineAdd() call
sal_Bool bStart, /// start or end Range
::com::sun::star::uno::Reference< /// the actual XTextRange
+ ::com::sun::star::text::XTextRange> & rRange,
+ /// text range is (from an XML view) outside of a paragraph
+ /// (i.e. before a table)
+ sal_Bool bIsOusideOfParagraph);
+
+ /**
+ * Adjust the start (end) position for a redline that begins in a
+ * start node. It takes the cursor positions _inside_ the redlined
+ * element (e.g. section or table).
+ *
+ * We will do sanity checking of the given text range: It will
+ * only be considered valid if it points to the next text node
+ * after the position given in a previous SetCursor */
+ void AdjustStartNodeCursor(
+ const ::rtl::OUString& rId, /// ID used in RedlineAdd() call
+ sal_Bool bStart,
+ /// XTextRange _inside_ a table/section
+ ::com::sun::star::uno::Reference<
::com::sun::star::text::XTextRange> & rRange);
private:
diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx
index ba96d84e67c3..c2c104a1beac 100644
--- a/sw/source/filter/xml/xmlexp.cxx
+++ b/sw/source/filter/xml/xmlexp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlexp.cxx,v $
*
- * $Revision: 1.17 $
+ * $Revision: 1.18 $
*
- * last change: $Author: mib $ $Date: 2001-01-18 12:39:02 $
+ * last change: $Author: dvo $ $Date: 2001-01-19 19:58:53 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -376,7 +376,7 @@ void SwXMLExport::_ExportContent()
} while( bContinue );
#else
- GetTextParagraphExport()->exportTrackedChanges();
+ GetTextParagraphExport()->exportTrackedChanges( sal_False );
GetTextParagraphExport()->exportTextDeclarations();
Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
Reference < XText > xText = xTextDoc->getText();
diff --git a/sw/source/filter/xml/xmlfmte.cxx b/sw/source/filter/xml/xmlfmte.cxx
index 24e5a0472e5c..715a7cc4e207 100644
--- a/sw/source/filter/xml/xmlfmte.cxx
+++ b/sw/source/filter/xml/xmlfmte.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlfmte.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: mib $ $Date: 2001-01-08 09:44:55 $
+ * last change: $Author: dvo $ $Date: 2001-01-19 19:58:53 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -244,6 +244,7 @@ void SwXMLExport::_ExportAutoStyles()
GetPageExport()->collectAutoStyles( sal_False );
// exported in _ExportContent
+ GetTextParagraphExport()->exportTrackedChanges( sal_True );
Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
Reference < XText > xText = xTextDoc->getText();
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 5f1f80aa4007..36d8759dd389 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmltbli.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: os $ $Date: 2001-01-12 16:15:12 $
+ * last change: $Author: dvo $ $Date: 2001-01-19 19:58:53 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1181,6 +1181,9 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport,
Reference < XText> xText( xCell, UNO_QUERY );
xOldCursor = GetImport().GetTextImport()->GetCursor();
GetImport().GetTextImport()->SetCursor( xText->createTextCursor() );
+
+ // take care of open redlines for tables
+ GetImport().GetTextImport()->RedlineAdjustStartNodeCursor(sal_True);
}
if( pXTable )
{
diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx
index 1d73475dd131..76379e670861 100644
--- a/sw/source/filter/xml/xmltexti.cxx
+++ b/sw/source/filter/xml/xmltexti.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmltexti.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: dvo $ $Date: 2001-01-10 21:01:48 $
+ * last change: $Author: dvo $ $Date: 2001-01-19 19:58:53 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -233,23 +233,23 @@ void SwXMLTextImportHelper::RedlineAdd(
const OUString& rComment,
const util::DateTime& rDateTime)
{
+ // create redline helper on demand
if (NULL == pRedlineHelper)
- pRedlineHelper = new XMLRedlineImportHelper();
+ pRedlineHelper = new XMLRedlineImportHelper(IsInsertMode());
pRedlineHelper->Add(rType, rId, rAuthor, rComment, rDateTime);
}
Reference<XTextCursor> SwXMLTextImportHelper::RedlineCreateText(
- Reference<XTextCursor> xOldCursor,
+ Reference<XTextCursor> & rOldCursor,
const OUString& rId)
{
Reference<XTextCursor> xRet;
if (NULL != pRedlineHelper)
{
- xRet = pRedlineHelper->CreateRedlineTextSection(xOldCursor, rId);
+ xRet = pRedlineHelper->CreateRedlineTextSection(rOldCursor, rId);
}
- // else: NOOP
return xRet;
}
@@ -257,13 +257,23 @@ Reference<XTextCursor> SwXMLTextImportHelper::RedlineCreateText(
void SwXMLTextImportHelper::RedlineSetCursor(
const OUString& rId,
sal_Bool bStart,
- Reference<XTextRange> & rRange)
+ sal_Bool bIsOutsideOfParagraph)
{
if (NULL != pRedlineHelper)
+ pRedlineHelper->SetCursor(rId, bStart, GetCursor()->getStart(),
+ bIsOutsideOfParagraph);
+ // else: ignore redline (wasn't added before, else we'd have a helper)
+}
+
+void SwXMLTextImportHelper::RedlineAdjustStartNodeCursor(
+ sal_Bool bStart)
+{
+ OUString& rId = GetOpenRedlineId();
+ if ((NULL != pRedlineHelper) && (rId.getLength() > 0))
{
- pRedlineHelper->SetCursor(rId, bStart, rRange);
+ pRedlineHelper->AdjustStartNodeCursor(rId, bStart,
+ GetCursor()->getStart());
+ ResetOpenRedlineId();
}
- // else: NOOP
- // (redline needs to be RedlineAdd() (which creates the pRedlineHelper)
- // before, so without pRedlineHelper this is a NOOP anyway
+ // else: ignore redline (wasn't added before, or no open redline ID
}
diff --git a/sw/source/filter/xml/xmltexti.hxx b/sw/source/filter/xml/xmltexti.hxx
index 1cf127328ac1..a38745c7e1fd 100644
--- a/sw/source/filter/xml/xmltexti.hxx
+++ b/sw/source/filter/xml/xmltexti.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmltexti.hxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: dvo $ $Date: 2001-01-10 21:01:48 $
+ * last change: $Author: dvo $ $Date: 2001-01-19 19:58:53 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -97,7 +97,7 @@ public:
// redlining helper methods
- // (override to provide the real implementation)
+ // (here is the real implementation)
virtual void RedlineAdd(
const ::rtl::OUString& rType, /// redline type (insert, del,... )
const ::rtl::OUString& rId, /// use to identify this redline
@@ -107,14 +107,14 @@ public:
virtual ::com::sun::star::uno::Reference<
::com::sun::star::text::XTextCursor> RedlineCreateText(
::com::sun::star::uno::Reference< /// needed to get the document
- ::com::sun::star::text::XTextCursor> xOldCursor,
+ ::com::sun::star::text::XTextCursor> & rOldCursor,
const ::rtl::OUString& rId); /// ID used to RedlineAdd() call
virtual void RedlineSetCursor(
- const ::rtl::OUString& rId, /// ID used to RedlineAdd() call
- sal_Bool bStart, /// start or end Cursor
- ::com::sun::star::uno::Reference<
- ::com::sun::star::text::XTextRange> & rRange);
-
+ const ::rtl::OUString& rId, /// ID used to RedlineAdd() call
+ sal_Bool bStart, /// start or end Cursor
+ sal_Bool bIsOutsideOfParagraph);
+ virtual void RedlineAdjustStartNodeCursor(
+ sal_Bool bStart);
};
#endif // _XMLTEXTI_HXX