summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/source/filter/rtf/swparrtf.cxx4
-rw-r--r--writerfilter/inc/dmapper/DomainMapper.hxx3
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx5
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx11
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.hxx8
-rw-r--r--writerfilter/source/dmapper/PropertyMap.cxx6
-rw-r--r--writerfilter/source/filter/RtfFilter.cxx3
7 files changed, 30 insertions, 10 deletions
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx
index 875beef7b176..24eee1e1cd39 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -151,10 +151,12 @@ sal_uLong SwRTFReader::Read( SwDoc &rDoc, const String& /*rBaseURL*/, SwPaM& /*r
xImporter->setTargetDocument(xDstDoc);
uno::Reference<document::XFilter> xFilter(xInterface, uno::UNO_QUERY_THROW);
- uno::Sequence<beans::PropertyValue> aDescriptor(1);
+ uno::Sequence<beans::PropertyValue> aDescriptor(2);
aDescriptor[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InputStream"));
uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(*pStrm));
aDescriptor[0].Value <<= xStream;
+ aDescriptor[1].Name = "IsNewDoc";
+ aDescriptor[1].Value <<= sal_False;
xFilter->filter(aDescriptor);
return 0;
diff --git a/writerfilter/inc/dmapper/DomainMapper.hxx b/writerfilter/inc/dmapper/DomainMapper.hxx
index 1d9b2f0d9500..87e28d27a234 100644
--- a/writerfilter/inc/dmapper/DomainMapper.hxx
+++ b/writerfilter/inc/dmapper/DomainMapper.hxx
@@ -81,7 +81,8 @@ public:
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xInputStream,
::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xModel,
bool bRepairStorage,
- SourceDocumentType eDocumentType);
+ SourceDocumentType eDocumentType,
+ bool bIsNewDoc = true);
virtual ~DomainMapper();
// Stream
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 089ba5e9255f..c71854ef8c94 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -86,11 +86,12 @@ DomainMapper::DomainMapper( const uno::Reference< uno::XComponentContext >& xCon
uno::Reference< io::XInputStream > xInputStream,
uno::Reference< lang::XComponent > xModel,
bool bRepairStorage,
- SourceDocumentType eDocumentType ) :
+ SourceDocumentType eDocumentType,
+ bool bIsNewDoc ) :
LoggedProperties(dmapper_logger, "DomainMapper"),
LoggedTable(dmapper_logger, "DomainMapper"),
LoggedStream(dmapper_logger, "DomainMapper"),
- m_pImpl( new DomainMapper_Impl( *this, xContext, xModel, eDocumentType )),
+ m_pImpl( new DomainMapper_Impl( *this, xContext, xModel, eDocumentType, bIsNewDoc )),
mnBackgroundColor(0), mbIsHighlightSet(false)
{
// #i24363# tab stops relative to indent
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 9349f7f8679f..4ea99838b9de 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -155,7 +155,8 @@ DomainMapper_Impl::DomainMapper_Impl(
DomainMapper& rDMapper,
uno::Reference < uno::XComponentContext > xContext,
uno::Reference< lang::XComponent > xModel,
- SourceDocumentType eDocumentType) :
+ SourceDocumentType eDocumentType,
+ bool bIsNewDoc) :
m_eDocumentType( eDocumentType ),
m_rDMapper( rDMapper ),
m_xTextDocument( xModel, uno::UNO_QUERY ),
@@ -182,7 +183,8 @@ DomainMapper_Impl::DomainMapper_Impl(
m_bIsLastParaInSection( false ),
m_bParaSectpr( false ),
m_bUsingEnhancedFields( false ),
- m_bSdt(false)
+ m_bSdt(false),
+ m_bIsNewDoc(bIsNewDoc)
{
appendTableManager( );
GetBodyText();
@@ -3797,6 +3799,11 @@ sal_Int32 DomainMapper_Impl::getCurrentNumberingProperty(OUString aProp)
return nRet;
}
+bool DomainMapper_Impl::IsNewDoc()
+{
+ return m_bIsNewDoc;
+}
+
}}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 5f722f807ebc..a84209332949 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -373,12 +373,15 @@ private:
std::map< sal_Int32, com::sun::star::uno::Any > deferredCharacterProperties;
+ bool m_bIsNewDoc;
+
public:
DomainMapper_Impl(
DomainMapper& rDMapper,
uno::Reference < uno::XComponentContext > xContext,
uno::Reference< lang::XComponent > xModel,
- SourceDocumentType eDocumentType );
+ SourceDocumentType eDocumentType,
+ bool bIsNewDoc );
DomainMapper_Impl();
virtual ~DomainMapper_Impl();
@@ -654,6 +657,9 @@ public:
/// Get a property of the current numbering style's current level.
sal_Int32 getCurrentNumberingProperty(OUString aProp);
+
+ /// If we're importing into a new document, or just pasting to an existing one.
+ bool IsNewDoc();
};
} //namespace dmapper
} //namespace writerfilter
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index e1258cc9449a..22f680b18e8f 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -970,7 +970,8 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
operator[](PropertyDefinition(PROP_GRID_MODE, false)) = uno::makeAny(nGridMode);
- _ApplyProperties( xFollowPageStyle );
+ if (rDM_Impl.IsNewDoc())
+ _ApplyProperties( xFollowPageStyle );
//todo: creating a "First Page" style depends on HasTitlePage und _fFacingPage_
if( m_bTitlePage )
@@ -979,7 +980,8 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
PrepareHeaderFooterProperties( true );
uno::Reference< beans::XPropertySet > xFirstPageStyle = GetPageStyle(
rDM_Impl.GetPageStyles(), rDM_Impl.GetTextFactory(), true );
- _ApplyProperties( xFirstPageStyle );
+ if (rDM_Impl.IsNewDoc())
+ _ApplyProperties( xFirstPageStyle );
sal_Int32 nPaperBin = m_nFirstPaperBin >= 0 ? m_nFirstPaperBin : m_nPaperBin >= 0 ? m_nPaperBin : 0;
if( nPaperBin )
diff --git a/writerfilter/source/filter/RtfFilter.cxx b/writerfilter/source/filter/RtfFilter.cxx
index 080f8adcbdf1..22f710817753 100644
--- a/writerfilter/source/filter/RtfFilter.cxx
+++ b/writerfilter/source/filter/RtfFilter.cxx
@@ -67,6 +67,7 @@ sal_Bool RtfFilter::filter( const uno::Sequence< beans::PropertyValue >& aDescri
{
MediaDescriptor aMediaDesc( aDescriptor );
bool bRepairStorage = aMediaDesc.getUnpackedValueOrDefault( "RepairPackage", false );
+ bool bIsNewDoc = aMediaDesc.getUnpackedValueOrDefault( "IsNewDoc", true );
#ifdef DEBUG_IMPORT
OUString sURL = aMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_URL(), OUString() );
::std::string sURLc = OUStringToOString(sURL, RTL_TEXTENCODING_ASCII_US).getStr();
@@ -88,7 +89,7 @@ sal_Bool RtfFilter::filter( const uno::Sequence< beans::PropertyValue >& aDescri
uno::Reference<task::XStatusIndicator>());
writerfilter::Stream::Pointer_t pStream(
- new writerfilter::dmapper::DomainMapper(m_xContext, xInputStream, m_xDstDoc, bRepairStorage, writerfilter::dmapper::DOCUMENT_RTF));
+ new writerfilter::dmapper::DomainMapper(m_xContext, xInputStream, m_xDstDoc, bRepairStorage, writerfilter::dmapper::DOCUMENT_RTF, bIsNewDoc));
writerfilter::rtftok::RTFDocument::Pointer_t const pDocument(
writerfilter::rtftok::RTFDocumentFactory::createDocument(m_xContext, xInputStream, m_xDstDoc, xFrame, xStatusIndicator));
pDocument->resolve(*pStream);