Unuseful SfxObjectFactory::GetFactoryURL() in SfxViewFrame::LoadViewIntoFrame_Impl, any clue?

classic Classic list List threaded Threaded
3 messages Options
Matteo Casalin-4 Matteo Casalin-4
Reply | Threaded
Open this post in threaded view
|

Unuseful SfxObjectFactory::GetFactoryURL() in SfxViewFrame::LoadViewIntoFrame_Impl, any clue?

Hi all,
     I stumbled in the following code snippet in
SfxViewFrame::LoadViewIntoFrame_Impl:

     OUString sURL( "private:object"  );
     if ( sURL.isEmpty() )
         sURL = i_rDoc.GetFactory().GetFactoryURL();

in which the "if" test is obviously always false. I looked at how code
evolved during development and, apart for some OUString reworking, the
main changes are:

1. Commit
https://cgit.freedesktop.org/libreoffice/core/commit/?id=9fb19fd9f062adc0bb778258c5e65d57ff794e09 
introduced GetFactoryURL() and simplified the original code into:

     ::rtl::OUString sURL( xDocument->getURL() );
     if ( !sURL.getLength() )
         sURL = i_rDoc.GetFactory().GetFactoryURL();

also adding a similar flow in SfxFrame::Create (sfx2/source/view/frame2.cxx)

2. Commit
https://cgit.freedesktop.org/libreoffice/core/commit/?id=c44ba0727fecc1a1a70f525e72b0854527ab3e22 
replaced (and this is the whole commit) all of the 3 lines with just:

      ::rtl::OUString sURL( RTL_CONSTASCII_USTRINGPARAM(
"private:object" ) );

3. Commit
https://cgit.freedesktop.org/libreoffice/core/commit/?id=a8f1ad65612c0e54969cabc541b183062ae3d905 
added back the "if":

      ::rtl::OUString sURL( RTL_CONSTASCII_USTRINGPARAM(
"private:object" ) );
     if ( sURL.isEmpty() )
         sURL = i_rDoc.GetFactory().GetFactoryURL();

and strangely replaced the similar code in SfxFrame::Create with the
same "fix" used in commit 2 (might it be a mis-merge?).

My guess is that the "if" in the code under consideration can be removed
since such code was untouched for so long but I have no idea about what
this code is menat to do. Does anybody have a clue on what this code is
supposed to do and on how to proceed?

Many thanks and kind regards
Matteo
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Caolán McNamara Caolán McNamara
Reply | Threaded
Open this post in threaded view
|

Re: Unuseful SfxObjectFactory::GetFactoryURL() in SfxViewFrame::LoadViewIntoFrame_Impl, any clue?

On Fri, 2017-03-17 at 17:39 +0100, Matteo Casalin wrote:
>
> 3. Commit 
> https://cgit.freedesktop.org/libreoffice/core/commit/?id=a8f1ad65612c
> 0e54969cabc541b183062ae3d905 
>
> My guess is that the "if" in the code under consideration can be
> removed.

Yeah, its clearly meaningless so might as well remove it. No idea what
the original intent there was, but its all quite a long time ago now so
safest is to just remove the code that does nothing.
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Matteo Casalin-4 Matteo Casalin-4
Reply | Threaded
Open this post in threaded view
|

Re: Unuseful SfxObjectFactory::GetFactoryURL() in SfxViewFrame::LoadViewIntoFrame_Impl, any clue?

On 2017-03-20 14:44, Caolán McNamara wrote:

> On Fri, 2017-03-17 at 17:39 +0100, Matteo Casalin wrote:
>>
>> 3. Commit 
>> https://cgit.freedesktop.org/libreoffice/core/commit/?id=a8f1ad65612c
>> 0e54969cabc541b183062ae3d905 
>>
>> My guess is that the "if" in the code under consideration can be
>> removed.
>
> Yeah, its clearly meaningless so might as well remove it. No idea what
> the original intent there was, but its all quite a long time ago now so
> safest is to just remove the code that does nothing.

Great, I will remove that lines.
Thanks for the feedback!

Kind regards
Matteo
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice