summaryrefslogtreecommitdiff
path: root/xmloff/source/text/XMLRedlineExport.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'xmloff/source/text/XMLRedlineExport.cxx')
-rw-r--r--xmloff/source/text/XMLRedlineExport.cxx89
1 files changed, 33 insertions, 56 deletions
diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx
index baf0d6de8760..d619e8b87034 100644
--- a/xmloff/source/text/XMLRedlineExport.cxx
+++ b/xmloff/source/text/XMLRedlineExport.cxx
@@ -60,28 +60,9 @@ using ::std::list;
XMLRedlineExport::XMLRedlineExport(SvXMLExport& rExp)
-: sDelete("Delete")
-, sDeletion(GetXMLToken(XML_DELETION))
-, sFormat("Format")
+: sDeletion(GetXMLToken(XML_DELETION))
, sFormatChange(GetXMLToken(XML_FORMAT_CHANGE))
-, sInsert("Insert")
, sInsertion(GetXMLToken(XML_INSERTION))
-, sIsCollapsed("IsCollapsed")
-, sIsStart("IsStart")
-, sRedlineAuthor("RedlineAuthor")
-, sRedlineComment("RedlineComment")
-, sRedlineDateTime("RedlineDateTime")
-, sRedlineSuccessorData("RedlineSuccessorData")
-, sRedlineText("RedlineText")
-, sRedlineType("RedlineType")
-, sUnknownChange("UnknownChange")
-, sStartRedline("StartRedline")
-, sEndRedline("EndRedline")
-, sRedlineIdentifier("RedlineIdentifier")
-, sIsInHeaderFooter("IsInHeaderFooter")
-, sRecordChanges("RecordChanges")
-, sMergeLastPara("MergeLastPara")
-, sChangePrefix("ct")
, rExport(rExp)
, pCurrentChangesList(nullptr)
{
@@ -215,7 +196,7 @@ void XMLRedlineExport::ExportChangesListElements()
uno::UNO_QUERY );
// redlining enabled?
bool bEnabled = *o3tl::doAccess<bool>(aDocPropertySet->getPropertyValue(
- sRecordChanges ));
+ "RecordChanges" ));
// only export if we have redlines or attributes
if ( aEnumAccess->hasElements() || bEnabled )
@@ -248,7 +229,7 @@ void XMLRedlineExport::ExportChangesListElements()
{
// export only if not in header or footer
// (those must be exported with their XText)
- aAny = xPropSet->getPropertyValue(sIsInHeaderFooter);
+ aAny = xPropSet->getPropertyValue("IsInHeaderFooter");
if (! *o3tl::doAccess<bool>(aAny))
{
// and finally, export change
@@ -270,8 +251,8 @@ void XMLRedlineExport::ExportChangeAutoStyle(
if (nullptr != pCurrentChangesList)
{
// put redline in list if it's collapsed or the redline start
- Any aIsStart = rPropSet->getPropertyValue(sIsStart);
- Any aIsCollapsed = rPropSet->getPropertyValue(sIsCollapsed);
+ Any aIsStart = rPropSet->getPropertyValue("IsStart");
+ Any aIsCollapsed = rPropSet->getPropertyValue("IsCollapsed");
if ( *o3tl::doAccess<bool>(aIsStart) ||
*o3tl::doAccess<bool>(aIsCollapsed) )
@@ -279,7 +260,7 @@ void XMLRedlineExport::ExportChangeAutoStyle(
}
// get XText for export of redline auto styles
- Any aAny = rPropSet->getPropertyValue(sRedlineText);
+ Any aAny = rPropSet->getPropertyValue("RedlineText");
Reference<XText> xText;
aAny >>= xText;
if (xText.is())
@@ -315,7 +296,7 @@ void XMLRedlineExport::ExportChangesListAutoStyles()
// export only if not in header or footer
// (those must be exported with their XText)
- aAny = xPropSet->getPropertyValue(sIsInHeaderFooter);
+ aAny = xPropSet->getPropertyValue("IsInHeaderFooter");
if (! *o3tl::doAccess<bool>(aAny))
{
ExportChangeAutoStyle(xPropSet);
@@ -331,7 +312,7 @@ void XMLRedlineExport::ExportChangeInline(
{
// determine element name (depending on collapsed, start/end)
enum XMLTokenEnum eElement = XML_TOKEN_INVALID;
- Any aAny = rPropSet->getPropertyValue(sIsCollapsed);
+ Any aAny = rPropSet->getPropertyValue("IsCollapsed");
bool bCollapsed = *o3tl::doAccess<bool>(aAny);
if (bCollapsed)
{
@@ -339,7 +320,7 @@ void XMLRedlineExport::ExportChangeInline(
}
else
{
- aAny = rPropSet->getPropertyValue(sIsStart);
+ aAny = rPropSet->getPropertyValue("IsStart");
const bool bStart = *o3tl::doAccess<bool>(aAny);
eElement = bStart ? XML_CHANGE_START : XML_CHANGE_END;
}
@@ -364,7 +345,7 @@ void XMLRedlineExport::ExportChangedRegion(
rExport.AddAttributeIdLegacy(XML_NAMESPACE_TEXT, GetRedlineID(rPropSet));
// merge-last-paragraph
- Any aAny = rPropSet->getPropertyValue(sMergeLastPara);
+ Any aAny = rPropSet->getPropertyValue("MergeLastPara");
if( ! *o3tl::doAccess<bool>(aAny) )
rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_MERGE_LAST_PARAGRAPH,
XML_FALSE);
@@ -376,7 +357,7 @@ void XMLRedlineExport::ExportChangedRegion(
// scope for (first) change element
{
- aAny = rPropSet->getPropertyValue(sRedlineType);
+ aAny = rPropSet->getPropertyValue("RedlineType");
OUString sType;
aAny >>= sType;
SvXMLElementExport aChange(rExport, XML_NAMESPACE_TEXT,
@@ -385,7 +366,7 @@ void XMLRedlineExport::ExportChangedRegion(
ExportChangeInfo(rPropSet);
// get XText from the redline and export (if the XText exists)
- aAny = rPropSet->getPropertyValue(sRedlineText);
+ aAny = rPropSet->getPropertyValue("RedlineText");
Reference<XText> xText;
aAny >>= xText;
if (xText.is())
@@ -399,7 +380,7 @@ void XMLRedlineExport::ExportChangedRegion(
// changed change? Hierarchical changes can onl be two levels
// deep. Here we check for the second level.
- aAny = rPropSet->getPropertyValue(sRedlineSuccessorData);
+ aAny = rPropSet->getPropertyValue("RedlineSuccessorData");
Sequence<PropertyValue> aSuccessorData;
aAny >>= aSuccessorData;
@@ -424,37 +405,36 @@ void XMLRedlineExport::ExportChangedRegion(
OUString const & XMLRedlineExport::ConvertTypeName(
const OUString& sApiName)
{
- if (sApiName == sDelete)
+ if (sApiName == "Delete")
{
return sDeletion;
}
- else if (sApiName == sInsert)
+ else if (sApiName == "Insert")
{
return sInsertion;
}
- else if (sApiName == sFormat)
+ else if (sApiName == "Format")
{
return sFormatChange;
}
else
{
OSL_FAIL("unknown redline type");
+ static const OUString sUnknownChange("UnknownChange");
return sUnknownChange;
}
}
/** Create a Redline-ID */
-const OUString XMLRedlineExport::GetRedlineID(
+OUString XMLRedlineExport::GetRedlineID(
const Reference<XPropertySet> & rPropSet)
{
- Any aAny = rPropSet->getPropertyValue(sRedlineIdentifier);
+ Any aAny = rPropSet->getPropertyValue("RedlineIdentifier");
OUString sTmp;
aAny >>= sTmp;
- OUStringBuffer sBuf(sChangePrefix);
- sBuf.append(sTmp);
- return sBuf.makeStringAndClear();
+ return "ct" + sTmp;
}
@@ -465,7 +445,7 @@ void XMLRedlineExport::ExportChangeInfo(
SvXMLElementExport aChangeInfo(rExport, XML_NAMESPACE_OFFICE,
XML_CHANGE_INFO, true, true);
- Any aAny = rPropSet->getPropertyValue(sRedlineAuthor);
+ Any aAny = rPropSet->getPropertyValue("RedlineAuthor");
OUString sTmp;
aAny >>= sTmp;
if (!sTmp.isEmpty())
@@ -476,7 +456,7 @@ void XMLRedlineExport::ExportChangeInfo(
rExport.Characters(sTmp);
}
- aAny = rPropSet->getPropertyValue(sRedlineDateTime);
+ aAny = rPropSet->getPropertyValue("RedlineDateTime");
util::DateTime aDateTime;
aAny >>= aDateTime;
{
@@ -489,7 +469,7 @@ void XMLRedlineExport::ExportChangeInfo(
}
// comment as <text:p> sequence
- aAny = rPropSet->getPropertyValue(sRedlineComment);
+ aAny = rPropSet->getPropertyValue("RedlineComment");
aAny >>= sTmp;
WriteComment( sTmp );
}
@@ -504,7 +484,7 @@ void XMLRedlineExport::ExportChangeInfo(
{
const PropertyValue& rVal = rPropertyValues[i];
- if( rVal.Name.equals(sRedlineAuthor) )
+ if( rVal.Name == "RedlineAuthor" )
{
OUString sTmp;
rVal.Value >>= sTmp;
@@ -513,11 +493,11 @@ void XMLRedlineExport::ExportChangeInfo(
rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_CHG_AUTHOR, sTmp);
}
}
- else if( rVal.Name.equals(sRedlineComment) )
+ else if( rVal.Name == "RedlineComment" )
{
rVal.Value >>= sComment;
}
- else if( rVal.Name.equals(sRedlineDateTime) )
+ else if( rVal.Name == "RedlineDateTime" )
{
util::DateTime aDateTime;
rVal.Value >>= aDateTime;
@@ -526,12 +506,12 @@ void XMLRedlineExport::ExportChangeInfo(
rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_CHG_DATE_TIME,
sBuf.makeStringAndClear());
}
- else if( rVal.Name.equals(sRedlineType) )
+ else if( rVal.Name == "RedlineType" )
{
// check if this is an insertion; cf. comment at calling location
OUString sTmp;
rVal.Value >>= sTmp;
- DBG_ASSERT(sTmp.equals(sInsert),
+ DBG_ASSERT(sTmp == "Insert",
"hierarchical change must be insertion");
}
// else: unknown value -> ignore
@@ -555,7 +535,7 @@ void XMLRedlineExport::ExportStartOrEndRedline(
Any aAny;
try
{
- aAny = rPropSet->getPropertyValue(bStart ? sStartRedline : sEndRedline);
+ aAny = rPropSet->getPropertyValue(bStart ? OUString("StartRedline") : OUString("EndRedline"));
}
catch(const UnknownPropertyException&)
{
@@ -575,16 +555,16 @@ void XMLRedlineExport::ExportStartOrEndRedline(
sal_Int32 nLength = aValues.getLength();
for(sal_Int32 i = 0; i < nLength; i++)
{
- if (sRedlineIdentifier.equals(pValues[i].Name))
+ if (pValues[i].Name == "RedlineIdentifier")
{
pValues[i].Value >>= sId;
bIdOK = true;
}
- else if (sIsCollapsed.equals(pValues[i].Name))
+ else if (pValues[i].Name == "IsCollapsed")
{
bIsCollapsed = *o3tl::doAccess<bool>(pValues[i].Value);
}
- else if (sIsStart.equals(pValues[i].Name))
+ else if (pValues[i].Name == "IsStart")
{
bIsStart = *o3tl::doAccess<bool>(pValues[i].Value);
}
@@ -595,11 +575,8 @@ void XMLRedlineExport::ExportStartOrEndRedline(
SAL_WARN_IF( sId.isEmpty(), "xmloff", "Redlines must have IDs" );
// TODO: use GetRedlineID or eliminate that function
- OUStringBuffer sBuffer(sChangePrefix);
- sBuffer.append(sId);
-
rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_CHANGE_ID,
- sBuffer.makeStringAndClear());
+ "ct" + sId);
// export the element
// (whitespace because we're not inside paragraphs)