summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-05-28 21:34:37 +0200
committerMiklos Vajna <vmiklos@suse.cz>2013-05-29 10:25:28 +0200
commit14e163b0caf97addf340aefc5760a9031ec98390 (patch)
tree91a7b698a92618c2229da3159aa9301b5f32c3f4 /writerfilter
parent9edaf808c567cb54477b522c51416921c4811d2e (diff)
import RTF_BACKGROUND
That destination contains a whole shape, but the only interesing detail of it is the fill color, which is the page background color. Change-Id: I9527db8954c48c980f8734c9bbeaa6ccd3c48fbc
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx7
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx4
-rw-r--r--writerfilter/source/rtftok/rtfsdrimport.cxx13
3 files changed, 23 insertions, 1 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index fcd0ef5db2b1..921f30eb746c 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1672,6 +1672,10 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
// Anything inside \ud is just normal Unicode content.
m_aStates.top().nDestinationState = DESTINATION_NORMAL;
break;
+ case RTF_BACKGROUND:
+ m_aStates.top().nDestinationState = DESTINATION_BACKGROUND;
+ m_aStates.top().bInBackground = true;
+ break;
default:
SAL_INFO("writerfilter", "TODO handle destination '" << lcl_RtfToString(nKeyword) << "'");
// Make sure we skip destinations (even without \*) till we don't handle them
@@ -4707,7 +4711,8 @@ RTFParserState::RTFParserState(RTFDocumentImpl *pDocumentImpl)
nCurrentStyleIndex(-1),
pCurrentBuffer(0),
bHasTableStyle(false),
- bInListpicture(false)
+ bInListpicture(false),
+ bInBackground(false)
{
}
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index d6216f48ee6d..76752d7e42bf 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -163,6 +163,7 @@ namespace writerfilter {
DESTINATION_MEQARR,
DESTINATION_UPR,
DESTINATION_LFOLEVEL,
+ DESTINATION_BACKGROUND,
};
enum RTFBorderState
@@ -399,6 +400,9 @@ namespace writerfilter {
/// If we're inside a \listpicture group.
bool bInListpicture;
+
+ /// If we're inside a \background group.
+ bool bInBackground;
};
class RTFTokenizer;
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index d3bda96929f4..24d7ca1aa6f4 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -29,6 +29,7 @@
#include <dmapper/DomainMapper.hxx>
#include "../dmapper/GraphicHelpers.hxx"
#include <rtfsdrimport.hxx>
+#include <rtfreferenceproperties.hxx>
#include <oox/vml/vmlformatting.hxx>
#include <oox/helper/modelobjecthelper.hxx>
@@ -526,6 +527,18 @@ void RTFSdrImport::resolve(RTFShape& rShape)
}
}
+ if (m_rImport.getState().bInBackground)
+ {
+ RTFSprms aAttributes;
+ aAttributes.set(NS_ooxml::LN_CT_Background_color, RTFValue::Pointer_t(new RTFValue(xPropertySet->getPropertyValue("FillColor").get<sal_Int32>())));
+ writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aAttributes));
+ m_rImport.Mapper().props(pProperties);
+
+ uno::Reference<lang::XComponent> xComponent(xShape, uno::UNO_QUERY);
+ xComponent->dispose();
+ return;
+ }
+
// Send it to dmapper
m_rImport.Mapper().startShape(xShape);
m_rImport.replayShapetext();