Hi,
On Wed, Jun 20, 2012 at 8:16 AM, julien2412 <serval2412@yahoo.fr> wrote:
Hello,
By looking in the last fix commits, I sometimes "opengrok" to see if the
same kind of initial problem solved by the fix could be found.
Then I read this code :
71 // query the attribute descriptions
72 void SwAttrSet::GetPresentation(
73 SfxItemPresentation ePres,
74 SfxMapUnit eCoreMetric,
75 SfxMapUnit ePresMetric,
76 String &rText ) const
77 {
78 static sal_Char const sKomma[] = ", ";
79
80 rText.Erase();
81 String aStr;
82 if( Count() )
83 {
84 SfxItemIter aIter( *this );
85 const IntlWrapper rInt(
::comphelper::getProcessServiceFactory(),
86 GetAppLanguage() );
87 while( sal_True )
88 {
89 aIter.GetCurItem()->GetPresentation( ePres, eCoreMetric,
90 ePresMetric, aStr,
91 &rInt );
92 if( rText.Len() && aStr.Len() )
93 rText += String::CreateFromAscii(sKomma);
94 rText += aStr;
95 if( aIter.IsAtEnd() )
96 break;
97 aIter.NextItem();
98 }
99 }
100 }
if "rText" variable is completely cleared at the beginning (line 80), what's
the use of "rText.Len() &&..." (line 92) (and therefore line 93 and 78) ?
As far as I can see by just looking at this snippet of code this is
needed because rText would be ", ... , ... , ..." instead of "... ,
... , ..." if you omit rText.Len() from the if statement. In other
words.. the rText.Len() is to ensure you don't write comma at the
beginning of rText.
Julien
--
View this message in context:
http://nabble.documentfoundation.org/Question-about-function-SwAttrSet-GetPresentation-sw-source-ui-utlui-attrdesc-cxx-tp3991205.html
Sent from the Dev mailing list archive at Nabble.com.
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice
Regards, Tomaž
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.