[Libreoffice] Trouble of showing LibreOffice/OpenOffice toolbar back

Carlos Trewartha ctrewartha at gw.novell.com
Mon Oct 24 10:32:35 PDT 2011


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 at 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 at 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 at suse.com  <><, Pseudo Engineer, itinerant idiot





Great Minds UnITe
BrainShare2011
Register at novell.com/brainshare
Follow us at twitter.com/brainshare
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20111024/cf95e72a/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 7601 bytes
Desc: Portable Network Graphics Format
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20111024/cf95e72a/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LibreOfficeEditor.png
Type: image/png
Size: 141656 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20111024/cf95e72a/attachment-0003.png>


More information about the LibreOffice mailing list