loplugin:passstuffbyref improved return in xmloff,sfx2

Change-Id: I7161dfca77f944027bd20614616e22d6acfa27cd
Reviewed-on: https://gerrit.libreoffice.org/47081
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2017-12-27 12:39:11 +02:00
parent 33bd6c3e35
commit a967c8f684
35 changed files with 71 additions and 70 deletions

View File

@ -249,7 +249,8 @@ void PassStuffByRef::checkReturnValue(const FunctionDecl * functionDecl, const C
.GlobalNamespace())
|| (dc.MemberFunction().Class("Submission").Namespace("xforms")
.GlobalNamespace())
|| (dc.Function("TopLeft").Class("SwRect").GlobalNamespace()))
|| (dc.Function("TopLeft").Class("SwRect").GlobalNamespace())
|| (dc.Function("ConvDicList_CreateInstance").GlobalNamespace()))
{
return;
}

View File

@ -89,9 +89,9 @@ public:
bool HasDocumentFooter();
void UpdateInfobar(SfxViewFrame& rViewFrame);
const std::vector<OUString> GetMarkings();
const std::vector<OUString> GetIntellectualPropertyParts();
const std::vector<OUString> GetIntellectualPropertyPartNumbers();
std::vector<OUString> const & GetMarkings();
std::vector<OUString> const & GetIntellectualPropertyParts();
std::vector<OUString> const & GetIntellectualPropertyPartNumbers();
/// Does a best-effort conversion of rType to SfxClassificationPolicyType.
static SfxClassificationPolicyType stringToPolicyType(const OUString& rType);
@ -130,7 +130,7 @@ private:
sal_Int32 m_nIPPartNumber;
sal_Int32 m_nMarkingNumber;
OUString getPolicyKey() const
OUString const & getPolicyKey() const
{
return m_sPolicy;
}

View File

@ -132,7 +132,7 @@ public:
void CheckFileDate( const css::util::DateTime& aInitDate );
SAL_WARN_UNUSED_RESULT bool DocNeedsFileDateCheck() const;
css::util::DateTime GetInitFileDate( bool bIgnoreOldValue );
css::util::DateTime const & GetInitFileDate( bool bIgnoreOldValue );
css::uno::Reference< css::ucb::XContent > GetContent() const;
const OUString& GetPhysicalName() const;
@ -144,7 +144,7 @@ public:
ErrCode GetErrorCode() const;
ErrCode GetError() const
{ return GetErrorCode().IgnoreWarning(); }
ErrCode GetLastStorageCreationState();
ErrCode const & GetLastStorageCreationState();
void SetError(ErrCode nError);
@ -191,7 +191,7 @@ public:
// independent of later changes via SetOpenMode; used for SID_RELOAD:
SAL_WARN_UNUSED_RESULT bool IsOriginallyLoadedReadOnly() const;
css::uno::Reference< css::io::XInputStream > GetInputStream();
css::uno::Reference< css::io::XInputStream > const & GetInputStream();
void CreateTempFile( bool bReplace = true );
void CreateTempFileNoCopy();
@ -207,9 +207,9 @@ public:
SAL_DLLPRIVATE bool HasStorage_Impl() const;
SAL_DLLPRIVATE void StorageBackup_Impl();
SAL_DLLPRIVATE OUString GetBackup_Impl();
SAL_DLLPRIVATE OUString const & GetBackup_Impl();
SAL_DLLPRIVATE css::uno::Reference< css::embed::XStorage > GetZipStorageToSign_Impl( bool bReadOnly = true );
SAL_DLLPRIVATE css::uno::Reference< css::embed::XStorage > const & GetZipStorageToSign_Impl( bool bReadOnly = true );
SAL_DLLPRIVATE void CloseZipStorage_Impl();
// the storage that will be returned by the medium on GetStorage request

View File

