diff options
author | Noel Grandin <noel@peralex.com> | 2014-03-13 08:38:29 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-03-13 08:39:26 +0200 |
commit | 78a2020846b855ed925ab88f06fa70a282a75e5a (patch) | |
tree | dd316d41417704fc02387700f2b664b55945773b | |
parent | 39c7532933bb4f1630e821a2a38b213eb05dcc59 (diff) |
vcl: prefer passing OUString and OString by reference
Change-Id: I6c2c6f597ca62c004ad7dc606cef3a3b10e810b6
-rw-r--r-- | include/vcl/GraphicNativeTransform.hxx | 2 | ||||
-rw-r--r-- | include/vcl/builder.hxx | 32 | ||||
-rw-r--r-- | include/vcl/outdev.hxx | 4 | ||||
-rw-r--r-- | vcl/inc/graphite_features.hxx | 4 | ||||
-rw-r--r-- | vcl/inc/outfont.hxx | 6 | ||||
-rw-r--r-- | vcl/inc/unx/saldisp.hxx | 2 | ||||
-rw-r--r-- | vcl/qa/cppunit/graphicfilter/filters-test.cxx | 4 | ||||
-rw-r--r-- | vcl/source/filter/GraphicNativeTransform.cxx | 2 | ||||
-rw-r--r-- | vcl/source/filter/wmf/emfwr.cxx | 2 | ||||
-rw-r--r-- | vcl/source/filter/wmf/emfwr.hxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/outdev3.cxx | 3 | ||||
-rw-r--r-- | vcl/source/gdi/outdevnative.cxx | 4 | ||||
-rw-r--r-- | vcl/source/glyphs/graphite_features.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/builder.cxx | 22 | ||||
-rw-r--r-- | vcl/unx/generic/app/keysymnames.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk/a11y/atkimage.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk/a11y/atktable.cxx | 2 |
17 files changed, 50 insertions, 49 deletions
diff --git a/include/vcl/GraphicNativeTransform.hxx b/include/vcl/GraphicNativeTransform.hxx index f90499a0d16c..b6b66fc75f98 100644 --- a/include/vcl/GraphicNativeTransform.hxx +++ b/include/vcl/GraphicNativeTransform.hxx @@ -28,7 +28,7 @@ class VCL_DLLPUBLIC GraphicNativeTransform bool rotateBitmapOnly (sal_uInt16 aRotation); bool rotateJPEG (sal_uInt16 aRotation); - bool rotateGeneric (sal_uInt16 aRotation, OUString aType); + bool rotateGeneric (sal_uInt16 aRotation, const OUString& aType); public: GraphicNativeTransform(Graphic& rGraphic); diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx index b545df0a3b83..f8208f560407 100644 --- a/include/vcl/builder.hxx +++ b/include/vcl/builder.hxx @@ -145,15 +145,15 @@ private: typedef std::vector<OString> row; std::vector<row> m_aEntries; }; - const ListStore* get_model_by_name(OString sID) const; + const ListStore* get_model_by_name(const OString& sID) const; static void mungeModel(ListBox &rTarget, const ListStore &rStore, sal_uInt16 nActiveId); typedef stringmap TextBuffer; - const TextBuffer* get_buffer_by_name(OString sID) const; + const TextBuffer* get_buffer_by_name(const OString& sID) const; static void mungeTextBuffer(VclMultiLineEdit &rTarget, const TextBuffer &rTextBuffer); typedef stringmap Adjustment; - const Adjustment *get_adjustment_by_name(OString sID) const; + const Adjustment *get_adjustment_by_name(const OString& sID) const; static void mungeAdjustment(NumericFormatter &rTarget, const Adjustment &rAdjustment); static void mungeAdjustment(DateField &rTarget, const Adjustment &rAdjustment); static void mungeAdjustment(TimeField &rTarget, const Adjustment &rAdjustment); @@ -236,8 +236,8 @@ private: bool m_bToplevelParentFound; ParserState *m_pParserState; - ::Window *get_by_name(OString sID); - void delete_by_name(OString sID); + ::Window *get_by_name(const OString& sID); + void delete_by_name(const OString& sID); class sortIntoBestTabTraversalOrder : public std::binary_function<const ::Window*, const ::Window*, bool> @@ -255,13 +255,13 @@ private: css::uno::Reference<css::frame::XFrame> m_xFrame; public: - VclBuilder(::Window *pParent, OUString sUIRootDir, OUString sUIFile, - OString sID = OString(), + VclBuilder(::Window *pParent, const OUString& sUIRootDir, const OUString& sUIFile, + const OString& sID = OString(), const com::sun::star::uno::Reference<com::sun::star::frame::XFrame> &rFrame = com::sun::star::uno::Reference<com::sun::star::frame::XFrame>()); ~VclBuilder(); ::Window *get_widget_root(); //sID must exist and be of type T - template <typename T> T* get(T*& ret, OString sID) + template <typename T> T* get(T*& ret, const OString& sID) { ::Window *w = get_by_name(sID); SAL_WARN_IF(!w, "vcl.layout", "widget \"" << sID.getStr() << "\" not found in .ui"); @@ -271,7 +271,7 @@ public: ret = static_cast<T*>(w); return ret; } - PopupMenu* get_menu(PopupMenu*& ret, OString sID) + PopupMenu* get_menu(PopupMenu*& ret, const OString& sID) { ret = get_menu(sID); SAL_WARN_IF(!ret, "vcl.layout", "menu \"" << sID.getStr() << "\" not found in .ui"); @@ -279,7 +279,7 @@ public: return ret; } //sID may not exist, but must be of type T if it does - template <typename T /*= ::Window if we had c++11*/> T* get(OString sID) + template <typename T /*= ::Window if we had c++11*/> T* get(const OString& sID) { ::Window *w = get_by_name(sID); SAL_WARN_IF(w && !dynamic_cast<T*>(w), @@ -288,7 +288,7 @@ public: return static_cast<T*>(w); } //sID may not exist - PopupMenu* get_menu(OString sID); + PopupMenu* get_menu(const OString& sID); //given an sID return the response value for that widget short get_response(const ::Window *pWindow) const; @@ -378,7 +378,7 @@ private: ::Window* prepareWidgetOwnScrolling(::Window *pParent, WinBits &rWinStyle); void cleanupWidgetOwnScrolling(::Window *pScrollParent, ::Window *pWindow, stringmap &rMap); - void set_response(OString sID, short nResponse); + void set_response(const OString& sID, short nResponse); }; @@ -403,19 +403,19 @@ public: static OUString getUIRootDir(); bool hasBuilder() const { return m_pUIBuilder != NULL; } css::uno::Reference<css::frame::XFrame> getFrame() { return m_pUIBuilder->getFrame(); } - template <typename T> T* get(T*& ret, OString sID) + template <typename T> T* get(T*& ret, const OString& sID) { return m_pUIBuilder->get<T>(ret, sID); } - template <typename T /*= ::Window if we had c++11*/> T* get(OString sID) + template <typename T /*= ::Window if we had c++11*/> T* get(const OString & sID) { return m_pUIBuilder->get<T>(sID); } - PopupMenu* get_menu(PopupMenu*& ret, OString sID) + PopupMenu* get_menu(PopupMenu*& ret, const OString & sID) { return m_pUIBuilder->get_menu(ret, sID); } - PopupMenu* get_menu(OString sID) + PopupMenu* get_menu(const OString & sID) { return m_pUIBuilder->get_menu(sID); } diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 125948fce167..951a26b7625d 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -1463,7 +1463,7 @@ public: const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, - OUString aCaption ); + const OUString& aCaption ); // Query the native control's actual drawing region (including adornment) bool GetNativeControlRegion( ControlType nType, @@ -1471,7 +1471,7 @@ public: const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, - OUString aCaption, + const OUString& aCaption, Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ) const; diff --git a/vcl/inc/graphite_features.hxx b/vcl/inc/graphite_features.hxx index 0202497ae95a..d1587fda0c14 100644 --- a/vcl/inc/graphite_features.hxx +++ b/vcl/inc/graphite_features.hxx @@ -41,8 +41,8 @@ namespace grutils static const char FEAT_PREFIX; static const char FEAT_SEPARATOR; static const char FEAT_ID_VALUE_SEPARATOR; - GrFeatureParser(const gr_face * face, const OString features, const OString lang); - GrFeatureParser(const gr_face * face, const OString lang); + GrFeatureParser(const gr_face * face, const OString& features, const OString& lang); + GrFeatureParser(const gr_face * face, const OString& lang); ~GrFeatureParser(); //size_t getFontFeatures(gr::FeatureSetting settings[MAX_FEATURES]) const; bool parseErrors() { return mbErrors; }; diff --git a/vcl/inc/outfont.hxx b/vcl/inc/outfont.hxx index 77a35205a040..a6d4def4e547 100644 --- a/vcl/inc/outfont.hxx +++ b/vcl/inc/outfont.hxx @@ -61,9 +61,9 @@ public: // TODO: create matching interface class FontPitch GetPitch() const { return mePitch; } FontWidth GetWidthType() const { return meWidthType; } bool IsSymbolFont() const { return mbSymbolFlag; } - void SetFamilyName(const OUString sFamilyName) { maName = sFamilyName; } - void SetStyleName( const OUString sStyleName) { maStyleName = sStyleName; } - void SetFamilyType(const FontFamily eFontFamily) { meFamily = eFontFamily; } + void SetFamilyName(const OUString& sFamilyName) { maName = sFamilyName; } + void SetStyleName( const OUString& sStyleName) { maStyleName = sStyleName; } + void SetFamilyType(const FontFamily eFontFamily) { meFamily = eFontFamily; } void SetPitch(const FontPitch ePitch ) { mePitch = ePitch; } void SetItalic(const FontItalic eItalic ) { meItalic = eItalic; } void SetWeight(const FontWeight eWeight ) { meWeight = eWeight; } diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx index 9b98a762175d..5d179e71b89a 100644 --- a/vcl/inc/unx/saldisp.hxx +++ b/vcl/inc/unx/saldisp.hxx @@ -409,7 +409,7 @@ public: // get foreign key names namespace vcl_sal { OUString getKeysymReplacementName( - OUString pLang, + const OUString& pLang, KeySym nSymbol ); } diff --git a/vcl/qa/cppunit/graphicfilter/filters-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-test.cxx index 811c2a16cbea..f7faae4c056c 100644 --- a/vcl/qa/cppunit/graphicfilter/filters-test.cxx +++ b/vcl/qa/cppunit/graphicfilter/filters-test.cxx @@ -34,7 +34,7 @@ public: const OUString &rURL, const OUString &, unsigned int, unsigned int, unsigned int); - void checkExportImport(OUString aFilterShortName); + void checkExportImport(const OUString& aFilterShortName); /** * Ensure CVEs remain unbroken @@ -77,7 +77,7 @@ void VclFiltersTest::testScaling() } } -void VclFiltersTest::checkExportImport(OUString aFilterShortName) +void VclFiltersTest::checkExportImport(const OUString& aFilterShortName) { Bitmap aBitmap( Size( 100, 100 ), 24 ); aBitmap.Erase(COL_WHITE); diff --git a/vcl/source/filter/GraphicNativeTransform.cxx b/vcl/source/filter/GraphicNativeTransform.cxx index 69a10bdc65c2..9661d4a67f97 100644 --- a/vcl/source/filter/GraphicNativeTransform.cxx +++ b/vcl/source/filter/GraphicNativeTransform.cxx @@ -104,7 +104,7 @@ bool GraphicNativeTransform::rotateBitmapOnly(sal_uInt16 aRotation) return true; } -bool GraphicNativeTransform::rotateGeneric(sal_uInt16 aRotation, OUString aType) +bool GraphicNativeTransform::rotateGeneric(sal_uInt16 aRotation, const OUString& aType) { // Can't rotate animations yet if (mrGraphic.IsAnimated()) diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx index abd2adabab26..ea0e32c5c32d 100644 --- a/vcl/source/filter/wmf/emfwr.cxx +++ b/vcl/source/filter/wmf/emfwr.cxx @@ -872,7 +872,7 @@ void EMFWriter::ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt, } } -void EMFWriter::ImplWriteTextRecord( const Point& rPos, const OUString rText, const sal_Int32* pDXArray, sal_uInt32 nWidth ) +void EMFWriter::ImplWriteTextRecord( const Point& rPos, const OUString& rText, const sal_Int32* pDXArray, sal_uInt32 nWidth ) { sal_Int32 nLen = rText.getLength(), i; diff --git a/vcl/source/filter/wmf/emfwr.hxx b/vcl/source/filter/wmf/emfwr.hxx index 03b5225c5dcb..62f0b281b7f8 100644 --- a/vcl/source/filter/wmf/emfwr.hxx +++ b/vcl/source/filter/wmf/emfwr.hxx @@ -79,7 +79,7 @@ private: void ImplWritePolygonRecord( const Polygon& rPoly, bool bClose ); void ImplWritePolyPolygonRecord( const PolyPolygon& rPolyPoly ); void ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt, const Size& rSz, sal_uInt32 nROP ); - void ImplWriteTextRecord( const Point& rPos, const OUString rText, const sal_Int32* pDXArray, sal_uInt32 nWidth ); + void ImplWriteTextRecord( const Point& rPos, const OUString& rText, const sal_Int32* pDXArray, sal_uInt32 nWidth ); void Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon); void ImplWrite( const GDIMetaFile& rMtf ); diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 628d309c5934..bfcccbd0002c 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -2341,7 +2341,7 @@ ImplFontEntry* ImplFontCache::GetFontEntry( ImplDevFontList* pFontList, namespace { - OUString stripCharSetFromName(OUString aName) + OUString stripCharSetFromName(const OUString& _aName) { // I worry that someone will have a font which *does* have // e.g. "Greek" legitimately at the end of its name :-( @@ -2358,6 +2358,7 @@ namespace " (vietnamese)" }; + OUString aName = _aName; // These can be crazily piled up, e.g. Times New Roman CYR Greek bool bFinished = false; while (!bFinished) diff --git a/vcl/source/gdi/outdevnative.cxx b/vcl/source/gdi/outdevnative.cxx index 33296903fbb2..bef50d8d4ec1 100644 --- a/vcl/source/gdi/outdevnative.cxx +++ b/vcl/source/gdi/outdevnative.cxx @@ -268,7 +268,7 @@ bool OutputDevice::DrawNativeControl( ControlType nType, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, - OUString aCaption ) + const OUString& aCaption ) { if( !lcl_enableNativeWidget( *this ) ) return false; @@ -310,7 +310,7 @@ bool OutputDevice::GetNativeControlRegion( ControlType nType, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, - OUString aCaption, + const OUString& aCaption, Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ) const { diff --git a/vcl/source/glyphs/graphite_features.cxx b/vcl/source/glyphs/graphite_features.cxx index 690193146f8d..2e999b4aa66f 100644 --- a/vcl/source/glyphs/graphite_features.cxx +++ b/vcl/source/glyphs/graphite_features.cxx @@ -38,14 +38,14 @@ const char GrFeatureParser::FEAT_PREFIX = ':'; const char GrFeatureParser::FEAT_SEPARATOR = '&'; const char GrFeatureParser::FEAT_ID_VALUE_SEPARATOR = '='; -GrFeatureParser::GrFeatureParser(const gr_face * pFace, const OString lang) +GrFeatureParser::GrFeatureParser(const gr_face * pFace, const OString& lang) : mnNumSettings(0), mbErrors(false), mpSettings(NULL) { maLang.label[0] = maLang.label[1] = maLang.label[2] = maLang.label[3] = '\0'; setLang(pFace, lang); } -GrFeatureParser::GrFeatureParser(const gr_face * pFace, const OString features, const OString lang) +GrFeatureParser::GrFeatureParser(const gr_face * pFace, const OString& features, const OString& lang) : mnNumSettings(0), mbErrors(false), mpSettings(NULL) { sal_Int32 nEquals = 0; diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 535222c4bfbc..c4fe9acce6ff 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -45,7 +45,7 @@ using namespace com::sun::star; namespace { - sal_uInt16 mapStockToImageResource(OString sType) + sal_uInt16 mapStockToImageResource(const OString& sType) { sal_uInt16 nRet = 0; if (sType == "gtk-index") @@ -55,7 +55,7 @@ namespace return nRet; } - SymbolType mapStockToSymbol(OString sType) + SymbolType mapStockToSymbol(const OString& sType) { SymbolType eRet = SYMBOL_NOSYMBOL; if (sType == "gtk-media-next") @@ -167,7 +167,7 @@ namespace } #endif -VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OString sID, const uno::Reference<frame::XFrame>& rFrame) +VclBuilder::VclBuilder(Window *pParent, const OUString& sUIDir, const OUString& sUIFile, const OString& sID, const uno::Reference<frame::XFrame>& rFrame) : m_sID(sID) , m_sHelpRoot(OUStringToOString(sUIFile, RTL_TEXTENCODING_UTF8)) , m_pStringReplace(ResMgr::GetReadStringHook()) @@ -851,7 +851,7 @@ namespace return nDigits; } - FieldUnit detectMetricUnit(OString sUnit) + FieldUnit detectMetricUnit(const OString& sUnit) { FieldUnit eUnit = FUNIT_NONE; @@ -2906,7 +2906,7 @@ Window *VclBuilder::get_widget_root() return m_aChildren.empty() ? NULL : m_aChildren[0].m_pWindow; } -Window *VclBuilder::get_by_name(OString sID) +Window *VclBuilder::get_by_name(const OString& sID) { for (std::vector<WinAndId>::iterator aI = m_aChildren.begin(), aEnd = m_aChildren.end(); aI != aEnd; ++aI) @@ -2918,7 +2918,7 @@ Window *VclBuilder::get_by_name(OString sID) return NULL; } -PopupMenu *VclBuilder::get_menu(OString sID) +PopupMenu *VclBuilder::get_menu(const OString& sID) { for (std::vector<MenuAndId>::iterator aI = m_aMenus.begin(), aEnd = m_aMenus.end(); aI != aEnd; ++aI) @@ -2946,7 +2946,7 @@ short VclBuilder::get_response(const Window *pWindow) const return RET_CANCEL; } -void VclBuilder::set_response(OString sID, short nResponse) +void VclBuilder::set_response(const OString& sID, short nResponse) { for (std::vector<WinAndId>::iterator aI = m_aChildren.begin(), aEnd = m_aChildren.end(); aI != aEnd; ++aI) @@ -2962,7 +2962,7 @@ void VclBuilder::set_response(OString sID, short nResponse) assert(false); } -void VclBuilder::delete_by_name(OString sID) +void VclBuilder::delete_by_name(const OString& sID) { for (std::vector<WinAndId>::iterator aI = m_aChildren.begin(), aEnd = m_aChildren.end(); aI != aEnd; ++aI) @@ -3031,7 +3031,7 @@ void VclBuilder::set_window_packing_position(const Window *pWindow, sal_Int32 nP } } -const VclBuilder::ListStore *VclBuilder::get_model_by_name(OString sID) const +const VclBuilder::ListStore *VclBuilder::get_model_by_name(const OString& sID) const { std::map<OString, ListStore>::const_iterator aI = m_pParserState->m_aModels.find(sID); if (aI != m_pParserState->m_aModels.end()) @@ -3039,7 +3039,7 @@ const VclBuilder::ListStore *VclBuilder::get_model_by_name(OString sID) const return NULL; } -const VclBuilder::TextBuffer *VclBuilder::get_buffer_by_name(OString sID) const +const VclBuilder::TextBuffer *VclBuilder::get_buffer_by_name(const OString& sID) const { std::map<OString, TextBuffer>::const_iterator aI = m_pParserState->m_aTextBuffers.find(sID); if (aI != m_pParserState->m_aTextBuffers.end()) @@ -3047,7 +3047,7 @@ const VclBuilder::TextBuffer *VclBuilder::get_buffer_by_name(OString sID) const return NULL; } -const VclBuilder::Adjustment *VclBuilder::get_adjustment_by_name(OString sID) const +const VclBuilder::Adjustment *VclBuilder::get_adjustment_by_name(const OString& sID) const { std::map<OString, Adjustment>::const_iterator aI = m_pParserState->m_aAdjustments.find(sID); if (aI != m_pParserState->m_aAdjustments.end()) diff --git a/vcl/unx/generic/app/keysymnames.cxx b/vcl/unx/generic/app/keysymnames.cxx index 50c53696acce..a2d411786c28 100644 --- a/vcl/unx/generic/app/keysymnames.cxx +++ b/vcl/unx/generic/app/keysymnames.cxx @@ -474,7 +474,7 @@ namespace vcl_sal { }; // translate keycodes, used within the displayed menu shortcuts - OUString getKeysymReplacementName( OUString pLang, KeySym nSymbol ) + OUString getKeysymReplacementName( const OUString& pLang, KeySym nSymbol ) { for( unsigned int n = 0; n < SAL_N_ELEMENTS(aKeyboards); n++ ) { diff --git a/vcl/unx/gtk/a11y/atkimage.cxx b/vcl/unx/gtk/a11y/atkimage.cxx index b413daae130d..d9f93edc4a9d 100644 --- a/vcl/unx/gtk/a11y/atkimage.cxx +++ b/vcl/unx/gtk/a11y/atkimage.cxx @@ -28,7 +28,7 @@ using namespace ::com::sun::star; // FIXME static G_CONST_RETURN gchar * -getAsConst( OUString rString ) +getAsConst( const OUString& rString ) { static const int nMax = 10; static OString aUgly[nMax]; diff --git a/vcl/unx/gtk/a11y/atktable.cxx b/vcl/unx/gtk/a11y/atktable.cxx index bf30e41eabdb..7094a7caf4b9 100644 --- a/vcl/unx/gtk/a11y/atktable.cxx +++ b/vcl/unx/gtk/a11y/atktable.cxx @@ -45,7 +45,7 @@ atk_object_wrapper_conditional_ref( const uno::Reference< accessibility::XAccess // FIXME static G_CONST_RETURN gchar * -getAsConst( OUString rString ) +getAsConst( const OUString& rString ) { static const int nMax = 10; static OString aUgly[nMax]; |