diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-10-15 16:42:15 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-10-15 16:54:10 +0200 |
commit | 4f1ba0486241bd239e46b71405662db8e10d9b96 (patch) | |
tree | 8db3854cd3df72f0b827971b80a8a7f06076fa7e /writerfilter | |
parent | bin tab that breaks configure (diff) | |
download | core-4f1ba0486241bd239e46b71405662db8e10d9b96.tar.gz core-4f1ba0486241bd239e46b71405662db8e10d9b96.zip |
fdo#46669 sw: RTF paste should not change page styles
Change-Id: Ic163a639fae9de838258b3cca9567a29ab875a35
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/inc/dmapper/DomainMapper.hxx | 3 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 5 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 11 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.hxx | 8 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.cxx | 6 | ||||
-rw-r--r-- | writerfilter/source/filter/RtfFilter.cxx | 3 |
6 files changed, 27 insertions, 9 deletions
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); |