@ -51,7 +51,7 @@ public:
~SfxFilterContainer();
const OUString GetName() const;
OUString const & GetName() const;
std::shared_ptr<const SfxFilter> GetAnyFilter( SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
std::shared_ptr<const SfxFilter> GetFilter4EA( const OUString& rEA, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;

View File

@ -137,7 +137,7 @@ public:
ErrCode Execute();
void StartExecuteModal( const Link<FileDialogHelper*,void>& rEndDialogHdl );
ErrCode GetError() const { return m_nError; }
ErrCode const & GetError() const { return m_nError; }
sal_Int16 GetDialogType() const;
bool IsPasswordEnabled() const;
OUString GetRealFilter() const;

View File

@ -592,9 +592,9 @@ public:
const css::uno::Reference< css::embed::XStorage >& xStorage,
sal_Int32 nVersion, bool bTemplate, bool bChart = false ) const;
css::uno::Reference< css::embed::XStorage > GetStorage();
css::uno::Reference< css::embed::XStorage > const & GetStorage();
SvGlobalName GetClassName() const;
SvGlobalName const & GetClassName() const;
// comphelper::IEmbeddedHelper
virtual css::uno::Reference< css::task::XInteractionHandler > getInteractionHandler() const override;

View File

@ -47,7 +47,7 @@ public:
void SetCurrentFilter(const OUString&);
//what was subsequently found to be the format
OUString GetDetectedFilter() const;
OUString const & GetDetectedFilter() const;
void SetDetectedFilter(const OUString&);
private:

View File

@ -46,7 +46,7 @@ public:
const OUString& GetId() const { return msId; }
VclPtr<DeckTitleBar> GetTitleBar() const;
VclPtr<DeckTitleBar> const & GetTitleBar() const;
tools::Rectangle GetContentArea() const;
void ResetPanels (const SharedPanelContainer& rPanels);
const SharedPanelContainer& GetPanels() const { return maPanels; }

View File

@ -47,7 +47,7 @@ public:
virtual ~Panel() override;
virtual void dispose() override;
VclPtr<PanelTitleBar> GetTitleBar() const;
VclPtr<PanelTitleBar> const & GetTitleBar() const;
bool IsTitleBarOptional() const { return mbIsTitleBarOptional;}
void SetUIElement (const css::uno::Reference<css::ui::XUIElement>& rxElement);
const css::uno::Reference<css::ui::XSidebarPanel>& GetPanelComponent() const { return mxPanelComponent;}

View File

@ -217,7 +217,7 @@ private:
void SetupPropertyMaps();
void UpdateTheme();
static PropertyType GetPropertyType (const ThemeItem eItem);
static css::uno::Type GetCppuType (const PropertyType eType);
static css::uno::Type const & GetCppuType (const PropertyType eType);
static sal_Int32 GetIndex (
const ThemeItem eItem,
const PropertyType eType);

View File

@ -104,7 +104,7 @@ public:
void setHelpText (const OUString &sText) { maHelpText = sText; }
virtual OUString getHelpText() const { return maHelpText; };
OUString getTitle() const { return maTitle; };
OUString const & getTitle() const { return maTitle; };
void setTitle (const OUString& rTitle);

View File

@ -22,9 +22,9 @@ public:
virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
const OUString GetText() const { return m_aText; }
OUString const & GetText() const { return m_aText; }
void SetText(const OUString& aText) { m_aText = aText; }
const OUString GetFont() const { return m_aFont; }
OUString const & GetFont() const { return m_aFont; }
void SetFont(const OUString& aFont) { m_aFont = aFont; }
sal_Int16 GetAngle() const { return m_nAngle; }
void SetAngle(const sal_Int16 nAngle) { m_nAngle = nAngle; }

View File

@ -683,7 +683,7 @@ public:
const css::uno::Sequence<sal_Int8> & rProtectionKey );
/// get the last open redline ID
OUString GetOpenRedlineId();
OUString const & GetOpenRedlineId();
/// modify the last open redline ID
void SetOpenRedlineId( OUString const & rId);
/// reset the last open redline ID

View File

