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

Matteo Casalin matteo.casalin at libreoffice.org
Fri Mar 17 16:39:26 UTC 2017


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


More information about the LibreOffice mailing list