Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


I was able to hide / unhide toolbar by following your steps.

Intead we save the visible state of each toolbar(in case user has a customized active), I'll just send setVisible uno command to the LayoutManager so it toggles the toolbar visible/not visible

if (SUCCEEDED(hr) && bHide)
{
VariantInit(&param1);

param1.vt = VT_BOOL;
param1.boolVal = VARIANT_FALSE;

hr = _OpenOffice::ExecuteFunc( pLayoutManager, L"setVisible", &param1, 1, NULL );
VariantClear(&param1);
}
else
{
VariantInit(&param1);

param1.vt = VT_BOOL;
param1.boolVal = VARIANT_TRUE;

hr = _OpenOffice::ExecuteFunc( pLayoutManager, L"setVisible", &param1, 1, NULL );
VariantClear(&param1);
}

Noel: the original code of HideToolbars is applied to the first instance of the Writer object, later instaces created after that appear without the toolbar the same way as the first. Even if the user tries to start working in the Writer afterwards the toolbar is gone, so he needs to “reset” the toolbar to make them appear again.

I'm not sure how old this bug is... but I've seen this since 3.2.1-9 Novell Edition build.

I've included an snapshot how the embedded editor look right now, while was composing this emai. I'm having refresh issue while switching to text view but beside that I could say the bug is “fixed”

Original code:
/***********************************************
/*if (SUCCEEDED(hr) && bHide)
{
for (WINT i = 0; SUCCEEDED(hr) && wzAllToolBarsAndMenus[i]; i++)
{
VariantInit(&param1);
VariantClear(&result);

param1.vt = VT_BSTR;
param1.bstrVal = ::SysAllocString(wzAllToolBarsAndMenus[i]) ;

hr = _OpenOffice::ExecuteFunc( pLayoutManager, L"isElementVisible", &param1, 1, &result );

if (result.vt == VT_BOOL)
{
m_bToolBarActive[i] = (result.boolVal == VARIANT_TRUE) ? TRUE : FALSE;
}

VariantClear(&param1);
VariantClear(&result);
}
}

if (SUCCEEDED(hr))
{
for (WINT i = 0; SUCCEEDED(hr) && wzAllToolBarsAndMenus[i]; i++)
{
VariantInit(&param1);

param1.vt = VT_BSTR;
param1.bstrVal = ::SysAllocString(wzAllToolBarsAndMenus[i]) ;

if (bHide)
{
hr = _OpenOffice::ExecuteFunc( pLayoutManager, L"hideElement", &param1, 1, NULL );
}
else if (m_bToolBarActive[i])
{
hr = _OpenOffice::ExecuteFunc( pLayoutManager, L"showElement", &param1, 1, NULL );
}
VariantClear(&param1);
}
}*/

hr = _OpenOffice::ExecuteFunc( pLayoutManager, L"doLayout", NULL, 0, NULL );
/****************************************

Carlos

>>> Michael Meeks <michael.meeks@suse.com> 10/24/11 >>>
Hi Noel & co.

I'll CC the public dev list on this since it may be of wider interest.

On Mon, 2011-10-24 at 11:24 +0100, Noel Power wrote:
> something like this should work ( although doesn't on master or 3.4
> but... does appear to work on 3.3 :-/ ) seems like this really is a
> regression

Carlos - reading the code, it looks like 'setVisible' is what you want
to be calling - it -looks- (on a first glance) as if it doesn't save the
state in this case - so it should be something we can call and will not
alter the other documents (but perhaps I'm mistaken).

> sub togglefind
> layoutManager = thisComponent.currentController.frame.layoutManager
> findbarUrl = "private:resource/toolbar/findbar"
> bVis = layoutmanager.iselementvisible( "private:resource/toolbar/findbar" )
> msgbox "Findbar currently IsVisible? " & bVis
>
> if bVis then
> layoutmanager.hideElement( findbarUrl )
> else
> layoutmanager.showelement( findbarUrl )
> endif
>
> end sub

I'm personally suspicious of:

commit 560e5132f606b1fcd790e3cf97d665cec8c442fc
Author: Carsten Driesner <cd@openoffice.org>
Date: Mon Nov 1 13:29:26 2010 +0100

dockingwindows: #i112595# Fixed problem related to changes for
better layouting. Further code rework

Which does the:

- if ( pWindow && pIter->m_bFloating )
- pWindow->Show(bVisible & bToolbarVisible, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
+ if ( pWindow )
+ {
+ bool bSetVisible( pIter->m_bVisible & bVisible );
+ if ( !bSetVisible )
+ pWindow->Hide();
+ else
+ {
+ if ( pIter->m_bFloating )
+ pWindow->Show(true, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
+ else
+ implts_setLayoutDirty();
+ }

Which (at first glance) doesn't seem to hide non-floating windows ( or
perhaps I'm missing how the dirty notification propagates somehow ).

HTH,

Michael.

--
michael.meeks@suse.com <><, Pseudo Engineer, itinerant idiot



Attachment: LibreOfficeEditor.png
Description: PNG image


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.