@ -215,8 +215,8 @@ protected:
/// Override this method to export the content of <office:body>.
virtual void ExportContent_() = 0;
OUString GetSourceShellID() const;
OUString GetDestinationShellID() const;
OUString const & GetSourceShellID() const;
OUString const & GetDestinationShellID() const;
// save linked sections? (may be false in global documents)
bool mbSaveLinkedSections;
@ -533,7 +533,7 @@ public:
// Written OpenDocument file format doesn't fit to the created text document (#i69627#)
bool writeOutlineStyleAsNormalListStyle() const;
css::uno::Reference< css::embed::XStorage > GetTargetStorage();
css::uno::Reference< css::embed::XStorage > const & GetTargetStorage();
/// returns the currently configured default version for odf export
SvtSaveOptions::ODFDefaultVersion getDefaultVersion() const;
@ -559,7 +559,7 @@ public:
bool SetNullDateOnUnitConverter();
/// Get clamped mimetype for image export (empty if none)
OUString GetImageFilterName() const;
OUString const & GetImageFilterName() const;
};
inline rtl::Reference< XMLTextParagraphExport > const & SvXMLExport::GetTextParagraphExport()

View File

@ -416,7 +416,7 @@ public:
OUString ResolveEmbeddedObjectURLFromBase64();
// get source storage we're importing from (if available)
css::uno::Reference< css::embed::XStorage >
css::uno::Reference< css::embed::XStorage > const &
GetSourceStorage();
void AddStyleDisplayName( sal_uInt16 nFamily,
@ -450,7 +450,7 @@ public:
bool IsTableShapeSupported() const { return mbIsTableShapeSupported; }
OUString GetODFVersion() const;
OUString const & GetODFVersion() const;
bool IsOOoXML() const; // legacy non-ODF format?
/**
@ -481,7 +481,7 @@ public:
::comphelper::UnoInterfaceToUniqueIdentifierMapper& getInterfaceToIdentifierMapper();
css::uno::Reference< css::uno::XComponentContext >
css::uno::Reference< css::uno::XComponentContext > const &
GetComponentContext() const;
// Convert drawing object positions from OOo file format to OASIS file format and vice versa (#i28749#)

View File

@ -337,7 +337,7 @@ public:
void SetDoubleClickHdl( const Link<Control*,bool>& rLink );
void SetSelectFactoryHdl( const Link<SfxHelpIndexWindow_Impl*,void>& rLink ) { aSelectFactoryLink = rLink; }
void SetFactory( const OUString& rFactory, bool bActive );
OUString GetFactory() const { return pIPage->GetFactory(); }
OUString const & GetFactory() const { return pIPage->GetFactory(); }
OUString GetSelectedEntry() const;
void AddBookmarks( const OUString& rTitle, const OUString& rURL );
bool IsValidFactory( const OUString& _rFactory );
@ -538,7 +538,7 @@ public:
virtual bool PreNotify( NotifyEvent& rNEvt ) override;
void setContainerWindow( const css::uno::Reference < css::awt::XWindow >& xWin );
css::uno::Reference < css::frame::XFrame2 >
css::uno::Reference < css::frame::XFrame2 > const &
getTextFrame() const { return pTextWin->getFrame(); }
void SetFactory( const OUString& rFactory );

View File

@ -254,7 +254,7 @@ OUString SvxOpenGraphicDialog::GetCurrentFilter() const
return mpImpl->aFileDlg.GetCurrentFilter();
}
OUString SvxOpenGraphicDialog::GetDetectedFilter() const
OUString const & SvxOpenGraphicDialog::GetDetectedFilter() const
{
return mpImpl->sDetectedFilter;
}

View File

@ -172,7 +172,7 @@ SfxFilterContainer::~SfxFilterContainer()
}
const OUString SfxFilterContainer::GetName() const
OUString const & SfxFilterContainer::GetName() const
{
return pImpl->aName;
}

View File

@ -2130,7 +2130,7 @@ void SfxCommonTemplateDialog_Impl::EnableExample_Impl(sal_uInt16 nId, bool bEnab
EnableItem(nId, bEnable);
}
VclPtr<PopupMenu> SfxCommonTemplateDialog_Impl::CreateContextMenu()
VclPtr<PopupMenu> const & SfxCommonTemplateDialog_Impl::CreateContextMenu()
{
if ( bBindingUpdate )
{

View File

@ -302,7 +302,7 @@ void SfxMedium::ResetError()
pImpl->m_pOutStream->ResetError();
}
ErrCode SfxMedium::GetLastStorageCreationState()
ErrCode const & SfxMedium::GetLastStorageCreationState()
{
return pImpl->nLastStorageError;
}
@ -365,7 +365,7 @@ bool SfxMedium::DocNeedsFileDateCheck() const
GetURLObject().isAnyKnownWebDAVScheme() ) );
}
util::DateTime SfxMedium::GetInitFileDate( bool bIgnoreOldValue )
util::DateTime const & SfxMedium::GetInitFileDate( bool bIgnoreOldValue )
{
if ( ( bIgnoreOldValue || !pImpl->m_bGotDateTime ) && !pImpl->m_aLogicName.isEmpty() )
{
@ -749,7 +749,7 @@ void SfxMedium::StorageBackup_Impl()
}
OUString SfxMedium::GetBackup_Impl()
OUString const & SfxMedium::GetBackup_Impl()
{
if ( pImpl->m_aBackupURL.isEmpty() )
StorageBackup_Impl();
@ -1484,7 +1484,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( bool bCreateTempIfNo )
}
uno::Reference< embed::XStorage > SfxMedium::GetZipStorageToSign_Impl( bool bReadOnly )
uno::Reference< embed::XStorage > const & SfxMedium::GetZipStorageToSign_Impl( bool bReadOnly )
{
if ( !GetError() && !pImpl->m_xZipStorage.is() )
{
@ -3191,7 +3191,7 @@ SvKeyValueIterator* SfxMedium::GetHeaderAttributes_Impl()
return pImpl->xAttributes.get();
}
css::uno::Reference< css::io::XInputStream > SfxMedium::GetInputStream()
css::uno::Reference< css::io::XInputStream > const & SfxMedium::GetInputStream()
{
if ( !pImpl->xInputStream.is() )
GetMedium_Impl();

View File

@ -289,7 +289,7 @@ OUString SfxObjectShell::CreateTempCopyOfStorage_Impl( const uno::Reference< emb
}
SvGlobalName SfxObjectShell::GetClassName() const
SvGlobalName const & SfxObjectShell::GetClassName() const
{
return GetFactory().GetClassId();
}
@ -3009,7 +3009,7 @@ bool SfxObjectShell::SaveAsOwnFormat( SfxMedium& rMedium )
else return false;
}
uno::Reference< embed::XStorage > SfxObjectShell::GetStorage()
uno::Reference< embed::XStorage > const & SfxObjectShell::GetStorage()
{
if ( !pImpl->m_xDocStorage.is() )
{

View File

@ -334,7 +334,7 @@ SfxOleObjectBase::~SfxOleObjectBase()
{
}
ErrCode SfxOleObjectBase::Load( SvStream& rStrm )
ErrCode const & SfxOleObjectBase::Load( SvStream& rStrm )
{
mnErrCode = ERRCODE_NONE;
ImplLoad( rStrm );
@ -342,7 +342,7 @@ ErrCode SfxOleObjectBase::Load( SvStream& rStrm )
return GetError();
}
ErrCode SfxOleObjectBase::Save( SvStream& rStrm )
ErrCode const & SfxOleObjectBase::Save( SvStream& rStrm )
{
mnErrCode = ERRCODE_NONE;
ImplSave( rStrm );
@ -1090,7 +1090,7 @@ void SfxOleSection::SaveProperty( SvStream& rStrm, SfxOlePropertyBase& rProp, sa
}
ErrCode SfxOlePropertySet::LoadPropertySet( SotStorage* pStrg, const OUString& rStrmName )
ErrCode const & SfxOlePropertySet::LoadPropertySet( SotStorage* pStrg, const OUString& rStrmName )
{
if( pStrg )
{
@ -1108,7 +1108,7 @@ ErrCode SfxOlePropertySet::LoadPropertySet( SotStorage* pStrg, const OUString& r
return GetError();
}
ErrCode SfxOlePropertySet::SavePropertySet( SotStorage* pStrg, const OUString& rStrmName )
ErrCode const & SfxOlePropertySet::SavePropertySet( SotStorage* pStrg, const OUString& rStrmName )
{
if( pStrg )
{

View File

@ -170,12 +170,12 @@ public:
virtual ~SfxOleObjectBase();
/** Returns the current error code. */
ErrCode GetError() const { return mnErrCode; }
ErrCode const & GetError() const { return mnErrCode; }
/** Loads this object from the passed stream. Calls virtual ImplLoad(). */
ErrCode Load( SvStream& rStrm );
ErrCode const & Load( SvStream& rStrm );
/** Saves this object to the passed stream. Calls virtual ImplSave(). */
ErrCode Save( SvStream& rStrm );
ErrCode const & Save( SvStream& rStrm );
protected:
/** Sets the passed error code. Will be returned by Load() and Save() functions.
@ -359,9 +359,9 @@ public:
explicit SfxOlePropertySet() {}
/** Loads this object from the passed storage. */
ErrCode LoadPropertySet( SotStorage* pStrg, const OUString& rStrmName );
ErrCode const & LoadPropertySet( SotStorage* pStrg, const OUString& rStrmName );
/** Saves this object to the passed storage. */
ErrCode SavePropertySet( SotStorage* pStrg, const OUString& rStrmName );
ErrCode const & SavePropertySet( SotStorage* pStrg, const OUString& rStrmName );
/** Returns the specified section, or an empty reference, if nothing found. */
SfxOleSectionRef GetSection( SfxOleSectionType eSection ) const;

View File

@ -327,7 +327,7 @@ public:
}
// normally for derivates from SvTreeListBoxes, but in this case the dialog handles context menus
VclPtr<PopupMenu> CreateContextMenu();
VclPtr<PopupMenu> const & CreateContextMenu();
};
class DropToolBox_Impl : public ToolBox, public DropTargetHelper

