diff options
58 files changed, 748 insertions, 909 deletions
diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx index 90bbcbe44e83..c8f9506014ad 100644 --- a/basctl/source/basicide/bastype3.cxx +++ b/basctl/source/basicide/bastype3.cxx @@ -486,60 +486,57 @@ EntryDescriptor TreeListBox::GetEntryDescriptor( SvTreeListEntry* pEntry ) pEntry = GetParent( pEntry ); } - if ( !aEntries.empty() ) + for (SvTreeListEntry* pLE : aEntries) { - for (SvTreeListEntry* pLE : aEntries) - { - assert(pLE && "Entry not found in array"); - Entry* pBE = static_cast<Entry*>(pLE->GetUserData()); - assert(pBE && "No data found in entry!"); + assert(pLE && "Entry not found in array"); + Entry* pBE = static_cast<Entry*>(pLE->GetUserData()); + assert(pBE && "No data found in entry!"); - switch ( pBE->GetType() ) + switch ( pBE->GetType() ) + { + case OBJ_TYPE_LIBRARY: { - case OBJ_TYPE_LIBRARY: - { - aLibName = GetEntryText( pLE ); - eType = pBE->GetType(); - } - break; - case OBJ_TYPE_MODULE: - { - aName = GetEntryText( pLE ); - eType = pBE->GetType(); - } - break; - case OBJ_TYPE_METHOD: - { - aMethodName = GetEntryText( pLE ); - eType = pBE->GetType(); - } - break; - case OBJ_TYPE_DIALOG: - { - aName = GetEntryText( pLE ); - eType = pBE->GetType(); - } - break; - case OBJ_TYPE_DOCUMENT_OBJECTS: - case OBJ_TYPE_USERFORMS: - case OBJ_TYPE_NORMAL_MODULES: - case OBJ_TYPE_CLASS_MODULES: - { - aLibSubName = GetEntryText( pLE ); - eType = pBE->GetType(); - } - break; - default: - { - OSL_FAIL( "GetEntryDescriptor: unknown type" ); - eType = OBJ_TYPE_UNKNOWN; - } - break; + aLibName = GetEntryText( pLE ); + eType = pBE->GetType(); } - - if ( eType == OBJ_TYPE_UNKNOWN ) - break; + break; + case OBJ_TYPE_MODULE: + { + aName = GetEntryText( pLE ); + eType = pBE->GetType(); + } + break; + case OBJ_TYPE_METHOD: + { + aMethodName = GetEntryText( pLE ); + eType = pBE->GetType(); + } + break; + case OBJ_TYPE_DIALOG: + { + aName = GetEntryText( pLE ); + eType = pBE->GetType(); + } + break; + case OBJ_TYPE_DOCUMENT_OBJECTS: + case OBJ_TYPE_USERFORMS: + case OBJ_TYPE_NORMAL_MODULES: + case OBJ_TYPE_CLASS_MODULES: + { + aLibSubName = GetEntryText( pLE ); + eType = pBE->GetType(); + } + break; + default: + { + OSL_FAIL( "GetEntryDescriptor: unknown type" ); + eType = OBJ_TYPE_UNKNOWN; + } + break; } + + if ( eType == OBJ_TYPE_UNKNOWN ) + break; } return EntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aName, aMethodName, eType ); diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 23fedab3b08b..3eebffa44d3a 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -1149,26 +1149,23 @@ void SbModule::implProcessModuleRunInit( ModuleInitDependencyMap& rMap, ClassMod if( pModule->pClassData != nullptr ) { std::vector< OUString >& rReqTypes = pModule->pClassData->maRequiredTypes; - if( !rReqTypes.empty() ) + for( const auto& rStr : rReqTypes ) { - for( const auto& rStr : rReqTypes ) + // Is required type a class module? + ModuleInitDependencyMap::iterator itFind = rMap.find( rStr ); + if( itFind != rMap.end() ) { - // Is required type a class module? - ModuleInitDependencyMap::iterator itFind = rMap.find( rStr ); - if( itFind != rMap.end() ) + ClassModuleRunInitItem& rParentItem = itFind->second; + if( rParentItem.m_bProcessing ) { - ClassModuleRunInitItem& rParentItem = itFind->second; - if( rParentItem.m_bProcessing ) - { - // TODO: raise error? - OSL_FAIL( "Cyclic module dependency detected" ); - continue; - } + // TODO: raise error? + OSL_FAIL( "Cyclic module dependency detected" ); + continue; + } - if( !rParentItem.m_bRunInitDone ) - { - implProcessModuleRunInit( rMap, rParentItem ); - } + if( !rParentItem.m_bRunInitDone ) + { + implProcessModuleRunInit( rMap, rParentItem ); } } } diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx index 8681d47875d0..3f814e2cc1eb 100644 --- a/desktop/source/migration/services/oo3extensionmigration.cxx +++ b/desktop/source/migration/services/oo3extensionmigration.cxx @@ -344,12 +344,9 @@ Any OO3ExtensionMigration::execute( const Sequence< beans::NamedValue >& ) sSourceDir += "/user/uno_packages/cache/uno_packages"; TStringVector aExtensionToMigrate; scanUserExtensions( sSourceDir, aExtensionToMigrate ); - if (!aExtensionToMigrate.empty()) + for (auto const& extensionToMigrate : aExtensionToMigrate) { - for (auto const& extensionToMigrate : aExtensionToMigrate) - { - migrateExtension(extensionToMigrate); - } + migrateExtension(extensionToMigrate); } } diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx index 6f22961fdf8d..0651b70eb1c0 100644 --- a/fpicker/source/office/OfficeFilePicker.cxx +++ b/fpicker/source/office/OfficeFilePicker.cxx @@ -189,7 +189,7 @@ void SvtFilePicker::prepareExecute() } - if ( m_pFilterList && !m_pFilterList->empty() ) + if ( m_pFilterList ) { for (auto & elem : *m_pFilterList) { @@ -652,7 +652,7 @@ Any SAL_CALL SvtFilePicker::getValue( sal_Int16 nElementID, sal_Int16 nControlAc ::svt::OControlAccess aAccess( getDialog(), getDialog()->GetView() ); aAny = aAccess.getValue( nElementID, nControlAction ); } - else if ( m_pElemList && !m_pElemList->empty() ) + else if ( m_pElemList ) { for (auto const& elem : *m_pElemList) { @@ -718,7 +718,7 @@ OUString SAL_CALL SvtFilePicker::getLabel( sal_Int16 nLabelID ) ::svt::OControlAccess aAccess( getDialog(), getDialog()->GetView() ); aLabel = aAccess.getLabel( nLabelID ); } - else if ( m_pElemList && !m_pElemList->empty() ) + else if ( m_pElemList ) { for (auto const& elem : *m_pElemList) { diff --git a/framework/source/dispatch/interceptionhelper.cxx b/framework/source/dispatch/interceptionhelper.cxx index 27fb2a14b538..32378f2283a5 100644 --- a/framework/source/dispatch/interceptionhelper.cxx +++ b/framework/source/dispatch/interceptionhelper.cxx @@ -52,7 +52,7 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL InterceptionHelper::queryD // b) No match by registration - but a valid interceptor list. // Find first interceptor w/o pattern, so we need to query it - if (!xInterceptor.is() && !m_lInterceptionRegs.empty()) + if (!xInterceptor.is()) { for (auto const& lInterceptionReg : m_lInterceptionRegs) { diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index 8451bef2bbfc..3cfcbe3b88fc 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -1269,12 +1269,9 @@ void ToolbarLayoutManager::implts_createNonContextSensitiveToolBars() { } - if ( !aMakeVisibleToolbars.empty() ) + for (auto const& rURL : aMakeVisibleToolbars) { - for (auto const& rURL : aMakeVisibleToolbars) - { - requestToolbar(rURL); - } + requestToolbar(rURL); } } diff --git a/helpcompiler/source/HelpLinker.cxx b/helpcompiler/source/HelpLinker.cxx index 95bf39d764d1..86d2d254bef2 100644 --- a/helpcompiler/source/HelpLinker.cxx +++ b/helpcompiler/source/HelpLinker.cxx @@ -372,7 +372,7 @@ void HelpLinker::link() addBookmark( pFileDbBase_DBHelp, documentPath, fileB, std::string(), jarfileB, titleB); const std::vector<std::string> *hidlist = streamTable.appl_hidlist.get(); - if (hidlist && !hidlist->empty()) + if (hidlist) { // now iterate over all elements of the hidlist for (auto & elem : *hidlist) @@ -413,7 +413,7 @@ void HelpLinker::link() // and last the helptexts const Stringtable *helpTextHash = streamTable.appl_helptexts.get(); - if (helpTextHash && !helpTextHash->empty()) + if (helpTextHash) { for (auto const& elem : *helpTextHash) { diff --git a/l10ntools/source/po.cxx b/l10ntools/source/po.cxx index a0107530e194..b1507a16ae65 100644 --- a/l10ntools/source/po.cxx +++ b/l10ntools/source/po.cxx @@ -137,11 +137,8 @@ void GenPoEntry::writeToFile(std::ofstream& rOFStream) const rOFStream << "#. " << m_sExtractCom.toString().replaceAll("\n","\n#. ") << std::endl; - if ( !m_sReferences.empty() ) - { - for(std::vector<OString>::const_iterator it = m_sReferences.begin(); it != m_sReferences.end(); ++it) - rOFStream << "#: " << *it << std::endl; - } + for(std::vector<OString>::const_iterator it = m_sReferences.begin(); it != m_sReferences.end(); ++it) + rOFStream << "#: " << *it << std::endl; if ( m_bFuzzy ) rOFStream << "#, fuzzy" << std::endl; if ( m_bCFormat ) diff --git a/oox/source/helper/propertymap.cxx b/oox/source/helper/propertymap.cxx index 6b5635d8023e..8e7d3c505f98 100644 --- a/oox/source/helper/propertymap.cxx +++ b/oox/source/helper/propertymap.cxx @@ -239,17 +239,14 @@ void PropertyMap::assignAll( const PropertyMap& rPropMap ) Sequence< PropertyValue > PropertyMap::makePropertyValueSequence() const { Sequence< PropertyValue > aSeq( static_cast< sal_Int32 >( maProperties.size() ) ); - if( !maProperties.empty() ) + PropertyValue* pValues = aSeq.getArray(); + for (auto const& prop : maProperties) { - PropertyValue* pValues = aSeq.getArray(); - for (auto const& prop : maProperties) - { - OSL_ENSURE( (0 <= prop.first) && (prop.first < PROP_COUNT), "PropertyMap::makePropertyValueSequence - invalid property identifier" ); - pValues->Name = (*mpPropNames)[ prop.first ]; - pValues->Value = prop.second; - pValues->State = PropertyState_DIRECT_VALUE; - ++pValues; - } + OSL_ENSURE( (0 <= prop.first) && (prop.first < PROP_COUNT), "PropertyMap::makePropertyValueSequence - invalid property identifier" ); + pValues->Name = (*mpPropNames)[ prop.first ]; + pValues->Value = prop.second; + pValues->State = PropertyState_DIRECT_VALUE; + ++pValues; } return aSeq; } diff --git a/oox/source/ole/axbinaryreader.cxx b/oox/source/ole/axbinaryreader.cxx index e478677f9aeb..cbd7051637a5 100644 --- a/oox/source/ole/axbinaryreader.cxx +++ b/oox/source/ole/axbinaryreader.cxx @@ -247,7 +247,7 @@ bool AxBinaryPropertyReader::finalizeImport() { // read large properties maInStrm.align( 4 ); - if( ensureValid( mnPropFlags == 0 ) && !maLargeProps.empty() ) + if( ensureValid( mnPropFlags == 0 ) ) { for (auto const& largeProp : maLargeProps) { @@ -260,7 +260,7 @@ bool AxBinaryPropertyReader::finalizeImport() maInStrm.seek( mnPropsEnd ); // read stream properties (no stream alignment between properties!) - if( ensureValid() && !maStreamProps.empty() ) + if( ensureValid() ) { for (auto const& streamProp : maStreamProps) { diff --git a/oox/source/ole/axbinarywriter.cxx b/oox/source/ole/axbinarywriter.cxx index d0e0c556e975..89d2dc25351a 100644 --- a/oox/source/ole/axbinarywriter.cxx +++ b/oox/source/ole/axbinarywriter.cxx @@ -155,28 +155,22 @@ void AxBinaryPropertyWriter::finalizeExport() { // write large properties maOutStrm.align( 4 ); - if( !maLargeProps.empty() ) + for (auto const& largeProp : maLargeProps) { - for (auto const& largeProp : maLargeProps) - { - if (!ensureValid()) - break; - largeProp->writeProperty( maOutStrm ); - maOutStrm.align( 4 ); - } + if (!ensureValid()) + break; + largeProp->writeProperty( maOutStrm ); + maOutStrm.align( 4 ); } mnBlockSize = maOutStrm.tell() - mnPropFlagsStart; // write stream properties (no stream alignment between properties!) - if( !maStreamProps.empty() ) + for (auto const& streamProp : maStreamProps) { - for (auto const& streamProp : maStreamProps) - { - if (!ensureValid()) - break; - streamProp->writeProperty( maOutStrm ); - } + if (!ensureValid()) + break; + streamProp->writeProperty( maOutStrm ); } sal_Int64 nPos = maOutStrm.tell(); diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index f29ecfd3ea0a..492d96692f65 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -1904,19 +1904,16 @@ void OStorage::ChildIsDisposed( const uno::Reference< uno::XInterface >& xChild // this method must not contain any locking // the locking is done in the listener - if ( !m_pData->m_aOpenSubComponentsVector.empty() ) + for ( WeakComponentVector::iterator pCompIter = m_pData->m_aOpenSubComponentsVector.begin(); + pCompIter != m_pData->m_aOpenSubComponentsVector.end(); ) { - for ( WeakComponentVector::iterator pCompIter = m_pData->m_aOpenSubComponentsVector.begin(); - pCompIter != m_pData->m_aOpenSubComponentsVector.end(); ) + uno::Reference< lang::XComponent > xTmp = (*pCompIter); + if ( !xTmp.is() || xTmp == xChild ) { - uno::Reference< lang::XComponent > xTmp = (*pCompIter); - if ( !xTmp.is() || xTmp == xChild ) - { - pCompIter = m_pData->m_aOpenSubComponentsVector.erase(pCompIter); - } - else - ++pCompIter; + pCompIter = m_pData->m_aOpenSubComponentsVector.erase(pCompIter); } + else + ++pCompIter; } } diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx index ab908712f108..907d292b4d37 100644 --- a/sc/source/core/data/table5.cxx +++ b/sc/source/core/data/table5.cxx @@ -1012,19 +1012,13 @@ void ScTable::SyncColRowFlags() pRowFlags->AndValue(0, MAXROW, nManualBreakComplement); mpColFlags->AndValue(0, MAXCOL+1, nManualBreakComplement); - if (!maRowManualBreaks.empty()) - { - for (set<SCROW>::const_iterator itr = maRowManualBreaks.begin(), itrEnd = maRowManualBreaks.end(); - itr != itrEnd; ++itr) - pRowFlags->OrValue(*itr, CRFlags::ManualBreak); - } + for (set<SCROW>::const_iterator itr = maRowManualBreaks.begin(), itrEnd = maRowManualBreaks.end(); + itr != itrEnd; ++itr) + pRowFlags->OrValue(*itr, CRFlags::ManualBreak); - if (!maColManualBreaks.empty()) - { - for (set<SCCOL>::const_iterator itr = maColManualBreaks.begin(), itrEnd = maColManualBreaks.end(); - itr != itrEnd; ++itr) - mpColFlags->OrValue(*itr, CRFlags::ManualBreak); - } + for (set<SCCOL>::const_iterator itr = maColManualBreaks.begin(), itrEnd = maColManualBreaks.end(); + itr != itrEnd; ++itr) + mpColFlags->OrValue(*itr, CRFlags::ManualBreak); // Hidden flags. lcl_syncFlags(*mpHiddenCols, *mpHiddenRows, mpColFlags.get(), pRowFlags.get(), CRFlags::Hidden); diff --git a/sc/source/core/tool/addincol.cxx b/sc/source/core/tool/addincol.cxx index 4e77457c9058..2ce4acabac43 100644 --- a/sc/source/core/tool/addincol.cxx +++ b/sc/source/core/tool/addincol.cxx @@ -605,19 +605,16 @@ bool ScUnoAddInCollection::GetCalcName( const OUString& rExcelName, OUString& rR if ( pFuncData ) { const ::std::vector<ScUnoAddInFuncData::LocalizedName>& rNames = pFuncData->GetCompNames(); - if ( !rNames.empty() ) + ::std::vector<ScUnoAddInFuncData::LocalizedName>::const_iterator it( rNames.begin()); + for ( ; it != rNames.end(); ++it) { - ::std::vector<ScUnoAddInFuncData::LocalizedName>::const_iterator it( rNames.begin()); - for ( ; it != rNames.end(); ++it) + if ( ScGlobal::pCharClass->uppercase( (*it).maName ) == aUpperCmp ) { - if ( ScGlobal::pCharClass->uppercase( (*it).maName ) == aUpperCmp ) - { - //TODO: store upper case for comparing? + //TODO: store upper case for comparing? - // use the first function that has this name for any language - rRetCalcName = pFuncData->GetOriginalName(); - return true; - } + // use the first function that has this name for any language + rRetCalcName = pFuncData->GetOriginalName(); + return true; } } } diff --git a/sc/source/core/tool/adiasync.cxx b/sc/source/core/tool/adiasync.cxx index 9a0770b7addb..05502b552625 100644 --- a/sc/source/core/tool/adiasync.cxx +++ b/sc/source/core/tool/adiasync.cxx @@ -121,20 +121,17 @@ void ScAddInAsync::CallBack( sal_uLong nHandleP, void* pData ) void ScAddInAsync::RemoveDocument( ScDocument* pDocumentP ) { - if ( !theAddInAsyncTbl.empty() ) - { - for( ScAddInAsyncs::reverse_iterator iter1 = theAddInAsyncTbl.rbegin(); iter1 != theAddInAsyncTbl.rend(); ++iter1 ) - { // backwards because of pointer-movement in array - ScAddInAsync* pAsync = iter1->get(); - ScAddInDocs* p = pAsync->pDocs.get(); - ScAddInDocs::iterator iter2 = p->find( pDocumentP ); - if( iter2 != p->end() ) - { - p->erase( iter2 ); - if ( p->empty() ) - { // this AddIn is not used anymore - theAddInAsyncTbl.erase( --(iter1.base()) ); - } + for( ScAddInAsyncs::reverse_iterator iter1 = theAddInAsyncTbl.rbegin(); iter1 != theAddInAsyncTbl.rend(); ++iter1 ) + { // backwards because of pointer-movement in array + ScAddInAsync* pAsync = iter1->get(); + ScAddInDocs* p = pAsync->pDocs.get(); + ScAddInDocs::iterator iter2 = p->find( pDocumentP ); + if( iter2 != p->end() ) + { + p->erase( iter2 ); + if ( p->empty() ) + { // this AddIn is not used anymore + theAddInAsyncTbl.erase( --(iter1.base()) ); } } } diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx index 49e7b5850a74..acd43adcea6a 100644 --- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx +++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx @@ -484,21 +484,18 @@ std::unique_ptr<ScChangeAction> ScXMLChangeTrackingImportHelper::CreateContentAc void ScXMLChangeTrackingImportHelper::CreateGeneratedActions(std::deque<ScMyGenerated>& rList) { - if (!rList.empty()) + for (ScMyGenerated & rGenerated : rList) { - for (ScMyGenerated & rGenerated : rList) + if (rGenerated.nID == 0) { - if (rGenerated.nID == 0) - { - ScCellValue aCell; - if (rGenerated.pCellInfo) - aCell = rGenerated.pCellInfo->CreateCell(pDoc); + ScCellValue aCell; + if (rGenerated.pCellInfo) + aCell = rGenerated.pCellInfo->CreateCell(pDoc); - if (!aCell.isEmpty()) - { - rGenerated.nID = pTrack->AddLoadedGenerated(aCell, rGenerated.aBigRange, rGenerated.pCellInfo->sInputString); - OSL_ENSURE(rGenerated.nID, "could not insert generated action"); - } + if (!aCell.isEmpty()) + { + rGenerated.nID = pTrack->AddLoadedGenerated(aCell, rGenerated.aBigRange, rGenerated.pCellInfo->sInputString); + OSL_ENSURE(rGenerated.nID, "could not insert generated action"); } } } diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 71abccec99a4..d7f51e0c7b7b 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -1882,14 +1882,11 @@ void ScPosWnd::FillRangeNames() ScRange aDummy; std::set<OUString> aSet; ScRangeName* pRangeNames = rDoc.GetRangeName(); - if (!pRangeNames->empty()) + ScRangeName::const_iterator itrBeg = pRangeNames->begin(), itrEnd = pRangeNames->end(); + for (ScRangeName::const_iterator itr = itrBeg; itr != itrEnd; ++itr) { - ScRangeName::const_iterator itrBeg = pRangeNames->begin(), itrEnd = pRangeNames->end(); - for (ScRangeName::const_iterator itr = itrBeg; itr != itrEnd; ++itr) - { - if (itr->second->IsValidReference(aDummy)) - aSet.insert(itr->second->GetName()); - } + if (itr->second->IsValidReference(aDummy)) + aSet.insert(itr->second->GetName()); } for (SCTAB i = 0; i < rDoc.GetTableCount(); ++i) { @@ -1906,13 +1903,10 @@ void ScPosWnd::FillRangeNames() } } - if (!aSet.empty()) + for (std::set<OUString>::iterator itr = aSet.begin(); + itr != aSet.end(); ++itr) { - for (std::set<OUString>::iterator itr = aSet.begin(); - itr != aSet.end(); ++itr) - { - InsertEntry(*itr); - } + InsertEntry(*itr); } } SetText(aPosStr); diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx index 33010a009833..583b5d61517c 100644 --- a/sc/source/ui/dbgui/sfiltdlg.cxx +++ b/sc/source/ui/dbgui/sfiltdlg.cxx @@ -163,19 +163,16 @@ void ScSpecialFilterDlg::Init( const SfxItemSet& rArgSet ) pLbFilterArea->Clear(); pLbFilterArea->InsertEntry( aStrUndefined, 0 ); - if (!pRangeNames->empty()) + ScRangeName::const_iterator itr = pRangeNames->begin(), itrEnd = pRangeNames->end(); + for (; itr != itrEnd; ++itr) { - ScRangeName::const_iterator itr = pRangeNames->begin(), itrEnd = pRangeNames->end(); - for (; itr != itrEnd; ++itr) - { - if (!itr->second->HasType(ScRangeData::Type::Criteria)) - continue; + if (!itr->second->HasType(ScRangeData::Type::Criteria)) + continue; - const sal_Int32 nInsert = pLbFilterArea->InsertEntry(itr->second->GetName()); - OUString aSymbol; - itr->second->GetSymbol(aSymbol); - pLbFilterArea->SetEntryData(nInsert, new OUString(aSymbol)); - } + const sal_Int32 nInsert = pLbFilterArea->InsertEntry(itr->second->GetName()); + OUString aSymbol; + itr->second->GetSymbol(aSymbol); + pLbFilterArea->SetEntryData(nInsert, new OUString(aSymbol)); } // is there a stored source range? diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 2a0f21fa5299..d3622d2c6f1e 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -1099,14 +1099,11 @@ void ScDocFunc::PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngine, bRet = SetEditCell(rPos, *pNewData, !bApi); // Set the paragraph attributes back to the EditEngine. - if (!aRememberItems.empty()) + ScMyRememberItemVector::iterator aItr = aRememberItems.begin(); + while (aItr != aRememberItems.end()) { - ScMyRememberItemVector::iterator aItr = aRememberItems.begin(); - while (aItr != aRememberItems.end()) - { - rEngine.SetParaAttribs((*aItr)->nIndex, (*aItr)->aItemSet); - ++aItr; - } + rEngine.SetParaAttribs((*aItr)->nIndex, (*aItr)->aItemSet); + ++aItr; } // #i61702# if the content isn't accessed, there's no need to set the UpdateMode again diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index cd1f340dea28..cca7461fea0b 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -891,14 +891,11 @@ void ScContentTree::GetAreaNames() ScRange aDummy; std::set<OUString> aSet; ScRangeName* pRangeNames = pDoc->GetRangeName(); - if (!pRangeNames->empty()) + ScRangeName::const_iterator itrBeg = pRangeNames->begin(), itrEnd = pRangeNames->end(); + for (ScRangeName::const_iterator itr = itrBeg; itr != itrEnd; ++itr) { - ScRangeName::const_iterator itrBeg = pRangeNames->begin(), itrEnd = pRangeNames->end(); - for (ScRangeName::const_iterator itr = itrBeg; itr != itrEnd; ++itr) - { - if (itr->second->IsValidReference(aDummy)) - aSet.insert(itr->second->GetName()); - } + if (itr->second->IsValidReference(aDummy)) + aSet.insert(itr->second->GetName()); } for (SCTAB i = 0; i < pDoc->GetTableCount(); ++i) { @@ -915,13 +912,10 @@ void ScContentTree::GetAreaNames() } } - if (!aSet.empty()) + for (std::set<OUString>::iterator itr = aSet.begin(); + itr != aSet.end(); ++itr) { - for (std::set<OUString>::iterator itr = aSet.begin(); - itr != aSet.end(); ++itr) - { - InsertContent(ScContentId::RANGENAME, *itr); - } + InsertContent(ScContentId::RANGENAME, *itr); } } diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index d9537c86acf7..956b0ee64bc1 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -4438,24 +4438,21 @@ static bool lcl_FindRangeOrEntry( const ScNamedEntryArr_Impl& rNamedEntries, // named entry in this object? - if ( !rNamedEntries.empty() ) - { - for (const auto & rNamedEntry : rNamedEntries) - if ( rNamedEntry.GetName() == rName ) - { - // test if named entry is contained in rRanges + for (const auto & rNamedEntry : rNamedEntries) + if ( rNamedEntry.GetName() == rName ) + { + // test if named entry is contained in rRanges - const ScRange& rComp = rNamedEntry.GetRange(); - ScMarkData aMarkData; - aMarkData.MarkFromRangeList( rRanges, false ); - aMarkData.MarkToMulti(); // needed for IsAllMarked - if ( aMarkData.IsAllMarked( rComp ) ) - { - rFound = rComp; - return true; - } + const ScRange& rComp = rNamedEntry.GetRange(); + ScMarkData aMarkData; + aMarkData.MarkFromRangeList( rRanges, false ); + aMarkData.MarkToMulti(); // needed for IsAllMarked + if ( aMarkData.IsAllMarked( rComp ) ) + { + rFound = rComp; + return true; } - } + } return false; // not found } @@ -4483,7 +4480,7 @@ void SAL_CALL ScCellRangesObj::removeByName( const OUString& aName ) ScRangeList aDiff; bool bValid = ( aDiff.Parse( aName, &pDocSh->GetDocument() ) & ScRefFlags::VALID ) == ScRefFlags::VALID; - if (!bValid && !m_pImpl->m_aNamedEntries.empty()) + if (!bValid) { sal_uInt16 nCount = m_pImpl->m_aNamedEntries.size(); for (sal_uInt16 n=0; n<nCount && !bValid; n++) diff --git a/sc/source/ui/unoobj/listenercalls.cxx b/sc/source/ui/unoobj/listenercalls.cxx index c7e30f314913..d05938d85101 100644 --- a/sc/source/ui/unoobj/listenercalls.cxx +++ b/sc/source/ui/unoobj/listenercalls.cxx @@ -46,28 +46,25 @@ void ScUnoListenerCalls::ExecuteAndClear() // During each modified() call, Add may be called again. // These new calls are executed here, too. - if (!aEntries.empty()) + std::vector<ScUnoListenerEntry>::iterator aItr(aEntries.begin()); + while (aItr != aEntries.end()) { - std::vector<ScUnoListenerEntry>::iterator aItr(aEntries.begin()); - while (aItr != aEntries.end()) + ScUnoListenerEntry aEntry = *aItr; + try { - ScUnoListenerEntry aEntry = *aItr; - try - { - aEntry.xListener->modified( aEntry.aEvent ); - } - catch ( const uno::RuntimeException& ) - { - // the listener is an external object and may throw a RuntimeException - // for reasons we don't know - } + aEntry.xListener->modified( aEntry.aEvent ); + } + catch ( const uno::RuntimeException& ) + { + // the listener is an external object and may throw a RuntimeException + // for reasons we don't know + } - // New calls that are added during the modified() call are appended to the end - // of aEntries, so the loop will catch them, too (as long as erase happens - // after modified). + // New calls that are added during the modified() call are appended to the end + // of aEntries, so the loop will catch them, too (as long as erase happens + // after modified). - aItr = aEntries.erase(aItr); - } + aItr = aEntries.erase(aItr); } } diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx index 3864714bb752..8f3ae51260de 100644 --- a/sc/source/ui/view/gridwin2.cxx +++ b/sc/source/ui/view/gridwin2.cxx @@ -515,7 +515,7 @@ void ScGridWindow::DPLaunchFieldPopupMenu(const Point& rScrPos, const Size& rScr ScMenuFloatingWindow* pSubMenu = mpDPFieldPopup->addSubMenuItem( ScResId(STR_MENU_SORT_CUSTOM), !aUserSortNames.empty()); - if (pSubMenu && !aUserSortNames.empty()) + if (pSubMenu) { size_t n = aUserSortNames.size(); for (size_t i = 0; i < n; ++i) diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx b/scripting/source/provider/BrowseNodeFactoryImpl.cxx index b27ac817329f..a0ff04cf2e1f 100644 --- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx +++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx @@ -123,23 +123,20 @@ public: virtual sal_Bool SAL_CALL hasChildNodes() override { - if ( !m_Nodes.empty() ) + for (Reference<XBrowseNode> & xNode : m_Nodes) { - for (Reference<XBrowseNode> & xNode : m_Nodes) + try { - try - { - if ( xNode->hasChildNodes() ) - { - return true; - } - } - catch ( Exception& ) + if ( xNode->hasChildNodes() ) { - // some form of exception getting child nodes so move - // on to the next one + return true; } } + catch ( Exception& ) + { + // some form of exception getting child nodes so move + // on to the next one + } } return false; diff --git a/sd/source/ui/func/smarttag.cxx b/sd/source/ui/func/smarttag.cxx index 3468e9125ee6..a08a47c5cd93 100644 --- a/sd/source/ui/func/smarttag.cxx +++ b/sd/source/ui/func/smarttag.cxx @@ -276,11 +276,8 @@ bool SmartTagSet::Command( const CommandEvent& rCEvt ) void SmartTagSet::addCustomHandles( SdrHdlList& rHandlerList ) { - if( !maSet.empty() ) - { - for( std::set< SmartTagReference >::iterator aIter( maSet.begin() ); aIter != maSet.end(); ) - (*aIter++)->addCustomHandles( rHandlerList ); - } + for( std::set< SmartTagReference >::iterator aIter( maSet.begin() ); aIter != maSet.end(); ) + (*aIter++)->addCustomHandles( rHandlerList ); } /** returns true if the currently selected smart tag has diff --git a/sfx2/source/doc/saveastemplatedlg.cxx b/sfx2/source/doc/saveastemplatedlg.cxx index 5a6a12277f8d..b801462e877a 100644 --- a/sfx2/source/doc/saveastemplatedlg.cxx +++ b/sfx2/source/doc/saveastemplatedlg.cxx @@ -113,11 +113,8 @@ void SfxSaveAsTemplateDialog::initialize() void SfxSaveAsTemplateDialog::SetCategoryLBEntries(const std::vector<OUString>& rFolderNames) { - if (!rFolderNames.empty()) - { - for (size_t i = 0, n = rFolderNames.size(); i < n; ++i) - m_xLBCategory->insert_text(i+1, rFolderNames[i]); - } + for (size_t i = 0, n = rFolderNames.size(); i < n; ++i) + m_xLBCategory->insert_text(i+1, rFolderNames[i]); m_xLBCategory->select(0); } diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index c78cf5b002ac..717eabb934c2 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -344,11 +344,8 @@ void SfxTemplateManagerDlg::fillFolderComboBox() { std::vector<OUString> aFolderNames = mpLocalView->getFolderNames(); - if (!aFolderNames.empty()) - { - for (size_t i = 0, n = aFolderNames.size(); i < n; ++i) - mpCBFolder->InsertEntry(aFolderNames[i], i+1); - } + for (size_t i = 0, n = aFolderNames.size(); i < n; ++i) + mpCBFolder->InsertEntry(aFolderNames[i], i+1); mpCBFolder->SelectEntryPos(0); mpActionMenu->HideItem(MNI_ACTION_RENAME_FOLDER); } @@ -1377,11 +1374,8 @@ IMPL_LINK_NOARG(SfxTemplateCategoryDialog, SelectCategoryHdl, weld::TreeView&, v void SfxTemplateCategoryDialog::SetCategoryLBEntries(std::vector<OUString> aFolderNames) { - if (!aFolderNames.empty()) - { - for (size_t i = 0, n = aFolderNames.size(); i < n; ++i) - mxLBCategory->append_text(aFolderNames[i]); - } + for (size_t i = 0, n = aFolderNames.size(); i < n; ++i) + mxLBCategory->append_text(aFolderNames[i]); mxLBCategory->select(0); } diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index ee119ce4549d..f762768b4dad 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -816,15 +816,12 @@ void SlideImpl::drawPolygons() const void SlideImpl::addPolygons(const PolyPolygonVector& rPolygons) { - if(!rPolygons.empty()) + for( PolyPolygonVector::const_iterator aIter = rPolygons.begin(), + aEnd = rPolygons.end(); + aIter!=aEnd; + ++aIter ) { - for( PolyPolygonVector::const_iterator aIter = rPolygons.begin(), - aEnd = rPolygons.end(); - aIter!=aEnd; - ++aIter ) - { - maPolygons.push_back(*aIter); - } + maPolygons.push_back(*aIter); } } diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index 15a419881e30..59a497d34e46 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -439,12 +439,9 @@ void FmXFormView::notifyViewDying( ) FmXFormView::~FmXFormView() { DBG_ASSERT( m_aPageWindowAdapters.empty(), "FmXFormView::~FmXFormView: Window list not empty!" ); - if ( !m_aPageWindowAdapters.empty() ) + for (const auto& rpAdapter : m_aPageWindowAdapters) { - for (const auto& rpAdapter : m_aPageWindowAdapters) - { - rpAdapter->dispose(); - } + rpAdapter->dispose(); } cancelEvents(); diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index 13ee857e655f..4fd4a177fc2b 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -730,32 +730,29 @@ void SdrDragMethod::CreateOverlayGeometry( } // #i54102# if there are edges, reconnect their ends to the corresponding clones (if found) - if(!aEdges.empty()) + for(SdrEdgeObj* pSdrEdgeObj: aEdges) { - for(SdrEdgeObj* pSdrEdgeObj: aEdges) + SdrObject* pConnectedTo = pSdrEdgeObj->GetConnectedNode(true); + + if(pConnectedTo) { - SdrObject* pConnectedTo = pSdrEdgeObj->GetConnectedNode(true); + SdrObjectAndCloneMap::iterator aEntry = aOriginalAndClones.find(pConnectedTo); - if(pConnectedTo) + if(aEntry != aOriginalAndClones.end()) { - SdrObjectAndCloneMap::iterator aEntry = aOriginalAndClones.find(pConnectedTo); - - if(aEntry != aOriginalAndClones.end()) - { - pSdrEdgeObj->ConnectToNode(true, aEntry->second); - } + pSdrEdgeObj->ConnectToNode(true, aEntry->second); } + } - pConnectedTo = pSdrEdgeObj->GetConnectedNode(false); + pConnectedTo = pSdrEdgeObj->GetConnectedNode(false); - if(pConnectedTo) - { - SdrObjectAndCloneMap::iterator aEntry = aOriginalAndClones.find(pConnectedTo); + if(pConnectedTo) + { + SdrObjectAndCloneMap::iterator aEntry = aOriginalAndClones.find(pConnectedTo); - if(aEntry != aOriginalAndClones.end()) - { - pSdrEdgeObj->ConnectToNode(false, aEntry->second); - } + if(aEntry != aOriginalAndClones.end()) + { + pSdrEdgeObj->ConnectToNode(false, aEntry->second); } } } diff --git a/svx/source/svdraw/svdmark.cxx b/svx/source/svdraw/svdmark.cxx index c1b591404d3f..812f57e67dca 100644 --- a/svx/source/svdraw/svdmark.cxx +++ b/svx/source/svdraw/svdmark.cxx @@ -247,7 +247,7 @@ size_t SdrMarkList::FindObject(const SdrObject* pObj) const // is not inserted in a object list. // Since this may be by purpose and necessary somewhere else i decided that it is // less dangerous to change this method then changing SdrObject::GetOrdNum(). - if(pObj && !maList.empty()) + if(pObj) { for(size_t a = 0; a < maList.size(); ++a) { diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 7706cfebd826..72373d9c98e3 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -2320,13 +2320,10 @@ SdrObject* SdrObject::ImpConvertToContourObj(bool bForceLineDash) extractLineContourFromPrimitive2DSequence(xSequence, aExtractedHairlines, aExtractedLineFills); - if(!aExtractedHairlines.empty()) + // for SdrObject creation, just copy all to a single Hairline-PolyPolygon + for(basegfx::B2DPolygon & rExtractedHairline : aExtractedHairlines) { - // for SdrObject creation, just copy all to a single Hairline-PolyPolygon - for(basegfx::B2DPolygon & rExtractedHairline : aExtractedHairlines) - { - aMergedHairlinePolyPolygon.append(rExtractedHairline); - } + aMergedHairlinePolyPolygon.append(rExtractedHairline); } // check for fill rsults diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index bd77f85b5edb..a720020a7fc4 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -1389,16 +1389,14 @@ void SwAccessibleMap::InvalidateShapeInParaSelection() mpSeletedFrameMap->clear(); } - if( !mapTemp.empty() ) + SwAccessibleContextMap_Impl::iterator aIter = mapTemp.begin(); + while( aIter != mapTemp.end() ) { - SwAccessibleContextMap_Impl::iterator aIter = mapTemp.begin(); - while( aIter != mapTemp.end() ) - { - mpSeletedFrameMap->emplace( (*aIter).first, (*aIter).second ); - ++aIter; - } - mapTemp.clear(); + mpSeletedFrameMap->emplace( (*aIter).first, (*aIter).second ); + ++aIter; } + mapTemp.clear(); + if( bMarkChanged && mpFrameMap) { for (SwAccessibleContext* pAccPara : vecAdd) diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx index f979890d3b9b..1e4cb8e7fcd9 100644 --- a/sw/source/core/undo/undel.cxx +++ b/sw/source/core/undo/undel.cxx @@ -54,18 +54,15 @@ */ static void lcl_MakeAutoFrames( const SwFrameFormats& rSpzArr, sal_uLong nMovedIndex ) { - if( !rSpzArr.empty() ) + for( size_t n = 0; n < rSpzArr.size(); ++n ) { - for( size_t n = 0; n < rSpzArr.size(); ++n ) + SwFrameFormat * pFormat = rSpzArr[n]; + const SwFormatAnchor* pAnchor = &pFormat->GetAnchor(); + if (pAnchor->GetAnchorId() == RndStdIds::FLY_AT_CHAR) { - SwFrameFormat * pFormat = rSpzArr[n]; - const SwFormatAnchor* pAnchor = &pFormat->GetAnchor(); - if (pAnchor->GetAnchorId() == RndStdIds::FLY_AT_CHAR) - { - const SwPosition* pAPos = pAnchor->GetContentAnchor(); - if( pAPos && nMovedIndex == pAPos->nNode.GetIndex() ) - pFormat->MakeFrames(); - } + const SwPosition* pAPos = pAnchor->GetContentAnchor(); + if( pAPos && nMovedIndex == pAPos->nNode.GetIndex() ) + pFormat->MakeFrames(); } } } diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 0776b3325261..1ba5b3f760a5 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -1176,29 +1176,26 @@ static void lcl_ExportAnnotationStarts( SwAnnotationStartPortion_ImplList& rAnnotationStartArr, const sal_Int32 nIndex) { - if ( !rAnnotationStartArr.empty() ) + for ( SwAnnotationStartPortion_ImplList::iterator aIter = rAnnotationStartArr.begin(), aEnd = rAnnotationStartArr.end(); + aIter != aEnd; ) { - for ( SwAnnotationStartPortion_ImplList::iterator aIter = rAnnotationStartArr.begin(), aEnd = rAnnotationStartArr.end(); - aIter != aEnd; ) + SwAnnotationStartPortion_ImplSharedPtr pPtr = (*aIter); + if ( nIndex > pPtr->getIndex() ) { - SwAnnotationStartPortion_ImplSharedPtr pPtr = (*aIter); - if ( nIndex > pPtr->getIndex() ) - { - aIter = rAnnotationStartArr.erase(aIter); - continue; - } - if ( pPtr->getIndex() > nIndex ) - { - break; - } - - SwXTextPortion* pPortion = - new SwXTextPortion( pUnoCursor, xParent, PORTION_ANNOTATION ); - pPortion->SetTextField( pPtr->mxAnnotationField ); - rPortions.emplace_back(pPortion); - aIter = rAnnotationStartArr.erase(aIter); + continue; } + if ( pPtr->getIndex() > nIndex ) + { + break; + } + + SwXTextPortion* pPortion = + new SwXTextPortion( pUnoCursor, xParent, PORTION_ANNOTATION ); + pPortion->SetTextField( pPtr->mxAnnotationField ); + rPortions.emplace_back(pPortion); + + aIter = rAnnotationStartArr.erase(aIter); } } diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index f984100ab9a4..f401e7ac2451 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -4722,13 +4722,9 @@ void SwHTMLParser::SetTextCollAttrs( HTMLAttrContext *pContext ) } // remove previous hard attribution of paragraph - if( !m_aParaAttrs.empty() ) - { - for( auto pParaAttr : m_aParaAttrs ) - pParaAttr->Invalidate(); - - m_aParaAttrs.clear(); - } + for( auto pParaAttr : m_aParaAttrs ) + pParaAttr->Invalidate(); + m_aParaAttrs.clear(); // set the style m_xDoc->SetTextFormatColl( *m_pPam, pCollToSet ); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index a7851e49e49f..01b1aa4b0319 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -649,17 +649,14 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT m_pSerializer->mergeTopMarks(Tag_StartParagraph_1); // Write framePr - if(!aFramePrTextbox.empty()) + for ( const auto & pFrame : aFramePrTextbox ) { - for ( const auto & pFrame : aFramePrTextbox ) - { - DocxTableExportContext aTableExportContext(*this); - m_pCurrentFrame = pFrame.get(); - m_rExport.SdrExporter().writeOnlyTextOfFrame(pFrame.get()); - m_pCurrentFrame = nullptr; - } - aFramePrTextbox.clear(); + DocxTableExportContext aTableExportContext(*this); + m_pCurrentFrame = pFrame.get(); + m_rExport.SdrExporter().writeOnlyTextOfFrame(pFrame.get()); + m_pCurrentFrame = nullptr; } + aFramePrTextbox.clear(); // Check for end of cell, rows, tables here FinishTableRowCell( pTextNodeInfoInner ); @@ -2376,20 +2373,17 @@ void DocxAttributeOutput::WriteCollectedRunProperties() m_pSerializer->singleElementNS( XML_w, XML_lang, xAttrList ); } - if (!m_aTextEffectsGrabBag.empty()) + for (beans::PropertyValue & i : m_aTextEffectsGrabBag) { - for (beans::PropertyValue & i : m_aTextEffectsGrabBag) + boost::optional<sal_Int32> aElementId = lclGetElementIdForName(i.Name); + if(aElementId) { - boost::optional<sal_Int32> aElementId = lclGetElementIdForName(i.Name); - if(aElementId) - { - uno::Sequence<beans::PropertyValue> aGrabBagSeq; - i.Value >>= aGrabBagSeq; - lclProcessRecursiveGrabBag(*aElementId, aGrabBagSeq, m_pSerializer); - } + uno::Sequence<beans::PropertyValue> aGrabBagSeq; + i.Value >>= aGrabBagSeq; + lclProcessRecursiveGrabBag(*aElementId, aGrabBagSeq, m_pSerializer); } - m_aTextEffectsGrabBag.clear(); } + m_aTextEffectsGrabBag.clear(); } void DocxAttributeOutput::EndRunProperties( const SwRedlineData* pRedlineData ) diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 849ede23b070..4f455cdb1921 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -1102,19 +1102,16 @@ void MSWord_SdrAttrIter::OutAttr( sal_Int32 nSwPos ) //duplicate attributes in docx export. Doesn't matter in doc //export as later props just override earlier ones. std::set<sal_uInt16> aUsedRunWhichs; - if (!aTextAtrArr.empty()) + for(const auto& rTextAtr : aTextAtrArr) { - for(const auto& rTextAtr : aTextAtrArr) + if (nSwPos >= rTextAtr.nStart && nSwPos < rTextAtr.nEnd) { - if (nSwPos >= rTextAtr.nStart && nSwPos < rTextAtr.nEnd) - { - sal_uInt16 nWhich = rTextAtr.pAttr->Which(); - aUsedRunWhichs.insert(nWhich); - } - - if( nSwPos < rTextAtr.nStart ) - break; + sal_uInt16 nWhich = rTextAtr.pAttr->Which(); + aUsedRunWhichs.insert(nWhich); } + + if( nSwPos < rTextAtr.nStart ) + break; } OutParaAttr(true, &aUsedRunWhichs); diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index ec4425b1da8c..41855fdbf6b9 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -2746,16 +2746,13 @@ SwFrameFormat* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp ) /* Insert text if necessary into textboxes contained in groups. */ - if (!aData.empty()) + for (const auto& it : aData) { - for (const auto& it : aData) - { - pRecord = it.get(); - if (pRecord->pObj && pRecord->aTextId.nTxBxS) - { // #i52825# pRetFrameFormat can be NULL - pRetFrameFormat = MungeTextIntoDrawBox( - pRecord, nGrafAnchorCp, pRetFrameFormat); - } + pRecord = it.get(); + if (pRecord->pObj && pRecord->aTextId.nTxBxS) + { // #i52825# pRetFrameFormat can be NULL + pRetFrameFormat = MungeTextIntoDrawBox( + pRecord, nGrafAnchorCp, pRetFrameFormat); } } } diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index fdd0f4f6a733..e41cd8237137 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -474,29 +474,26 @@ void SwEditRegionDlg::RecurseList(const SwSectionFormat* pFormat, SvTreeListEntr SwSections aTmpArr; SvTreeListEntry* pNEntry; pFormat->GetChildSections(aTmpArr, SectionSort::Pos); - if( !aTmpArr.empty() ) + for( const auto pSect : aTmpArr ) { - for( const auto pSect : aTmpArr ) + SectionType eTmpType; + pFormat = pSect->GetFormat(); + if( pFormat->IsInNodesArr() && + (eTmpType = pFormat->GetSection()->GetType()) != TOX_CONTENT_SECTION + && TOX_HEADER_SECTION != eTmpType ) { - SectionType eTmpType; - pFormat = pSect->GetFormat(); - if( pFormat->IsInNodesArr() && - (eTmpType = pFormat->GetSection()->GetType()) != TOX_CONTENT_SECTION - && TOX_HEADER_SECTION != eTmpType ) - { - SectRepr* pSectRepr=new SectRepr( - FindArrPos( pSect->GetFormat() ), *pSect ); - Image aImage = BuildBitmap( pSect->IsProtect(), - pSect->IsHidden()); - pNEntry = m_pTree->InsertEntry( - pSect->GetSectionName(), aImage, aImage, pEntry); - pNEntry->SetUserData(pSectRepr); - RecurseList( pSect->GetFormat(), pNEntry ); - if( pNEntry->HasChildren()) - m_pTree->Expand(pNEntry); - if (pCurrSect==pSect) - pSelEntry = pNEntry; - } + SectRepr* pSectRepr=new SectRepr( + FindArrPos( pSect->GetFormat() ), *pSect ); + Image aImage = BuildBitmap( pSect->IsProtect(), + pSect->IsHidden()); + pNEntry = m_pTree->InsertEntry( + pSect->GetSectionName(), aImage, aImage, pEntry); + pNEntry->SetUserData(pSectRepr); + RecurseList( pSect->GetFormat(), pNEntry ); + if( pNEntry->HasChildren()) + m_pTree->Expand(pNEntry); + if (pCurrSect==pSect) + pSelEntry = pNEntry; } } } diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 0c24cc563f7e..52f4f97474e9 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -2680,13 +2680,10 @@ void SwFrameURLPage::Reset( const SfxItemSet *rSet ) { std::unique_ptr<TargetList> pList(new TargetList); SfxFrame::GetDefaultTargetList(*pList); - if( !pList->empty() ) + size_t nCount = pList->size(); + for (size_t i = 0; i < nCount; ++i) { - size_t nCount = pList->size(); - for (size_t i = 0; i < nCount; ++i) - { - m_xFrameCB->append_text(pList->at(i)); - } + m_xFrameCB->append_text(pList->at(i)); } } diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 68fe77ff8a9f..e4271f9058bb 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -1032,15 +1032,12 @@ void SwDocShell::Execute(SfxRequest& rReq) bool bOutline[MAXLEVEL] = {false}; const SwOutlineNodes& rOutlNds = m_xDoc->GetNodes().GetOutLineNds(); - if( !rOutlNds.empty() ) + for( size_t n = 0; n < rOutlNds.size(); ++n ) { - for( size_t n = 0; n < rOutlNds.size(); ++n ) + const int nLevel = rOutlNds[n]->GetTextNode()->GetAttrOutlineLevel(); + if( nLevel > 0 && ! bOutline[nLevel-1] ) { - const int nLevel = rOutlNds[n]->GetTextNode()->GetAttrOutlineLevel(); - if( nLevel > 0 && ! bOutline[nLevel-1] ) - { - bOutline[nLevel-1] = true; - } + bOutline[nLevel-1] = true; } } diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 442400bdb173..2355151e851c 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -1311,16 +1311,13 @@ void SwPostItMgr::AddPostIts(bool bCheckExistence, bool bFocus) void SwPostItMgr::RemoveSidebarWin() { - if (!mvPostItFields.empty()) + for (auto const& postItField : mvPostItFields) { - for (auto const& postItField : mvPostItFields) - { - EndListening( *const_cast<SfxBroadcaster*>(postItField->GetBroadCaster()) ); - postItField->pPostIt.disposeAndClear(); - delete postItField; - } - mvPostItFields.clear(); + EndListening( *const_cast<SfxBroadcaster*>(postItField->GetBroadCaster()) ); + postItField->pPostIt.disposeAndClear(); + delete postItField; } + mvPostItFields.clear(); // all postits removed, no items should be left in pages PreparePageContainer(); diff --git a/ucb/source/ucp/webdav-neon/NeonHeadRequest.cxx b/ucb/source/ucp/webdav-neon/NeonHeadRequest.cxx index f3759a5f0657..9f112fed099e 100644 --- a/ucb/source/ucp/webdav-neon/NeonHeadRequest.cxx +++ b/ucb/source/ucp/webdav-neon/NeonHeadRequest.cxx @@ -47,12 +47,9 @@ void process_headers( ne_request * req, #if defined SAL_LOG_INFO { - if( !rHeaderNames.empty() ) + for ( const auto& rHeader : rHeaderNames ) { - for ( const auto& rHeader : rHeaderNames ) - { - SAL_INFO( "ucb.ucp.webdav", "HEAD - requested header: " << rHeader ); - } + SAL_INFO( "ucb.ucp.webdav", "HEAD - requested header: " << rHeader ); } } #endif diff --git a/unodevtools/source/skeletonmaker/cppcompskeleton.cxx b/unodevtools/source/skeletonmaker/cppcompskeleton.cxx index 3cf2a236f08b..097115d94879 100644 --- a/unodevtools/source/skeletonmaker/cppcompskeleton.cxx +++ b/unodevtools/source/skeletonmaker/cppcompskeleton.cxx @@ -569,18 +569,16 @@ static void generateMemberInitialization(std::ostream& o, rtl::Reference< TypeManager > const & manager, AttributeInfo const & members) { - if (!members.empty()) { - for (const auto& rMember : members) + for (const auto& rMember : members) + { + sal_Int32 rank; + if ((manager->decompose(rMember.type, true, nullptr, &rank, nullptr, nullptr) + <= codemaker::UnoType::Sort::Char) + && rank == 0) { - sal_Int32 rank; - if ((manager->decompose(rMember.type, true, nullptr, &rank, nullptr, nullptr) - <= codemaker::UnoType::Sort::Char) - && rank == 0) - { - o << ",\n m_" << rMember.name << "("; - printType(o, options, manager, rMember.type, 16, true); - o << ")"; - } + o << ",\n m_" << rMember.name << "("; + printType(o, options, manager, rMember.type, 16, true); + o << ")"; } } } diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx index c83c14d93cda..f988b5f17759 100644 --- a/unotools/source/misc/fontdefs.cxx +++ b/unotools/source/misc/fontdefs.cxx @@ -529,7 +529,7 @@ OUString GetSubsFontName( const OUString& rName, SubsFontFlags nFlags ) const utl::FontNameAttr* pAttr = utl::FontSubstConfiguration::get().getSubstInfo( aOrgName ); if ( pAttr ) { - if( nFlags & SubsFontFlags::MS && !pAttr->MSSubstitutions.empty() ) + if( nFlags & SubsFontFlags::MS ) { for( const auto& rSubstitution : pAttr->MSSubstitutions ) if( ! ImplIsFontToken( rName, rSubstitution ) ) diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index 7b34620983c2..94f5c608a298 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -899,11 +899,8 @@ void OpenGLSalGraphicsImpl::DrawPolyPolygon( const basegfx::B2DPolyPolygon& rPol basegfx::B2DTrapezoidVector aB2DTrapVector; basegfx::utils::trapezoidSubdivide( aB2DTrapVector, aSimplePolyPolygon ); // draw tessellation result - if( !aB2DTrapVector.empty()) - { - for(basegfx::B2DTrapezoid & i : aB2DTrapVector) - DrawTrapezoid( i, blockAA ); - } + for(basegfx::B2DTrapezoid & i : aB2DTrapVector) + DrawTrapezoid( i, blockAA ); } void OpenGLSalGraphicsImpl::DrawRegionBand( const RegionBand& rRegion ) diff --git a/vcl/source/control/notebookbar.cxx b/vcl/source/control/notebookbar.cxx index 94740fadbcbf..f7680a07d524 100644 --- a/vcl/source/control/notebookbar.cxx +++ b/vcl/source/control/notebookbar.cxx @@ -147,7 +147,7 @@ void NotebookBar::SetSystemWindow(SystemWindow* pSystemWindow) void SAL_CALL NotebookBarContextChangeEventListener::notifyContextChangeEvent(const css::ui::ContextChangeEventObject& rEvent) { - if (mpParent && !mpParent->m_pContextContainers.empty()) + if (mpParent) { for (NotebookbarContextControl* pControl : mpParent->m_pContextContainers) pControl->SetContext(vcl::EnumContext::GetContextEnum(rEvent.ContextName)); diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx index 092df7cfbee7..83ecf677f1ed 100644 --- a/vcl/source/filter/ipdf/pdfdocument.cxx +++ b/vcl/source/filter/ipdf/pdfdocument.cxx @@ -2295,12 +2295,9 @@ size_t PDFDictionaryElement::Parse(const std::vector<std::unique_ptr<PDFElement> auto pEndArr = dynamic_cast<PDFEndArrayElement*>(rElements[i].get()); if (pArray && pEndArr) { - if (!aNumbers.empty()) - { - for (auto& pNumber : aNumbers) - pArray->PushBack(pNumber); - aNumbers.clear(); - } + for (auto& pNumber : aNumbers) + pArray->PushBack(pNumber); + aNumbers.clear(); rDictionary[aName] = pArray; if (pThisDictionary) { diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx index 394c5484a5bd..8690378c1120 100644 --- a/vcl/unx/generic/fontmanager/fontmanager.cxx +++ b/vcl/unx/generic/fontmanager/fontmanager.cxx @@ -174,15 +174,12 @@ std::vector<fontID> PrintFontManager::addFontFile( const OString& rFileName ) if( aFontIds.empty() ) { std::vector<std::unique_ptr<PrintFont>> aNewFonts = analyzeFontFile(nDirID, aName); - if (!aNewFonts.empty()) + for (auto & font : aNewFonts) { - for (auto & font : aNewFonts) - { - fontID nFontId = m_nNextFontID++; - m_aFonts[nFontId] = std::move(font); - m_aFontFileToFontID[ aName ].insert( nFontId ); - aFontIds.push_back(nFontId); - } + fontID nFontId = m_nNextFontID++; + m_aFonts[nFontId] = std::move(font); + m_aFontFileToFontID[ aName ].insert( nFontId ); + aFontIds.push_back(nFontId); } } return aFontIds; diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx index 2dd75d4f3166..dd67982a9725 100644 --- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx +++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx @@ -1923,7 +1923,7 @@ void SalGtkFilePicker::SetFilters() if( GTK_FILE_CHOOSER_ACTION_SAVE == gtk_file_chooser_get_action( GTK_FILE_CHOOSER( m_pDialog ) ) ) { std::set<OUString> aAllFormats; - if( m_pFilterVector && !m_pFilterVector->empty() ) + if( m_pFilterVector ) { for (auto & filter : *m_pFilterVector) { @@ -1954,7 +1954,7 @@ void SalGtkFilePicker::SetFilters() } } - if( m_pFilterVector && !m_pFilterVector->empty() ) + if( m_pFilterVector ) { for (auto & filter : *m_pFilterVector) { diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index 3f09010adfd0..2383e4344321 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -746,386 +746,383 @@ bool SdXMLExport::ImpPrepAutoLayoutInfo(const Reference<XDrawPage>& xPage, OUStr void SdXMLExport::ImpWriteAutoLayoutInfos() { - if( !mvAutoLayoutInfoList.empty() ) + for(auto & pInfo : mvAutoLayoutInfoList) { - for(auto & pInfo : mvAutoLayoutInfoList) + if(pInfo) { - if(pInfo) - { - // prepare presentation-page layout attributes, style-name - AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, pInfo->GetLayoutName()); + // prepare presentation-page layout attributes, style-name + AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, pInfo->GetLayoutName()); - // write draw-style attributes - SvXMLElementExport aDSE(*this, XML_NAMESPACE_STYLE, XML_PRESENTATION_PAGE_LAYOUT, true, true); + // write draw-style attributes + SvXMLElementExport aDSE(*this, XML_NAMESPACE_STYLE, XML_PRESENTATION_PAGE_LAYOUT, true, true); - // write presentation placeholders - switch(pInfo->GetLayoutType()) + // write presentation placeholders + switch(pInfo->GetLayoutType()) + { + case AUTOLAYOUT_TITLE : { - case AUTOLAYOUT_TITLE : - { - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderSubtitle, pInfo->GetPresRectangle()); - break; - } - case AUTOLAYOUT_TITLE_CONTENT : - { - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, pInfo->GetPresRectangle()); - break; - } - case AUTOLAYOUT_CHART : - { - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, pInfo->GetPresRectangle()); - break; - } - case AUTOLAYOUT_TITLE_2CONTENT : - { - tools::Rectangle aLeft(pInfo->GetPresRectangle()); - aLeft.setWidth(long(aLeft.GetWidth() * 0.488)); - tools::Rectangle aRight(aLeft); - aRight.SetLeft(long(aRight.Left() + aRight.GetWidth() * 1.05)); - - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight); - break; - } - case AUTOLAYOUT_TEXTCHART : - { - tools::Rectangle aLeft(pInfo->GetPresRectangle()); - aLeft.setWidth(long(aLeft.GetWidth() * 0.488)); - tools::Rectangle aRight(aLeft); - aRight.SetLeft( long(aRight.Left() + aRight.GetWidth() * 1.05) ); - - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aRight); - break; - } - case AUTOLAYOUT_TEXTCLIP : - { - tools::Rectangle aLeft(pInfo->GetPresRectangle()); - aLeft.setWidth(long(aLeft.GetWidth() * 0.488)); - tools::Rectangle aRight(aLeft); - aRight.SetLeft(long(aRight.Left() + aRight.GetWidth() * 1.05)); - - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aRight); - break; - } - case AUTOLAYOUT_CHARTTEXT : - { - tools::Rectangle aLeft(pInfo->GetPresRectangle()); - aLeft.setWidth(long(aLeft.GetWidth() * 0.488)); - tools::Rectangle aRight(aLeft); - aRight.SetLeft(long(aRight.Left() + aRight.GetWidth() * 1.05)); - - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aLeft); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight); - break; - } - case AUTOLAYOUT_TAB : - { - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTable, pInfo->GetPresRectangle()); - break; - } - case AUTOLAYOUT_CLIPTEXT : - { - tools::Rectangle aLeft(pInfo->GetPresRectangle()); - aLeft.setWidth(long(aLeft.GetWidth() * 0.488)); - tools::Rectangle aRight(aLeft); - aRight.SetLeft(long(aRight.Left() + aRight.GetWidth() * 1.05)); - - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aLeft); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight); - break; - } - case AUTOLAYOUT_TEXTOBJ : - { - tools::Rectangle aLeft(pInfo->GetPresRectangle()); - aLeft.setWidth(long(aLeft.GetWidth() * 0.488)); - tools::Rectangle aRight(aLeft); - aRight.SetLeft(long(aRight.Left() + aRight.GetWidth() * 1.05)); - - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRight); - break; - } - case AUTOLAYOUT_OBJ : - { - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, pInfo->GetPresRectangle()); - break; - } - case AUTOLAYOUT_TITLE_CONTENT_2CONTENT : - { - tools::Rectangle aLeft(pInfo->GetPresRectangle()); - aLeft.setWidth(long(aLeft.GetWidth() * 0.488)); - tools::Rectangle aRightTop(aLeft); - aRightTop.SetLeft(long(aRightTop.Left() + aRightTop.GetWidth() * 1.05)); - aRightTop.setHeight(long(aRightTop.GetHeight() * 0.477)); - tools::Rectangle aRightBottom(aRightTop); - aRightBottom.SetTop(long(aRightBottom.Top() + aRightBottom.GetHeight() * 1.095)); - - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRightTop); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRightBottom); - break; - } - case AUTOLAYOUT_OBJTEXT : - { - tools::Rectangle aLeft(pInfo->GetPresRectangle()); - aLeft.setWidth(long(aLeft.GetWidth() * 0.488)); - tools::Rectangle aRight(aLeft); - aRight.SetLeft(long(aRight.Left() + aRight.GetWidth() * 1.05)); - - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeft); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight); - break; - } - case AUTOLAYOUT_TITLE_CONTENT_OVER_CONTENT : - { - tools::Rectangle aTop(pInfo->GetPresRectangle()); - aTop.setHeight(long(aTop.GetHeight() * 0.477)); - tools::Rectangle aBottom(aTop); - aBottom.SetTop(long(aBottom.Top() + aBottom.GetHeight() * 1.095)); - - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTop); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aBottom); - break; - } - case AUTOLAYOUT_TITLE_2CONTENT_CONTENT : - { - tools::Rectangle aLeftTop(pInfo->GetPresRectangle()); - aLeftTop.setWidth(long(aLeftTop.GetWidth() * 0.488)); - tools::Rectangle aRight(aLeftTop); - aRight.SetLeft(long(aRight.Left() + aRight.GetWidth() * 1.05)); - aLeftTop.setHeight(long(aLeftTop.GetHeight() * 0.477)); - tools::Rectangle aLeftBottom(aLeftTop); - aLeftBottom.SetTop(long(aLeftBottom.Top() + aLeftBottom.GetHeight() * 1.095)); - - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeftTop); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeftBottom); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight); - break; - } - case AUTOLAYOUT_TITLE_2CONTENT_OVER_CONTENT : - { - tools::Rectangle aTopLeft(pInfo->GetPresRectangle()); - aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477)); - tools::Rectangle aBottom(aTopLeft); - aBottom.SetTop(long(aBottom.Top() + aBottom.GetHeight() * 1.095)); - aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.488)); - tools::Rectangle aTopRight(aTopLeft); - aTopRight.SetLeft(long(aTopRight.Left() + aTopRight.GetWidth() * 1.05)); - - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopLeft); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopRight); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aBottom); - break; - } - case AUTOLAYOUT_TEXTOVEROBJ : - { - tools::Rectangle aTop(pInfo->GetPresRectangle()); - aTop.setHeight(long(aTop.GetHeight() * 0.477)); - tools::Rectangle aBottom(aTop); - aBottom.SetTop(long(aBottom.Top() + aBottom.GetHeight() * 1.095)); - - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aTop); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottom); - break; - } - case AUTOLAYOUT_TITLE_4CONTENT : - { - tools::Rectangle aTopLeft(pInfo->GetPresRectangle()); - aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477)); - aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.488)); - tools::Rectangle aBottomLeft(aTopLeft); - aBottomLeft.SetTop(long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095)); - tools::Rectangle aTopRight(aTopLeft); - aTopRight.SetLeft(long(aTopRight.Left() + aTopRight.GetWidth() * 1.05)); - tools::Rectangle aBottomRight(aTopRight); - aBottomRight.SetTop(long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095)); - - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopLeft); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopRight); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottomLeft); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottomRight); - break; - } - case AUTOLAYOUT_TITLE_ONLY : - { - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); - break; - } - case AUTOLAYOUT_NOTES : + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderSubtitle, pInfo->GetPresRectangle()); + break; + } + case AUTOLAYOUT_TITLE_CONTENT : + { + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, pInfo->GetPresRectangle()); + break; + } + case AUTOLAYOUT_CHART : + { + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, pInfo->GetPresRectangle()); + break; + } + case AUTOLAYOUT_TITLE_2CONTENT : + { + tools::Rectangle aLeft(pInfo->GetPresRectangle()); + aLeft.setWidth(long(aLeft.GetWidth() * 0.488)); + tools::Rectangle aRight(aLeft); + aRight.SetLeft(long(aRight.Left() + aRight.GetWidth() * 1.05)); + + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight); + break; + } + case AUTOLAYOUT_TEXTCHART : + { + tools::Rectangle aLeft(pInfo->GetPresRectangle()); + aLeft.setWidth(long(aLeft.GetWidth() * 0.488)); + tools::Rectangle aRight(aLeft); + aRight.SetLeft( long(aRight.Left() + aRight.GetWidth() * 1.05) ); + + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aRight); + break; + } + case AUTOLAYOUT_TEXTCLIP : + { + tools::Rectangle aLeft(pInfo->GetPresRectangle()); + aLeft.setWidth(long(aLeft.GetWidth() * 0.488)); + tools::Rectangle aRight(aLeft); + aRight.SetLeft(long(aRight.Left() + aRight.GetWidth() * 1.05)); + + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aRight); + break; + } + case AUTOLAYOUT_CHARTTEXT : + { + tools::Rectangle aLeft(pInfo->GetPresRectangle()); + aLeft.setWidth(long(aLeft.GetWidth() * 0.488)); + tools::Rectangle aRight(aLeft); + aRight.SetLeft(long(aRight.Left() + aRight.GetWidth() * 1.05)); + + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aLeft); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight); + break; + } + case AUTOLAYOUT_TAB : + { + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTable, pInfo->GetPresRectangle()); + break; + } + case AUTOLAYOUT_CLIPTEXT : + { + tools::Rectangle aLeft(pInfo->GetPresRectangle()); + aLeft.setWidth(long(aLeft.GetWidth() * 0.488)); + tools::Rectangle aRight(aLeft); + aRight.SetLeft(long(aRight.Left() + aRight.GetWidth() * 1.05)); + + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aLeft); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight); + break; + } + case AUTOLAYOUT_TEXTOBJ : + { + tools::Rectangle aLeft(pInfo->GetPresRectangle()); + aLeft.setWidth(long(aLeft.GetWidth() * 0.488)); + tools::Rectangle aRight(aLeft); + aRight.SetLeft(long(aRight.Left() + aRight.GetWidth() * 1.05)); + + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRight); + break; + } + case AUTOLAYOUT_OBJ : + { + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, pInfo->GetPresRectangle()); + break; + } + case AUTOLAYOUT_TITLE_CONTENT_2CONTENT : + { + tools::Rectangle aLeft(pInfo->GetPresRectangle()); + aLeft.setWidth(long(aLeft.GetWidth() * 0.488)); + tools::Rectangle aRightTop(aLeft); + aRightTop.SetLeft(long(aRightTop.Left() + aRightTop.GetWidth() * 1.05)); + aRightTop.setHeight(long(aRightTop.GetHeight() * 0.477)); + tools::Rectangle aRightBottom(aRightTop); + aRightBottom.SetTop(long(aRightBottom.Top() + aRightBottom.GetHeight() * 1.095)); + + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRightTop); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRightBottom); + break; + } + case AUTOLAYOUT_OBJTEXT : + { + tools::Rectangle aLeft(pInfo->GetPresRectangle()); + aLeft.setWidth(long(aLeft.GetWidth() * 0.488)); + tools::Rectangle aRight(aLeft); + aRight.SetLeft(long(aRight.Left() + aRight.GetWidth() * 1.05)); + + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeft); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight); + break; + } + case AUTOLAYOUT_TITLE_CONTENT_OVER_CONTENT : + { + tools::Rectangle aTop(pInfo->GetPresRectangle()); + aTop.setHeight(long(aTop.GetHeight() * 0.477)); + tools::Rectangle aBottom(aTop); + aBottom.SetTop(long(aBottom.Top() + aBottom.GetHeight() * 1.095)); + + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTop); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aBottom); + break; + } + case AUTOLAYOUT_TITLE_2CONTENT_CONTENT : + { + tools::Rectangle aLeftTop(pInfo->GetPresRectangle()); + aLeftTop.setWidth(long(aLeftTop.GetWidth() * 0.488)); + tools::Rectangle aRight(aLeftTop); + aRight.SetLeft(long(aRight.Left() + aRight.GetWidth() * 1.05)); + aLeftTop.setHeight(long(aLeftTop.GetHeight() * 0.477)); + tools::Rectangle aLeftBottom(aLeftTop); + aLeftBottom.SetTop(long(aLeftBottom.Top() + aLeftBottom.GetHeight() * 1.095)); + + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeftTop); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeftBottom); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight); + break; + } + case AUTOLAYOUT_TITLE_2CONTENT_OVER_CONTENT : + { + tools::Rectangle aTopLeft(pInfo->GetPresRectangle()); + aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477)); + tools::Rectangle aBottom(aTopLeft); + aBottom.SetTop(long(aBottom.Top() + aBottom.GetHeight() * 1.095)); + aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.488)); + tools::Rectangle aTopRight(aTopLeft); + aTopRight.SetLeft(long(aTopRight.Left() + aTopRight.GetWidth() * 1.05)); + + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopLeft); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopRight); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aBottom); + break; + } + case AUTOLAYOUT_TEXTOVEROBJ : + { + tools::Rectangle aTop(pInfo->GetPresRectangle()); + aTop.setHeight(long(aTop.GetHeight() * 0.477)); + tools::Rectangle aBottom(aTop); + aBottom.SetTop(long(aBottom.Top() + aBottom.GetHeight() * 1.095)); + + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aTop); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottom); + break; + } + case AUTOLAYOUT_TITLE_4CONTENT : + { + tools::Rectangle aTopLeft(pInfo->GetPresRectangle()); + aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477)); + aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.488)); + tools::Rectangle aBottomLeft(aTopLeft); + aBottomLeft.SetTop(long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095)); + tools::Rectangle aTopRight(aTopLeft); + aTopRight.SetLeft(long(aTopRight.Left() + aTopRight.GetWidth() * 1.05)); + tools::Rectangle aBottomRight(aTopRight); + aBottomRight.SetTop(long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095)); + + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopLeft); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopRight); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottomLeft); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottomRight); + break; + } + case AUTOLAYOUT_TITLE_ONLY : + { + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); + break; + } + case AUTOLAYOUT_NOTES : + { + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderPage, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderNotes, pInfo->GetPresRectangle()); + break; + } + case AUTOLAYOUT_HANDOUT1 : + case AUTOLAYOUT_HANDOUT2 : + case AUTOLAYOUT_HANDOUT3 : + case AUTOLAYOUT_HANDOUT4 : + case AUTOLAYOUT_HANDOUT6 : + case AUTOLAYOUT_HANDOUT9 : + { + sal_Int32 nColCnt, nRowCnt; + sal_Int32 nGapX = pInfo->GetGapX(); + sal_Int32 nGapY = pInfo->GetGapY(); + + switch(pInfo->GetLayoutType()) { - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderPage, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderNotes, pInfo->GetPresRectangle()); - break; + case 22 : nColCnt = 1; nRowCnt = 1; break; + case 23 : nColCnt = 1; nRowCnt = 2; break; + case 24 : nColCnt = 1; nRowCnt = 3; break; + case 25 : nColCnt = 2; nRowCnt = 2; break; + case 26 : nColCnt = 3; nRowCnt = 2; break; + case 31 : nColCnt = 3; nRowCnt = 3; break; + default: nColCnt = 0; nRowCnt = 0; break; // FIXME - What is correct values? } - case AUTOLAYOUT_HANDOUT1 : - case AUTOLAYOUT_HANDOUT2 : - case AUTOLAYOUT_HANDOUT3 : - case AUTOLAYOUT_HANDOUT4 : - case AUTOLAYOUT_HANDOUT6 : - case AUTOLAYOUT_HANDOUT9 : - { - sal_Int32 nColCnt, nRowCnt; - sal_Int32 nGapX = pInfo->GetGapX(); - sal_Int32 nGapY = pInfo->GetGapY(); - switch(pInfo->GetLayoutType()) - { - case 22 : nColCnt = 1; nRowCnt = 1; break; - case 23 : nColCnt = 1; nRowCnt = 2; break; - case 24 : nColCnt = 1; nRowCnt = 3; break; - case 25 : nColCnt = 2; nRowCnt = 2; break; - case 26 : nColCnt = 3; nRowCnt = 2; break; - case 31 : nColCnt = 3; nRowCnt = 3; break; - default: nColCnt = 0; nRowCnt = 0; break; // FIXME - What is correct values? - } + Size aPartSize(pInfo->GetTitleRectangle().GetSize()); + Point aPartPos(pInfo->GetTitleRectangle().TopLeft()); - Size aPartSize(pInfo->GetTitleRectangle().GetSize()); - Point aPartPos(pInfo->GetTitleRectangle().TopLeft()); + if(aPartSize.Width() > aPartSize.Height()) + { + sal_Int32 nZwi(nColCnt); + nColCnt = nRowCnt; + nRowCnt = nZwi; + } - if(aPartSize.Width() > aPartSize.Height()) - { - sal_Int32 nZwi(nColCnt); - nColCnt = nRowCnt; - nRowCnt = nZwi; - } + if (nColCnt == 0 || nRowCnt == 0) + break; - if (nColCnt == 0 || nRowCnt == 0) - break; + aPartSize.setWidth( (aPartSize.Width() - ((nColCnt - 1) * nGapX)) / nColCnt ); + aPartSize.setHeight( (aPartSize.Height() - ((nRowCnt - 1) * nGapY)) / nRowCnt ); - aPartSize.setWidth( (aPartSize.Width() - ((nColCnt - 1) * nGapX)) / nColCnt ); - aPartSize.setHeight( (aPartSize.Height() - ((nRowCnt - 1) * nGapY)) / nRowCnt ); + Point aTmpPos(aPartPos); - Point aTmpPos(aPartPos); + for (sal_Int32 a = 0; a < nRowCnt; a++) + { + aTmpPos.setX(aPartPos.X()); - for (sal_Int32 a = 0; a < nRowCnt; a++) + for (sal_Int32 b = 0; b < nColCnt; b++) { - aTmpPos.setX(aPartPos.X()); - - for (sal_Int32 b = 0; b < nColCnt; b++) - { - tools::Rectangle aTmpRect(aTmpPos, aPartSize); + tools::Rectangle aTmpRect(aTmpPos, aPartSize); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderHandout, aTmpRect); - aTmpPos.AdjustX( aPartSize.Width() + nGapX ); - } - - aTmpPos.AdjustY( aPartSize.Height() + nGapY ); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderHandout, aTmpRect); + aTmpPos.AdjustX( aPartSize.Width() + nGapX ); } - break; - } - case AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT : - { - tools::Rectangle aTop(pInfo->GetPresRectangle()); - aTop.setHeight(long(aTop.GetHeight() * 0.488)); - tools::Rectangle aBottom(aTop); - aBottom.SetTop(long(aBottom.Top() + aBottom.GetHeight() * 1.05)); - - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalTitle, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, aTop); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aBottom); - break; - } - case AUTOLAYOUT_VTITLE_VCONTENT : - { - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalTitle, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, pInfo->GetPresRectangle()); - break; - } - case AUTOLAYOUT_TITLE_VCONTENT : - { - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, pInfo->GetPresRectangle()); - break; - } - case AUTOLAYOUT_TITLE_2VTEXT : - { - tools::Rectangle aLeft(pInfo->GetPresRectangle()); - aLeft.setWidth(long(aLeft.GetWidth() * 0.488)); - tools::Rectangle aRight(aLeft); - aRight.SetLeft(long(aRight.Left() + aRight.GetWidth() * 1.05)); - - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aLeft); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, aRight); - break; - } - case AUTOLAYOUT_ONLY_TEXT : - { - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderSubtitle, pInfo->GetPresRectangle()); - break; - } - case AUTOLAYOUT_4CLIPART : - { - tools::Rectangle aTopLeft(pInfo->GetPresRectangle()); - aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477)); - aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.488)); - tools::Rectangle aBottomLeft(aTopLeft); - aBottomLeft.SetTop(long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095)); - tools::Rectangle aTopRight(aTopLeft); - aTopRight.SetLeft(long(aTopRight.Left() + aTopRight.GetWidth() * 1.05)); - tools::Rectangle aBottomRight(aTopRight); - aBottomRight.SetTop(long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095)); - - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopLeft); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopRight); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomLeft); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomRight); - break; + aTmpPos.AdjustY( aPartSize.Height() + nGapY ); } + break; + } + case AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT : + { + tools::Rectangle aTop(pInfo->GetPresRectangle()); + aTop.setHeight(long(aTop.GetHeight() * 0.488)); + tools::Rectangle aBottom(aTop); + aBottom.SetTop(long(aBottom.Top() + aBottom.GetHeight() * 1.05)); + + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalTitle, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, aTop); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aBottom); + break; + } + case AUTOLAYOUT_VTITLE_VCONTENT : + { + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalTitle, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, pInfo->GetPresRectangle()); + break; + } + case AUTOLAYOUT_TITLE_VCONTENT : + { + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, pInfo->GetPresRectangle()); + break; + } + case AUTOLAYOUT_TITLE_2VTEXT : + { + tools::Rectangle aLeft(pInfo->GetPresRectangle()); + aLeft.setWidth(long(aLeft.GetWidth() * 0.488)); + tools::Rectangle aRight(aLeft); + aRight.SetLeft(long(aRight.Left() + aRight.GetWidth() * 1.05)); + + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aLeft); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, aRight); + break; + } + case AUTOLAYOUT_ONLY_TEXT : + { + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderSubtitle, pInfo->GetPresRectangle()); + break; + } - case AUTOLAYOUT_TITLE_6CONTENT : - { - tools::Rectangle aTopLeft(pInfo->GetPresRectangle()); - aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477)); - aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.322)); - tools::Rectangle aTopCenter(aTopLeft); - aTopCenter.SetLeft(long(aTopCenter.Left() + aTopCenter.GetWidth() * 1.05)); - tools::Rectangle aTopRight(aTopLeft); - aTopRight.SetLeft(long(aTopRight.Left() + aTopRight.GetWidth() * 2 * 1.05)); - - tools::Rectangle aBottomLeft(aTopLeft); - aBottomLeft.SetTop(long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095)); - tools::Rectangle aBottomCenter(aTopCenter); - aBottomCenter.SetTop(long(aBottomCenter.Top() + aBottomCenter.GetHeight() * 1.095)); - tools::Rectangle aBottomRight(aTopRight); - aBottomRight.SetTop(long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095)); - - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopLeft); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopCenter); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopRight); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomLeft); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomCenter); - ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomRight); - break; - } - default: - { - OSL_FAIL("XMLEXP: unknown autolayout export"); - break; - } + case AUTOLAYOUT_4CLIPART : + { + tools::Rectangle aTopLeft(pInfo->GetPresRectangle()); + aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477)); + aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.488)); + tools::Rectangle aBottomLeft(aTopLeft); + aBottomLeft.SetTop(long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095)); + tools::Rectangle aTopRight(aTopLeft); + aTopRight.SetLeft(long(aTopRight.Left() + aTopRight.GetWidth() * 1.05)); + tools::Rectangle aBottomRight(aTopRight); + aBottomRight.SetTop(long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095)); + + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopLeft); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopRight); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomLeft); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomRight); + break; + } + + case AUTOLAYOUT_TITLE_6CONTENT : + { + tools::Rectangle aTopLeft(pInfo->GetPresRectangle()); + aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477)); + aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.322)); + tools::Rectangle aTopCenter(aTopLeft); + aTopCenter.SetLeft(long(aTopCenter.Left() + aTopCenter.GetWidth() * 1.05)); + tools::Rectangle aTopRight(aTopLeft); + aTopRight.SetLeft(long(aTopRight.Left() + aTopRight.GetWidth() * 2 * 1.05)); + + tools::Rectangle aBottomLeft(aTopLeft); + aBottomLeft.SetTop(long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095)); + tools::Rectangle aBottomCenter(aTopCenter); + aBottomCenter.SetTop(long(aBottomCenter.Top() + aBottomCenter.GetHeight() * 1.095)); + tools::Rectangle aBottomRight(aTopRight); + aBottomRight.SetTop(long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095)); + + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopLeft); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopCenter); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopRight); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomLeft); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomCenter); + ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomRight); + break; + } + default: + { + OSL_FAIL("XMLEXP: unknown autolayout export"); + break; } } } @@ -1320,7 +1317,7 @@ void SdXMLExport::ImpWritePageMasterInfos() ImpXMLEXPPageMasterInfo* SdXMLExport::ImpGetPageMasterInfoByName(const OUString& rName) { - if(!rName.isEmpty() && !mvPageMasterInfoList.empty()) + if(!rName.isEmpty()) { for(auto & pInfo : mvPageMasterInfoList) { diff --git a/xmloff/source/draw/shapeimport.cxx b/xmloff/source/draw/shapeimport.cxx index c55cd25411a9..14b5e5acc2a6 100644 --- a/xmloff/source/draw/shapeimport.cxx +++ b/xmloff/source/draw/shapeimport.cxx @@ -911,47 +911,44 @@ void XMLShapeImportHelper::addShapeConnection( css::uno::Reference< css::drawing void XMLShapeImportHelper::restoreConnections() { - if( !mpImpl->maConnections.empty() ) + const vector<ConnectionHint>::size_type nCount = mpImpl->maConnections.size(); + for( vector<ConnectionHint>::size_type i = 0; i < nCount; i++ ) { - const vector<ConnectionHint>::size_type nCount = mpImpl->maConnections.size(); - for( vector<ConnectionHint>::size_type i = 0; i < nCount; i++ ) + ConnectionHint& rHint = mpImpl->maConnections[i]; + uno::Reference< beans::XPropertySet > xConnector( rHint.mxConnector, uno::UNO_QUERY ); + if( xConnector.is() ) { - ConnectionHint& rHint = mpImpl->maConnections[i]; - uno::Reference< beans::XPropertySet > xConnector( rHint.mxConnector, uno::UNO_QUERY ); - if( xConnector.is() ) + // #86637# remember line deltas + uno::Any aLine1Delta; + uno::Any aLine2Delta; + uno::Any aLine3Delta; + OUString aStr1("EdgeLine1Delta"); + OUString aStr2("EdgeLine2Delta"); + OUString aStr3("EdgeLine3Delta"); + aLine1Delta = xConnector->getPropertyValue(aStr1); + aLine2Delta = xConnector->getPropertyValue(aStr2); + aLine3Delta = xConnector->getPropertyValue(aStr3); + + // #86637# simply setting these values WILL force the connector to do + // an new layout promptly. So the line delta values have to be rescued + // and restored around connector changes. + uno::Reference< drawing::XShape > xShape( + mrImporter.getInterfaceToIdentifierMapper().getReference( rHint.aDestShapeId ), uno::UNO_QUERY ); + if( xShape.is() ) { - // #86637# remember line deltas - uno::Any aLine1Delta; - uno::Any aLine2Delta; - uno::Any aLine3Delta; - OUString aStr1("EdgeLine1Delta"); - OUString aStr2("EdgeLine2Delta"); - OUString aStr3("EdgeLine3Delta"); - aLine1Delta = xConnector->getPropertyValue(aStr1); - aLine2Delta = xConnector->getPropertyValue(aStr2); - aLine3Delta = xConnector->getPropertyValue(aStr3); - - // #86637# simply setting these values WILL force the connector to do - // an new layout promptly. So the line delta values have to be rescued - // and restored around connector changes. - uno::Reference< drawing::XShape > xShape( - mrImporter.getInterfaceToIdentifierMapper().getReference( rHint.aDestShapeId ), uno::UNO_QUERY ); - if( xShape.is() ) - { - xConnector->setPropertyValue( rHint.bStart ? gsStartShape : gsEndShape, uno::Any(xShape) ); - - sal_Int32 nGlueId = rHint.nDestGlueId < 4 ? rHint.nDestGlueId : getGluePointId( xShape, rHint.nDestGlueId ); - xConnector->setPropertyValue( rHint.bStart ? gsStartGluePointIndex : gsEndGluePointIndex, uno::Any(nGlueId) ); - } - - // #86637# restore line deltas - xConnector->setPropertyValue(aStr1, aLine1Delta ); - xConnector->setPropertyValue(aStr2, aLine2Delta ); - xConnector->setPropertyValue(aStr3, aLine3Delta ); + xConnector->setPropertyValue( rHint.bStart ? gsStartShape : gsEndShape, uno::Any(xShape) ); + + sal_Int32 nGlueId = rHint.nDestGlueId < 4 ? rHint.nDestGlueId : getGluePointId( xShape, rHint.nDestGlueId ); + xConnector->setPropertyValue( rHint.bStart ? gsStartGluePointIndex : gsEndGluePointIndex, uno::Any(nGlueId) ); } + + // #86637# restore line deltas + xConnector->setPropertyValue(aStr1, aLine1Delta ); + xConnector->setPropertyValue(aStr2, aLine2Delta ); + xConnector->setPropertyValue(aStr3, aLine3Delta ); } - mpImpl->maConnections.clear(); } + mpImpl->maConnections.clear(); } SvXMLImportPropertyMapper* XMLShapeImportHelper::CreateShapePropMapper( const uno::Reference< frame::XModel>& rModel, SvXMLImport& rImport ) diff --git a/xmloff/source/table/XMLTableImport.cxx b/xmloff/source/table/XMLTableImport.cxx index 5cc315c73efd..7bfe87b96ed9 100644 --- a/xmloff/source/table/XMLTableImport.cxx +++ b/xmloff/source/table/XMLTableImport.cxx @@ -594,20 +594,17 @@ void XMLTableImportContext::StartElement( const Reference< XAttributeList >& /*x void XMLTableImportContext::EndElement() { - if( !maMergeInfos.empty() ) + for( const std::shared_ptr< MergeInfo >& xInfo : maMergeInfos ) { - for( const std::shared_ptr< MergeInfo >& xInfo : maMergeInfos ) + if( xInfo.get() ) try { - if( xInfo.get() ) try - { - Reference< XCellRange > xRange( mxTable->getCellRangeByPosition( xInfo->mnStartColumn, xInfo->mnStartRow, xInfo->mnEndColumn, xInfo->mnEndRow ) ); - Reference< XMergeableCellRange > xCursor( mxTable->createCursorByRange( xRange ), UNO_QUERY_THROW ); - xCursor->merge(); - } - catch( Exception& ) - { - OSL_FAIL("XMLTableImportContext::EndElement(), exception caught while merging cells!"); - } + Reference< XCellRange > xRange( mxTable->getCellRangeByPosition( xInfo->mnStartColumn, xInfo->mnStartRow, xInfo->mnEndColumn, xInfo->mnEndRow ) ); + Reference< XMergeableCellRange > xCursor( mxTable->createCursorByRange( xRange ), UNO_QUERY_THROW ); + xCursor->merge(); + } + catch( Exception& ) + { + OSL_FAIL("XMLTableImportContext::EndElement(), exception caught while merging cells!"); } } } diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx index 562a7def9a69..565f4bdd2891 100644 --- a/xmloff/source/text/txtparai.cxx +++ b/xmloff/source/text/txtparai.cxx @@ -2013,7 +2013,7 @@ void XMLParaContext::EndElement() } } - if (m_xHints && !m_xHints->GetHints().empty()) + if (m_xHints) { for (const auto & i : m_xHints->GetHints()) { diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx index 7ac877ab91a3..0fde594f8921 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx @@ -1228,12 +1228,9 @@ void ElementDescriptor::readBullitinBoard( StyleBag * all_styles ) } } } - if (! all_elements.empty()) + for (ElementDescriptor* p : all_elements) { - for (ElementDescriptor* p : all_elements) - { - addSubElement( p ); - } + addSubElement( p ); } } diff --git a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx index 21d1ccc4bd2d..5358230f7a46 100644 --- a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx +++ b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx @@ -169,15 +169,11 @@ BufferNode* SAXEventKeeperImpl::addNewElementMarkBuffers() m_pNewBlocker = nullptr; } - if (!m_vNewElementCollectors.empty()) + for( const auto& i : m_vNewElementCollectors ) { - for( const auto& i : m_vNewElementCollectors ) - { - pBufferNode->addElementCollector(i); - } - - m_vNewElementCollectors.clear(); + pBufferNode->addElementCollector(i); } + m_vNewElementCollectors.clear(); } return pBufferNode; diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index 0da6276551af..847bdc61e4a6 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -126,10 +126,8 @@ SecurityEnvironment_NssImpl::~SecurityEnvironment_NssImpl() { PK11_FreeSlot(slot); } - if( !m_tSymKeyList.empty() ) { - for( auto& symKey : m_tSymKeyList ) - PK11_FreeSymKey( symKey ) ; - } + for( auto& symKey : m_tSymKeyList ) + PK11_FreeSymKey( symKey ) ; } /* XServiceInfo */ |