help needed (embedded writed docs): fdo#44081 fix circular dependency sw / sfx

Tomaž Vajngerl quikee at gmail.com
Wed Aug 27 12:27:45 PDT 2014


Hi,

On Wed, Aug 27, 2014 at 7:44 PM, Lionel Elie Mamane <lionel at mamane.lu> wrote:
> Hi,
>
> I'd like to have some help on fdo#44081
> https://bugs.freedesktop.org/44081
>
> The bug is that for Base forms (which are embedded Writer documents),
> setting the property "open read-only" is sticky (can never be unset
> through the UI). The "edit" entry in the writer read-only pop-up menu
> is disabled.
>
> The situation is that this "edit" entry should indeed be disabled when
> the form is opened in normal mode (because then the writer document is
> *not* supposed to be changed by the user, only the contents of the
> form controls). But enabling this menu entry when it is opened in
> design mode ("edit" in the base UI instead of "open") would solve
> fdo#44081 nicely.
>
> So I worked on that, and wrote https://gerrit.libreoffice.org/11152
> Which I'm deeply unhappy about:
>
> 1) It makes sfx2 use private headers from sw, in a way that does not
>    seem immediately trivial to fix; I mean these headers use other
>    private headers, so we'd have to move more headers to public
>    (include/sw). Doable, but maybe overkill.
>
> 2) Worse, it includes a circular dependency between libswlo and
>    libsfxlo. IMHO, we cannot have that.
>
> I'd very much appreciate some help / guidance on how to avoid these
> issues, because I don't see a way out; the code in sfx needs to know
> whether the form is in design mode or not, and for that, it needs to
> call member functions of sw types defined in private headers, and
> libsfxlo needs the typeinfo (so to be linked against) libswlo... And I
> don't expect that we can remove the dependency of libswlo upon
> libsfxlo :)
>
>
> Alternatively, a possibly less ideal fix, (thinking aloud here) maybe
> we could instruct writer to ignore the "open read-only" property on
> Base forms? Would someone have code pointers for that?
>
> If we go this route, we should *disable* that checkbox in the UI (menu
> File / Properties, tab "Security"), rather than let the user set a
> checkbox that will be ignored. Code pointers to do that also
> appreciated.
>
>
> Does *anything* *else* than Base use embedded writer documents? Just
> to make sure that by changing stuff for "all embedded writer
> documents" (which is the level at which decisions are taken now: all
> embedded documents have the "edit" entry in read-only pop-up meny
> disabled), we will not break another use case.
>
> --
> Lionel

Add a (virtual) method to SfxObjectShell with a default implementation
and override the implementation in SwDocShell (SwDocShell derives from
SfxObjectShell).
You can then call this method in viewfrm.cxx and don't even need to
cast SfxObjectShell to something else - Polymorphism. ;)

Regards, Tomaž


More information about the LibreOffice mailing list