summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vogelheim <dvo@openoffice.org>2001-11-08 18:06:46 +0000
committerDaniel Vogelheim <dvo@openoffice.org>2001-11-08 18:06:46 +0000
commit6af264883910fe31433b4164b1956f4f9ed75ecb (patch)
tree92e25a1b4b362c19452a9b99d891a1ed04a9c51b
parent45bac2d0be18bc9abf7b04a3e6e01bafab1aab4a (diff)
#94187# switch redline mode outside of XML export components (or inside for each of them)
(also fixes #94465#)
-rw-r--r--sw/source/filter/xml/wrtxml.cxx28
-rw-r--r--sw/source/filter/xml/xmlexp.cxx125
-rw-r--r--sw/source/filter/xml/xmlexp.hxx8
-rw-r--r--sw/source/filter/xml/xmlfmte.cxx36
4 files changed, 82 insertions, 115 deletions
diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx
index 03efcd017920..2c598751d5de 100644
--- a/sw/source/filter/xml/wrtxml.cxx
+++ b/sw/source/filter/xml/wrtxml.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: wrtxml.cxx,v $
*
- * $Revision: 1.37 $
+ * $Revision: 1.38 $
*
- * last change: $Author: mib $ $Date: 2001-10-19 14:30:12 $
+ * last change: $Author: dvo $ $Date: 2001-11-08 19:06:46 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -219,6 +219,9 @@ sal_uInt32 SwXMLWriter::_Write()
{ "UsePrettyPrinting", sizeof("UsePrettyPrinting")-1, 0,
&::getBooleanCppuType(),
beans::PropertyAttribute::MAYBEVOID, 0},
+ { "ShowChanges", sizeof("ShowChanges")-1, 0,
+ &::getBooleanCppuType(),
+ beans::PropertyAttribute::MAYBEVOID, 0 },
{ NULL, 0, 0, NULL, 0, 0 }
};
uno::Reference< beans::XPropertySet > xInfoSet(
@@ -280,6 +283,18 @@ sal_uInt32 SwXMLWriter::_Write()
aAny.setValue( &bUsePrettyPrinting, ::getBooleanCppuType() );
xInfoSet->setPropertyValue( sUsePrettyPrinting, aAny );
+ // save show redline mode ...
+ OUString sShowChanges(RTL_CONSTASCII_USTRINGPARAM("ShowChanges"));
+ sal_uInt16 nRedlineMode = pDoc->GetRedlineMode();
+ sal_Bool bShowChanges( IsShowChanges( nRedlineMode ) );
+ aAny.setValue( &bShowChanges, ::getBooleanCppuType() );
+ xInfoSet->setPropertyValue( sShowChanges, aAny );
+ // ... and hide redlines for export
+ nRedlineMode &= ~REDLINE_SHOW_MASK;
+ nRedlineMode |= REDLINE_SHOW_INSERT;
+ pDoc->SetRedlineMode( nRedlineMode );
+
+
// filter arguments
// - graphics + object resolver for styles + content
// - status indicator
@@ -433,6 +448,15 @@ sal_uInt32 SwXMLWriter::_Write()
SvXMLEmbeddedObjectHelper::Destroy( pObjectHelper );
xObjectResolver = 0;
+ // restore redline mode
+ aAny = xInfoSet->getPropertyValue( sShowChanges );
+ nRedlineMode = pDoc->GetRedlineMode();
+ nRedlineMode &= ~REDLINE_SHOW_MASK;
+ nRedlineMode |= REDLINE_SHOW_INSERT;
+ if ( *(sal_Bool*)aAny.getValue() )
+ nRedlineMode |= REDLINE_SHOW_DELETE;
+ pDoc->SetRedlineMode( nRedlineMode );
+
if (xStatusIndicator.is())
{
xStatusIndicator->end();
diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx
index b50f1c35eeed..3cee02a28030 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.64 $
+ * $Revision: 1.65 $
*
- * last change: $Author: dvo $ $Date: 2001-10-09 18:07:06 $
+ * last change: $Author: dvo $ $Date: 2001-11-08 19:06:46 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -254,7 +254,6 @@ SwXMLExport::SwXMLExport(sal_uInt16 nExportFlags) :
#endif
bBlock( sal_False ),
bShowProgress( sal_True ),
- bRedlineModeSaved( sal_False ),
sNumberFormat(RTL_CONSTASCII_USTRINGPARAM("NumberFormat")),
sIsProtected(RTL_CONSTASCII_USTRINGPARAM("IsProtected")),
sCell(RTL_CONSTASCII_USTRINGPARAM("Cell"))
@@ -278,7 +277,6 @@ SwXMLExport::SwXMLExport( const Reference< XModel >& rModel, SwPaM& rPaM,
bExportWholeDoc( bExpWholeDoc ),
bExportFirstTableOnly( bExpFirstTableOnly ),
bShowProgress( bShowProg ),
- bRedlineModeSaved( sal_False ),
sNumberFormat(RTL_CONSTASCII_USTRINGPARAM("NumberFormat")),
sIsProtected(RTL_CONSTASCII_USTRINGPARAM("IsProtected")),
sCell(RTL_CONSTASCII_USTRINGPARAM("Cell"))
@@ -392,10 +390,6 @@ sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass )
SetExtended( bExtended );
-#ifdef XML_CORE_API
- SetCurPaM( rPaM, bExportWholeDoc, bExportFirstTableOnly );
-#endif
-
SwDocStat aDocStat( pDoc->GetDocStat() );
if( (getExportFlags() & EXPORT_META) != 0 )
{
@@ -486,25 +480,47 @@ sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass )
}
}
+ // set redline mode if we export STYLES or CONTENT, unless redline
+ // mode is taken care of outside (through info XPropertySet)
+ sal_Bool bSaveRedline =
+ ( (getExportFlags() & (EXPORT_CONTENT|EXPORT_STYLES)) != 0 );
+ if( bSaveRedline )
+ {
+ // if the info property set has a ShowChanges property,
+ // then change tracking is taken care of on the outside,
+ // so we don't have to!
+ Reference<XPropertySet> rInfoSet = getExportInfo();
+ if( rInfoSet.is() )
+ {
+ OUString sShowChanges( RTL_CONSTASCII_USTRINGPARAM("ShowChanges"));
+ bSaveRedline = ! rInfoSet->getPropertySetInfo()->hasPropertyByName(
+ sShowChanges );
+ }
+ }
+ sal_uInt16 nRedlineMode = 0;
+ bSavedShowChanges = IsShowChanges( pDoc->GetRedlineMode() );
+ if( bSaveRedline )
+ {
+ // now save and switch redline mode
+ nRedlineMode = pDoc->GetRedlineMode();
+ pDoc->SetRedlineMode(
+ ( nRedlineMode & REDLINE_SHOW_MASK ) | REDLINE_INSERT );
+ }
+
sal_uInt32 nRet = SvXMLExport::exportDoc( eClass );
+ // now we can restore the redline mode (if we changed it previously)
+ if( bSaveRedline )
+ {
+ pDoc->SetRedlineMode( nRedlineMode );
+ }
+
+
if( pGraphicResolver )
SvXMLGraphicHelper::Destroy( pGraphicResolver );
if( pEmbeddedResolver )
SvXMLEmbeddedObjectHelper::Destroy( pEmbeddedResolver );
- DBG_ASSERT(! bRedlineModeSaved,
- "If Redline mode was changed + saved, it should have been restored by now!")
-
-#ifdef XML_CORE_API
- if( pCurPaM )
- {
- while( pCurPaM->GetNext() != pCurPaM )
- delete pCurPaM->GetNext();
- delete pCurPaM;
- pCurPam = 0;
- }
-#endif
ASSERT( !pTableLines, "there are table columns infos left" );
return nRet;
@@ -615,7 +631,20 @@ void SwXMLExport::GetViewSettings(Sequence<PropertyValue>& aProps)
pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaHeight") );
pValue[nIndex++].Value <<= rRect.GetHeight();
- sal_Bool bShowRedlineChanges = IsShowChanges ( pDoc->GetRedlineMode() );
+ // "show redline mode" cannot simply be read from the document
+ // since it gets changed during execution. If it's in the info
+ // XPropertySet, we take it from there.
+ sal_Bool bShowRedlineChanges = bSavedShowChanges;
+ Reference<XPropertySet> xInfoSet( getExportInfo() );
+ if ( xInfoSet.is() )
+ {
+ OUString sShowChanges( RTL_CONSTASCII_USTRINGPARAM( "ShowChanges" ));
+ if( xInfoSet->getPropertySetInfo()->hasPropertyByName( sShowChanges ) )
+ {
+ bShowRedlineChanges = *(sal_Bool*) xInfoSet->
+ getPropertyValue( sShowChanges ).getValue();
+ }
+ }
pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ShowRedlineChanges") );
pValue[nIndex++].Value.setValue( &bShowRedlineChanges, ::getBooleanCppuType() );
@@ -650,29 +679,6 @@ void SwXMLExport::GetConfigurationSettings( Sequence < PropertyValue >& rProps)
void SwXMLExport::_ExportContent()
{
-#ifdef XML_CORE_API
- // export field declarations
-// pTextFieldExport->ExportFieldDeclarations();
-
- // export all PaMs
- SwPaM *pPaM = pOrigPaM;
- sal_Bool bContinue = sal_True;
- do
- {
- // export PaM content
- ExportCurPaM( bExportWholeDoc );
-
- bContinue = pPaM->GetNext() != pOrigPaM;
-
- if( bContinue )
- {
- pPaM = (SwPaM *)pPaM->GetNext();
- SetCurPaM( *pPaM, bExportWholeDoc, bExportFirstTableOnly );
- }
-
- } while( bContinue );
-#else
-
// export forms
Reference<XDrawPageSupplier> xDrawPageSupplier(GetModel(), UNO_QUERY);
if (xDrawPageSupplier.is())
@@ -692,29 +698,12 @@ void SwXMLExport::_ExportContent()
}
}
- // switch redline mode (and preserve old mode) before exporting content
- OUString sShowChanges(RTL_CONSTASCII_USTRINGPARAM("ShowChanges"));
Reference<XPropertySet> xPropSet(GetModel(), UNO_QUERY);
if (xPropSet.is())
{
- Any aAny;
-
- if (! bRedlineModeSaved)
- {
- // record old mode
- aAny = xPropSet->getPropertyValue(sShowChanges);
- bRedlineModeValue = *(sal_Bool*)aAny.getValue();
- bRedlineModeSaved = sal_True;
-
- // set mode to false
- sal_Bool bTmp = sal_False;
- aAny.setValue(&bTmp, ::getBooleanCppuType());
- xPropSet->setPropertyValue(sShowChanges, aAny);
- }
-
OUString sTwoDigitYear(RTL_CONSTASCII_USTRINGPARAM("TwoDigitYear"));
- aAny = xPropSet->getPropertyValue( sTwoDigitYear );
+ Any aAny = xPropSet->getPropertyValue( sTwoDigitYear );
aAny <<= (sal_Int16)1930;
sal_Int16 nYear;
@@ -735,18 +724,6 @@ void SwXMLExport::_ExportContent()
GetTextParagraphExport()->exportFramesBoundToPage( bShowProgress );
GetTextParagraphExport()->exportText( xText, bShowProgress );
-
- // restore redline mode
- if (bRedlineModeSaved && xPropSet.is())
- {
- // set mode to previous value
- Any aAny;
- aAny.setValue(&bRedlineModeValue, ::getBooleanCppuType());
- xPropSet->setPropertyValue(sShowChanges, aAny);
-
- bRedlineModeSaved = sal_False;
- }
-#endif
}
diff --git a/sw/source/filter/xml/xmlexp.hxx b/sw/source/filter/xml/xmlexp.hxx
index b74cf28373c6..d3a445fe3769 100644
--- a/sw/source/filter/xml/xmlexp.hxx
+++ b/sw/source/filter/xml/xmlexp.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlexp.hxx,v $
*
- * $Revision: 1.25 $
+ * $Revision: 1.26 $
*
- * last change: $Author: mib $ $Date: 2001-11-01 13:49:08 $
+ * last change: $Author: dvo $ $Date: 2001-11-08 19:06:46 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -122,9 +122,7 @@ class SwXMLExport : public SvXMLExport
sal_Bool bBlock : 1; // export text block?
sal_Bool bExportFirstTableOnly : 1;
sal_Bool bShowProgress : 1;
-
- sal_Bool bRedlineModeSaved; /// saved old redline mode?
- sal_Bool bRedlineModeValue; /// value of redline mode
+ sal_Bool bSavedShowChanges : 1;
void _InitItemExport();
void _FinitItemExport();
diff --git a/sw/source/filter/xml/xmlfmte.cxx b/sw/source/filter/xml/xmlfmte.cxx
index a3ec9e9325cd..1bde371f152b 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.32 $
+ * $Revision: 1.33 $
*
- * last change: $Author: dvo $ $Date: 2001-11-05 13:45:33 $
+ * last change: $Author: dvo $ $Date: 2001-11-08 19:06:46 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -327,40 +327,8 @@ XMLPageExport* SwXMLExport::CreatePageExport()
void SwXMLExport::_ExportMasterStyles()
{
- // switch redline mode (and preserve old mode) before exporting content
- OUString sShowChanges(RTL_CONSTASCII_USTRINGPARAM("ShowChanges"));
- Reference<XPropertySet> xPropSet(GetModel(), UNO_QUERY);
- if (xPropSet.is() && ! bRedlineModeSaved)
- {
- if (xPropSet.is())
- {
- // record old mode
- Any aAny = xPropSet->getPropertyValue(sShowChanges);
- bRedlineModeValue = *(sal_Bool*)aAny.getValue();
- bRedlineModeSaved = sal_True;
-
- // set mode to false
- sal_Bool bTmp = sal_False;
- aAny.setValue(&bTmp, ::getBooleanCppuType());
- xPropSet->setPropertyValue(sShowChanges, aAny);
- }
- }
-
// export master styles
GetPageExport()->exportMasterStyles( sal_False );
-
- // restore redline mode (but only if we aren't going to do so
- // anyway in exportContent)
- if (bRedlineModeSaved && xPropSet.is() &&
- ((getExportFlags() & EXPORT_CONTENT) == 0) )
- {
- // set mode to previous value
- Any aAny;
- aAny.setValue(&bRedlineModeValue, ::getBooleanCppuType());
- xPropSet->setPropertyValue(sShowChanges, aAny);
-
- bRedlineModeSaved = sal_False;
- }
}
// ---------------------------------------------------------------------