Hi Jean-Noël,
Jean-Noël Rouvignac píše v Po 18. 03. 2013 v 09:45 +0100:
The problem you are facing is due to the return type of the method:
XubString& then OUString& .
To fix this, you need to return a reference to a non locally created
OUString.
I have successfully used a static OUString in the past for these
cases.
Can you get access to the variable aEmptyOUStr in sw/inc/swtypes.hxx
from your piece of code?
OUString is reference counted, so I think in many cases it is just
safe / not hitting performance at all to use the much more readable form
of changing the return type to OUString (from OUString&), and just
return OUString() :-)
Ie. in this case, I'd just change
-const XubString& ToolBox::GetItemText( sal_uInt16 nItemId ) const
-OUString ToolBox::GetItemText( sal_uInt16 nItemId ) const
{
ImplToolItem* pItem = ImplGetItem( nItemId );
if ( pItem )
return pItem->maText;
- else
- return ImplGetSVEmptyStr();
+
+ return OUString();
}
and be done with that ;-)
All the best,
Kendy
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.