<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Libreoffice Notebookbar is not exposing accessible events needed for screen reader users."
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=109425#c21">Comment # 21</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Libreoffice Notebookbar is not exposing accessible events needed for screen reader users."
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=109425">bug 109425</a>
              from <span class="vcard"><a class="email" href="mailto:raykowj@gmail.com" title="Jim Raykowski <raykowj@gmail.com>"> <span class="fn">Jim Raykowski</span></a>
</span></b>
        <pre>Hi Andreas, I should have jumped in earlier to let you know I was testing the
patches.

Here are some concerns I've found with Notebookbar_single.ui

1) I think Default-Grow and Default-Shrink buttons need to be visible.

2) Draw-FormatArea button does the same action as Draw-FormatArea2 button.
There is differences in visible when horizontal/vertical and icon. Are both
required?

3) Similar to 2, Grapic-GraphicDialog1 button does the same action as
Graphic-GraphicDialog button in the GraphicContainer

4) Print preview only shows undo and paste buttons. To show all the buttons in
the print container the visible property needs to be set to True. I haven't
investigated why it is required in the .ui file to be set visible for the
PrintContainer and not for the other containers. 
<object class="sfxlo-PriorityMergedHBox" id="PrintContainer">
                    <property name="visible">True</property>

5) Crash occurs in print preview when Close Preview button is pressed - can be
reproduced in previous versions.

I don't know much about XContextChangeEventMultiplexer
addContextChangeEventListener which seems to be the cause of the crash.
cssl::IllegalArgumentException("listener added twice",
static_cast<XWeak*>(this), 0) get thrown. To work around this one or the other
places illustrated below can be commented out. Hopefully someone with knowledge
about this will find the following helpful.


sfx2/source/notebookbar/SfxNotebookBar.cxx
bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
                                 const Reference<css::frame::XFrame>& xFrame,
                                 const OUString& rUIFile, bool
bReloadNotebookbar)
{
...
            SfxViewFrame* pView = SfxViewFrame::Current();

            if(pView)
            {
                Reference<XContextChangeEventMultiplexer> xMultiplexer
                            = ContextChangeEventMultiplexer::get( xContext );

                if(xFrame.is())
                {
--->                xMultiplexer->addContextChangeEventListener(
                                       
pNotebookBar->getContextChangeEventListener(),
                                        xFrame->getController());
                }
            }
        }

        return true;
    }

vcl/source/control/notebookbar.cxx
void NotebookBar::ControlListener(bool bListen)
{
    if(bListen)
    {
        // remove listeners
        css::uno::Reference<css::ui::XContextChangeEventMultiplexer>
xMultiplexer (css::ui::ContextChangeEventMultiplexer::get(
                ::comphelper::getProcessComponentContext()));
       
xMultiplexer->removeContextChangeEventListener(getContextChangeEventListener(),mxFrame->getController());
    }
// remove this else block or comment out below in the SwPagePreview destructor
and crash doesn't happen
    else
    {
        // add listeners
        css::uno::Reference<css::ui::XContextChangeEventMultiplexer>
xMultiplexer (css::ui::ContextChangeEventMultiplexer::get(
                ::comphelper::getProcessComponentContext()));
--->   
xMultiplexer->addContextChangeEventListener(getContextChangeEventListener(),mxFrame->getController());
    }
}

sw/source/uibase/uiview/pview.cxx
SwPagePreview::~SwPagePreview()
{
    SetWindow( nullptr );
    SwViewShell* pVShell =  m_pViewWin->GetViewShell();
    pVShell->SetWin(nullptr);
    delete pVShell;

    m_pViewWin.disposeAndClear();
//    if (SfxViewFrame* pCurrent = SfxViewFrame::Current())
//        if (auto& pBar =
pCurrent->GetWindow().GetSystemWindow()->GetNotebookBar())
//--->        pBar->ControlListener(false);
    m_pScrollFill.disposeAndClear();
    m_pHScrollbar.disposeAndClear();
    m_pVScrollbar.disposeAndClear();
}

framework/source/services/ContextChangeEventMultiplexer.cxx
// XContextChangeEventMultiplexer
void SAL_CALL ContextChangeEventMultiplexer::addContextChangeEventListener (
    const cssu::Reference<css::ui::XContextChangeEventListener>& rxListener,
    const cssu::Reference<cssu::XInterface>& rxEventFocus)
{
    if ( ! rxListener.is())
        throw css::lang::IllegalArgumentException(
            "can not add an empty reference",
            static_cast<XWeak*>(this),
            0);

    FocusDescriptor* pFocusDescriptor = GetFocusDescriptor(rxEventFocus, true);
    if (pFocusDescriptor != nullptr)
    {
        ListenerContainer& rContainer (pFocusDescriptor->maListeners);
        if (::std::find(rContainer.begin(), rContainer.end(), rxListener) !=
rContainer.end())
        {
            // The listener was added for the same event focus
            // previously.  That is an error.
--->        throw cssl::IllegalArgumentException("listener added twice",
static_cast<XWeak*>(this), 0);
        }
        rContainer.push_back(rxListener);
    }</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>