summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xmloff/inc/xmlkywd.hxx5
-rw-r--r--xmloff/source/text/XMLRedlineExport.cxx38
-rw-r--r--xmloff/source/text/XMLRedlineExport.hxx7
-rw-r--r--xmloff/source/text/XMLTrackedChangesImportContext.cxx63
-rw-r--r--xmloff/source/text/XMLTrackedChangesImportContext.hxx10
-rw-r--r--xmloff/source/text/txtimp.cxx20
6 files changed, 125 insertions, 18 deletions
diff --git a/xmloff/inc/xmlkywd.hxx b/xmloff/inc/xmlkywd.hxx
index ef5b12c787c0..0c6066290032 100644
--- a/xmloff/inc/xmlkywd.hxx
+++ b/xmloff/inc/xmlkywd.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlkywd.hxx,v $
*
- * $Revision: 1.143 $
+ * $Revision: 1.144 $
*
- * last change: $Author: bm $ $Date: 2001-04-25 16:26:22 $
+ * last change: $Author: dvo $ $Date: 2001-05-02 16:19:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1701,6 +1701,7 @@ XML_CONSTASCII_ACTION( sXML_top_values, "top values");
XML_CONSTASCII_ACTION( sXML_trace_dependents, "trace-dependents" );
XML_CONSTASCII_ACTION( sXML_trace_errors, "trace-errors" );
XML_CONSTASCII_ACTION( sXML_trace_precedents, "trace-precedents" );
+XML_CONSTASCII_ACTION( sXML_track_changes, "track-changes" );
XML_CONSTASCII_ACTION( sXML_tracked_changes, "tracked-changes" );
XML_CONSTASCII_ACTION( sXML_tracked_changes_view_settings, "tracked-changes-view-settings" );
XML_CONSTASCII_ACTION( sXML_transform , "transform" );
diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx
index 28f9a21f149c..2a61902c92fb 100644
--- a/xmloff/source/text/XMLRedlineExport.cxx
+++ b/xmloff/source/text/XMLRedlineExport.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XMLRedlineExport.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: dvo $ $Date: 2001-03-09 14:13:18 $
+ * last change: $Author: dvo $ $Date: 2001-05-02 16:19:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -166,6 +166,8 @@ XMLRedlineExport::XMLRedlineExport(SvXMLExport& rExp) :
sEndRedline(RTL_CONSTASCII_USTRINGPARAM("EndRedline")),
sRedlineIdentifier(RTL_CONSTASCII_USTRINGPARAM("RedlineIdentifier")),
sIsInHeaderFooter(RTL_CONSTASCII_USTRINGPARAM("IsInHeaderFooter")),
+ sRedlineProtectionKey(RTL_CONSTASCII_USTRINGPARAM("RedlineProtectionKey")),
+ sRecordChanges(RTL_CONSTASCII_USTRINGPARAM("RecordChanges")),
rExport(rExp),
aChangeMap(),
pCurrentChangesList(NULL)
@@ -286,9 +288,35 @@ void XMLRedlineExport::ExportChangesListElements()
{
Reference<XEnumerationAccess> aEnumAccess = xSupplier->getRedlines();
- // only export if we actually have redlines
- if (aEnumAccess->hasElements())
+ // redline protection key
+ Sequence<sal_Int8> aKey;
+ Reference<XPropertySet> aDocPropertySet( rExport.GetModel(),
+ uno::UNO_QUERY );
+ aDocPropertySet->getPropertyValue( sRedlineProtectionKey ) >>= aKey;
+ if ( aKey.getLength() > 0 )
+ {
+ OUStringBuffer aBuffer;
+ SvXMLUnitConverter::encodeBase64( aBuffer, aKey );
+ rExport.AddAttribute( XML_NAMESPACE_TEXT, sXML_protection_key,
+ aBuffer.makeStringAndClear() );
+ }
+
+ // redlining enabled?
+ sal_Bool bEnabled = *(sal_Bool*)aDocPropertySet->getPropertyValue(
+ sRecordChanges ).getValue();
+
+ // only export if we have redlines or attributes
+ if ( aEnumAccess->hasElements() || bEnabled || aKey.getLength() > 0 )
{
+
+ // export only if we have changes, but tracking is not enabled
+ if ( !bEnabled != !aEnumAccess->hasElements() )
+ {
+ rExport.AddAttributeASCII(
+ XML_NAMESPACE_TEXT, sXML_track_changes,
+ bEnabled ? sXML_true : sXML_false );
+ }
+
// changes container element
SvXMLElementExport aChanges(rExport, XML_NAMESPACE_TEXT,
sXML_tracked_changes,
@@ -665,5 +693,3 @@ void XMLRedlineExport::ExportStartOrEndRedline(
DBG_ERROR("XPropertySet expected");
}
}
-
-
diff --git a/xmloff/source/text/XMLRedlineExport.hxx b/xmloff/source/text/XMLRedlineExport.hxx
index bd7a1c6cf9ba..ba1f0e4a8a73 100644
--- a/xmloff/source/text/XMLRedlineExport.hxx
+++ b/xmloff/source/text/XMLRedlineExport.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XMLRedlineExport.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: dvo $ $Date: 2001-03-09 14:13:18 $
+ * last change: $Author: dvo $ $Date: 2001-05-02 16:19:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -127,7 +127,8 @@ class XMLRedlineExport
const ::rtl::OUString sEndRedline;
const ::rtl::OUString sRedlineIdentifier;
const ::rtl::OUString sIsInHeaderFooter;
-
+ const ::rtl::OUString sRedlineProtectionKey;
+ const ::rtl::OUString sRecordChanges;
const ::rtl::OUString sChangePrefix;
diff --git a/xmloff/source/text/XMLTrackedChangesImportContext.cxx b/xmloff/source/text/XMLTrackedChangesImportContext.cxx
index 9fd828344a9b..e2a415cb467d 100644
--- a/xmloff/source/text/XMLTrackedChangesImportContext.cxx
+++ b/xmloff/source/text/XMLTrackedChangesImportContext.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XMLTrackedChangesImportContext.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dvo $ $Date: 2001-01-10 20:51:01 $
+ * last change: $Author: dvo $ $Date: 2001-05-02 16:19:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -71,6 +71,10 @@
#include <com/sun/star/uno/Reference.h>
#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
+#include <com/sun/star/uno/Sequence.h>
+#endif
+
#ifndef _XMLOFF_XMLIMP_HXX
#include "xmlimp.hxx"
#endif
@@ -79,6 +83,14 @@
#include "xmlnmspe.hxx"
#endif
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
#ifndef _XMLOFF_XMLKYWD_HXX
#include "xmlkywd.hxx"
#endif
@@ -86,6 +98,7 @@
using ::rtl::OUString;
using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
using ::com::sun::star::xml::sax::XAttributeList;
@@ -104,6 +117,52 @@ XMLTrackedChangesImportContext::~XMLTrackedChangesImportContext()
{
}
+void XMLTrackedChangesImportContext::StartElement(
+ const Reference<XAttributeList> & xAttrList )
+{
+ sal_Bool bTrackChanges = sal_True;
+ Sequence<sal_Int8> aProtectionKey;
+
+ // scan for text:track-changes and text:protection-key attributes
+ sal_Int16 nLength = xAttrList->getLength();
+ for( sal_Int16 i = 0; i < nLength; i++ )
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
+
+ if ( XML_NAMESPACE_TEXT == nPrefix )
+ {
+ if ( sLocalName.equalsAsciiL( sXML_track_changes,
+ sizeof(sXML_track_changes)-1 ) )
+ {
+ sal_Bool bTmp;
+ if( SvXMLUnitConverter::convertBool(
+ bTmp, xAttrList->getValueByIndex(i)) )
+ {
+ bTrackChanges = bTmp;
+ }
+ }
+ else if ( sLocalName.equalsAsciiL( sXML_protection_key,
+ sizeof(sXML_protection_key)-1 ) )
+ {
+ Sequence<sal_Int8> aSequence;
+ SvXMLUnitConverter::decodeBase64(
+ aSequence, xAttrList->getValueByIndex(i));
+ if ( aSequence.getLength() > 0 )
+ {
+ aProtectionKey = aSequence;
+ }
+ }
+ }
+ }
+
+ // set tracked changes
+ GetImport().GetTextImport()->SetRecordChanges( bTrackChanges );
+ GetImport().GetTextImport()->SetChangesProtectionKey( aProtectionKey );
+}
+
+
SvXMLImportContext* XMLTrackedChangesImportContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
diff --git a/xmloff/source/text/XMLTrackedChangesImportContext.hxx b/xmloff/source/text/XMLTrackedChangesImportContext.hxx
index 8884ca9b5f9d..f52851e51454 100644
--- a/xmloff/source/text/XMLTrackedChangesImportContext.hxx
+++ b/xmloff/source/text/XMLTrackedChangesImportContext.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XMLTrackedChangesImportContext.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dvo $ $Date: 2001-01-10 20:51:01 $
+ * last change: $Author: dvo $ $Date: 2001-05-02 16:19:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -100,7 +100,11 @@ public:
~XMLTrackedChangesImportContext();
- SvXMLImportContext* CreateChildContext(
+ virtual void StartElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual SvXMLImportContext* CreateChildContext(
sal_uInt16 nPrefix,
const ::rtl::OUString& rLocalName,
const ::com::sun::star::uno::Reference<
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index ed13f688ed70..99591c71065a 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: txtimp.cxx,v $
*
- * $Revision: 1.68 $
+ * $Revision: 1.69 $
*
- * last change: $Author: mib $ $Date: 2001-04-30 09:04:04 $
+ * last change: $Author: dvo $ $Date: 2001-05-02 16:19:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1916,6 +1916,22 @@ void XMLTextImportHelper::RedlineAdjustStartNodeCursor(
// dummy implementation: do nothing
}
+void XMLTextImportHelper::SetShowChanges( sal_Bool bShowChanges )
+{
+ // dummy implementation: do nothing
+}
+
+void XMLTextImportHelper::SetRecordChanges( sal_Bool bRecordChanges )
+{
+ // dummy implementation: do nothing
+}
+void XMLTextImportHelper::SetChangesProtectionKey(
+ const Sequence<sal_Int8> & rProtectionKey )
+{
+ // dummy implementation: do nothing
+}
+
+
OUString XMLTextImportHelper::GetOpenRedlineId()
{
return sOpenRedlineIdentifier;