Kaydet (Commit) 1e6d829f authored tarafından Daniel Vogelheim's avatar Daniel Vogelheim

- changed: change tracking comments are now represented as a sequence of <text:p> elements

- changed: moved XMLStringBufferImportContext into files of it's own
üst 9ba98c3c
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: txtfldi.hxx,v $ * $RCSfile: txtfldi.hxx,v $
* *
* $Revision: 1.10 $ * $Revision: 1.11 $
* *
* last change: $Author: dvo $ $Date: 2001-01-15 17:19:30 $ * last change: $Author: dvo $ $Date: 2001-01-24 16:49:47 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -1335,39 +1335,6 @@ protected: ...@@ -1335,39 +1335,6 @@ protected:
}; };
/**
* Import all text into a string buffer. Paragraph elements (<text:p>)
* are recognized and cause a return character (0x0a) to be added.
*/
class XMLStringBufferImportContext : public SvXMLImportContext
{
::rtl::OUStringBuffer& rTextBuffer;
public:
TYPEINFO();
XMLStringBufferImportContext(
SvXMLImport& rImport,
sal_uInt16 nPrefix,
const ::rtl::OUString& sLocalName,
::rtl::OUStringBuffer& rBuffer);
virtual ~XMLStringBufferImportContext();
virtual SvXMLImportContext *CreateChildContext(
USHORT nPrefix,
const ::rtl::OUString& rLocalName,
const ::com::sun::star::uno::Reference<
::com::sun::star::xml::sax::XAttributeList >& xAttrList );
virtual void Characters(
const ::rtl::OUString& rChars );
virtual void EndElement();
};
/** Import an annotation field (<text:annotation>) */ /** Import an annotation field (<text:annotation>) */
class XMLAnnotationImportContext : public XMLTextFieldImportContext class XMLAnnotationImportContext : public XMLTextFieldImportContext
{ {
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: XMLChangeInfoContext.cxx,v $ * $RCSfile: XMLChangeInfoContext.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-01-24 16:49:51 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -67,6 +67,10 @@ ...@@ -67,6 +67,10 @@
#include "XMLChangedRegionImportContext.hxx" #include "XMLChangedRegionImportContext.hxx"
#endif #endif
#ifndef _XMLOFF_XMLSTRINGBUFFERIMPORTCONTEXT_HXX
#include "XMLStringBufferImportContext.hxx"
#endif
#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_ #ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
#include <com/sun/star/uno/Reference.h> #include <com/sun/star/uno/Reference.h>
#endif #endif
...@@ -116,11 +120,7 @@ XMLChangeInfoContext::~XMLChangeInfoContext() ...@@ -116,11 +120,7 @@ XMLChangeInfoContext::~XMLChangeInfoContext()
void XMLChangeInfoContext::StartElement( void XMLChangeInfoContext::StartElement(
const Reference<XAttributeList> & xAttrList) const Reference<XAttributeList> & xAttrList)
{ {
OUString sAuthor; // process attributes: chg-author, chg-date-time
OUString sComment;
OUString sDateTime;
// process attributes: chg-author, chg-comment, chg-date-time
sal_Int16 nLength = xAttrList->getLength(); sal_Int16 nLength = xAttrList->getLength();
for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++) for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
{ {
...@@ -136,11 +136,6 @@ void XMLChangeInfoContext::StartElement( ...@@ -136,11 +136,6 @@ void XMLChangeInfoContext::StartElement(
{ {
sAuthor = sValue; sAuthor = sValue;
} }
else if (sLocalName.equalsAsciiL(sXML_chg_comment,
sizeof(sXML_chg_comment)-1))
{
sComment = sValue;
}
else if (sLocalName.equalsAsciiL(sXML_chg_date_time, else if (sLocalName.equalsAsciiL(sXML_chg_date_time,
sizeof(sXML_chg_date_time)-1)) sizeof(sXML_chg_date_time)-1))
{ {
...@@ -151,6 +146,34 @@ void XMLChangeInfoContext::StartElement( ...@@ -151,6 +146,34 @@ void XMLChangeInfoContext::StartElement(
// else: unknown namespace // else: unknown namespace
} }
}
SvXMLImportContext* XMLChangeInfoContext::CreateChildContext(
USHORT nPrefix,
const OUString& rLocalName,
const Reference<XAttributeList >& xAttrList )
{
SvXMLImportContext* pContext = NULL;
if ((XML_NAMESPACE_TEXT == nPrefix) &&
rLocalName.equalsAsciiL(sXML_p, sizeof(sXML_p)-1))
{
pContext = new XMLStringBufferImportContext(GetImport(), nPrefix,
rLocalName, sCommentBuffer);
}
else
{
pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName,
xAttrList);
}
return pContext;
}
void XMLChangeInfoContext::EndElement()
{
// set values at changed region context // set values at changed region context
rChangedRegion.SetChangeInfo(rType, sAuthor, sComment, sDateTime); rChangedRegion.SetChangeInfo(rType, sAuthor,
sCommentBuffer.makeStringAndClear(),
sDateTime);
} }
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: XMLChangeInfoContext.hxx,v $ * $RCSfile: XMLChangeInfoContext.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-01-24 16:49:51 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -71,9 +71,14 @@ ...@@ -71,9 +71,14 @@
#include <com/sun/star/uno/Reference.h> #include <com/sun/star/uno/Reference.h>
#endif #endif
namespace rtl { #ifndef _RTL_USTRING_HXX_
class OUString; #include <rtl/ustring.hxx>
} #endif
#ifndef _RTL_USTRBUF_HXX_
#include <rtl/ustrbuf.hxx>
#endif
namespace com { namespace sun { namespace star { namespace com { namespace sun { namespace star {
namespace xml { namespace sax { class XAttributeList; } } namespace xml { namespace sax { class XAttributeList; } }
} } } } } }
...@@ -91,6 +96,10 @@ class XMLChangeInfoContext : public SvXMLImportContext ...@@ -91,6 +96,10 @@ class XMLChangeInfoContext : public SvXMLImportContext
{ {
const ::rtl::OUString& rType; const ::rtl::OUString& rType;
::rtl::OUString sAuthor;
::rtl::OUString sDateTime;
::rtl::OUStringBuffer sCommentBuffer;
XMLChangedRegionImportContext& rChangedRegion; XMLChangedRegionImportContext& rChangedRegion;
public: public:
...@@ -109,6 +118,15 @@ public: ...@@ -109,6 +118,15 @@ public:
virtual void StartElement( virtual void StartElement(
const ::com::sun::star::uno::Reference< const ::com::sun::star::uno::Reference<
::com::sun::star::xml::sax::XAttributeList> & xAttrList); ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
virtual SvXMLImportContext *CreateChildContext(
USHORT nPrefix,
const ::rtl::OUString& rLocalName,
const ::com::sun::star::uno::Reference<
::com::sun::star::xml::sax::XAttributeList >& xAttrList );
virtual void EndElement();
}; };
#endif #endif
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: XMLRedlineExport.cxx,v $ * $RCSfile: XMLRedlineExport.cxx,v $
* *
* $Revision: 1.5 $ * $Revision: 1.6 $
* *
* last change: $Author: dvo $ $Date: 2001-01-19 19:19:50 $ * last change: $Author: dvo $ $Date: 2001-01-24 16:49:51 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -414,13 +414,6 @@ void XMLRedlineExport::ExportChangeInfo( ...@@ -414,13 +414,6 @@ void XMLRedlineExport::ExportChangeInfo(
rExport.AddAttribute(XML_NAMESPACE_OFFICE, sXML_chg_author, sTmp); rExport.AddAttribute(XML_NAMESPACE_OFFICE, sXML_chg_author, sTmp);
} }
aAny = rPropSet->getPropertyValue(sRedlineComment);
aAny >>= sTmp;
if (sTmp.getLength() > 0)
{
rExport.AddAttribute(XML_NAMESPACE_OFFICE, sXML_chg_comment, sTmp);
}
aAny = rPropSet->getPropertyValue(sRedlineDateTime); aAny = rPropSet->getPropertyValue(sRedlineDateTime);
util::DateTime aDateTime; util::DateTime aDateTime;
aAny >>= aDateTime; aAny >>= aDateTime;
...@@ -431,6 +424,23 @@ void XMLRedlineExport::ExportChangeInfo( ...@@ -431,6 +424,23 @@ void XMLRedlineExport::ExportChangeInfo(
SvXMLElementExport aChangeInfo(rExport, XML_NAMESPACE_OFFICE, SvXMLElementExport aChangeInfo(rExport, XML_NAMESPACE_OFFICE,
sXML_change_info, sal_True, sal_True); sXML_change_info, sal_True, sal_True);
// comment as <text:p> sequence
aAny = rPropSet->getPropertyValue(sRedlineComment);
aAny >>= sTmp;
if (sTmp.getLength() > 0)
{
// iterate over all string-pieces separated by return (0x0a) and
// put each inside a paragraph element.
SvXMLTokenEnumerator aEnumerator(sTmp, sal_Char(0x0a));
OUString aSubString;
while (aEnumerator.getNextToken(aSubString))
{
SvXMLElementExport aParagraph(
rExport, XML_NAMESPACE_TEXT, sXML_p, sal_True, sal_False);
rExport.GetDocHandler()->characters(aSubString);
}
}
} }
void XMLRedlineExport::ExportChangeInfo( void XMLRedlineExport::ExportChangeInfo(
......
/*************************************************************************
*
* $RCSfile: XMLStringBufferImportContext.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dvo $ $Date: 2001-01-24 16:49:52 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _XMLOFF_XMLSTRINGBUFFERIMPORTCONTEXT_HXX
#include "XMLStringBufferImportContext.hxx"
#endif
#ifndef _XMLOFF_XMLKYWD_HXX
#include "xmlkywd.hxx"
#endif
#ifndef _XMLOFF_XMLNMSPE_HXX
#include "xmlnmspe.hxx"
#endif
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::xml::sax::XAttributeList;
TYPEINIT1(XMLStringBufferImportContext, SvXMLImportContext);
XMLStringBufferImportContext::XMLStringBufferImportContext(
SvXMLImport& rImport,
sal_uInt16 nPrefix,
const OUString& sLocalName,
OUStringBuffer& rBuffer) :
SvXMLImportContext(rImport, nPrefix, sLocalName),
rTextBuffer(rBuffer)
{
}
XMLStringBufferImportContext::~XMLStringBufferImportContext()
{
}
SvXMLImportContext *XMLStringBufferImportContext::CreateChildContext(
USHORT nPrefix,
const OUString& rLocalName,
const Reference<XAttributeList> & xAttrList)
{
return new XMLStringBufferImportContext(GetImport(), nPrefix,
rLocalName, rTextBuffer);
}
void XMLStringBufferImportContext::Characters(
const OUString& rChars )
{
rTextBuffer.append(rChars);
}
void XMLStringBufferImportContext::EndElement()
{
// add return for paragraph elements
if ( (XML_NAMESPACE_TEXT == GetPrefix()) &&
(GetLocalName().equalsAsciiL(sXML_p, sizeof(sXML_p)-1)) )
{
rTextBuffer.append(sal_Unicode(0x0a));
}
}
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
# #
# $RCSfile: makefile.mk,v $ # $RCSfile: makefile.mk,v $
# #
# $Revision: 1.19 $ # $Revision: 1.20 $
# #
# last change: $Author: dvo $ $Date: 2001-01-19 19:19:50 $ # last change: $Author: dvo $ $Date: 2001-01-24 16:49:52 $
# #
# The Contents of this file are made available subject to the terms of # The Contents of this file are made available subject to the terms of
# either of the following licenses # either of the following licenses
...@@ -129,6 +129,7 @@ CXXFILES = \ ...@@ -129,6 +129,7 @@ CXXFILES = \
XMLSectionImportContext.cxx \ XMLSectionImportContext.cxx \
XMLSectionSourceDDEImportContext.cxx \ XMLSectionSourceDDEImportContext.cxx \
XMLSectionSourceImportContext.cxx \ XMLSectionSourceImportContext.cxx \
XMLStringBufferImportContext.cxx \
XMLTextColumnsContext.cxx \ XMLTextColumnsContext.cxx \
XMLTextColumnsExport.cxx \ XMLTextColumnsExport.cxx \
XMLTextFrameContext.cxx \ XMLTextFrameContext.cxx \
...@@ -201,6 +202,7 @@ SLOFILES = \ ...@@ -201,6 +202,7 @@ SLOFILES = \
$(SLO)$/XMLSectionImportContext.obj \ $(SLO)$/XMLSectionImportContext.obj \
$(SLO)$/XMLSectionSourceDDEImportContext.obj \ $(SLO)$/XMLSectionSourceDDEImportContext.obj \
$(SLO)$/XMLSectionSourceImportContext.obj \ $(SLO)$/XMLSectionSourceImportContext.obj \
$(SLO)$/XMLStringBufferImportContext.obj \
$(SLO)$/XMLTextColumnsContext.obj \ $(SLO)$/XMLTextColumnsContext.obj \
$(SLO)$/XMLTextColumnsExport.obj \ $(SLO)$/XMLTextColumnsExport.obj \
$(SLO)$/XMLTextFrameContext.obj \ $(SLO)$/XMLTextFrameContext.obj \
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: txtfldi.cxx,v $ * $RCSfile: txtfldi.cxx,v $
* *
* $Revision: 1.18 $ * $Revision: 1.19 $
* *
* last change: $Author: dvo $ $Date: 2001-01-23 15:43:03 $ * last change: $Author: dvo $ $Date: 2001-01-24 16:49:52 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -105,6 +105,10 @@ ...@@ -105,6 +105,10 @@
#include "xmlement.hxx" #include "xmlement.hxx"
#endif #endif
#ifndef _XMLOFF_XMLSTRINGBUFFERIMPORTCONTEXT_HXX
#include "XMLStringBufferImportContext.hxx"
#endif
#ifndef _COM_SUN_STAR_XML_SAX_XATTRIBUTELIST_HPP_ #ifndef _COM_SUN_STAR_XML_SAX_XATTRIBUTELIST_HPP_
#include <com/sun/star/xml/sax/XAttributeList.hpp> #include <com/sun/star/xml/sax/XAttributeList.hpp>
#endif #endif
...@@ -3389,53 +3393,6 @@ const sal_Char* XMLBibliographyFieldImportContext::MapBibliographyFieldName( ...@@ -3389,53 +3393,6 @@ const sal_Char* XMLBibliographyFieldImportContext::MapBibliographyFieldName(
return pName; return pName;
} }
//
// XMLStringBufferImportContext
//
TYPEINIT1(XMLStringBufferImportContext, SvXMLImportContext);
XMLStringBufferImportContext::XMLStringBufferImportContext(
SvXMLImport& rImport,
sal_uInt16 nPrefix,
const OUString& sLocalName,
OUStringBuffer& rBuffer) :
SvXMLImportContext(rImport, nPrefix, sLocalName),
rTextBuffer(rBuffer)
{
}
XMLStringBufferImportContext::~XMLStringBufferImportContext()
{
}
SvXMLImportContext *XMLStringBufferImportContext::CreateChildContext(
USHORT nPrefix,
const OUString& rLocalName,
const Reference<XAttributeList> & xAttrList)
{
return new XMLStringBufferImportContext(GetImport(), nPrefix,
rLocalName, rTextBuffer);
}
void XMLStringBufferImportContext::Characters(
const OUString& rChars )
{
rTextBuffer.append(rChars);
}
void XMLStringBufferImportContext::EndElement()
{
// add return for paragraph elements
if ( (XML_NAMESPACE_TEXT == GetPrefix()) &&
(GetLocalName().equalsAsciiL(sXML_p, sizeof(sXML_p)-1)) )
{
rTextBuffer.append(sal_Unicode(0x0a));
}
}
// //
// Annotation Field // Annotation Field
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment