[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - writerfilter/source
László Németh
laszlo.nemeth at collabora.com
Tue May 26 10:14:26 PDT 2015
writerfilter/source/dmapper/GraphicImport.cxx | 102 +++++++++++++-------------
1 file changed, 52 insertions(+), 50 deletions(-)
New commits:
commit ca93124e4c9d51641b3c002132a7da8e5b0df956
Author: László Németh <laszlo.nemeth at collabora.com>
Date: Tue May 26 12:07:31 2015 +0200
DOCX import: fix vertical position of inline images
(regression of commit ab81e3bff2a1844be67209bc8947d539edbaf8e6)
Change-Id: Ie78f8be059b18cdd81c83a8d01f2d865ac3fec2b
Reviewed-on: https://gerrit.libreoffice.org/15916
Reviewed-by: Joren De Cuyper <jorendc at libreoffice.org>
Tested-by: Joren De Cuyper <jorendc at libreoffice.org>
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index a04c833..0111889 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1220,69 +1220,71 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b
uno::makeAny(true));
sal_Int32 nWidth = m_pImpl->nRightPosition - m_pImpl->nLeftPosition;
- //adjust margins
- if( (m_pImpl->nHoriOrient == text::HoriOrientation::LEFT &&
- (m_pImpl->nHoriRelation == text::RelOrientation::PAGE_PRINT_AREA ||
- m_pImpl->nHoriRelation == text::RelOrientation::FRAME) ) ||
- (m_pImpl->nHoriOrient == text::HoriOrientation::INSIDE &&
- m_pImpl->nHoriRelation == text::RelOrientation::PAGE_PRINT_AREA ))
- m_pImpl->nLeftMargin = 0;
- if((m_pImpl->nHoriOrient == text::HoriOrientation::RIGHT &&
+ if (m_pImpl->eGraphicImportType == IMPORT_AS_DETECTED_ANCHOR)
+ {
+ //adjust margins
+ if( (m_pImpl->nHoriOrient == text::HoriOrientation::LEFT &&
+ (m_pImpl->nHoriRelation == text::RelOrientation::PAGE_PRINT_AREA ||
+ m_pImpl->nHoriRelation == text::RelOrientation::FRAME) ) ||
+ (m_pImpl->nHoriOrient == text::HoriOrientation::INSIDE &&
+ m_pImpl->nHoriRelation == text::RelOrientation::PAGE_PRINT_AREA ))
+ m_pImpl->nLeftMargin = 0;
+ if((m_pImpl->nHoriOrient == text::HoriOrientation::RIGHT &&
(m_pImpl->nHoriRelation == text::RelOrientation::PAGE_PRINT_AREA ||
m_pImpl->nHoriRelation == text::RelOrientation::FRAME) ) ||
- (m_pImpl->nHoriOrient == text::HoriOrientation::INSIDE &&
- m_pImpl->nHoriRelation == text::RelOrientation::PAGE_PRINT_AREA ))
- m_pImpl->nRightMargin = 0;
- // adjust top/bottom margins
- if( m_pImpl->nVertOrient == text::VertOrientation::TOP &&
+ (m_pImpl->nHoriOrient == text::HoriOrientation::INSIDE &&
+ m_pImpl->nHoriRelation == text::RelOrientation::PAGE_PRINT_AREA ))
+ m_pImpl->nRightMargin = 0;
+ // adjust top/bottom margins
+ if( m_pImpl->nVertOrient == text::VertOrientation::TOP &&
( m_pImpl->nVertRelation == text::RelOrientation::PAGE_PRINT_AREA ||
m_pImpl->nVertRelation == text::RelOrientation::PAGE_FRAME))
- m_pImpl->nTopMargin = 0;
- if( m_pImpl->nVertOrient == text::VertOrientation::BOTTOM &&
+ m_pImpl->nTopMargin = 0;
+ if( m_pImpl->nVertOrient == text::VertOrientation::BOTTOM &&
( m_pImpl->nVertRelation == text::RelOrientation::PAGE_PRINT_AREA ||
m_pImpl->nVertRelation == text::RelOrientation::PAGE_FRAME))
- m_pImpl->nBottomMargin = 0;
- if( m_pImpl->nVertOrient == text::VertOrientation::BOTTOM &&
+ m_pImpl->nBottomMargin = 0;
+ if( m_pImpl->nVertOrient == text::VertOrientation::BOTTOM &&
m_pImpl->nVertRelation == text::RelOrientation::PAGE_PRINT_AREA )
- m_pImpl->nBottomMargin = 0;
-
- //adjust alignment
- if( m_pImpl->nHoriOrient == text::HoriOrientation::INSIDE &&
+ m_pImpl->nBottomMargin = 0;
+ //adjust alignment
+ if( m_pImpl->nHoriOrient == text::HoriOrientation::INSIDE &&
m_pImpl->nHoriRelation == text::RelOrientation::PAGE_FRAME )
- {
- // convert 'left to page' to 'from left -<width> to page text area'
- m_pImpl->nHoriOrient = text::HoriOrientation::NONE;
- m_pImpl->nHoriRelation = text::RelOrientation::PAGE_PRINT_AREA;
- m_pImpl->nLeftPosition = - nWidth;
- }
- else if( m_pImpl->nHoriOrient == text::HoriOrientation::OUTSIDE &&
+ {
+ // convert 'left to page' to 'from left -<width> to page text area'
+ m_pImpl->nHoriOrient = text::HoriOrientation::NONE;
+ m_pImpl->nHoriRelation = text::RelOrientation::PAGE_PRINT_AREA;
+ m_pImpl->nLeftPosition = - nWidth;
+ }
+ else if( m_pImpl->nHoriOrient == text::HoriOrientation::OUTSIDE &&
m_pImpl->nHoriRelation == text::RelOrientation::PAGE_FRAME )
- {
- // convert 'right to page' to 'from left 0 to right page border'
- m_pImpl->nHoriOrient = text::HoriOrientation::NONE;
- m_pImpl->nHoriRelation = text::RelOrientation::PAGE_RIGHT;
- m_pImpl->nLeftPosition = 0;
- }
+ {
+ // convert 'right to page' to 'from left 0 to right page border'
+ m_pImpl->nHoriOrient = text::HoriOrientation::NONE;
+ m_pImpl->nHoriRelation = text::RelOrientation::PAGE_RIGHT;
+ m_pImpl->nLeftPosition = 0;
+ }
- m_pImpl->applyPosition(xGraphicObjectProperties);
- m_pImpl->applyRelativePosition(xGraphicObjectProperties);
- bool bOpaque = m_pImpl->bOpaque && !m_pImpl->rDomainMapper.IsInHeaderFooter( );
- if( !bOpaque )
- {
- xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_OPAQUE ),
- uno::makeAny(bOpaque));
- }
- xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_SURROUND ),
+ m_pImpl->applyPosition(xGraphicObjectProperties);
+ m_pImpl->applyRelativePosition(xGraphicObjectProperties);
+ bool bOpaque = m_pImpl->bOpaque && !m_pImpl->rDomainMapper.IsInHeaderFooter( );
+ if( !bOpaque )
+ {
+ xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_OPAQUE ),
+ uno::makeAny(bOpaque));
+ }
+ xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_SURROUND ),
uno::makeAny(m_pImpl->nWrap));
- if( m_pImpl->bLayoutInCell && m_pImpl->nWrap != text::WrapTextMode_THROUGHT )
- xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_FOLLOW_TEXT_FLOW ),
+ if( m_pImpl->bLayoutInCell && m_pImpl->nWrap != text::WrapTextMode_THROUGHT )
+ xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_FOLLOW_TEXT_FLOW ),
uno::makeAny(true));
- xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_SURROUND_CONTOUR ),
- uno::makeAny(m_pImpl->bContour));
- xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_CONTOUR_OUTSIDE ),
- uno::makeAny(m_pImpl->bContourOutside));
- m_pImpl->applyMargins(xGraphicObjectProperties);
+ xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_SURROUND_CONTOUR ),
+ uno::makeAny(m_pImpl->bContour));
+ xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_CONTOUR_OUTSIDE ),
+ uno::makeAny(m_pImpl->bContourOutside));
+ m_pImpl->applyMargins(xGraphicObjectProperties);
+ }
if( m_pImpl->eColorMode == drawing::ColorMode_STANDARD &&
m_pImpl->nContrast == -70 &&
More information about the Libreoffice-commits
mailing list