[Libreoffice-commits] .: Branch 'libreoffice-3-3' - 2 commits - writerfilter/source
Noel Power
noelp at kemper.freedesktop.org
Fri Jan 21 04:50:27 PST 2011
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 40 ++++++++++++++++++++++
1 file changed, 40 insertions(+)
New commits:
commit 82102abd307f911c400735eb6f9b43fa69d221d8
Author: Noel Power <noel.power at novell.com>
Date: Tue Jan 18 12:58:17 2011 +0000
fdo#33237 remove debug line
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 7934d89..e89a40c 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -555,7 +555,6 @@ bool lcl_removeShape( const uno::Reference< text::XTextDocument >& rDoc, const
{
xDrawPage->remove( rShape );
}
- osl_trace("**** after removing shape ");
rAnchoredStack.pop();
rTextAppendStack.pop();
bRet = true;
commit 9c976ba4f8e1fd2bcd40412873e22728ed83d5bd
Author: Noel Power <noel.power at novell.com>
Date: Tue Jan 18 12:43:50 2011 +0000
fdo#33237# fix ole object import for writer (docx)
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 59a897f..7934d89 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -535,6 +535,38 @@ void DomainMapper_Impl::clearDeferredBreaks()
m_bIsColumnBreakDeferred = false;
m_bIsPageBreakDeferred = false;
}
+
+bool lcl_removeShape( const uno::Reference< text::XTextDocument >& rDoc, const uno::Reference< drawing::XShape >& rShape, TextContentStack& rAnchoredStack,TextAppendStack& rTextAppendStack )
+{
+ bool bRet = false;
+ // probably unecessary but just double check that indeed the top of Anchored stack
+ // does contain the shape we intend to remove
+ uno::Reference< drawing::XShape > xAnchorShape(rAnchoredStack.top( ), uno::UNO_QUERY );
+ if ( xAnchorShape == rShape )
+ {
+ // because we only want to process the embedded object and not the associated
+ // shape we need to get rid of that shape from the Draw page and Anchored and
+ // Append stacks so it wont be processed further
+ try
+ {
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(rDoc, uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
+ if ( xDrawPage.is() )
+ {
+ xDrawPage->remove( rShape );
+ }
+ osl_trace("**** after removing shape ");
+ rAnchoredStack.pop();
+ rTextAppendStack.pop();
+ bRet = true;
+ }
+ catch( uno::Exception& e )
+ {
+ }
+ }
+ return bRet;
+}
+
/*-------------------------------------------------------------------------
-----------------------------------------------------------------------*/
@@ -992,6 +1024,15 @@ void DomainMapper_Impl::appendOLE( const ::rtl::OUString& rStreamName, OLEHandle
uno::Reference< graphic::XGraphic > xGraphic = pOLEHandler->getReplacement();
xOLEProperties->setPropertyValue(PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_GRAPHIC ),
uno::makeAny(xGraphic));
+ // mimic the treatment of graphics here.. it seems anchoring as character
+ // gives a better ( visually ) result
+ xOLEProperties->setPropertyValue(PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_ANCHOR_TYPE ), uno::makeAny( text::TextContentAnchorType_AS_CHARACTER ) );
+ // remove ( if valid ) associated shape ( used for graphic replacement )
+ if ( m_bShapeContextAdded )
+ {
+ if ( lcl_removeShape( m_xTextDocument, pOLEHandler->getShape(), m_aAnchoredStack, m_aTextAppendStack ) )
+ m_bShapeContextAdded = false; // ensure PopShapeContext processing doesn't pop the append stack
+ }
//
appendTextContent( xOLE, uno::Sequence< beans::PropertyValue >() );
More information about the Libreoffice-commits
mailing list