INTEGRATION: CWS xmlfilter06 (1.3.6); FILE MERGED

2008/06/29 13:05:44 dr 1.3.6.4: RESYNC: (1.3-1.4); FILE MERGED
2008/06/12 15:04:43 hbrinkm 1.3.6.3: moved PropertySetToTagHandler
2008/05/30 12:26:58 hbrinkm 1.3.6.2: moved classes/functioins to util.cxx
2008/05/27 11:36:11 dr 1.3.6.1: joined changes from CWS xmlfilter05
This commit is contained in:
Oliver Bolte 2008-07-22 11:54:50 +00:00
parent 6b015aea9c
commit 7f939557b8

View file

@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: util.cxx,v $
* $Revision: 1.5 $
* $Revision: 1.6 $
*
* This file is part of OpenOffice.org.
*
@ -39,12 +39,14 @@
#include <com/sun/star/drawing/HomogenMatrix3.hpp>
#include <com/sun/star/text/TextContentAnchorType.hpp>
#include <resourcemodel/WW8ResourceModel.hxx>
#include <resourcemodel/TagLogger.hxx>
namespace writerfilter
{
using namespace com::sun::star;
using namespace std;
using text::TextContentAnchorType;
static string & logger_file()
{
static string _logger_file = string(getenv("TEMP")?getenv("TEMP"):"/tmp") + "/writerfilter.ooxml.tmp";
@ -368,4 +370,34 @@ string propertysetToString(uno::Reference<beans::XPropertySet> const & xPropSet)
return sResult;
}
string xmlify(const string & str)
{
string result = "";
char sBuffer[16];
for (string::const_iterator aIt = str.begin(); aIt != str.end(); ++aIt)
{
char c = *aIt;
if (isprint(c) && c != '\"')
{
if (c == '<')
result += "&lt;";
else if (c == '>')
result += "&gt;";
else if (c == '&')
result += "&amp;";
else
result += c;
}
else
{
snprintf(sBuffer, sizeof(sBuffer), "\\%03d", c);
result += sBuffer;
}
}
return result;
}
}