summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2018-04-21 07:50:54 +0200
committerJochen Nitschke <j.nitschke+logerrit@ok.de>2018-04-21 11:02:29 +0200
commitde07f40030bbd604bc42d58f0e954cca284a2646 (patch)
treed16090c7008b533b8af295b68701681012ba7608
parent3322661414a558d29146c40c0cd5e9db0a7b21dd (diff)
cppcheck: identicalInnerCondition
renamed temporary list in EnhancedCustomShape2d.cxx to avoid shadow of a local variable Change-Id: I17a2261dafd2067480fcc5314af4f48765d6b690 Reviewed-on: https://gerrit.libreoffice.org/53244 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
-rw-r--r--basegfx/source/polygon/b3dpolygontools.cxx5
-rw-r--r--basic/source/sbx/sbxscan.cxx3
-rw-r--r--basic/source/uno/scriptcont.cxx29
-rw-r--r--filter/source/svg/svgexport.cxx4
-rw-r--r--framework/source/xml/imagesdocumenthandler.cxx3
-rw-r--r--sfx2/source/doc/guisaveas.cxx3
-rw-r--r--sot/source/sdstor/stgstrms.cxx3
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.cxx33
-rw-r--r--svx/source/svdraw/svdedtv1.cxx2
-rw-r--r--svx/source/svdraw/svdomeas.cxx3
-rw-r--r--svx/source/xml/xmlexport.cxx49
-rwxr-xr-xsw/source/core/text/itrform2.cxx7
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx44
-rw-r--r--sw/source/ui/dbui/mmgreetingspage.cxx18
-rw-r--r--sw/source/uibase/utlui/content.cxx4
-rw-r--r--vcl/source/window/event.cxx8
-rw-r--r--vcl/unx/generic/gdi/cairotextrender.cxx21
-rw-r--r--xmloff/source/draw/shapeexport.cxx24
18 files changed, 117 insertions, 146 deletions
diff --git a/basegfx/source/polygon/b3dpolygontools.cxx b/basegfx/source/polygon/b3dpolygontools.cxx
index 17dd77600f96..2059d91bdef6 100644
--- a/basegfx/source/polygon/b3dpolygontools.cxx
+++ b/basegfx/source/polygon/b3dpolygontools.cxx
@@ -147,10 +147,7 @@ namespace basegfx
aSnippet.append(interpolate(aCurrentPoint, aNextPoint, fDotDashMovingLength / fEdgeLength));
- if(bHandleLine)
- {
- pLineTarget->append(aSnippet);
- }
+ pLineTarget->append(aSnippet);
aSnippet.clear();
}
diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx
index dc598bb05d0f..c725aff2397d 100644
--- a/basic/source/sbx/sbxscan.cxx
+++ b/basic/source/sbx/sbxscan.cxx
@@ -90,8 +90,7 @@ ErrCode ImpScan( const OUString& rWSrc, double& nVal, SbxDataType& rType,
if( bOnlyIntntl )
{
ImpGetIntntlSep( cIntntlDecSep, cIntntlGrpSep, cIntntlDecSepAlt );
- if( bOnlyIntntl )
- cNonIntntlDecSep = cIntntlDecSep;
+ cNonIntntlDecSep = cIntntlDecSep;
// Ensure that the decimal separator alternative is really one.
if (cIntntlDecSepAlt && cIntntlDecSepAlt == cNonIntntlDecSep)
cIntntlDecSepAlt = 0;
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index 3f391e81b03f..aba9aabbee01 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -861,26 +861,23 @@ bool SfxScriptLibraryContainer::implLoadPasswordLibrary
{
uno::Reference< embed::XStorage > xLibrariesStor;
uno::Reference< embed::XStorage > xLibraryStor;
- if( bStorage )
- {
- try {
- xLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READ );
- if ( !xLibrariesStor.is() )
- {
- throw uno::RuntimeException("null returned from openStorageElement");
- }
- xLibraryStor = xLibrariesStor->openStorageElement( Name, embed::ElementModes::READ );
- if ( !xLibraryStor.is() )
- {
- throw uno::RuntimeException("null returned from openStorageElement");
- }
+ try {
+ xLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READ );
+ if ( !xLibrariesStor.is() )
+ {
+ throw uno::RuntimeException("null returned from openStorageElement");
}
- catch(const uno::Exception& )
+ xLibraryStor = xLibrariesStor->openStorageElement( Name, embed::ElementModes::READ );
+ if ( !xLibraryStor.is() )
{
- OSL_FAIL( "### couldn't open sub storage for library" );
- return false;
+ throw uno::RuntimeException("null returned from openStorageElement");
}
}
+ catch(const uno::Exception& )
+ {
+ OSL_FAIL( "### couldn't open sub storage for library" );
+ return false;
+ }
for( sal_Int32 i = 0 ; i < nNameCount ; i++ )
{
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index 8f9b0da7feee..16d43eb24eb3 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -1894,9 +1894,7 @@ bool SVGFilter::implCreateObjects()
}
}
#endif
-
- if( xDrawPage.is() )
- implCreateObjectsFromShapes( xDrawPage, xDrawPage );
+ implCreateObjectsFromShapes( xDrawPage, xDrawPage );
}
}
return true;
diff --git a/framework/source/xml/imagesdocumenthandler.cxx b/framework/source/xml/imagesdocumenthandler.cxx
index cbcb0eb265df..f18df438ab4e 100644
--- a/framework/source/xml/imagesdocumenthandler.cxx
+++ b/framework/source/xml/imagesdocumenthandler.cxx
@@ -510,8 +510,7 @@ void SAL_CALL OReadImagesDocumentHandler::endElement(const OUString& aName)
{
if ( m_pExternalImages && !m_aImageList.pExternalImageList )
{
- if ( !m_aImageList.pExternalImageList )
- m_aImageList.pExternalImageList.reset( m_pExternalImages );
+ m_aImageList.pExternalImageList.reset( m_pExternalImages );
}
m_bExternalImagesStartFound = false;
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 17e8edd623cb..1f5472b3087e 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -736,8 +736,7 @@ sal_Int8 ModelData_Impl::CheckFilter( const OUString& aFilterName )
{
// get properties of filter
uno::Sequence< beans::PropertyValue > aFilterProps;
- if ( !aFilterName.isEmpty() )
- m_pOwner->GetFilterConfiguration()->getByName( aFilterName ) >>= aFilterProps;
+ m_pOwner->GetFilterConfiguration()->getByName( aFilterName ) >>= aFilterProps;
aFiltPropsHM = ::comphelper::SequenceAsHashMap( aFilterProps );
nFiltFlags = static_cast<SfxFilterFlags>(aFiltPropsHM.getUnpackedValueOrDefault("Flags", sal_Int32(0) ));
diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index a9e7217a3a21..ae140fdb128a 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -370,8 +370,7 @@ sal_Int32 StgStrm::scanBuildPageChainCache()
// see if an already counted page is re-visited
while( nBgn >= 0 && !bError )
{
- if( nBgn >= 0 )
- m_aPagesCache.push_back(nBgn);
+ m_aPagesCache.push_back(nBgn);
nBgn = m_pFat->GetNextPage( nBgn );
//returned second is false if it already exists
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index f2a00feaad80..70e2c5fb352d 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -2266,30 +2266,27 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( bool bLineGeometryNeededOnly )
sal_uInt32 nColorIndex(0);
// #i37011# remove invisible objects
- if(!vObjectList.empty())
+ std::vector< std::pair< SdrPathObj*, double> > vNewList;
+
+ for ( std::pair< SdrPathObj*, double >& rCandidate : vObjectList )
{
- std::vector< std::pair< SdrPathObj*, double> > vTempList;
+ SdrPathObj* pObj(rCandidate.first);
+ const drawing::LineStyle eLineStyle(pObj->GetMergedItem(XATTR_LINESTYLE).GetValue());
+ const drawing::FillStyle eFillStyle(pObj->GetMergedItem(XATTR_FILLSTYLE).GetValue());
- for ( std::pair< SdrPathObj*, double >& rCandidate : vObjectList )
+ // #i40600# if bLineGeometryNeededOnly is set, linestyle does not matter
+ if(!bLineGeometryNeededOnly && (drawing::LineStyle_NONE == eLineStyle) && (drawing::FillStyle_NONE == eFillStyle))
{
- SdrPathObj* pObj(rCandidate.first);
- const drawing::LineStyle eLineStyle(pObj->GetMergedItem(XATTR_LINESTYLE).GetValue());
- const drawing::FillStyle eFillStyle(pObj->GetMergedItem(XATTR_FILLSTYLE).GetValue());
-
- // #i40600# if bLineGeometryNeededOnly is set, linestyle does not matter
- if(!bLineGeometryNeededOnly && (drawing::LineStyle_NONE == eLineStyle) && (drawing::FillStyle_NONE == eFillStyle))
- {
- delete pObj;
- }
- else
- {
- vTempList.push_back(rCandidate);
- }
+ delete pObj;
+ }
+ else
+ {
+ vNewList.push_back(rCandidate);
}
-
- vObjectList = vTempList;
}
+ vObjectList = vNewList;
+
if(1 == vObjectList.size())
{
// a single object, correct some values
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index b3bc7bcea969..8297cd96d3d0 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -1044,7 +1044,7 @@ void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, bool bReplaceAll)
SdrEdgeObj* pEdgeObj = dynamic_cast< SdrEdgeObj* >( pObj );
if ( pEdgeObj )
bPossibleGeomChange = true;
- else if( bUndo )
+ else
vConnectorUndoActions = CreateConnectorUndo( *pObj );
AddUndoActions( vConnectorUndoActions );
diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx
index 9c1f6550f66d..bcb83fb92003 100644
--- a/svx/source/svdraw/svdomeas.cxx
+++ b/svx/source/svdraw/svdomeas.cxx
@@ -164,8 +164,7 @@ OUString SdrMeasureObj::TakeRepresentation(SdrMeasureFieldKind eMeasureFieldKind
if(eMeasureUnit == FUNIT_NONE)
eMeasureUnit = eModUIUnit;
- if(bShowUnit)
- aStr = SdrModel::GetUnitString(eMeasureUnit);
+ aStr = SdrModel::GetUnitString(eMeasureUnit);
}
break;
diff --git a/svx/source/xml/xmlexport.cxx b/svx/source/xml/xmlexport.cxx
index f34dcb5de520..5e542ac665f5 100644
--- a/svx/source/xml/xmlexport.cxx
+++ b/svx/source/xml/xmlexport.cxx
@@ -84,37 +84,34 @@ bool SvxDrawingLayerExport( SdrModel* pModel, const uno::Reference<io::XOutputSt
xGraphicHelper = SvXMLGraphicHelper::Create( SvXMLGraphicHelperMode::Write );
xGraphicResolver = xGraphicHelper.get();
- if( bDocRet )
- {
- uno::Reference<xml::sax::XDocumentHandler> xHandler( xWriter, uno::UNO_QUERY );
+ uno::Reference<xml::sax::XDocumentHandler> xHandler( xWriter, uno::UNO_QUERY );
- // doc export
- uno::Reference< io::XActiveDataSource > xDocSrc( xWriter, uno::UNO_QUERY );
- xDocSrc->setOutputStream( xOut );
+ // doc export
+ uno::Reference< io::XActiveDataSource > xDocSrc( xWriter, uno::UNO_QUERY );
+ xDocSrc->setOutputStream( xOut );
- uno::Sequence< uno::Any > aArgs( xObjectResolver.is() ? 3 : 2 );
- aArgs[0] <<= xHandler;
- aArgs[1] <<= xGraphicResolver;
- if( xObjectResolver.is() )
- aArgs[2] <<= xObjectResolver;
+ uno::Sequence< uno::Any > aArgs( xObjectResolver.is() ? 3 : 2 );
+ aArgs[0] <<= xHandler;
+ aArgs[1] <<= xGraphicResolver;
+ if( xObjectResolver.is() )
+ aArgs[2] <<= xObjectResolver;
- uno::Reference< document::XFilter > xFilter( xContext->getServiceManager()->createInstanceWithArgumentsAndContext( OUString::createFromAscii( pExportService ), aArgs, xContext ), uno::UNO_QUERY );
- if( !xFilter.is() )
- {
- OSL_FAIL( "com.sun.star.comp.Draw.XMLExporter service missing" );
- bDocRet = false;
- }
+ uno::Reference< document::XFilter > xFilter( xContext->getServiceManager()->createInstanceWithArgumentsAndContext( OUString::createFromAscii( pExportService ), aArgs, xContext ), uno::UNO_QUERY );
+ if( !xFilter.is() )
+ {
+ OSL_FAIL( "com.sun.star.comp.Draw.XMLExporter service missing" );
+ bDocRet = false;
+ }
- if( bDocRet )
+ if( bDocRet )
+ {
+ uno::Reference< document::XExporter > xExporter( xFilter, uno::UNO_QUERY );
+ if( xExporter.is() )
{
- uno::Reference< document::XExporter > xExporter( xFilter, uno::UNO_QUERY );
- if( xExporter.is() )
- {
- xExporter->setSourceDocument( xSourceDoc );
-
- uno::Sequence< beans::PropertyValue > aDescriptor( 0 );
- bDocRet = xFilter->filter( aDescriptor );
- }
+ xExporter->setSourceDocument( xSourceDoc );
+
+ uno::Sequence< beans::PropertyValue > aDescriptor( 0 );
+ bDocRet = xFilter->filter( aDescriptor );
}
}
}
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 3e32430d1c36..92091f901bd8 100755
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -486,10 +486,9 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf )
else if ( bHasGrid && pGrid->IsSnapToChars() && ! pGridKernPortion && ! pMulti && ! pPor->InTabGrp() )
{
// insert a grid kerning portion
- if ( ! pGridKernPortion )
- pGridKernPortion = pPor->IsKernPortion() ?
- static_cast<SwKernPortion*>(pPor) :
- new SwKernPortion( *m_pCurr );
+ pGridKernPortion = pPor->IsKernPortion() ?
+ static_cast<SwKernPortion*>(pPor) :
+ new SwKernPortion( *m_pCurr );
// if we have a new GridKernPortion, we initially calculate
// its size so that its ends on the grid
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 0395b9902528..0f328d303d0f 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -1146,30 +1146,28 @@ void WW8TabBandDesc::ReadDef(bool bVer67, const sal_uInt8* pS, short nLen)
WW8_TCellVer6 const * pTc = reinterpret_cast<WW8_TCellVer6 const *>(pT);
for (int i = 0; i < nColsToRead; i++, ++pCurrentTC,++pTc)
{
- if( i < nColsToRead )
- { // TC from file ?
- sal_uInt8 aBits1 = pTc->aBits1Ver6;
- pCurrentTC->bFirstMerged = sal_uInt8( ( aBits1 & 0x01 ) != 0 );
- pCurrentTC->bMerged = sal_uInt8( ( aBits1 & 0x02 ) != 0 );
- pCurrentTC->rgbrc[ WW8_TOP ]
- = WW8_BRCVer9(WW8_BRC( pTc->rgbrcVer6[ WW8_TOP ] ));
- pCurrentTC->rgbrc[ WW8_LEFT ]
- = WW8_BRCVer9(WW8_BRC( pTc->rgbrcVer6[ WW8_LEFT ] ));
- pCurrentTC->rgbrc[ WW8_BOT ]
- = WW8_BRCVer9(WW8_BRC( pTc->rgbrcVer6[ WW8_BOT ] ));
- pCurrentTC->rgbrc[ WW8_RIGHT ]
+ // TC from file ?
+ sal_uInt8 aBits1 = pTc->aBits1Ver6;
+ pCurrentTC->bFirstMerged = sal_uInt8( ( aBits1 & 0x01 ) != 0 );
+ pCurrentTC->bMerged = sal_uInt8( ( aBits1 & 0x02 ) != 0 );
+ pCurrentTC->rgbrc[ WW8_TOP ]
+ = WW8_BRCVer9(WW8_BRC( pTc->rgbrcVer6[ WW8_TOP ] ));
+ pCurrentTC->rgbrc[ WW8_LEFT ]
+ = WW8_BRCVer9(WW8_BRC( pTc->rgbrcVer6[ WW8_LEFT ] ));
+ pCurrentTC->rgbrc[ WW8_BOT ]
+ = WW8_BRCVer9(WW8_BRC( pTc->rgbrcVer6[ WW8_BOT ] ));
+ pCurrentTC->rgbrc[ WW8_RIGHT ]
+ = WW8_BRCVer9(WW8_BRC( pTc->rgbrcVer6[ WW8_RIGHT ] ));
+ if( ( pCurrentTC->bMerged )
+ && ( i > 0 ) )
+ {
+ // Cell merged -> remember
+ //bWWMergedVer6[i] = true;
+ pTCs[i-1].rgbrc[ WW8_RIGHT ]
= WW8_BRCVer9(WW8_BRC( pTc->rgbrcVer6[ WW8_RIGHT ] ));
- if( ( pCurrentTC->bMerged )
- && ( i > 0 ) )
- {
- // Cell merged -> remember
- //bWWMergedVer6[i] = true;
- pTCs[i-1].rgbrc[ WW8_RIGHT ]
- = WW8_BRCVer9(WW8_BRC( pTc->rgbrcVer6[ WW8_RIGHT ] ));
- // apply right border to previous cell
- // bExist must not be set to false, because WW
- // does not count this cells in text boxes....
- }
+ // apply right border to previous cell
+ // bExist must not be set to false, because WW
+ // does not count this cells in text boxes....
}
}
}
diff --git a/sw/source/ui/dbui/mmgreetingspage.cxx b/sw/source/ui/dbui/mmgreetingspage.cxx
index 35aecdbbbeee..85a395f0671a 100644
--- a/sw/source/ui/dbui/mmgreetingspage.cxx
+++ b/sw/source/ui/dbui/mmgreetingspage.cxx
@@ -177,17 +177,15 @@ void SwMailMergeGreetingsPage::UpdatePreview()
try
{
bFemale = xColumn->getString() == sFemaleValue;
- if( !bNoValue )
+
+ //no last name value marks the greeting also as neutral
+ const OUString sLastNameColumn =
+ m_rConfigItem.GetAssignedColumn(MM_PART_LASTNAME);
+ if ( xColAccess->hasByName(sLastNameColumn) )
{
- //no last name value marks the greeting also as neutral
- const OUString sLastNameColumn =
- m_rConfigItem.GetAssignedColumn(MM_PART_LASTNAME);
- if ( xColAccess->hasByName(sLastNameColumn) )
- {
- aCol = xColAccess->getByName(sLastNameColumn);
- aCol >>= xColumn;
- bNoValue = xColumn->getString().isEmpty();
- }
+ aCol = xColAccess->getByName(sLastNameColumn);
+ aCol >>= xColumn;
+ bNoValue = xColumn->getString().isEmpty();
}
}
catch (const sdbc::SQLException&)
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index a4932d34a7eb..4fe719131123 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1250,7 +1250,7 @@ VclPtr<PopupMenu> SwContentTree::CreateContextMenu()
pSubPop4->CheckItem( 405, SwEditShell::IsTOXBaseReadonly(*pBase));
pSubPop4->InsertItem(501, m_aContextStrings[IDX_STR_DELETE_ENTRY]);
}
- else if(ContentTypeId::TABLE == nContentType && !bReadonly)
+ else if(ContentTypeId::TABLE == nContentType)
{
bSubPop4 = true;
pSubPop4->InsertItem(403, m_aContextStrings[IDX_STR_EDIT_ENTRY]);
@@ -1262,7 +1262,7 @@ VclPtr<PopupMenu> SwContentTree::CreateContextMenu()
pSubPop4->EnableItem(404, bProt );
pSubPop4->InsertItem(501, m_aContextStrings[IDX_STR_DELETE_ENTRY]);
}
- else if(bEditable || bDeletable)
+ else
{
if(bEditable && bDeletable)
diff --git a/vcl/source/window/event.cxx b/vcl/source/window/event.cxx
index 6a9ed84cbaab..b344d7104fc6 100644
--- a/vcl/source/window/event.cxx
+++ b/vcl/source/window/event.cxx
@@ -629,11 +629,9 @@ void Window::ImplCallFocusChangeActivate( vcl::Window* pNewOverlapWindow,
}
if ( bCallActivate && ! pNewOverlapWindow->mpWindowImpl->mbActive )
{
- if( ! pNewOverlapWindow->mpWindowImpl->mbActive )
- {
- pNewOverlapWindow->mpWindowImpl->mbActive = true;
- pNewOverlapWindow->Activate();
- }
+ pNewOverlapWindow->mpWindowImpl->mbActive = true;
+ pNewOverlapWindow->Activate();
+
if ( pNewRealWindow != pNewOverlapWindow )
{
if( ! pNewRealWindow->mpWindowImpl->mbActive )
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index 7febf686e9fd..25317651a003 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -275,17 +275,16 @@ void CairoTextRender::DrawTextLayout(const CommonSalLayout& rLayout)
//like them
double xdiff = 0.0;
double ydiff = 0.0;
- if (nGlyphRotation)
- {
- // The y is the origin point position, but Cairo will draw
- // the glyph *above* that point, we need to move it down to
- // the glyph’s baseline.
- cairo_text_extents_t aExt;
- cairo_glyph_extents(cr, &cairo_glyphs[nStartIndex], nLen, &aExt);
- double nDescender = std::fmax(aExt.height + aExt.y_bearing, 0);
- ydiff = (aExt.x_advance - nDescender) / nHeight;
- xdiff = -font_extents.descent/nHeight;
- }
+
+ // The y is the origin point position, but Cairo will draw
+ // the glyph *above* that point, we need to move it down to
+ // the glyph’s baseline.
+ cairo_text_extents_t aExt;
+ cairo_glyph_extents(cr, &cairo_glyphs[nStartIndex], nLen, &aExt);
+ double nDescender = std::fmax(aExt.height + aExt.y_bearing, 0);
+ ydiff = (aExt.x_advance - nDescender) / nHeight;
+ xdiff = -font_extents.descent/nHeight;
+
cairo_matrix_translate(&m, xdiff, ydiff);
}
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index a04343009b6b..27b6dd486ef0 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -1823,19 +1823,17 @@ void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& x
if( nFound & Found::MACRO )
{
SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, true, true);
- if ( nFound & Found::MACRO )
- {
- mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_LANGUAGE, mrExport.GetNamespaceMap().GetQNameByKey(
- XML_NAMESPACE_OOO, GetXMLToken(XML_SCRIPT) ) );
- OUString aEventQName(
- mrExport.GetNamespaceMap().GetQNameByKey(
- XML_NAMESPACE_DOM, "click" ) );
- mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
- mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aStrMacro );
- mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, "simple" );
-
- SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, true, true);
- }
+
+ mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_LANGUAGE, mrExport.GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_OOO, GetXMLToken(XML_SCRIPT) ) );
+ OUString aEventQName(
+ mrExport.GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_DOM, "click" ) );
+ mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aStrMacro );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, "simple" );
+
+ SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, true, true);
}
}
}