View File

@ -92,7 +92,7 @@ void Deck::dispose()
vcl::Window::dispose();
}
VclPtr<DeckTitleBar> Deck::GetTitleBar() const
VclPtr<DeckTitleBar> const & Deck::GetTitleBar() const
{
return mpTitleBar;
}

View File

@ -100,7 +100,7 @@ void Panel::dispose()
vcl::Window::dispose();
}
VclPtr<PanelTitleBar> Panel::GetTitleBar() const
VclPtr<PanelTitleBar> const & Panel::GetTitleBar() const
{
return mpTitleBar;
}

View File

@ -840,7 +840,7 @@ Theme::PropertyType Theme::GetPropertyType (const ThemeItem eItem)
}
}
css::uno::Type Theme::GetCppuType (const PropertyType eType)
css::uno::Type const & Theme::GetCppuType (const PropertyType eType)
{
switch(eType)
{

View File

@ -582,17 +582,17 @@ SfxClassificationHelper::SfxClassificationHelper(const uno::Reference<document::
SfxClassificationHelper::~SfxClassificationHelper() = default;
const std::vector<OUString> SfxClassificationHelper::GetMarkings()
std::vector<OUString> const & SfxClassificationHelper::GetMarkings()
{
return m_pImpl->m_aMarkings;
}
const std::vector<OUString> SfxClassificationHelper::GetIntellectualPropertyParts()
std::vector<OUString> const & SfxClassificationHelper::GetIntellectualPropertyParts()
{
return m_pImpl->m_aIPParts;
}
const std::vector<OUString> SfxClassificationHelper::GetIntellectualPropertyPartNumbers()
std::vector<OUString> const & SfxClassificationHelper::GetIntellectualPropertyPartNumbers()
{
return m_pImpl->m_aIPPartNumbers;
}

View File

@ -125,7 +125,7 @@ public:
void SizeHasChanged();
DECL_LINK(TimerHdl, Timer *, void);
uno::Reference < frame::XFrame > GetFrame() const;
uno::Reference < frame::XFrame > const & GetFrame() const;
// XEmbeddedClient
virtual void SAL_CALL saveObject() override;
@ -201,7 +201,7 @@ void SAL_CALL SfxInPlaceClient_Impl::disposing( const css::lang::EventObject& /*
// XEmbeddedClient
uno::Reference < frame::XFrame > SfxInPlaceClient_Impl::GetFrame() const
uno::Reference < frame::XFrame > const & SfxInPlaceClient_Impl::GetFrame() const
{
if ( !m_pClient )
throw uno::RuntimeException();

View File

@ -54,7 +54,7 @@ public:
SvXMLExportFlags nExportFlags );
virtual ~SchXMLExport() override;
rtl::Reference< XMLPropertySetMapper > GetPropertySetMapper() const;
rtl::Reference< XMLPropertySetMapper > const & GetPropertySetMapper() const;
};
#endif // INCLUDED_XMLOFF_INC_SCHXMLEXPORT_HXX

View File

@ -3613,7 +3613,7 @@ void SchXMLExport::ExportContent_()
}
}
rtl::Reference< XMLPropertySetMapper > SchXMLExport::GetPropertySetMapper() const
rtl::Reference< XMLPropertySetMapper > const & SchXMLExport::GetPropertySetMapper() const
{
return maExportHelper->m_pImpl->GetPropertySetMapper();
}

View File

@ -1455,12 +1455,12 @@ void SvXMLExport::ResetNamespaceMap()
delete mpNamespaceMap; mpNamespaceMap = new SvXMLNamespaceMap;
}
OUString SvXMLExport::GetSourceShellID() const
OUString const & SvXMLExport::GetSourceShellID() const
{
return mpImpl->maSrcShellID;
}
OUString SvXMLExport::GetDestinationShellID() const
OUString const & SvXMLExport::GetDestinationShellID() const
{
return mpImpl->maDestShellID;
}
@ -2337,7 +2337,7 @@ bool SvXMLExport::writeOutlineStyleAsNormalListStyle() const
return mpImpl->mbOutlineStyleAsNormalListStyle;
}
uno::Reference< embed::XStorage > SvXMLExport::GetTargetStorage()
uno::Reference< embed::XStorage > const & SvXMLExport::GetTargetStorage()
{
return mpImpl->mxTargetStorage;
}
@ -2466,7 +2466,7 @@ bool SvXMLExport::SetNullDateOnUnitConverter()
return mpImpl->mbNullDateInitialized;
}
OUString SvXMLExport::GetImageFilterName() const
OUString const & SvXMLExport::GetImageFilterName() const
{
return msImgFilterName;
}

View File

@ -1421,7 +1421,7 @@ OUString SvXMLImport::ResolveEmbeddedObjectURL(
return sRet;
}
Reference< embed::XStorage > SvXMLImport::GetSourceStorage()
Reference< embed::XStorage > const & SvXMLImport::GetSourceStorage()
{
return mpImpl->mxSourceStorage;
}
@ -1895,7 +1895,7 @@ void SvXMLImport::DisposingModel()
return mpImpl->maInterfaceToIdentifierMapper;
}
uno::Reference< uno::XComponentContext >
uno::Reference< uno::XComponentContext > const &
SvXMLImport::GetComponentContext() const
{
return mpImpl->mxComponentContext;
@ -1966,7 +1966,7 @@ bool SvXMLImport::isGeneratorVersionOlderThan(
}
OUString SvXMLImport::GetODFVersion() const
OUString const & SvXMLImport::GetODFVersion() const
{
return mpImpl->aODFVersion;
}

View File

@ -2864,7 +2864,7 @@ void XMLTextImportHelper::SetChangesProtectionKey(const Sequence<sal_Int8> &)
}
OUString XMLTextImportHelper::GetOpenRedlineId()
OUString const & XMLTextImportHelper::GetOpenRedlineId()
{
return m_xImpl->m_sOpenRedlineIdentifier;
}

View File

@ -230,7 +230,7 @@ public:
}
// Frame "to character": anchor moves from first to last char after saving (#i33242#)
css::uno::Reference < css::drawing::XShape > GetShape() const
css::uno::Reference < css::drawing::XShape > const & GetShape() const
{
return static_cast<SvXMLShapeContext*>(xContext.get())->getShape();
}