summaryrefslogtreecommitdiff
path: root/sax/source/tools
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <pierre-eric@lanedo.com>2013-01-11 14:34:04 +0100
committerNoel Power <noel.power@suse.com>2013-01-14 15:51:14 +0000
commit1f2c079dd2bc9a2f5aa3597a8222bde3073a04da (patch)
treeb363ffb350b31a55d62f82bf4081bb625ee10746 /sax/source/tools
parent8c178a50334109b34ef456ca6aa51cd3d98699ae (diff)
sax: add methods to duplicate current top marker and reapply it later
The need for this is ooxml: we need to have a duplicate entry (rPr) like this: <p> <pPr> <rPr>...</rPr> </pPr> <r> <rPr>...</rPR> </r> </p> This patch allows to do that by setting aside a copy of the <rPr> line, and then merging the copy when needed. Change-Id: I3868a822aa9e5210f3d814c68398a38f95072cd5 Reviewed-on: https://gerrit.libreoffice.org/1648 Reviewed-by: Noel Power <noel.power@suse.com> Tested-by: Noel Power <noel.power@suse.com>
Diffstat (limited to 'sax/source/tools')
-rw-r--r--sax/source/tools/fastserializer.cxx14
-rw-r--r--sax/source/tools/fastserializer.hxx3
-rw-r--r--sax/source/tools/fshelper.cxx10
3 files changed, 27 insertions, 0 deletions
diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx
index bc2b12e92a9d..31aac1e285f8 100644
--- a/sax/source/tools/fastserializer.cxx
+++ b/sax/source/tools/fastserializer.cxx
@@ -265,6 +265,20 @@ namespace sax_fastparser {
}
}
+ void FastSaxSerializer::copyTopMarkPush()
+ {
+ assert (!maMarkStack.empty());
+ maSavedMarkStack.push(boost::shared_ptr< ForMerge > ( new ForMerge(*maMarkStack.top())));
+ }
+
+ void FastSaxSerializer::copyTopMarkPop()
+ {
+ assert (!maSavedMarkStack.empty());
+ maMarkStack.push(maSavedMarkStack.top());
+ mergeTopMarks();
+ maSavedMarkStack.pop();
+ }
+
void FastSaxSerializer::writeBytes( const Sequence< ::sal_Int8 >& aData ) throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException )
{
if ( maMarkStack.empty() )
diff --git a/sax/source/tools/fastserializer.hxx b/sax/source/tools/fastserializer.hxx
index b80f1ccaecc2..70bc1533b482 100644
--- a/sax/source/tools/fastserializer.hxx
+++ b/sax/source/tools/fastserializer.hxx
@@ -145,6 +145,8 @@ public:
@see mark()
*/
void mergeTopMarks( sax_fastparser::MergeMarksEnum eMergeType = sax_fastparser::MERGE_MARKS_APPEND );
+ void copyTopMarkPush();
+ void copyTopMarkPop();
private:
::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > mxOutputStream;
@@ -203,6 +205,7 @@ private:
};
::std::stack< boost::shared_ptr< ForMerge > > maMarkStack;
+ ::std::stack< boost::shared_ptr< ForMerge > > maSavedMarkStack;
void writeFastAttributeList( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs );
void write( const ::rtl::OUString& s );
diff --git a/sax/source/tools/fshelper.cxx b/sax/source/tools/fshelper.cxx
index 2f3f7bfc5292..37cf3d06394a 100644
--- a/sax/source/tools/fshelper.cxx
+++ b/sax/source/tools/fshelper.cxx
@@ -162,6 +162,16 @@ void FastSerializerHelper::mergeTopMarks( MergeMarksEnum eMergeType )
mpSerializer->mergeTopMarks( eMergeType );
}
+void FastSerializerHelper::copyTopMarkPush()
+{
+ mpSerializer->copyTopMarkPush();
+}
+
+void FastSerializerHelper::copyTopMarkPop()
+{
+ mpSerializer->copyTopMarkPop();
+}
+
FastAttributeList * FastSerializerHelper::createAttrList()
{
return new FastAttributeList( mxTokenHandler );