summaryrefslogtreecommitdiff
path: root/sd/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-05-31 10:45:36 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-06-01 09:33:08 +0200
commitaaa3e5f722e693ebc5dd925b7ce35dce1753e810 (patch)
treec442363f396904eea0de32b28619f7a23569dc8c /sd/source
parent6a4409647519e0466896fae4ffe2dc64edd53d9a (diff)
no need to allocate these on the heap
Change-Id: Iddbc48638fbd1326df79b59080132280029c5d46 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116477 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source')
-rw-r--r--sd/source/ui/func/fuinsfil.cxx60
-rw-r--r--sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx10
-rw-r--r--sd/source/ui/slidesorter/cache/SlsBitmapCache.hxx2
-rw-r--r--sd/source/ui/slidesorter/cache/SlsCacheCompactor.cxx4
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx24
-rw-r--r--sd/source/ui/view/sdview.cxx10
-rw-r--r--sd/source/ui/view/sdview3.cxx16
7 files changed, 63 insertions, 63 deletions
diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx
index 028168b6a8e5..ff890dfb5ec7 100644
--- a/sd/source/ui/func/fuinsfil.cxx
+++ b/sd/source/ui/func/fuinsfil.cxx
@@ -422,10 +422,10 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium)
- the draw outliner of the drawing engine has to draw something in
between
- the global outliner could be used in SdPage::CreatePresObj */
- std::unique_ptr<SdrOutliner> pOutliner(new SdOutliner( mpDoc, OutlinerMode::TextObject ));
+ SdOutliner aOutliner( mpDoc, OutlinerMode::TextObject );
// set reference device
- pOutliner->SetRefDevice( SD_MOD()->GetVirtualRefDevice() );
+ aOutliner.SetRefDevice( SD_MOD()->GetVirtualRefDevice() );
SdPage* pPage = static_cast<DrawViewShell*>(mpViewShell)->GetActualPage();
aLayoutName = pPage->GetLayoutName();
@@ -433,15 +433,15 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium)
if( nIndex != -1 )
aLayoutName = aLayoutName.copy(0, nIndex);
- pOutliner->SetPaperSize(pPage->GetSize());
+ aOutliner.SetPaperSize(pPage->GetSize());
SvStream* pStream = pMedium->GetInStream();
assert(pStream && "No InStream!");
pStream->Seek( 0 );
- ErrCode nErr = pOutliner->Read( *pStream, pMedium->GetBaseURL(), nFormat, mpDocSh->GetHeaderAttributes() );
+ ErrCode nErr = aOutliner.Read( *pStream, pMedium->GetBaseURL(), nFormat, mpDocSh->GetHeaderAttributes() );
- if (nErr || pOutliner->GetEditEngine().GetText().isEmpty())
+ if (nErr || aOutliner.GetEditEngine().GetText().isEmpty())
{
std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(mpWindow->GetFrameWeld(),
VclMessageType::Warning, VclButtonsType::Ok, SdResId(STR_READ_DATA_ERROR)));
@@ -466,20 +466,20 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium)
if( pObj &&
pObj->GetObjInventor() == SdrInventor::Default &&
pObj->GetObjIdentifier() == OBJ_TITLETEXT &&
- pOutliner->GetParagraphCount() > 1 )
+ aOutliner.GetParagraphCount() > 1 )
{
// in title objects, only one paragraph is allowed
- while ( pOutliner->GetParagraphCount() > 1 )
+ while ( aOutliner.GetParagraphCount() > 1 )
{
- Paragraph* pPara = pOutliner->GetParagraph( 0 );
- sal_uLong nLen = pOutliner->GetText( pPara ).getLength();
- pOutliner->QuickDelete( ESelection( 0, nLen, 1, 0 ) );
- pOutliner->QuickInsertLineBreak( ESelection( 0, nLen, 0, nLen ) );
+ Paragraph* pPara = aOutliner.GetParagraph( 0 );
+ sal_uLong nLen = aOutliner.GetText( pPara ).getLength();
+ aOutliner.QuickDelete( ESelection( 0, nLen, 1, 0 ) );
+ aOutliner.QuickInsertLineBreak( ESelection( 0, nLen, 0, nLen ) );
}
}
}
- std::unique_ptr<OutlinerParaObject> pOPO = pOutliner->CreateParaObject();
+ std::unique_ptr<OutlinerParaObject> pOPO = aOutliner.CreateParaObject();
if (pOutlinerView)
{
@@ -499,7 +499,7 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium)
/* can be bigger as the maximal allowed size:
limit object size if necessary */
- Size aSize(pOutliner->CalcTextSize());
+ Size aSize(aOutliner.CalcTextSize());
Size aMaxSize = mpDoc->GetMaxObjSize();
aSize.setHeight( std::min(aSize.Height(), aMaxSize.Height()) );
aSize.setWidth( std::min(aSize.Width(), aMaxSize.Width()) );
@@ -573,20 +573,20 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium)
- the draw outliner of the drawing engine has to draw something in
between
- the global outliner could be used in SdPage::CreatePresObj */
- std::unique_ptr< ::Outliner> pOutliner(new ::Outliner( &mpDoc->GetItemPool(), OutlinerMode::OutlineObject ));
- pOutliner->SetStyleSheetPool(static_cast<SfxStyleSheetPool*>(mpDoc->GetStyleSheetPool()));
+ ::Outliner aOutliner( &mpDoc->GetItemPool(), OutlinerMode::OutlineObject );
+ aOutliner.SetStyleSheetPool(static_cast<SfxStyleSheetPool*>(mpDoc->GetStyleSheetPool()));
// set reference device
- pOutliner->SetRefDevice(SD_MOD()->GetVirtualRefDevice());
- pOutliner->SetPaperSize(Size(0x7fffffff, 0x7fffffff));
+ aOutliner.SetRefDevice(SD_MOD()->GetVirtualRefDevice());
+ aOutliner.SetPaperSize(Size(0x7fffffff, 0x7fffffff));
SvStream* pStream = pMedium->GetInStream();
DBG_ASSERT( pStream, "No InStream!" );
pStream->Seek( 0 );
- ErrCode nErr = pOutliner->Read(*pStream, pMedium->GetBaseURL(), nFormat, mpDocSh->GetHeaderAttributes());
+ ErrCode nErr = aOutliner.Read(*pStream, pMedium->GetBaseURL(), nFormat, mpDocSh->GetHeaderAttributes());
- if (nErr || pOutliner->GetEditEngine().GetText().isEmpty())
+ if (nErr || aOutliner.GetEditEngine().GetText().isEmpty())
{
std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(mpWindow->GetFrameWeld(),
VclMessageType::Warning, VclButtonsType::Ok, SdResId(STR_READ_DATA_ERROR)));
@@ -594,22 +594,22 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium)
}
else
{
- sal_Int32 nParaCount = pOutliner->GetParagraphCount();
+ sal_Int32 nParaCount = aOutliner.GetParagraphCount();
// for progress bar: number of level-0-paragraphs
sal_uInt16 nNewPages = 0;
- pPara = pOutliner->GetParagraph( 0 );
+ pPara = aOutliner.GetParagraph( 0 );
while (pPara)
{
- sal_Int32 nPos = pOutliner->GetAbsPos( pPara );
+ sal_Int32 nPos = aOutliner.GetAbsPos( pPara );
if( Outliner::HasParaFlag( pPara, ParaFlag::ISPAGE ) )
nNewPages++;
- pPara = pOutliner->GetParagraph( ++nPos );
+ pPara = aOutliner.GetParagraph( ++nPos );
}
mpDocSh->SetWaitCursor( false );
- std::unique_ptr<SfxProgress> pProgress(new SfxProgress( mpDocSh, SdResId(STR_CREATE_PAGES), nNewPages));
+ std::optional<SfxProgress> pProgress( std::in_place, mpDocSh, SdResId(STR_CREATE_PAGES), nNewPages);
pProgress->SetState( 0, 100 );
nNewPages = 0;
@@ -620,17 +620,17 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium)
sal_Int32 nSourcePos = 0;
SfxStyleSheet* pStyleSheet = pPage->GetStyleSheetForPresObj( PresObjKind::Outline );
- Paragraph* pSourcePara = pOutliner->GetParagraph( 0 );
+ Paragraph* pSourcePara = aOutliner.GetParagraph( 0 );
while (pSourcePara)
{
- sal_Int32 nPos = pOutliner->GetAbsPos( pSourcePara );
- sal_Int16 nDepth = pOutliner->GetDepth( nPos );
+ sal_Int32 nPos = aOutliner.GetAbsPos( pSourcePara );
+ sal_Int16 nDepth = aOutliner.GetDepth( nPos );
// only take the last paragraph if it is filled
if (nSourcePos < nParaCount - 1 ||
- !pOutliner->GetText(pSourcePara).isEmpty())
+ !aOutliner.GetText(pSourcePara).isEmpty())
{
- rDocliner.Insert( pOutliner->GetText(pSourcePara), nTargetPos, nDepth );
+ rDocliner.Insert( aOutliner.GetText(pSourcePara), nTargetPos, nDepth );
OUString aStyleSheetName( pStyleSheet->GetName() );
aStyleSheetName = aStyleSheetName.subView( 0, aStyleSheetName.getLength()-1 ) +
OUString::number( nDepth <= 0 ? 1 : nDepth+1 );
@@ -645,7 +645,7 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium)
pProgress->SetState( nNewPages );
}
- pSourcePara = pOutliner->GetParagraph( ++nPos );
+ pSourcePara = aOutliner.GetParagraph( ++nPos );
nTargetPos++;
nSourcePos++;
}
diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx b/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx
index 8df823778177..6343c230d033 100644
--- a/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx
@@ -368,7 +368,7 @@ void BitmapCache::Recycle (const BitmapCache& rCache)
}
}
-::std::unique_ptr<BitmapCache::CacheIndex> BitmapCache::GetCacheIndex() const
+BitmapCache::CacheIndex BitmapCache::GetCacheIndex() const
{
::osl::MutexGuard aGuard (maMutex);
@@ -392,11 +392,11 @@ void BitmapCache::Recycle (const BitmapCache& rCache)
::std::sort(aSortedContainer.begin(), aSortedContainer.end(), AccessTimeComparator());
// Return a list with the keys of the sorted entries.
- ::std::unique_ptr<CacheIndex> pIndex(new CacheIndex);
- pIndex->reserve(aSortedContainer.size());
+ CacheIndex aIndex;
+ aIndex.reserve(aSortedContainer.size());
for (const auto& rIndexEntry : aSortedContainer)
- pIndex->push_back(rIndexEntry.first);
- return pIndex;
+ aIndex.push_back(rIndexEntry.first);
+ return aIndex;
}
void BitmapCache::Compress (
diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapCache.hxx b/sd/source/ui/slidesorter/cache/SlsBitmapCache.hxx
index eee7ad6d0dda..95acc9a184d9 100644
--- a/sd/source/ui/slidesorter/cache/SlsBitmapCache.hxx
+++ b/sd/source/ui/slidesorter/cache/SlsBitmapCache.hxx
@@ -145,7 +145,7 @@ public:
Entries with the precious flag set are omitted.
Entries with that have no preview bitmaps are omitted.
*/
- ::std::unique_ptr<CacheIndex> GetCacheIndex() const;
+ CacheIndex GetCacheIndex() const;
/** Compress the specified preview bitmap with the given bitmap
compressor. A reference to the compressor is stored for later
diff --git a/sd/source/ui/slidesorter/cache/SlsCacheCompactor.cxx b/sd/source/ui/slidesorter/cache/SlsCacheCompactor.cxx
index 96dc82b9be4b..3e4bf42882a4 100644
--- a/sd/source/ui/slidesorter/cache/SlsCacheCompactor.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsCacheCompactor.cxx
@@ -169,9 +169,9 @@ void CacheCompactionByCompression::Run()
SAL_INFO("sd.sls", __func__ << ": bitmap cache uses too much space: " << mrCache.GetSize() << " > " << mnMaximalCacheSize);
- ::std::unique_ptr< ::sd::slidesorter::cache::BitmapCache::CacheIndex> pIndex (
+ ::sd::slidesorter::cache::BitmapCache::CacheIndex aIndex (
mrCache.GetCacheIndex());
- for (const auto& rpIndex : *pIndex)
+ for (const auto& rpIndex : aIndex)
{
if (rpIndex == nullptr)
continue;
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 0d9e888187cb..006a9cad3347 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -1890,7 +1890,7 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r
pPDFExtOutDevData->SetCurrentPageNumber(nOutputPageNum);
}
- std::unique_ptr<::sd::ClientView> pView( new ::sd::ClientView( mpDocShell, pOut ) );
+ ::sd::ClientView aView( mpDocShell, pOut );
::tools::Rectangle aVisArea( Point(), mpDoc->GetSdPage( static_cast<sal_uInt16>(nPageNumber) - 1, ePageKind )->GetSize() );
vcl::Region aRegion( aVisArea );
@@ -1900,11 +1900,11 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r
if ( pOldSdView )
pOldSdView->SdrEndTextEdit();
- pView->SetHlplVisible( false );
- pView->SetGridVisible( false );
- pView->SetBordVisible( false );
- pView->SetPageVisible( false );
- pView->SetGlueVisible( false );
+ aView.SetHlplVisible( false );
+ aView.SetGridVisible( false );
+ aView.SetBordVisible( false );
+ aView.SetPageVisible( false );
+ aView.SetGlueVisible( false );
pOut->SetMapMode(MapMode(MapUnit::Map100thMM));
pOut->IntersectClipRegion( aVisArea );
@@ -1914,8 +1914,8 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r
if( xModel == mpDocShell->GetModel() )
{
- pView->ShowSdrPage( mpDoc->GetSdPage( static_cast<sal_uInt16>(nPageNumber) - 1, ePageKind ));
- SdrPageView* pPV = pView->GetSdrPageView();
+ aView.ShowSdrPage( mpDoc->GetSdPage( static_cast<sal_uInt16>(nPageNumber) - 1, ePageKind ));
+ SdrPageView* pPV = aView.GetSdrPageView();
if( pOldSdView )
{
@@ -1949,7 +1949,7 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r
// hint value if screen display. Only then the AutoColor mechanisms shall be applied
rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor( pPV, bScreenDisplay ) );
}
- pView->SdrPaintView::CompleteRedraw( pOut, aRegion, &aImplRenderPaintProc );
+ aView.SdrPaintView::CompleteRedraw( pOut, aRegion, &aImplRenderPaintProc );
if ( pPDFExtOutDevData && pPage )
{
@@ -2176,14 +2176,14 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r
&& aImplRenderPaintProc.IsPrintable( pObj ) )
{
if( !pPV )
- pPV = pView->ShowSdrPage( pObj->getSdrPageFromSdrObject() );
+ pPV = aView.ShowSdrPage( pObj->getSdrPageFromSdrObject() );
if( pPV )
- pView->MarkObj( pObj, pPV );
+ aView.MarkObj( pObj, pPV );
}
}
}
- pView->DrawMarkedObj(*pOut);
+ aView.DrawMarkedObj(*pOut);
}
}
}
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index d36f81b1a604..32f9feac8d35 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -1267,7 +1267,7 @@ void View::ChangeMarkedObjectsBulletsNumbering(
const bool bToggleOn = ShouldToggleOn( bToggle, bHandleBullets );
std::unique_ptr<SdrOutliner> pOutliner(SdrMakeOutliner(OutlinerMode::TextObject, *pSdrModel));
- std::unique_ptr<OutlinerView> pOutlinerView(new OutlinerView(pOutliner.get(), pWindow));
+ OutlinerView aOutlinerView(pOutliner.get(), pWindow);
const size_t nMarkCount = GetMarkedObjectCount();
for (size_t nIndex = 0; nIndex < nMarkCount; ++nIndex)
@@ -1308,11 +1308,11 @@ void View::ChangeMarkedObjectsBulletsNumbering(
}
if ( !bToggleOn )
{
- pOutlinerView->SwitchOffBulletsNumbering();
+ aOutlinerView.SwitchOffBulletsNumbering();
}
else
{
- pOutlinerView->ApplyBulletsNumbering( bHandleBullets, pNumRule, bToggle );
+ aOutlinerView.ApplyBulletsNumbering( bHandleBullets, pNumRule, bToggle );
}
sal_uInt32 nParaCount = pOutliner->GetParagraphCount();
pText->SetOutlinerParaObject(pOutliner->CreateParaObject(0, static_cast<sal_uInt16>(nParaCount)));
@@ -1339,11 +1339,11 @@ void View::ChangeMarkedObjectsBulletsNumbering(
}
if ( !bToggleOn )
{
- pOutlinerView->SwitchOffBulletsNumbering();
+ aOutlinerView.SwitchOffBulletsNumbering();
}
else
{
- pOutlinerView->ApplyBulletsNumbering( bHandleBullets, pNumRule, bToggle );
+ aOutlinerView.ApplyBulletsNumbering( bHandleBullets, pNumRule, bToggle );
}
sal_uInt32 nParaCount = pOutliner->GetParagraphCount();
pTextObj->SetOutlinerParaObject(pOutliner->CreateParaObject(0, static_cast<sal_uInt16>(nParaCount)));
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index 3cad2f275af4..4bac17745309 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -1528,16 +1528,16 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
bool View::PasteRTFTable( const ::tools::SvRef<SotTempStream>& xStm, SdrPage* pPage, SdrInsertFlags nPasteOptions )
{
- std::unique_ptr<SdDrawDocument> pModel(new SdDrawDocument( DocumentType::Impress, mpDocSh ));
- pModel->NewOrLoadCompleted(DocCreationMode::New);
- pModel->GetItemPool().SetDefaultMetric(MapUnit::Map100thMM);
- pModel->InsertPage(pModel->AllocPage(false).get());
+ SdDrawDocument aModel( DocumentType::Impress, mpDocSh );
+ aModel.NewOrLoadCompleted(DocCreationMode::New);
+ aModel.GetItemPool().SetDefaultMetric(MapUnit::Map100thMM);
+ aModel.InsertPage(aModel.AllocPage(false).get());
- Reference< XComponent > xComponent( new SdXImpressDocument( pModel.get(), true ) );
- pModel->setUnoModel( Reference< XInterface >::query( xComponent ) );
+ Reference< XComponent > xComponent( new SdXImpressDocument( &aModel, true ) );
+ aModel.setUnoModel( Reference< XInterface >::query( xComponent ) );
- CreateTableFromRTF( *xStm, pModel.get() );
- bool bRet = Paste(*pModel, maDropPos, pPage, nPasteOptions);
+ CreateTableFromRTF( *xStm, &aModel );
+ bool bRet = Paste(aModel, maDropPos, pPage, nPasteOptions);
xComponent->dispose();
xComponent.clear();