toolbarlayoutmanager.cxx (b63233d8) toolbarlayoutmanager.cxx (53d915a9)
1/**************************************************************
1/**************************************************************
2 *
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
19 *
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_framework.hxx"
26
27// my own includes

--- 21 unchanged lines hidden (view full) ---

49#include <vcl/dockingarea.hxx>
50#include <boost/bind.hpp>
51
52using namespace ::com::sun::star;
53
54namespace framework
55{
56
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_framework.hxx"
26
27// my own includes

--- 21 unchanged lines hidden (view full) ---

49#include <vcl/dockingarea.hxx>
50#include <boost/bind.hpp>
51
52using namespace ::com::sun::star;
53
54namespace framework
55{
56
57ToolbarLayoutManager::ToolbarLayoutManager(
58 const uno::Reference< lang::XMultiServiceFactory >& xSMGR,
57ToolbarLayoutManager::ToolbarLayoutManager(
58 const uno::Reference< lang::XMultiServiceFactory >& xSMGR,
59 const uno::Reference< ui::XUIElementFactory >& xUIElementFactory,
60 ILayoutNotifications* pParentLayouter )
61 : ThreadHelpBase( &Application::GetSolarMutex() ),
62 m_xSMGR( xSMGR ),
63 m_xUIElementFactoryManager( xUIElementFactory ),
64 m_pParentLayouter( pParentLayouter ),
65 m_eDockOperation( DOCKOP_ON_COLROW ),
66 m_pAddonOptions( 0 ),

--- 10 unchanged lines hidden (view full) ---

77 m_aFullAddonTbxPrefix( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/addon_" )),
78 m_aCustomTbxPrefix( RTL_CONSTASCII_USTRINGPARAM( "custom_" )),
79 m_aCustomizeCmd( RTL_CONSTASCII_USTRINGPARAM( "ConfigureDialog" )),
80 m_aToolbarTypeString( RTL_CONSTASCII_USTRINGPARAM( UIRESOURCETYPE_TOOLBAR ))
81{
82 // initialize rectangles to zero values
83 setZeroRectangle( m_aDockingAreaOffsets );
84 setZeroRectangle( m_aDockingArea );
59 const uno::Reference< ui::XUIElementFactory >& xUIElementFactory,
60 ILayoutNotifications* pParentLayouter )
61 : ThreadHelpBase( &Application::GetSolarMutex() ),
62 m_xSMGR( xSMGR ),
63 m_xUIElementFactoryManager( xUIElementFactory ),
64 m_pParentLayouter( pParentLayouter ),
65 m_eDockOperation( DOCKOP_ON_COLROW ),
66 m_pAddonOptions( 0 ),

--- 10 unchanged lines hidden (view full) ---

77 m_aFullAddonTbxPrefix( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/addon_" )),
78 m_aCustomTbxPrefix( RTL_CONSTASCII_USTRINGPARAM( "custom_" )),
79 m_aCustomizeCmd( RTL_CONSTASCII_USTRINGPARAM( "ConfigureDialog" )),
80 m_aToolbarTypeString( RTL_CONSTASCII_USTRINGPARAM( UIRESOURCETYPE_TOOLBAR ))
81{
82 // initialize rectangles to zero values
83 setZeroRectangle( m_aDockingAreaOffsets );
84 setZeroRectangle( m_aDockingArea );
85
85
86 // create toolkit object
87 m_xToolkit = uno::Reference< awt::XToolkit >( m_xSMGR->createInstance( SERVICENAME_VCLTOOLKIT ), uno::UNO_QUERY );
88}
89
90ToolbarLayoutManager::~ToolbarLayoutManager()
91{
92}
93

--- 36 unchanged lines hidden (view full) ---

130awt::Rectangle ToolbarLayoutManager::getDockingArea()
131{
132 WriteGuard aWriteLock( m_aLock );
133 Rectangle aNewDockingArea( m_aDockingArea );
134 aWriteLock.unlock();
135
136 if ( isLayoutDirty() )
137 aNewDockingArea = implts_calcDockingArea();
86 // create toolkit object
87 m_xToolkit = uno::Reference< awt::XToolkit >( m_xSMGR->createInstance( SERVICENAME_VCLTOOLKIT ), uno::UNO_QUERY );
88}
89
90ToolbarLayoutManager::~ToolbarLayoutManager()
91{
92}
93

--- 36 unchanged lines hidden (view full) ---

130awt::Rectangle ToolbarLayoutManager::getDockingArea()
131{
132 WriteGuard aWriteLock( m_aLock );
133 Rectangle aNewDockingArea( m_aDockingArea );
134 aWriteLock.unlock();
135
136 if ( isLayoutDirty() )
137 aNewDockingArea = implts_calcDockingArea();
138
138
139 aWriteLock.lock();
140 m_aDockingArea = aNewDockingArea;
141 aWriteLock.unlock();
139 aWriteLock.lock();
140 m_aDockingArea = aNewDockingArea;
141 aWriteLock.unlock();
142
142
143 return putRectangleValueToAWT(aNewDockingArea);
144}
145
146void ToolbarLayoutManager::setDockingArea( const awt::Rectangle& rDockingArea )
147{
148 WriteGuard aWriteLock( m_aLock );
149 m_aDockingArea = putAWTToRectangle( rDockingArea );
150 m_bLayoutDirty = true;

--- 7 unchanged lines hidden (view full) ---

158 uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow );
159 uno::Reference< awt::XWindow > xTopDockAreaWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] );
160 uno::Reference< awt::XWindow > xBottomDockAreaWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] );
161 uno::Reference< awt::XWindow > xLeftDockAreaWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] );
162 uno::Reference< awt::XWindow > xRightDockAreaWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] );
163 aReadLock.unlock();
164
165 uno::Reference< awt::XDevice > xDevice( xContainerWindow, uno::UNO_QUERY );
143 return putRectangleValueToAWT(aNewDockingArea);
144}
145
146void ToolbarLayoutManager::setDockingArea( const awt::Rectangle& rDockingArea )
147{
148 WriteGuard aWriteLock( m_aLock );
149 m_aDockingArea = putAWTToRectangle( rDockingArea );
150 m_bLayoutDirty = true;

--- 7 unchanged lines hidden (view full) ---

158 uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow );
159 uno::Reference< awt::XWindow > xTopDockAreaWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] );
160 uno::Reference< awt::XWindow > xBottomDockAreaWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] );
161 uno::Reference< awt::XWindow > xLeftDockAreaWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] );
162 uno::Reference< awt::XWindow > xRightDockAreaWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] );
163 aReadLock.unlock();
164
165 uno::Reference< awt::XDevice > xDevice( xContainerWindow, uno::UNO_QUERY );
166
167 // Convert relativ size to output size.
166
167 // Convert relative size to output size.
168 awt::Rectangle aRectangle = xContainerWindow->getPosSize();
169 awt::DeviceInfo aInfo = xDevice->getInfo();
168 awt::Rectangle aRectangle = xContainerWindow->getPosSize();
169 awt::DeviceInfo aInfo = xDevice->getInfo();
170 awt::Size aContainerClientSize = awt::Size( aRectangle.Width - aInfo.LeftInset - aInfo.RightInset ,
171 aRectangle.Height - aInfo.TopInset - aInfo.BottomInset );
170 awt::Size aContainerClientSize = awt::Size( aRectangle.Width - aInfo.LeftInset - aInfo.RightInset ,
171 aRectangle.Height - aInfo.TopInset - aInfo.BottomInset );
172 long aStatusBarHeight = aDockOffsets.GetHeight();
173
174 sal_Int32 nLeftRightDockingAreaHeight( aContainerClientSize.Height );
175 if ( rBorderSpace.Y >= 0 )
176 {
177 // Top docking area window
178 xTopDockAreaWindow->setPosSize( 0, 0, aContainerClientSize.Width, rBorderSpace.Y, awt::PosSize::POSSIZE );
179 xTopDockAreaWindow->setVisible( sal_True );

--- 64 unchanged lines hidden (view full) ---

244 {
245 sal_uInt32 nIndex = bReverse ? nCount-j-1 : j;
246 implts_calcWindowPosSizeOnSingleRowColumn( i, nOffset, aRowColumnsWindowData[nIndex], aContainerSize );
247 nOffset += aRowColumnsWindowData[j].nStaticSize;
248 }
249 }
250
251 implts_setDockingAreaWindowSizes( aDockingArea );
172 long aStatusBarHeight = aDockOffsets.GetHeight();
173
174 sal_Int32 nLeftRightDockingAreaHeight( aContainerClientSize.Height );
175 if ( rBorderSpace.Y >= 0 )
176 {
177 // Top docking area window
178 xTopDockAreaWindow->setPosSize( 0, 0, aContainerClientSize.Width, rBorderSpace.Y, awt::PosSize::POSSIZE );
179 xTopDockAreaWindow->setVisible( sal_True );

--- 64 unchanged lines hidden (view full) ---

244 {
245 sal_uInt32 nIndex = bReverse ? nCount-j-1 : j;
246 implts_calcWindowPosSizeOnSingleRowColumn( i, nOffset, aRowColumnsWindowData[nIndex], aContainerSize );
247 nOffset += aRowColumnsWindowData[j].nStaticSize;
248 }
249 }
250
251 implts_setDockingAreaWindowSizes( aDockingArea );
252
252
253 aWriteLock.lock();
254 m_bLayoutDirty = false;
255 m_bLayoutInProgress = false;
256 aWriteLock.unlock();
257}
258
259bool ToolbarLayoutManager::implts_isParentWindowVisible() const
260{

--- 105 unchanged lines hidden (view full) ---

366 aBorderSpace.Bottom() = calcDockingAreaSize( aDockingAreaSizeDatas[ui::DockingArea_DOCKINGAREA_BOTTOM] );
367 aBorderSpace.Left() = calcDockingAreaSize( aDockingAreaSizeDatas[ui::DockingArea_DOCKINGAREA_LEFT] );
368 aBorderSpace.Right() = calcDockingAreaSize( aDockingAreaSizeDatas[ui::DockingArea_DOCKINGAREA_RIGHT] );
369
370 return aBorderSpace;
371}
372
373void ToolbarLayoutManager::reset()
253 aWriteLock.lock();
254 m_bLayoutDirty = false;
255 m_bLayoutInProgress = false;
256 aWriteLock.unlock();
257}
258
259bool ToolbarLayoutManager::implts_isParentWindowVisible() const
260{

--- 105 unchanged lines hidden (view full) ---

366 aBorderSpace.Bottom() = calcDockingAreaSize( aDockingAreaSizeDatas[ui::DockingArea_DOCKINGAREA_BOTTOM] );
367 aBorderSpace.Left() = calcDockingAreaSize( aDockingAreaSizeDatas[ui::DockingArea_DOCKINGAREA_LEFT] );
368 aBorderSpace.Right() = calcDockingAreaSize( aDockingAreaSizeDatas[ui::DockingArea_DOCKINGAREA_RIGHT] );
369
370 return aBorderSpace;
371}
372
373void ToolbarLayoutManager::reset()
374{
374{
375 WriteGuard aWriteLock( m_aLock );
376 uno::Reference< ui::XUIConfigurationManager > xModuleCfgMgr( m_xModuleCfgMgr );
377 uno::Reference< ui::XUIConfigurationManager > xDocCfgMgr( m_xDocCfgMgr );
378 m_xModuleCfgMgr.clear();
379 m_xDocCfgMgr.clear();
380 m_bComponentAttached = false;
381 aWriteLock.unlock();
382
383 destroyToolbars();
384 resetDockingArea();
385}
386
375 WriteGuard aWriteLock( m_aLock );
376 uno::Reference< ui::XUIConfigurationManager > xModuleCfgMgr( m_xModuleCfgMgr );
377 uno::Reference< ui::XUIConfigurationManager > xDocCfgMgr( m_xDocCfgMgr );
378 m_xModuleCfgMgr.clear();
379 m_xDocCfgMgr.clear();
380 m_bComponentAttached = false;
381 aWriteLock.unlock();
382
383 destroyToolbars();
384 resetDockingArea();
385}
386
387void ToolbarLayoutManager::attach(
387void ToolbarLayoutManager::attach(
388 const uno::Reference< frame::XFrame >& xFrame,
389 const uno::Reference< ui::XUIConfigurationManager >& xModuleCfgMgr,
390 const uno::Reference< ui::XUIConfigurationManager >& xDocCfgMgr,
391 const uno::Reference< container::XNameAccess >& xPersistentWindowState )
392{
393 // reset toolbar manager if we lose our current frame
394 if ( m_xFrame.is() && m_xFrame != xFrame )
395 reset();
388 const uno::Reference< frame::XFrame >& xFrame,
389 const uno::Reference< ui::XUIConfigurationManager >& xModuleCfgMgr,
390 const uno::Reference< ui::XUIConfigurationManager >& xDocCfgMgr,
391 const uno::Reference< container::XNameAccess >& xPersistentWindowState )
392{
393 // reset toolbar manager if we lose our current frame
394 if ( m_xFrame.is() && m_xFrame != xFrame )
395 reset();
396
396
397 WriteGuard aWriteLock( m_aLock );
398 m_xFrame = xFrame;
399 m_xModuleCfgMgr = xModuleCfgMgr;
400 m_xDocCfgMgr = xDocCfgMgr;
401 m_xPersistentWindowState = xPersistentWindowState;
402 m_bComponentAttached = true;
403}
404

--- 10 unchanged lines hidden (view full) ---

415{
416 bool bNotify( false );
417 bool bMustCallCreate( false );
418 uno::Reference< ui::XUIElement > xUIElement;
419
420 ReadGuard aReadLock( m_aLock );
421 uno::Reference< frame::XFrame > xFrame( m_xFrame );
422 aReadLock.unlock();
397 WriteGuard aWriteLock( m_aLock );
398 m_xFrame = xFrame;
399 m_xModuleCfgMgr = xModuleCfgMgr;
400 m_xDocCfgMgr = xDocCfgMgr;
401 m_xPersistentWindowState = xPersistentWindowState;
402 m_bComponentAttached = true;
403}
404

--- 10 unchanged lines hidden (view full) ---

415{
416 bool bNotify( false );
417 bool bMustCallCreate( false );
418 uno::Reference< ui::XUIElement > xUIElement;
419
420 ReadGuard aReadLock( m_aLock );
421 uno::Reference< frame::XFrame > xFrame( m_xFrame );
422 aReadLock.unlock();
423
423
424 uno::Reference< frame::XModel > xModel( impl_getModelFromFrame( xFrame ));
425 if ( implts_isPreviewModel( xModel ))
426 return false; // no toolbars for preview frame!
424 uno::Reference< frame::XModel > xModel( impl_getModelFromFrame( xFrame ));
425 if ( implts_isPreviewModel( xModel ))
426 return false; // no toolbars for preview frame!
427
427
428 UIElement aRequestedToolbar = impl_findToolbar( rResourceURL );
428 UIElement aRequestedToolbar = impl_findToolbar( rResourceURL );
429 if ( aRequestedToolbar.m_aName != rResourceURL )
429 if ( aRequestedToolbar.m_aName != rResourceURL )
430 {
431 bMustCallCreate = true;
432 aRequestedToolbar.m_aName = rResourceURL;
433 aRequestedToolbar.m_aType = m_aToolbarTypeString;
434 aRequestedToolbar.m_xUIElement = xUIElement;
435 implts_readWindowStateData( rResourceURL, aRequestedToolbar );
436 }
430 {
431 bMustCallCreate = true;
432 aRequestedToolbar.m_aName = rResourceURL;
433 aRequestedToolbar.m_aType = m_aToolbarTypeString;
434 aRequestedToolbar.m_xUIElement = xUIElement;
435 implts_readWindowStateData( rResourceURL, aRequestedToolbar );
436 }
437
437
438 xUIElement = aRequestedToolbar.m_xUIElement;
439 if ( !xUIElement.is() )
440 bMustCallCreate = true;
438 xUIElement = aRequestedToolbar.m_xUIElement;
439 if ( !xUIElement.is() )
440 bMustCallCreate = true;
441
441
442 bool bCreateOrShowToolbar( aRequestedToolbar.m_bVisible & !aRequestedToolbar.m_bMasterHide );
443 uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow, uno::UNO_QUERY );
444 if ( xContainerWindow.is() && aRequestedToolbar.m_bFloating )
445 bCreateOrShowToolbar &= bool( xContainerWindow->isActive());
442 bool bCreateOrShowToolbar( aRequestedToolbar.m_bVisible & !aRequestedToolbar.m_bMasterHide );
443 uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow, uno::UNO_QUERY );
444 if ( xContainerWindow.is() && aRequestedToolbar.m_bFloating )
445 bCreateOrShowToolbar &= bool( xContainerWindow->isActive());
446
446
447 if ( bCreateOrShowToolbar )
448 bNotify = ( bMustCallCreate ) ? createToolbar( rResourceURL ) : showToolbar( rResourceURL );
447 if ( bCreateOrShowToolbar )
448 bNotify = ( bMustCallCreate ) ? createToolbar( rResourceURL ) : showToolbar( rResourceURL );
449
449
450 return bNotify;
451}
452
453bool ToolbarLayoutManager::createToolbar( const ::rtl::OUString& rResourceURL )
454{
455 bool bNotify( false );
456 uno::Reference< ui::XUIElement > xUITempElement;
450 return bNotify;
451}
452
453bool ToolbarLayoutManager::createToolbar( const ::rtl::OUString& rResourceURL )
454{
455 bool bNotify( false );
456 uno::Reference< ui::XUIElement > xUITempElement;
457
457
458 implts_createToolBar( rResourceURL, bNotify, xUITempElement );
459 return bNotify;
460}
461
462bool ToolbarLayoutManager::destroyToolbar( const ::rtl::OUString& rResourceURL )
463{
464 const rtl::OUString aAddonTbResourceName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/addon_" ));
458 implts_createToolBar( rResourceURL, bNotify, xUITempElement );
459 return bNotify;
460}
461
462bool ToolbarLayoutManager::destroyToolbar( const ::rtl::OUString& rResourceURL )
463{
464 const rtl::OUString aAddonTbResourceName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/addon_" ));
465
465
466 UIElementVector::iterator pIter;
467 uno::Reference< lang::XComponent > xComponent;
468
469 bool bNotify( false );
470 bool bMustBeSorted( false );
471 bool bMustLayouted( false );
472 bool bMustBeDestroyed( rResourceURL.indexOf( aAddonTbResourceName ) != 0 );
466 UIElementVector::iterator pIter;
467 uno::Reference< lang::XComponent > xComponent;
468
469 bool bNotify( false );
470 bool bMustBeSorted( false );
471 bool bMustLayouted( false );
472 bool bMustBeDestroyed( rResourceURL.indexOf( aAddonTbResourceName ) != 0 );
473
473
474 WriteGuard aWriteLock( m_aLock );
475 for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
476 {
477 if ( pIter->m_aName == rResourceURL )
478 {
479 xComponent.set( pIter->m_xUIElement, uno::UNO_QUERY );
480 if ( bMustBeDestroyed )
481 pIter->m_xUIElement.clear();

--- 34 unchanged lines hidden (view full) ---

516 xWindow->setVisible( sal_False );
517 bNotify = true;
518 }
519
520 if ( !xDockWindow->isFloating() )
521 bMustLayouted = true;
522 bMustBeSorted = true;
523 }
474 WriteGuard aWriteLock( m_aLock );
475 for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
476 {
477 if ( pIter->m_aName == rResourceURL )
478 {
479 xComponent.set( pIter->m_xUIElement, uno::UNO_QUERY );
480 if ( bMustBeDestroyed )
481 pIter->m_xUIElement.clear();

--- 34 unchanged lines hidden (view full) ---

516 xWindow->setVisible( sal_False );
517 bNotify = true;
518 }
519
520 if ( !xDockWindow->isFloating() )
521 bMustLayouted = true;
522 bMustBeSorted = true;
523 }
524
524
525 if ( bMustBeDestroyed )
526 {
527 if ( xComponent.is() )
528 xComponent->dispose();
529 bNotify = true;
530 }
531
532 if ( bMustLayouted )
533 implts_setLayoutDirty();
525 if ( bMustBeDestroyed )
526 {
527 if ( xComponent.is() )
528 xComponent->dispose();
529 bNotify = true;
530 }
531
532 if ( bMustLayouted )
533 implts_setLayoutDirty();
534
534
535 if ( bMustBeSorted )
536 implts_sortUIElements();
537
538 return bNotify;
539}
540
541void ToolbarLayoutManager::destroyToolbars()
542{

--- 196 unchanged lines hidden (view full) ---

739 aUIElement.m_aDockedData.m_aPos = aDockPos;
740 }
741 }
742
743 implts_setToolbar( aUIElement );
744
745 if ( xDockWindow->isFloating() )
746 {
535 if ( bMustBeSorted )
536 implts_sortUIElements();
537
538 return bNotify;
539}
540
541void ToolbarLayoutManager::destroyToolbars()
542{

--- 196 unchanged lines hidden (view full) ---

739 aUIElement.m_aDockedData.m_aPos = aDockPos;
740 }
741 }
742
743 implts_setToolbar( aUIElement );
744
745 if ( xDockWindow->isFloating() )
746 {
747 // ATTENTION: This will call toggleFloatingMode() via notifications which
747 // ATTENTION: This will call toggleFloatingMode() via notifications which
748 // sets the floating member of the UIElement correctly!
749 xDockWindow->setFloatingMode( sal_False );
750 }
751 else
752 {
753 implts_writeWindowStateData( aUIElement );
754 implts_sortUIElements();
755

--- 47 unchanged lines hidden (view full) ---

803 // anymore!
804 if ( pEvent && pEvent->ISA( VclWindowEvent ))
805 {
806 if ( pEvent->GetId() == VCLEVENT_TOOLBOX_SELECT )
807 {
808 ::rtl::OUString aToolbarName;
809 ::rtl::OUString aCommand;
810 ToolBox* pToolBox = getToolboxPtr( ((VclWindowEvent*)pEvent)->GetWindow() );
748 // sets the floating member of the UIElement correctly!
749 xDockWindow->setFloatingMode( sal_False );
750 }
751 else
752 {
753 implts_writeWindowStateData( aUIElement );
754 implts_sortUIElements();
755

--- 47 unchanged lines hidden (view full) ---

803 // anymore!
804 if ( pEvent && pEvent->ISA( VclWindowEvent ))
805 {
806 if ( pEvent->GetId() == VCLEVENT_TOOLBOX_SELECT )
807 {
808 ::rtl::OUString aToolbarName;
809 ::rtl::OUString aCommand;
810 ToolBox* pToolBox = getToolboxPtr( ((VclWindowEvent*)pEvent)->GetWindow() );
811
811
812 if ( pToolBox )
813 {
814 aToolbarName = retrieveToolbarNameFromHelpURL( pToolBox );
815 sal_uInt16 nId = pToolBox->GetCurItemId();
816 if ( nId > 0 )
817 aCommand = pToolBox->GetItemCommand( nId );
818 }
819

--- 21 unchanged lines hidden (view full) ---

841 catch ( uno::RuntimeException& ) { throw; }
842 catch ( uno::Exception& ) {}
843 }
844 }
845 }
846 else if ( pEvent->GetId() == VCLEVENT_TOOLBOX_FORMATCHANGED )
847 {
848 if ( !implts_isToolbarCreationActive() )
812 if ( pToolBox )
813 {
814 aToolbarName = retrieveToolbarNameFromHelpURL( pToolBox );
815 sal_uInt16 nId = pToolBox->GetCurItemId();
816 if ( nId > 0 )
817 aCommand = pToolBox->GetItemCommand( nId );
818 }
819

--- 21 unchanged lines hidden (view full) ---

841 catch ( uno::RuntimeException& ) { throw; }
842 catch ( uno::Exception& ) {}
843 }
844 }
845 }
846 else if ( pEvent->GetId() == VCLEVENT_TOOLBOX_FORMATCHANGED )
847 {
848 if ( !implts_isToolbarCreationActive() )
849 {
849 {
850 ToolBox* pToolBox = getToolboxPtr( ((VclWindowEvent*)pEvent)->GetWindow() );
851 if ( pToolBox )
852 {
853 ::rtl::OUString aToolbarName = retrieveToolbarNameFromHelpURL( pToolBox );
854 if ( aToolbarName.getLength() > 0 )
855 {
856 ::rtl::OUStringBuffer aBuf(100);
857 aBuf.appendAscii( "private:resource/toolbar/" );
858 aBuf.append( aToolbarName );
859
860 UIElement aToolbar = implts_findToolbar( aBuf.makeStringAndClear() );
861 if ( aToolbar.m_xUIElement.is() && !aToolbar.m_bFloating )
862 {
850 ToolBox* pToolBox = getToolboxPtr( ((VclWindowEvent*)pEvent)->GetWindow() );
851 if ( pToolBox )
852 {
853 ::rtl::OUString aToolbarName = retrieveToolbarNameFromHelpURL( pToolBox );
854 if ( aToolbarName.getLength() > 0 )
855 {
856 ::rtl::OUStringBuffer aBuf(100);
857 aBuf.appendAscii( "private:resource/toolbar/" );
858 aBuf.append( aToolbarName );
859
860 UIElement aToolbar = implts_findToolbar( aBuf.makeStringAndClear() );
861 if ( aToolbar.m_xUIElement.is() && !aToolbar.m_bFloating )
862 {
863 implts_setLayoutDirty();
863 implts_setLayoutDirty();
864 m_pParentLayouter->requestLayout( ILayoutNotifications::HINT_TOOLBARSPACE_HAS_CHANGED );
865 }
866 }
867 }
868 }
869 }
870 }
871
872 return 1;
873}
874
875void ToolbarLayoutManager::resetDockingArea()
876{
877 ReadGuard aReadLock( m_aLock );
878 uno::Reference< awt::XWindow > xTopDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] );
879 uno::Reference< awt::XWindow > xLeftDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] );
880 uno::Reference< awt::XWindow > xRightDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] );
881 uno::Reference< awt::XWindow > xBottomDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] );
882 aReadLock.unlock();
864 m_pParentLayouter->requestLayout( ILayoutNotifications::HINT_TOOLBARSPACE_HAS_CHANGED );
865 }
866 }
867 }
868 }
869 }
870 }
871
872 return 1;
873}
874
875void ToolbarLayoutManager::resetDockingArea()
876{
877 ReadGuard aReadLock( m_aLock );
878 uno::Reference< awt::XWindow > xTopDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] );
879 uno::Reference< awt::XWindow > xLeftDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] );
880 uno::Reference< awt::XWindow > xRightDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] );
881 uno::Reference< awt::XWindow > xBottomDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] );
882 aReadLock.unlock();
883
883
884 if ( xTopDockingWindow.is() )
885 xTopDockingWindow->setPosSize( 0, 0, 0, 0, awt::PosSize::POSSIZE );
886 if ( xLeftDockingWindow.is() )
887 xLeftDockingWindow->setPosSize( 0, 0, 0, 0, awt::PosSize::POSSIZE );
888 if ( xRightDockingWindow.is() )
889 xRightDockingWindow->setPosSize( 0, 0, 0, 0, awt::PosSize::POSSIZE );
890 if ( xBottomDockingWindow.is() )
891 xBottomDockingWindow->setPosSize( 0, 0, 0, 0, awt::PosSize::POSSIZE );
892}
893
884 if ( xTopDockingWindow.is() )
885 xTopDockingWindow->setPosSize( 0, 0, 0, 0, awt::PosSize::POSSIZE );
886 if ( xLeftDockingWindow.is() )
887 xLeftDockingWindow->setPosSize( 0, 0, 0, 0, awt::PosSize::POSSIZE );
888 if ( xRightDockingWindow.is() )
889 xRightDockingWindow->setPosSize( 0, 0, 0, 0, awt::PosSize::POSSIZE );
890 if ( xBottomDockingWindow.is() )
891 xBottomDockingWindow->setPosSize( 0, 0, 0, 0, awt::PosSize::POSSIZE );
892}
893
894void ToolbarLayoutManager::setParentWindow(
894void ToolbarLayoutManager::setParentWindow(
895 const uno::Reference< awt::XWindowPeer >& xParentWindow )
896{
897 static const char DOCKINGAREASTRING[] = "dockingarea";
898
899 uno::Reference< awt::XWindow > xTopDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xSMGR, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
900 uno::Reference< awt::XWindow > xLeftDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xSMGR, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
901 uno::Reference< awt::XWindow > xRightDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xSMGR, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
902 uno::Reference< awt::XWindow > xBottomDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xSMGR, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
895 const uno::Reference< awt::XWindowPeer >& xParentWindow )
896{
897 static const char DOCKINGAREASTRING[] = "dockingarea";
898
899 uno::Reference< awt::XWindow > xTopDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xSMGR, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
900 uno::Reference< awt::XWindow > xLeftDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xSMGR, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
901 uno::Reference< awt::XWindow > xRightDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xSMGR, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
902 uno::Reference< awt::XWindow > xBottomDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xSMGR, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
903
903
904 WriteGuard aWriteLock( m_aLock );
904 WriteGuard aWriteLock( m_aLock );
905 m_xContainerWindow = uno::Reference< awt::XWindow2 >( xParentWindow, uno::UNO_QUERY );
905 m_xContainerWindow = uno::Reference< awt::XWindow2 >( xParentWindow, uno::UNO_QUERY );
906 m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] = xTopDockWindow;
907 m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] = xLeftDockWindow;
908 m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] = xRightDockWindow;
909 m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] = xBottomDockWindow;
910 aWriteLock.unlock();
911
912 if ( xParentWindow.is() )
913 {

--- 213 unchanged lines hidden (view full) ---

1127 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
1128 WriteGuard aWriteLock( m_aLock );
1129
1130 const rtl::OUString* pTbNames = aToolbarNames.getConstArray();
1131 for ( sal_Int32 i = 0; i < aToolbarNames.getLength(); i++ )
1132 {
1133 aName = pTbNames[i];
1134 parseResourceURL( aName, aElementType, aElementName );
906 m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] = xTopDockWindow;
907 m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] = xLeftDockWindow;
908 m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] = xRightDockWindow;
909 m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] = xBottomDockWindow;
910 aWriteLock.unlock();
911
912 if ( xParentWindow.is() )
913 {

--- 213 unchanged lines hidden (view full) ---

1127 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
1128 WriteGuard aWriteLock( m_aLock );
1129
1130 const rtl::OUString* pTbNames = aToolbarNames.getConstArray();
1131 for ( sal_Int32 i = 0; i < aToolbarNames.getLength(); i++ )
1132 {
1133 aName = pTbNames[i];
1134 parseResourceURL( aName, aElementType, aElementName );
1135
1135
1136 // Check that we only create:
1137 // - Toolbars (the statusbar is also member of the persistent window state)
1136 // Check that we only create:
1137 // - Toolbars (the statusbar is also member of the persistent window state)
1138 // - Not custom toolbars, there are created with their own method (implts_createCustomToolbars)
1138 // - Not custom toolbars, they are created with their own method (implts_createCustomToolbars)
1139 if ( aElementType.equalsIgnoreAsciiCaseAscii( "toolbar" ) && aElementName.indexOf( m_aCustomTbxPrefix ) == -1 )
1140 {
1141 UIElement aNewToolbar = implts_findToolbar( aName );
1142 bool bFound = ( aNewToolbar.m_aName == aName );
1143 if ( !bFound )
1144 implts_readWindowStateData( aName, aNewToolbar );
1145
1146 if ( aNewToolbar.m_bVisible && !aNewToolbar.m_bContextSensitive )

--- 38 unchanged lines hidden (view full) ---

1185
1186void ToolbarLayoutManager::implts_createCustomToolBar( const rtl::OUString& aTbxResName, const rtl::OUString& aTitle )
1187{
1188 if ( aTbxResName.getLength() > 0 )
1189 {
1190 bool bNotify( false );
1191 uno::Reference< ui::XUIElement > xUIElement;
1192 implts_createToolBar( aTbxResName, bNotify, xUIElement );
1139 if ( aElementType.equalsIgnoreAsciiCaseAscii( "toolbar" ) && aElementName.indexOf( m_aCustomTbxPrefix ) == -1 )
1140 {
1141 UIElement aNewToolbar = implts_findToolbar( aName );
1142 bool bFound = ( aNewToolbar.m_aName == aName );
1143 if ( !bFound )
1144 implts_readWindowStateData( aName, aNewToolbar );
1145
1146 if ( aNewToolbar.m_bVisible && !aNewToolbar.m_bContextSensitive )

--- 38 unchanged lines hidden (view full) ---

1185
1186void ToolbarLayoutManager::implts_createCustomToolBar( const rtl::OUString& aTbxResName, const rtl::OUString& aTitle )
1187{
1188 if ( aTbxResName.getLength() > 0 )
1189 {
1190 bool bNotify( false );
1191 uno::Reference< ui::XUIElement > xUIElement;
1192 implts_createToolBar( aTbxResName, bNotify, xUIElement );
1193
1193
1194 if ( !aTitle.isEmpty() && xUIElement.is() )
1195 {
1196 vos::OGuard aGuard( Application::GetSolarMutex() );
1197
1198 Window* pWindow = getWindowFromXUIElement( xUIElement );
1194 if ( !aTitle.isEmpty() && xUIElement.is() )
1195 {
1196 vos::OGuard aGuard( Application::GetSolarMutex() );
1197
1198 Window* pWindow = getWindowFromXUIElement( xUIElement );
1199 if ( pWindow )
1199 if ( pWindow )
1200 pWindow->SetText( aTitle );
1201 }
1202 }
1203}
1204
1205void ToolbarLayoutManager::implts_reparentToolbars()
1206{
1207 WriteGuard aWriteLock( m_aLock );

--- 62 unchanged lines hidden (view full) ---

1270void ToolbarLayoutManager::implts_createToolBar( const ::rtl::OUString& aName, bool& bNotify, uno::Reference< ui::XUIElement >& rUIElement )
1271{
1272 ReadGuard aReadLock( m_aLock );
1273 uno::Reference< frame::XFrame > xFrame( m_xFrame );
1274 uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow );
1275 aReadLock.unlock();
1276
1277 bNotify = false;
1200 pWindow->SetText( aTitle );
1201 }
1202 }
1203}
1204
1205void ToolbarLayoutManager::implts_reparentToolbars()
1206{
1207 WriteGuard aWriteLock( m_aLock );

--- 62 unchanged lines hidden (view full) ---

1270void ToolbarLayoutManager::implts_createToolBar( const ::rtl::OUString& aName, bool& bNotify, uno::Reference< ui::XUIElement >& rUIElement )
1271{
1272 ReadGuard aReadLock( m_aLock );
1273 uno::Reference< frame::XFrame > xFrame( m_xFrame );
1274 uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow );
1275 aReadLock.unlock();
1276
1277 bNotify = false;
1278
1278
1279 if ( !xFrame.is() || !xContainerWindow.is() )
1280 return;
1281
1282 UIElement aToolbarElement = implts_findToolbar( aName );
1279 if ( !xFrame.is() || !xContainerWindow.is() )
1280 return;
1281
1282 UIElement aToolbarElement = implts_findToolbar( aName );
1283 if ( !aToolbarElement.m_xUIElement.is() )
1283 if ( !aToolbarElement.m_xUIElement.is() )
1284 {
1285 uno::Reference< ui::XUIElement > xUIElement = implts_createElement( aName );
1286
1287 bool bVisible( false );
1288 bool bFloating( false );
1289 if ( xUIElement.is() )
1290 {
1291 rUIElement = xUIElement;
1284 {
1285 uno::Reference< ui::XUIElement > xUIElement = implts_createElement( aName );
1286
1287 bool bVisible( false );
1288 bool bFloating( false );
1289 if ( xUIElement.is() )
1290 {
1291 rUIElement = xUIElement;
1292
1292
1293 uno::Reference< awt::XWindow > xWindow( xUIElement->getRealInterface(), uno::UNO_QUERY );
1294 uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
1295 if ( xDockWindow.is() && xWindow.is() )
1296 {
1297 try
1298 {
1299 xDockWindow->addDockableWindowListener( uno::Reference< awt::XDockableWindowListener >(
1300 static_cast< OWeakObject * >( this ), uno::UNO_QUERY ));

--- 40 unchanged lines hidden (view full) ---

1341 ToolBox* pToolbar = (ToolBox *)pWindow;
1342 sal_uInt16 nMenuType = pToolbar->GetMenuType();
1343 if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, m_aCustomizeCmd ))
1344 pToolbar->SetMenuType( nMenuType & ~TOOLBOX_MENUTYPE_CUSTOMIZE );
1345 else
1346 pToolbar->SetMenuType( nMenuType | TOOLBOX_MENUTYPE_CUSTOMIZE );
1347 }
1348 bNotify = true;
1293 uno::Reference< awt::XWindow > xWindow( xUIElement->getRealInterface(), uno::UNO_QUERY );
1294 uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
1295 if ( xDockWindow.is() && xWindow.is() )
1296 {
1297 try
1298 {
1299 xDockWindow->addDockableWindowListener( uno::Reference< awt::XDockableWindowListener >(
1300 static_cast< OWeakObject * >( this ), uno::UNO_QUERY ));

--- 40 unchanged lines hidden (view full) ---

1341 ToolBox* pToolbar = (ToolBox *)pWindow;
1342 sal_uInt16 nMenuType = pToolbar->GetMenuType();
1343 if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, m_aCustomizeCmd ))
1344 pToolbar->SetMenuType( nMenuType & ~TOOLBOX_MENUTYPE_CUSTOMIZE );
1345 else
1346 pToolbar->SetMenuType( nMenuType | TOOLBOX_MENUTYPE_CUSTOMIZE );
1347 }
1348 bNotify = true;
1349
1349
1350 implts_sortUIElements();
1351
1352 if ( bVisible && !bFloating )
1353 implts_setLayoutDirty();
1354 }
1355 }
1356}
1357

--- 65 unchanged lines hidden (view full) ---

1423 if ( pWindow )
1424 {
1425 vos::OGuard aGuard( Application::GetSolarMutex() );
1426 String aText = pWindow->GetText();
1427 if ( aText.Len() == 0 )
1428 pWindow->SetText( rElement.m_aUIName );
1429 }
1430
1350 implts_sortUIElements();
1351
1352 if ( bVisible && !bFloating )
1353 implts_setLayoutDirty();
1354 }
1355 }
1356}
1357

--- 65 unchanged lines hidden (view full) ---

1423 if ( pWindow )
1424 {
1425 vos::OGuard aGuard( Application::GetSolarMutex() );
1426 String aText = pWindow->GetText();
1427 if ( aText.Len() == 0 )
1428 pWindow->SetText( rElement.m_aUIName );
1429 }
1430
1431 ::Point aPos( rElement.m_aFloatingData.m_aPos.X(),
1432 rElement.m_aFloatingData.m_aPos.Y() );
1431 ::Point aPos( rElement.m_aFloatingData.m_aPos.X(),
1432 rElement.m_aFloatingData.m_aPos.Y() );
1433 bool bWriteData( false );
1434 bool bUndefPos = hasDefaultPosValue( rElement.m_aFloatingData.m_aPos );
1435 bool bSetSize = ( rElement.m_aFloatingData.m_aSize.Width() != 0 &&
1436 rElement.m_aFloatingData.m_aSize.Height() != 0 );
1437 xDockWindow->setFloatingMode( sal_True );
1438 if ( bUndefPos )
1439 {
1440 aPos = implts_findNextCascadeFloatingPos();

--- 37 unchanged lines hidden (view full) ---

1478 bool bSetSize( false );
1479 ::Point aDockPos;
1480 ::Point aPixelPos;
1481 ::Size aSize;
1482
1483 if ( pToolBox )
1484 {
1485 vos::OGuard aGuard( Application::GetSolarMutex() );
1433 bool bWriteData( false );
1434 bool bUndefPos = hasDefaultPosValue( rElement.m_aFloatingData.m_aPos );
1435 bool bSetSize = ( rElement.m_aFloatingData.m_aSize.Width() != 0 &&
1436 rElement.m_aFloatingData.m_aSize.Height() != 0 );
1437 xDockWindow->setFloatingMode( sal_True );
1438 if ( bUndefPos )
1439 {
1440 aPos = implts_findNextCascadeFloatingPos();

--- 37 unchanged lines hidden (view full) ---

1478 bool bSetSize( false );
1479 ::Point aDockPos;
1480 ::Point aPixelPos;
1481 ::Size aSize;
1482
1483 if ( pToolBox )
1484 {
1485 vos::OGuard aGuard( Application::GetSolarMutex() );
1486 pToolBox->SetAlign( ImplConvertAlignment(rElement.m_aDockedData.m_nDockedArea ) );
1486 pToolBox->SetAlign( ImplConvertAlignment(rElement.m_aDockedData.m_nDockedArea ) );
1487 pToolBox->SetLineCount( 1 );
1488 xDockWindow->setFloatingMode( sal_False );
1489 if ( rElement.m_aDockedData.m_bLocked )
1490 xDockWindow->lock();
1491 aSize = pToolBox->CalcWindowSizePixel();
1492 bSetSize = true;
1493
1494 if ( isDefaultPos( rElement.m_aDockedData.m_aPos ))
1495 {
1496 implts_findNextDockingPos( (ui::DockingArea)rElement.m_aDockedData.m_nDockedArea, aSize, aDockPos, aPixelPos );
1497 rElement.m_aDockedData.m_aPos = aDockPos;
1498 }
1499 }
1500
1501 xWindow->setPosSize( aPixelPos.X(), aPixelPos.Y(), 0, 0, awt::PosSize::POS );
1502 if( bSetSize )
1503 xWindow->setOutputSize( AWTSize( aSize) );
1504
1505 if ( pWindow )
1487 pToolBox->SetLineCount( 1 );
1488 xDockWindow->setFloatingMode( sal_False );
1489 if ( rElement.m_aDockedData.m_bLocked )
1490 xDockWindow->lock();
1491 aSize = pToolBox->CalcWindowSizePixel();
1492 bSetSize = true;
1493
1494 if ( isDefaultPos( rElement.m_aDockedData.m_aPos ))
1495 {
1496 implts_findNextDockingPos( (ui::DockingArea)rElement.m_aDockedData.m_nDockedArea, aSize, aDockPos, aPixelPos );
1497 rElement.m_aDockedData.m_aPos = aDockPos;
1498 }
1499 }
1500
1501 xWindow->setPosSize( aPixelPos.X(), aPixelPos.Y(), 0, 0, awt::PosSize::POS );
1502 if( bSetSize )
1503 xWindow->setOutputSize( AWTSize( aSize) );
1504
1505 if ( pWindow )
1506 {
1506 {
1507 vos::OGuard aGuard( Application::GetSolarMutex() );
1508 if ( !bShowElement )
1509 pWindow->Hide();
1510 }
1511 }
1512 }
1513}
1514

--- 253 unchanged lines hidden (view full) ---

1768 uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
1769 if ( xDockWindow.is() )
1770 bFloating = xDockWindow->isFloating();
1771
1772 uno::Reference< awt::XWindow2 > xWindow2( xWindow, uno::UNO_QUERY );
1773 if( xWindow2.is() )
1774 {
1775 aPos = xWindow2->getPosSize();
1507 vos::OGuard aGuard( Application::GetSolarMutex() );
1508 if ( !bShowElement )
1509 pWindow->Hide();
1510 }
1511 }
1512 }
1513}
1514

--- 253 unchanged lines hidden (view full) ---

1768 uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
1769 if ( xDockWindow.is() )
1770 bFloating = xDockWindow->isFloating();
1771
1772 uno::Reference< awt::XWindow2 > xWindow2( xWindow, uno::UNO_QUERY );
1773 if( xWindow2.is() )
1774 {
1775 aPos = xWindow2->getPosSize();
1776 aSize = xWindow2->getOutputSize(); // always use output size for consistency
1776 aSize = xWindow2->getOutputSize(); // always use output size for consistency
1777 bVisible = xWindow2->isVisible();
1778 }
1779
1780 WriteGuard aWriteLock( m_aLock );
1781 UIElement& rUIElement = impl_findToolbar( aName );
1782 if ( rUIElement.m_xUIElement.is() )
1783 {
1784 rUIElement.m_bVisible = bVisible;

--- 12 unchanged lines hidden (view full) ---

1797/******************************************************************************
1798 LOOKUP PART FOR TOOLBARS
1799******************************************************************************/
1800
1801UIElement& ToolbarLayoutManager::impl_findToolbar( const rtl::OUString& aName )
1802{
1803 static UIElement aEmptyElement;
1804 UIElementVector::iterator pIter;
1777 bVisible = xWindow2->isVisible();
1778 }
1779
1780 WriteGuard aWriteLock( m_aLock );
1781 UIElement& rUIElement = impl_findToolbar( aName );
1782 if ( rUIElement.m_xUIElement.is() )
1783 {
1784 rUIElement.m_bVisible = bVisible;

--- 12 unchanged lines hidden (view full) ---

1797/******************************************************************************
1798 LOOKUP PART FOR TOOLBARS
1799******************************************************************************/
1800
1801UIElement& ToolbarLayoutManager::impl_findToolbar( const rtl::OUString& aName )
1802{
1803 static UIElement aEmptyElement;
1804 UIElementVector::iterator pIter;
1805
1805
1806 ReadGuard aReadLock( m_aLock );
1807 for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
1808 {
1809 if ( pIter->m_aName == aName )
1810 return *pIter;
1811 }
1812
1813 return aEmptyElement;

--- 56 unchanged lines hidden (view full) ---

1870 return pWindow;
1871}
1872
1873bool ToolbarLayoutManager::implts_insertToolbar( const UIElement& rUIElement )
1874{
1875 UIElement aTempData;
1876 bool bFound( false );
1877 bool bResult( false );
1806 ReadGuard aReadLock( m_aLock );
1807 for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
1808 {
1809 if ( pIter->m_aName == aName )
1810 return *pIter;
1811 }
1812
1813 return aEmptyElement;

--- 56 unchanged lines hidden (view full) ---

1870 return pWindow;
1871}
1872
1873bool ToolbarLayoutManager::implts_insertToolbar( const UIElement& rUIElement )
1874{
1875 UIElement aTempData;
1876 bool bFound( false );
1877 bool bResult( false );
1878
1878
1879 aTempData = implts_findToolbar( rUIElement.m_aName );
1880 if ( aTempData.m_aName == rUIElement.m_aName )
1881 bFound = true;
1879 aTempData = implts_findToolbar( rUIElement.m_aName );
1880 if ( aTempData.m_aName == rUIElement.m_aName )
1881 bFound = true;
1882
1882
1883 if ( !bFound )
1884 {
1885 WriteGuard aWriteLock( m_aLock );
1886 m_aUIElements.push_back( rUIElement );
1887 bResult = true;
1888 }
1883 if ( !bFound )
1884 {
1885 WriteGuard aWriteLock( m_aLock );
1886 m_aUIElements.push_back( rUIElement );
1887 bResult = true;
1888 }
1889
1889
1890 return bResult;
1891}
1892
1893void ToolbarLayoutManager::implts_setToolbar( const UIElement& rUIElement )
1894{
1895 WriteGuard aWriteLock( m_aLock );
1896 UIElement& rData = impl_findToolbar( rUIElement.m_aName );
1897 if ( rData.m_aName == rUIElement.m_aName )

--- 172 unchanged lines hidden (view full) ---

2070
2071 const sal_uInt32 nCount = aWindowVector.size();
2072 for ( j = 0; j < sal_Int32( nCount); j++ )
2073 {
2074 const UIElement& rElement = aWindowVector[j];
2075 uno::Reference< awt::XWindow > xWindow;
2076 uno::Reference< ui::XUIElement > xUIElement( rElement.m_xUIElement );
2077 awt::Rectangle aPosSize;
1890 return bResult;
1891}
1892
1893void ToolbarLayoutManager::implts_setToolbar( const UIElement& rUIElement )
1894{
1895 WriteGuard aWriteLock( m_aLock );
1896 UIElement& rData = impl_findToolbar( rUIElement.m_aName );
1897 if ( rData.m_aName == rUIElement.m_aName )

--- 172 unchanged lines hidden (view full) ---

2070
2071 const sal_uInt32 nCount = aWindowVector.size();
2072 for ( j = 0; j < sal_Int32( nCount); j++ )
2073 {
2074 const UIElement& rElement = aWindowVector[j];
2075 uno::Reference< awt::XWindow > xWindow;
2076 uno::Reference< ui::XUIElement > xUIElement( rElement.m_xUIElement );
2077 awt::Rectangle aPosSize;
2078
2078
2079 if ( !lcl_checkUIElement(xUIElement,aPosSize,xWindow) )
2080 continue;
2081 if ( isHorizontalDockingArea( eDockingArea ))
2082 {
2083 if ( nCurrPos == -1 )
2084 {
2085 nCurrPos = rElement.m_aDockedData.m_aPos.Y();
2086 nLastPos = 0;

--- 342 unchanged lines hidden (view full) ---

2429 aReadLock.unlock();
2430
2431 if (( DockingArea < ui::DockingArea_DOCKINGAREA_TOP ) || ( DockingArea > ui::DockingArea_DOCKINGAREA_RIGHT ))
2432 DockingArea = ui::DockingArea_DOCKINGAREA_TOP;
2433
2434 {
2435 // Retrieve output size from container Window
2436 vos::OGuard aGuard( Application::GetSolarMutex() );
2079 if ( !lcl_checkUIElement(xUIElement,aPosSize,xWindow) )
2080 continue;
2081 if ( isHorizontalDockingArea( eDockingArea ))
2082 {
2083 if ( nCurrPos == -1 )
2084 {
2085 nCurrPos = rElement.m_aDockedData.m_aPos.Y();
2086 nLastPos = 0;

--- 342 unchanged lines hidden (view full) ---

2429 aReadLock.unlock();
2430
2431 if (( DockingArea < ui::DockingArea_DOCKINGAREA_TOP ) || ( DockingArea > ui::DockingArea_DOCKINGAREA_RIGHT ))
2432 DockingArea = ui::DockingArea_DOCKINGAREA_TOP;
2433
2434 {
2435 // Retrieve output size from container Window
2436 vos::OGuard aGuard( Application::GetSolarMutex() );
2437 pDockingWindow = VCLUnoHelper::GetWindow( xDockingWindow );
2437 pDockingWindow = VCLUnoHelper::GetWindow( xDockingWindow );
2438 if ( pDockingWindow )
2439 aDockingWinSize = pDockingWindow->GetOutputSizePixel();
2440 }
2441
2442 sal_Int32 nFreeRowColPixelPos( 0 );
2443 sal_Int32 nMaxSpace( 0 );
2444 sal_Int32 nNeededSpace( 0 );
2445 sal_Int32 nTopDockingAreaSize( 0 );

--- 15 unchanged lines hidden (view full) ---

2461 implts_getDockingAreaElementInfos( DockingArea, aRowColumnsWindowData );
2462 sal_Int32 nPixelPos( 0 );
2463 const sal_uInt32 nCount = aRowColumnsWindowData.size();
2464 for ( sal_uInt32 i = 0; i < nCount; i++ )
2465 {
2466 SingleRowColumnWindowData& rRowColumnWindowData = aRowColumnsWindowData[i];
2467
2468 if (( DockingArea == ui::DockingArea_DOCKINGAREA_BOTTOM ) ||
2438 if ( pDockingWindow )
2439 aDockingWinSize = pDockingWindow->GetOutputSizePixel();
2440 }
2441
2442 sal_Int32 nFreeRowColPixelPos( 0 );
2443 sal_Int32 nMaxSpace( 0 );
2444 sal_Int32 nNeededSpace( 0 );
2445 sal_Int32 nTopDockingAreaSize( 0 );

--- 15 unchanged lines hidden (view full) ---

2461 implts_getDockingAreaElementInfos( DockingArea, aRowColumnsWindowData );
2462 sal_Int32 nPixelPos( 0 );
2463 const sal_uInt32 nCount = aRowColumnsWindowData.size();
2464 for ( sal_uInt32 i = 0; i < nCount; i++ )
2465 {
2466 SingleRowColumnWindowData& rRowColumnWindowData = aRowColumnsWindowData[i];
2467
2468 if (( DockingArea == ui::DockingArea_DOCKINGAREA_BOTTOM ) ||
2469 ( DockingArea == ui::DockingArea_DOCKINGAREA_RIGHT ))
2469 ( DockingArea == ui::DockingArea_DOCKINGAREA_RIGHT ))
2470 nPixelPos += rRowColumnWindowData.nStaticSize;
2471
2472 if ((( nMaxSpace - rRowColumnWindowData.nVarSize ) >= nNeededSpace ) ||
2473 ( rRowColumnWindowData.nSpace >= nNeededSpace ))
2474 {
2475 // Check current row where we can find the needed space
2476 sal_Int32 nCurrPos( 0 );
2477 const sal_uInt32 nWindowSizesCount = rRowColumnWindowData.aRowColumnWindowSizes.size();

--- 47 unchanged lines hidden (view full) ---

2525 rPixelPos = ::Point( nPixelPos, nTopDockingAreaSize + nCurrPos );
2526 else
2527 rPixelPos = ::Point( aDockingWinSize.Width() - nPixelPos , nTopDockingAreaSize + nCurrPos );
2528 return;
2529 }
2530 }
2531 }
2532
2470 nPixelPos += rRowColumnWindowData.nStaticSize;
2471
2472 if ((( nMaxSpace - rRowColumnWindowData.nVarSize ) >= nNeededSpace ) ||
2473 ( rRowColumnWindowData.nSpace >= nNeededSpace ))
2474 {
2475 // Check current row where we can find the needed space
2476 sal_Int32 nCurrPos( 0 );
2477 const sal_uInt32 nWindowSizesCount = rRowColumnWindowData.aRowColumnWindowSizes.size();

--- 47 unchanged lines hidden (view full) ---

2525 rPixelPos = ::Point( nPixelPos, nTopDockingAreaSize + nCurrPos );
2526 else
2527 rPixelPos = ::Point( aDockingWinSize.Width() - nPixelPos , nTopDockingAreaSize + nCurrPos );
2528 return;
2529 }
2530 }
2531 }
2532
2533 if (( DockingArea == ui::DockingArea_DOCKINGAREA_TOP ) || ( DockingArea == ui::DockingArea_DOCKINGAREA_LEFT ))
2533 if (( DockingArea == ui::DockingArea_DOCKINGAREA_TOP ) || ( DockingArea == ui::DockingArea_DOCKINGAREA_LEFT ))
2534 nPixelPos += rRowColumnWindowData.nStaticSize;
2535 }
2536
2537 sal_Int32 nNextFreeRowCol( 0 );
2538 sal_Int32 nRowColumnsCount = aRowColumnsWindowData.size();
2539 if ( nRowColumnsCount > 0 )
2540 nNextFreeRowCol = aRowColumnsWindowData[nRowColumnsCount-1].nRowColumn+1;
2541 else
2542 nNextFreeRowCol = 0;
2543
2544 if ( nNextFreeRowCol == 0 )
2545 {
2546 if ( DockingArea == ui::DockingArea_DOCKINGAREA_BOTTOM )
2547 nFreeRowColPixelPos = aDockingWinSize.Height() - aUIElementSize.Height();
2534 nPixelPos += rRowColumnWindowData.nStaticSize;
2535 }
2536
2537 sal_Int32 nNextFreeRowCol( 0 );
2538 sal_Int32 nRowColumnsCount = aRowColumnsWindowData.size();
2539 if ( nRowColumnsCount > 0 )
2540 nNextFreeRowCol = aRowColumnsWindowData[nRowColumnsCount-1].nRowColumn+1;
2541 else
2542 nNextFreeRowCol = 0;
2543
2544 if ( nNextFreeRowCol == 0 )
2545 {
2546 if ( DockingArea == ui::DockingArea_DOCKINGAREA_BOTTOM )
2547 nFreeRowColPixelPos = aDockingWinSize.Height() - aUIElementSize.Height();
2548 else if ( DockingArea == ui::DockingArea_DOCKINGAREA_RIGHT )
2548 else if ( DockingArea == ui::DockingArea_DOCKINGAREA_RIGHT )
2549 nFreeRowColPixelPos = aDockingWinSize.Width() - aUIElementSize.Width();
2550 }
2551
2552 if ( isHorizontalDockingArea( DockingArea ))
2553 {
2554 rVirtualPos = ::Point( 0, nNextFreeRowCol );
2555 if ( DockingArea == ui::DockingArea_DOCKINGAREA_TOP )
2556 rPixelPos = ::Point( 0, nFreeRowColPixelPos );
2557 else
2558 rPixelPos = ::Point( 0, aDockingWinSize.Height() - nFreeRowColPixelPos );
2559 }
2560 else
2561 {
2562 rVirtualPos = ::Point( nNextFreeRowCol, 0 );
2563 rPixelPos = ::Point( aDockingWinSize.Width() - nFreeRowColPixelPos, 0 );
2564 }
2565}
2566
2549 nFreeRowColPixelPos = aDockingWinSize.Width() - aUIElementSize.Width();
2550 }
2551
2552 if ( isHorizontalDockingArea( DockingArea ))
2553 {
2554 rVirtualPos = ::Point( 0, nNextFreeRowCol );
2555 if ( DockingArea == ui::DockingArea_DOCKINGAREA_TOP )
2556 rPixelPos = ::Point( 0, nFreeRowColPixelPos );
2557 else
2558 rPixelPos = ::Point( 0, aDockingWinSize.Height() - nFreeRowColPixelPos );
2559 }
2560 else
2561 {
2562 rVirtualPos = ::Point( nNextFreeRowCol, 0 );
2563 rPixelPos = ::Point( aDockingWinSize.Width() - nFreeRowColPixelPos, 0 );
2564 }
2565}
2566
2567void ToolbarLayoutManager::implts_calcWindowPosSizeOnSingleRowColumn(
2567void ToolbarLayoutManager::implts_calcWindowPosSizeOnSingleRowColumn(
2568 sal_Int32 nDockingArea,
2569 sal_Int32 nOffset,
2570 SingleRowColumnWindowData& rRowColumnWindowData,
2571 const ::Size& rContainerSize )
2572{
2573 sal_Int32 nDiff(0);
2574 sal_Int32 nRCSpace( rRowColumnWindowData.nSpace );
2575 sal_Int32 nTopDockingAreaSize(0);

--- 178 unchanged lines hidden (view full) ---

2754::Rectangle ToolbarLayoutManager::implts_calcHotZoneRect( const ::Rectangle& rRect, sal_Int32 nHotZoneOffset )
2755{
2756 ::Rectangle aRect( rRect );
2757
2758 aRect.Left() -= nHotZoneOffset;
2759 aRect.Top() -= nHotZoneOffset;
2760 aRect.Right() += nHotZoneOffset;
2761 aRect.Bottom() += nHotZoneOffset;
2568 sal_Int32 nDockingArea,
2569 sal_Int32 nOffset,
2570 SingleRowColumnWindowData& rRowColumnWindowData,
2571 const ::Size& rContainerSize )
2572{
2573 sal_Int32 nDiff(0);
2574 sal_Int32 nRCSpace( rRowColumnWindowData.nSpace );
2575 sal_Int32 nTopDockingAreaSize(0);

--- 178 unchanged lines hidden (view full) ---

2754::Rectangle ToolbarLayoutManager::implts_calcHotZoneRect( const ::Rectangle& rRect, sal_Int32 nHotZoneOffset )
2755{
2756 ::Rectangle aRect( rRect );
2757
2758 aRect.Left() -= nHotZoneOffset;
2759 aRect.Top() -= nHotZoneOffset;
2760 aRect.Right() += nHotZoneOffset;
2761 aRect.Bottom() += nHotZoneOffset;
2762
2762
2763 return aRect;
2764}
2765
2766void ToolbarLayoutManager::implts_calcDockingPosSize(
2767 UIElement& rUIElement,
2768 DockingOperation& rDockingOperation,
2769 ::Rectangle& rTrackingRect,
2770 const Point& rMousePos )

--- 122 unchanged lines hidden (view full) ---

2893 ::Rectangle aUIElementRect( aWindowRect );
2894 sal_Int32 nMiddle( bHorizontalDockArea ? ( aWindowRect.Left() + aWindowRect.getWidth() / 2 ) :
2895 ( aWindowRect.Top() + aWindowRect.getHeight() / 2 ));
2896 sal_Bool bInsertBefore( bHorizontalDockArea ? ( rMousePos.X() < nMiddle ) : ( rMousePos.Y() < nMiddle ));
2897 if ( bInsertBefore )
2898 {
2899 if ( bHorizontalDockArea )
2900 {
2763 return aRect;
2764}
2765
2766void ToolbarLayoutManager::implts_calcDockingPosSize(
2767 UIElement& rUIElement,
2768 DockingOperation& rDockingOperation,
2769 ::Rectangle& rTrackingRect,
2770 const Point& rMousePos )

--- 122 unchanged lines hidden (view full) ---

2893 ::Rectangle aUIElementRect( aWindowRect );
2894 sal_Int32 nMiddle( bHorizontalDockArea ? ( aWindowRect.Left() + aWindowRect.getWidth() / 2 ) :
2895 ( aWindowRect.Top() + aWindowRect.getHeight() / 2 ));
2896 sal_Bool bInsertBefore( bHorizontalDockArea ? ( rMousePos.X() < nMiddle ) : ( rMousePos.Y() < nMiddle ));
2897 if ( bInsertBefore )
2898 {
2899 if ( bHorizontalDockArea )
2900 {
2901 sal_Int32 nSize = ::std::max( sal_Int32( 0 ), std::min( sal_Int32( aContainerWinSize.Width() - aWindowRect.Left() ),
2901 sal_Int32 nSize = ::std::max( sal_Int32( 0 ), std::min( sal_Int32( aContainerWinSize.Width() - aWindowRect.Left() ),
2902 sal_Int32( aTrackingRect.getWidth() )));
2903 if ( nSize == 0 )
2904 nSize = aWindowRect.getWidth();
2905
2906 aUIElementRect.SetSize( ::Size( nSize, aWindowRect.getHeight() ));
2907 aWindowRect = implts_determineFrontDockingRect( eDockedArea, nRowCol, aWindowRect,rUIElement.m_aName, aUIElementRect );
2908
2909 // Set virtual position

--- 72 unchanged lines hidden (view full) ---

2982 eDockedArea, nRowCol, rUIElement,
2983 aTrackingRect, aRowColumnRect, aContainerWinSize );
2984 return;
2985 }
2986 }
2987 else
2988 {
2989 if ((( nRowCol == nMinRowCol ) && ( rDockingOperation == DOCKOP_BEFORE_COLROW )) ||
2902 sal_Int32( aTrackingRect.getWidth() )));
2903 if ( nSize == 0 )
2904 nSize = aWindowRect.getWidth();
2905
2906 aUIElementRect.SetSize( ::Size( nSize, aWindowRect.getHeight() ));
2907 aWindowRect = implts_determineFrontDockingRect( eDockedArea, nRowCol, aWindowRect,rUIElement.m_aName, aUIElementRect );
2908
2909 // Set virtual position

--- 72 unchanged lines hidden (view full) ---

2982 eDockedArea, nRowCol, rUIElement,
2983 aTrackingRect, aRowColumnRect, aContainerWinSize );
2984 return;
2985 }
2986 }
2987 else
2988 {
2989 if ((( nRowCol == nMinRowCol ) && ( rDockingOperation == DOCKOP_BEFORE_COLROW )) ||
2990 (( nRowCol == nMaxRowCol ) && ( rDockingOperation == DOCKOP_AFTER_COLROW )))
2990 (( nRowCol == nMaxRowCol ) && ( rDockingOperation == DOCKOP_AFTER_COLROW )))
2991 bOpOutsideOfDockingArea = true;
2992 else
2993 {
2994 // handle docking before/after a row
2995 implts_setTrackingRect( eDockedArea, rMousePos, aTrackingRect );
2996 rTrackingRect = implts_calcTrackingAndElementRect(
2997 eDockedArea, nRowCol, rUIElement,
2998 aTrackingRect, aRowColumnRect, aContainerWinSize );

--- 356 unchanged lines hidden (view full) ---

3355 }
3356 catch ( uno::Exception& ) {}
3357 }
3358}
3359
3360//---------------------------------------------------------------------------------------------------------
3361// XWindowListener
3362//---------------------------------------------------------------------------------------------------------
2991 bOpOutsideOfDockingArea = true;
2992 else
2993 {
2994 // handle docking before/after a row
2995 implts_setTrackingRect( eDockedArea, rMousePos, aTrackingRect );
2996 rTrackingRect = implts_calcTrackingAndElementRect(
2997 eDockedArea, nRowCol, rUIElement,
2998 aTrackingRect, aRowColumnRect, aContainerWinSize );

--- 356 unchanged lines hidden (view full) ---

3355 }
3356 catch ( uno::Exception& ) {}
3357 }
3358}
3359
3360//---------------------------------------------------------------------------------------------------------
3361// XWindowListener
3362//---------------------------------------------------------------------------------------------------------
3363void SAL_CALL ToolbarLayoutManager::windowResized( const awt::WindowEvent& aEvent )
3363void SAL_CALL ToolbarLayoutManager::windowResized( const awt::WindowEvent& aEvent )
3364throw( uno::RuntimeException )
3365{
3366 WriteGuard aWriteLock( m_aLock );
3367 bool bLocked( m_bDockingInProgress );
3368 bool bLayoutInProgress( m_bLayoutInProgress );
3369 aWriteLock.unlock();
3370
3371 // Do not do anything if we are in the middle of a docking process. This would interfere all other

--- 6 unchanged lines hidden (view full) ---

3378 uno::Reference< awt::XWindow > xWindow( aEvent.Source, uno::UNO_QUERY );
3379
3380 UIElement aUIElement = implts_findToolbar( aEvent.Source );
3381 if ( aUIElement.m_xUIElement.is() )
3382 {
3383 if ( aUIElement.m_bFloating )
3384 {
3385 uno::Reference< awt::XWindow2 > xWindow2( xWindow, uno::UNO_QUERY );
3364throw( uno::RuntimeException )
3365{
3366 WriteGuard aWriteLock( m_aLock );
3367 bool bLocked( m_bDockingInProgress );
3368 bool bLayoutInProgress( m_bLayoutInProgress );
3369 aWriteLock.unlock();
3370
3371 // Do not do anything if we are in the middle of a docking process. This would interfere all other

--- 6 unchanged lines hidden (view full) ---

3378 uno::Reference< awt::XWindow > xWindow( aEvent.Source, uno::UNO_QUERY );
3379
3380 UIElement aUIElement = implts_findToolbar( aEvent.Source );
3381 if ( aUIElement.m_xUIElement.is() )
3382 {
3383 if ( aUIElement.m_bFloating )
3384 {
3385 uno::Reference< awt::XWindow2 > xWindow2( xWindow, uno::UNO_QUERY );
3386
3386
3387 if( xWindow2.is() )
3388 {
3389 awt::Rectangle aPos = xWindow2->getPosSize();
3387 if( xWindow2.is() )
3388 {
3389 awt::Rectangle aPos = xWindow2->getPosSize();
3390 awt::Size aSize = xWindow2->getOutputSize(); // always use output size for consistency
3390 awt::Size aSize = xWindow2->getOutputSize(); // always use output size for consistency
3391 bool bVisible = xWindow2->isVisible();
3391 bool bVisible = xWindow2->isVisible();
3392
3392
3393 // update element data
3394 aUIElement.m_aFloatingData.m_aPos = ::Point( aPos.X, aPos.Y );
3395 aUIElement.m_aFloatingData.m_aSize = ::Size( aSize.Width, aSize.Height );
3396 aUIElement.m_bVisible = bVisible;
3397 }
3393 // update element data
3394 aUIElement.m_aFloatingData.m_aPos = ::Point( aPos.X, aPos.Y );
3395 aUIElement.m_aFloatingData.m_aSize = ::Size( aSize.Width, aSize.Height );
3396 aUIElement.m_bVisible = bVisible;
3397 }
3398
3398
3399 implts_writeWindowStateData( aUIElement );
3400 }
3401 else
3402 {
3403 implts_setLayoutDirty();
3404 bNotify = true;
3405 }
3406 }
3407
3408 if ( bNotify )
3409 m_pParentLayouter->requestLayout( ILayoutNotifications::HINT_TOOLBARSPACE_HAS_CHANGED );
3410 }
3411}
3412
3399 implts_writeWindowStateData( aUIElement );
3400 }
3401 else
3402 {
3403 implts_setLayoutDirty();
3404 bNotify = true;
3405 }
3406 }
3407
3408 if ( bNotify )
3409 m_pParentLayouter->requestLayout( ILayoutNotifications::HINT_TOOLBARSPACE_HAS_CHANGED );
3410 }
3411}
3412
3413void SAL_CALL ToolbarLayoutManager::windowMoved( const awt::WindowEvent& /*aEvent*/ )
3413void SAL_CALL ToolbarLayoutManager::windowMoved( const awt::WindowEvent& /*aEvent*/ )
3414throw( uno::RuntimeException )
3415{
3416}
3417
3414throw( uno::RuntimeException )
3415{
3416}
3417
3418void SAL_CALL ToolbarLayoutManager::windowShown( const lang::EventObject& /*aEvent*/ )
3418void SAL_CALL ToolbarLayoutManager::windowShown( const lang::EventObject& /*aEvent*/ )
3419throw( uno::RuntimeException )
3420{
3421}
3422
3419throw( uno::RuntimeException )
3420{
3421}
3422
3423void SAL_CALL ToolbarLayoutManager::windowHidden( const lang::EventObject& /*aEvent*/ )
3423void SAL_CALL ToolbarLayoutManager::windowHidden( const lang::EventObject& /*aEvent*/ )
3424throw( uno::RuntimeException )
3425{
3426}
3427
3428//---------------------------------------------------------------------------------------------------------
3429// XDockableWindowListener
3430//---------------------------------------------------------------------------------------------------------
3424throw( uno::RuntimeException )
3425{
3426}
3427
3428//---------------------------------------------------------------------------------------------------------
3429// XDockableWindowListener
3430//---------------------------------------------------------------------------------------------------------
3431void SAL_CALL ToolbarLayoutManager::startDocking( const awt::DockingEvent& e )
3431void SAL_CALL ToolbarLayoutManager::startDocking( const awt::DockingEvent& e )
3432throw (uno::RuntimeException)
3433{
3434 bool bWinFound( false );
3435
3436 ReadGuard aReadGuard( m_aLock );
3437 uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow );
3438 uno::Reference< awt::XWindow2 > xWindow( e.Source, uno::UNO_QUERY );
3439 aReadGuard.unlock();

--- 7 unchanged lines hidden (view full) ---

3447 aMousePos = pContainerWindow->ScreenToOutputPixel( ::Point( e.MousePos.X, e.MousePos.Y ));
3448 }
3449
3450 UIElement aUIElement = implts_findToolbar( e.Source );
3451
3452 if ( aUIElement.m_xUIElement.is() && xWindow.is() )
3453 {
3454 awt::Rectangle aRect;
3432throw (uno::RuntimeException)
3433{
3434 bool bWinFound( false );
3435
3436 ReadGuard aReadGuard( m_aLock );
3437 uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow );
3438 uno::Reference< awt::XWindow2 > xWindow( e.Source, uno::UNO_QUERY );
3439 aReadGuard.unlock();

--- 7 unchanged lines hidden (view full) ---

3447 aMousePos = pContainerWindow->ScreenToOutputPixel( ::Point( e.MousePos.X, e.MousePos.Y ));
3448 }
3449
3450 UIElement aUIElement = implts_findToolbar( e.Source );
3451
3452 if ( aUIElement.m_xUIElement.is() && xWindow.is() )
3453 {
3454 awt::Rectangle aRect;
3455
3455
3456 bWinFound = true;
3457 uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
3458 if ( xDockWindow->isFloating() )
3459 {
3460 awt::Rectangle aPos = xWindow->getPosSize();
3461 awt::Size aSize = xWindow->getOutputSize();
3462
3463 aUIElement.m_aFloatingData.m_aPos = ::Point( aPos.X, aPos.Y );

--- 13 unchanged lines hidden (view full) ---

3477 WriteGuard aWriteLock( m_aLock );
3478 m_bDockingInProgress = bWinFound;
3479 m_aDockUIElement = aUIElement;
3480 m_aDockUIElement.m_bUserActive = true;
3481 m_aStartDockMousePos = aMousePos;
3482 aWriteLock.unlock();
3483}
3484
3456 bWinFound = true;
3457 uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
3458 if ( xDockWindow->isFloating() )
3459 {
3460 awt::Rectangle aPos = xWindow->getPosSize();
3461 awt::Size aSize = xWindow->getOutputSize();
3462
3463 aUIElement.m_aFloatingData.m_aPos = ::Point( aPos.X, aPos.Y );

--- 13 unchanged lines hidden (view full) ---

3477 WriteGuard aWriteLock( m_aLock );
3478 m_bDockingInProgress = bWinFound;
3479 m_aDockUIElement = aUIElement;
3480 m_aDockUIElement.m_bUserActive = true;
3481 m_aStartDockMousePos = aMousePos;
3482 aWriteLock.unlock();
3483}
3484
3485awt::DockingData SAL_CALL ToolbarLayoutManager::docking( const awt::DockingEvent& e )
3485awt::DockingData SAL_CALL ToolbarLayoutManager::docking( const awt::DockingEvent& e )
3486throw (uno::RuntimeException)
3487{
3488 const sal_Int32 MAGNETIC_DISTANCE_UNDOCK = 25;
3489 const sal_Int32 MAGNETIC_DISTANCE_DOCK = 20;
3490
3491 ReadGuard aReadLock( m_aLock );
3492 awt::DockingData aDockingData;
3493 uno::Reference< awt::XDockableWindow > xDockWindow( e.Source, uno::UNO_QUERY );

--- 159 unchanged lines hidden (view full) ---

3653 aWriteLock.unlock();
3654 }
3655 catch ( uno::Exception& ) {}
3656 }
3657
3658 return aDockingData;
3659}
3660
3486throw (uno::RuntimeException)
3487{
3488 const sal_Int32 MAGNETIC_DISTANCE_UNDOCK = 25;
3489 const sal_Int32 MAGNETIC_DISTANCE_DOCK = 20;
3490
3491 ReadGuard aReadLock( m_aLock );
3492 awt::DockingData aDockingData;
3493 uno::Reference< awt::XDockableWindow > xDockWindow( e.Source, uno::UNO_QUERY );

--- 159 unchanged lines hidden (view full) ---

3653 aWriteLock.unlock();
3654 }
3655 catch ( uno::Exception& ) {}
3656 }
3657
3658 return aDockingData;
3659}
3660
3661void SAL_CALL ToolbarLayoutManager::endDocking( const awt::EndDockingEvent& e )
3661void SAL_CALL ToolbarLayoutManager::endDocking( const awt::EndDockingEvent& e )
3662throw (uno::RuntimeException)
3663{
3664 bool bDockingInProgress( false );
3665 bool bStartDockFloated( false );
3666 bool bFloating( false );
3667 UIElement aUIDockingElement;
3668
3669 /* SAFE AREA ----------------------------------------------------------------------------------------------- */

--- 68 unchanged lines hidden (view full) ---

3738
3739 // Lock layouting updates as our listener would be called due to SetSizePixel
3740 pToolBox->SetOutputSizePixel( aSize );
3741 }
3742 }
3743 }
3744
3745 implts_sortUIElements();
3662throw (uno::RuntimeException)
3663{
3664 bool bDockingInProgress( false );
3665 bool bStartDockFloated( false );
3666 bool bFloating( false );
3667 UIElement aUIDockingElement;
3668
3669 /* SAFE AREA ----------------------------------------------------------------------------------------------- */

--- 68 unchanged lines hidden (view full) ---

3738
3739 // Lock layouting updates as our listener would be called due to SetSizePixel
3740 pToolBox->SetOutputSizePixel( aSize );
3741 }
3742 }
3743 }
3744
3745 implts_sortUIElements();
3746
3746
3747 aWriteLock.lock();
3748 m_bDockingInProgress = sal_False;
3749 m_bLayoutDirty = !bStartDockFloated || !bFloating;
3750 bool bNotify = m_bLayoutDirty;
3751 aWriteLock.unlock();
3752
3753 if ( bNotify )
3754 m_pParentLayouter->requestLayout( ILayoutNotifications::HINT_TOOLBARSPACE_HAS_CHANGED );
3755}
3756
3747 aWriteLock.lock();
3748 m_bDockingInProgress = sal_False;
3749 m_bLayoutDirty = !bStartDockFloated || !bFloating;
3750 bool bNotify = m_bLayoutDirty;
3751 aWriteLock.unlock();
3752
3753 if ( bNotify )
3754 m_pParentLayouter->requestLayout( ILayoutNotifications::HINT_TOOLBARSPACE_HAS_CHANGED );
3755}
3756
3757sal_Bool SAL_CALL ToolbarLayoutManager::prepareToggleFloatingMode( const lang::EventObject& e )
3757sal_Bool SAL_CALL ToolbarLayoutManager::prepareToggleFloatingMode( const lang::EventObject& e )
3758throw (uno::RuntimeException)
3759{
3760 ReadGuard aReadLock( m_aLock );
3761 bool bDockingInProgress = m_bDockingInProgress;
3762 aReadLock.unlock();
3763
3764 UIElement aUIDockingElement = implts_findToolbar( e.Source );
3765 bool bWinFound( aUIDockingElement.m_aName.getLength() > 0 );

--- 25 unchanged lines hidden (view full) ---

3791 implts_setToolbar( aUIDockingElement );
3792 }
3793 }
3794 }
3795
3796 return sal_True;
3797}
3798
3758throw (uno::RuntimeException)
3759{
3760 ReadGuard aReadLock( m_aLock );
3761 bool bDockingInProgress = m_bDockingInProgress;
3762 aReadLock.unlock();
3763
3764 UIElement aUIDockingElement = implts_findToolbar( e.Source );
3765 bool bWinFound( aUIDockingElement.m_aName.getLength() > 0 );

--- 25 unchanged lines hidden (view full) ---

3791 implts_setToolbar( aUIDockingElement );
3792 }
3793 }
3794 }
3795
3796 return sal_True;
3797}
3798
3799void SAL_CALL ToolbarLayoutManager::toggleFloatingMode( const lang::EventObject& e )
3799void SAL_CALL ToolbarLayoutManager::toggleFloatingMode( const lang::EventObject& e )
3800throw (uno::RuntimeException)
3801{
3802 UIElement aUIDockingElement;
3803
3804 ReadGuard aReadLock( m_aLock );
3805 bool bDockingInProgress( m_bDockingInProgress );
3806 if ( bDockingInProgress )
3807 aUIDockingElement = m_aDockUIElement;

--- 11 unchanged lines hidden (view full) ---

3819 if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX )
3820 pToolBox = (ToolBox *)pWindow;
3821 }
3822
3823 if ( !bDockingInProgress )
3824 {
3825 aUIDockingElement = implts_findToolbar( e.Source );
3826 bool bWinFound = ( aUIDockingElement.m_aName.getLength() > 0 );
3800throw (uno::RuntimeException)
3801{
3802 UIElement aUIDockingElement;
3803
3804 ReadGuard aReadLock( m_aLock );
3805 bool bDockingInProgress( m_bDockingInProgress );
3806 if ( bDockingInProgress )
3807 aUIDockingElement = m_aDockUIElement;

--- 11 unchanged lines hidden (view full) ---

3819 if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX )
3820 pToolBox = (ToolBox *)pWindow;
3821 }
3822
3823 if ( !bDockingInProgress )
3824 {
3825 aUIDockingElement = implts_findToolbar( e.Source );
3826 bool bWinFound = ( aUIDockingElement.m_aName.getLength() > 0 );
3827
3827
3828 if ( bWinFound && xWindow.is() )
3829 {
3830 aUIDockingElement.m_bFloating = !aUIDockingElement.m_bFloating;
3831 aUIDockingElement.m_bUserActive = true;
3832
3833 implts_setLayoutInProgress( true );
3834 if ( aUIDockingElement.m_bFloating )
3835 {

--- 59 unchanged lines hidden (view full) ---

3895 }
3896 }
3897
3898 implts_setLayoutInProgress( false );
3899 implts_setToolbar( aUIDockingElement );
3900 implts_writeWindowStateData( aUIDockingElement );
3901 implts_sortUIElements();
3902 implts_setLayoutDirty();
3828 if ( bWinFound && xWindow.is() )
3829 {
3830 aUIDockingElement.m_bFloating = !aUIDockingElement.m_bFloating;
3831 aUIDockingElement.m_bUserActive = true;
3832
3833 implts_setLayoutInProgress( true );
3834 if ( aUIDockingElement.m_bFloating )
3835 {

--- 59 unchanged lines hidden (view full) ---

3895 }
3896 }
3897
3898 implts_setLayoutInProgress( false );
3899 implts_setToolbar( aUIDockingElement );
3900 implts_writeWindowStateData( aUIDockingElement );
3901 implts_sortUIElements();
3902 implts_setLayoutDirty();
3903
3903
3904 aReadLock.lock();
3905 ILayoutNotifications* pParentLayouter( m_pParentLayouter );
3906 aReadLock.unlock();
3907
3908 if ( pParentLayouter )
3909 pParentLayouter->requestLayout( ILayoutNotifications::HINT_TOOLBARSPACE_HAS_CHANGED );
3910 }
3911 }

--- 10 unchanged lines hidden (view full) ---

3922 pToolBox->SetAlign( WINDOWALIGN_LEFT );
3923 }
3924 else
3925 pToolBox->SetAlign( ImplConvertAlignment( aUIDockingElement.m_aDockedData.m_nDockedArea) );
3926 }
3927 }
3928}
3929
3904 aReadLock.lock();
3905 ILayoutNotifications* pParentLayouter( m_pParentLayouter );
3906 aReadLock.unlock();
3907
3908 if ( pParentLayouter )
3909 pParentLayouter->requestLayout( ILayoutNotifications::HINT_TOOLBARSPACE_HAS_CHANGED );
3910 }
3911 }

--- 10 unchanged lines hidden (view full) ---

3922 pToolBox->SetAlign( WINDOWALIGN_LEFT );
3923 }
3924 else
3925 pToolBox->SetAlign( ImplConvertAlignment( aUIDockingElement.m_aDockedData.m_nDockedArea) );
3926 }
3927 }
3928}
3929
3930void SAL_CALL ToolbarLayoutManager::closed( const lang::EventObject& e )
3930void SAL_CALL ToolbarLayoutManager::closed( const lang::EventObject& e )
3931throw (uno::RuntimeException)
3932{
3933 rtl::OUString aName;
3934 UIElement aUIElement;
3935 UIElementVector::iterator pIter;
3936
3937 WriteGuard aWriteLock( m_aLock );
3938 for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
3939 {
3940 uno::Reference< ui::XUIElement > xUIElement( pIter->m_xUIElement );
3941 if ( xUIElement.is() )
3942 {
3943 uno::Reference< uno::XInterface > xIfac( xUIElement->getRealInterface(), uno::UNO_QUERY );
3944 if ( xIfac == e.Source )
3945 {
3946 aName = pIter->m_aName;
3947
3948 // user closes a toolbar =>
3949 // context sensitive toolbar: only destroy toolbar and store state.
3931throw (uno::RuntimeException)
3932{
3933 rtl::OUString aName;
3934 UIElement aUIElement;
3935 UIElementVector::iterator pIter;
3936
3937 WriteGuard aWriteLock( m_aLock );
3938 for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
3939 {
3940 uno::Reference< ui::XUIElement > xUIElement( pIter->m_xUIElement );
3941 if ( xUIElement.is() )
3942 {
3943 uno::Reference< uno::XInterface > xIfac( xUIElement->getRealInterface(), uno::UNO_QUERY );
3944 if ( xIfac == e.Source )
3945 {
3946 aName = pIter->m_aName;
3947
3948 // user closes a toolbar =>
3949 // context sensitive toolbar: only destroy toolbar and store state.
3950 // context sensitive toolbar: make it invisible, store state and destroy it.
3950 // non-context sensitive toolbar: make it invisible, store state and destroy it.
3951 if ( !pIter->m_bContextSensitive )
3952 pIter->m_bVisible = sal_False;
3953
3954 aUIElement = *pIter;
3955 break;
3956 }
3957 }
3958 }
3959 aWriteLock.unlock();
3960
3961 // destroy element
3962 if ( aName.getLength() > 0 )
3963 {
3964 implts_writeWindowStateData( aUIElement );
3965 destroyToolbar( aName );
3966 }
3967}
3968
3951 if ( !pIter->m_bContextSensitive )
3952 pIter->m_bVisible = sal_False;
3953
3954 aUIElement = *pIter;
3955 break;
3956 }
3957 }
3958 }
3959 aWriteLock.unlock();
3960
3961 // destroy element
3962 if ( aName.getLength() > 0 )
3963 {
3964 implts_writeWindowStateData( aUIElement );
3965 destroyToolbar( aName );
3966 }
3967}
3968
3969void SAL_CALL ToolbarLayoutManager::endPopupMode( const awt::EndPopupModeEvent& /*e*/ )
3969void SAL_CALL ToolbarLayoutManager::endPopupMode( const awt::EndPopupModeEvent& /*e*/ )
3970throw (uno::RuntimeException)
3971{
3972}
3973
3974//---------------------------------------------------------------------------------------------------------
3975// XUIConfigurationListener
3976//---------------------------------------------------------------------------------------------------------
3970throw (uno::RuntimeException)
3971{
3972}
3973
3974//---------------------------------------------------------------------------------------------------------
3975// XUIConfigurationListener
3976//---------------------------------------------------------------------------------------------------------
3977void SAL_CALL ToolbarLayoutManager::elementInserted( const ui::ConfigurationEvent& rEvent )
3977void SAL_CALL ToolbarLayoutManager::elementInserted( const ui::ConfigurationEvent& rEvent )
3978throw (uno::RuntimeException)
3979{
3980 UIElement aUIElement = implts_findToolbar( rEvent.ResourceURL );
3981
3982 uno::Reference< ui::XUIElementSettings > xElementSettings( aUIElement.m_xUIElement, uno::UNO_QUERY );
3983 if ( xElementSettings.is() )
3984 {
3985 ::rtl::OUString aConfigSourcePropName( RTL_CONSTASCII_USTRINGPARAM( "ConfigurationSource" ));

--- 31 unchanged lines hidden (view full) ---

4017 }
4018 catch ( container::NoSuchElementException& ) {}
4019 catch ( beans::UnknownPropertyException& ) {}
4020 catch ( lang::WrappedTargetException& ) {}
4021
4022 {
4023 vos::OGuard aGuard( Application::GetSolarMutex() );
4024 Window* pWindow = getWindowFromXUIElement( xUIElement );
3978throw (uno::RuntimeException)
3979{
3980 UIElement aUIElement = implts_findToolbar( rEvent.ResourceURL );
3981
3982 uno::Reference< ui::XUIElementSettings > xElementSettings( aUIElement.m_xUIElement, uno::UNO_QUERY );
3983 if ( xElementSettings.is() )
3984 {
3985 ::rtl::OUString aConfigSourcePropName( RTL_CONSTASCII_USTRINGPARAM( "ConfigurationSource" ));

--- 31 unchanged lines hidden (view full) ---

4017 }
4018 catch ( container::NoSuchElementException& ) {}
4019 catch ( beans::UnknownPropertyException& ) {}
4020 catch ( lang::WrappedTargetException& ) {}
4021
4022 {
4023 vos::OGuard aGuard( Application::GetSolarMutex() );
4024 Window* pWindow = getWindowFromXUIElement( xUIElement );
4025 if ( pWindow )
4025 if ( pWindow )
4026 pWindow->SetText( aUIName );
4027 }
4028
4029 showToolbar( rEvent.ResourceURL );
4030 }
4031 }
4032 }
4033}
4034
4026 pWindow->SetText( aUIName );
4027 }
4028
4029 showToolbar( rEvent.ResourceURL );
4030 }
4031 }
4032 }
4033}
4034
4035void SAL_CALL ToolbarLayoutManager::elementRemoved( const ui::ConfigurationEvent& rEvent )
4035void SAL_CALL ToolbarLayoutManager::elementRemoved( const ui::ConfigurationEvent& rEvent )
4036throw (uno::RuntimeException)
4037{
4038 ReadGuard aReadLock( m_aLock );
4039 uno::Reference< awt::XWindow > xContainerWindow( m_xContainerWindow, uno::UNO_QUERY );
4040 uno::Reference< ui::XUIConfigurationManager > xModuleCfgMgr( m_xModuleCfgMgr );
4041 uno::Reference< ui::XUIConfigurationManager > xDocCfgMgr( m_xDocCfgMgr );
4042 aReadLock.unlock();
4036throw (uno::RuntimeException)
4037{
4038 ReadGuard aReadLock( m_aLock );
4039 uno::Reference< awt::XWindow > xContainerWindow( m_xContainerWindow, uno::UNO_QUERY );
4040 uno::Reference< ui::XUIConfigurationManager > xModuleCfgMgr( m_xModuleCfgMgr );
4041 uno::Reference< ui::XUIConfigurationManager > xDocCfgMgr( m_xDocCfgMgr );
4042 aReadLock.unlock();
4043
4043
4044 UIElement aUIElement = implts_findToolbar( rEvent.ResourceURL );
4045 uno::Reference< ui::XUIElementSettings > xElementSettings( aUIElement.m_xUIElement, uno::UNO_QUERY );
4046 if ( xElementSettings.is() )
4047 {
4048 bool bNoSettings( false );
4049 ::rtl::OUString aConfigSourcePropName( RTL_CONSTASCII_USTRINGPARAM( "ConfigurationSource" ));
4050 uno::Reference< uno::XInterface > xElementCfgMgr;
4051 uno::Reference< beans::XPropertySet > xPropSet( xElementSettings, uno::UNO_QUERY );

--- 23 unchanged lines hidden (view full) ---

4075 }
4076
4077 // No settings anymore, element must be destroyed
4078 if ( xContainerWindow.is() && bNoSettings )
4079 destroyToolbar( rEvent.ResourceURL );
4080 }
4081}
4082
4044 UIElement aUIElement = implts_findToolbar( rEvent.ResourceURL );
4045 uno::Reference< ui::XUIElementSettings > xElementSettings( aUIElement.m_xUIElement, uno::UNO_QUERY );
4046 if ( xElementSettings.is() )
4047 {
4048 bool bNoSettings( false );
4049 ::rtl::OUString aConfigSourcePropName( RTL_CONSTASCII_USTRINGPARAM( "ConfigurationSource" ));
4050 uno::Reference< uno::XInterface > xElementCfgMgr;
4051 uno::Reference< beans::XPropertySet > xPropSet( xElementSettings, uno::UNO_QUERY );

--- 23 unchanged lines hidden (view full) ---

4075 }
4076
4077 // No settings anymore, element must be destroyed
4078 if ( xContainerWindow.is() && bNoSettings )
4079 destroyToolbar( rEvent.ResourceURL );
4080 }
4081}
4082
4083void SAL_CALL ToolbarLayoutManager::elementReplaced( const ui::ConfigurationEvent& rEvent )
4083void SAL_CALL ToolbarLayoutManager::elementReplaced( const ui::ConfigurationEvent& rEvent )
4084throw (uno::RuntimeException)
4085{
4086 UIElement aUIElement = implts_findToolbar( rEvent.ResourceURL );
4087
4088 uno::Reference< ui::XUIElementSettings > xElementSettings( aUIElement.m_xUIElement, uno::UNO_QUERY );
4089 if ( xElementSettings.is() )
4090 {
4091 ::rtl::OUString aConfigSourcePropName( RTL_CONSTASCII_USTRINGPARAM( "ConfigurationSource" ));

--- 5 unchanged lines hidden (view full) ---

4097
4098 if ( !xElementCfgMgr.is() )
4099 return;
4100
4101 // Check if the same UI configuration manager has changed => update settings
4102 if ( rEvent.Source == xElementCfgMgr )
4103 {
4104 xElementSettings->updateSettings();
4084throw (uno::RuntimeException)
4085{
4086 UIElement aUIElement = implts_findToolbar( rEvent.ResourceURL );
4087
4088 uno::Reference< ui::XUIElementSettings > xElementSettings( aUIElement.m_xUIElement, uno::UNO_QUERY );
4089 if ( xElementSettings.is() )
4090 {
4091 ::rtl::OUString aConfigSourcePropName( RTL_CONSTASCII_USTRINGPARAM( "ConfigurationSource" ));

--- 5 unchanged lines hidden (view full) ---

4097
4098 if ( !xElementCfgMgr.is() )
4099 return;
4100
4101 // Check if the same UI configuration manager has changed => update settings
4102 if ( rEvent.Source == xElementCfgMgr )
4103 {
4104 xElementSettings->updateSettings();
4105
4105
4106 WriteGuard aWriteLock( m_aLock );
4107 bool bNotify = !aUIElement.m_bFloating;
4108 m_bLayoutDirty = bNotify;
4109 ILayoutNotifications* pParentLayouter( m_pParentLayouter );
4110 aWriteLock.unlock();
4111
4112 if ( bNotify && pParentLayouter )
4113 pParentLayouter->requestLayout( ILayoutNotifications::HINT_TOOLBARSPACE_HAS_CHANGED );

--- 4 unchanged lines hidden (view full) ---

4118uno::Reference< ui::XUIElement > ToolbarLayoutManager::getToolbar( const ::rtl::OUString& aName )
4119{
4120 return implts_findToolbar( aName ).m_xUIElement;
4121}
4122
4123uno::Sequence< uno::Reference< ui::XUIElement > > ToolbarLayoutManager::getToolbars()
4124{
4125 uno::Sequence< uno::Reference< ui::XUIElement > > aSeq;
4106 WriteGuard aWriteLock( m_aLock );
4107 bool bNotify = !aUIElement.m_bFloating;
4108 m_bLayoutDirty = bNotify;
4109 ILayoutNotifications* pParentLayouter( m_pParentLayouter );
4110 aWriteLock.unlock();
4111
4112 if ( bNotify && pParentLayouter )
4113 pParentLayouter->requestLayout( ILayoutNotifications::HINT_TOOLBARSPACE_HAS_CHANGED );

--- 4 unchanged lines hidden (view full) ---

4118uno::Reference< ui::XUIElement > ToolbarLayoutManager::getToolbar( const ::rtl::OUString& aName )
4119{
4120 return implts_findToolbar( aName ).m_xUIElement;
4121}
4122
4123uno::Sequence< uno::Reference< ui::XUIElement > > ToolbarLayoutManager::getToolbars()
4124{
4125 uno::Sequence< uno::Reference< ui::XUIElement > > aSeq;
4126
4126
4127 ReadGuard aReadLock( m_aLock );
4128 if ( m_aUIElements.size() > 0 )
4129 {
4130 sal_uInt32 nCount(0);
4131 UIElementVector::iterator pIter;
4132 for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
4133 {
4134 if ( pIter->m_xUIElement.is() )

--- 18 unchanged lines hidden (view full) ---

4153 uno::Reference< awt::XDockableWindow > xDockWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
4154 if ( xDockWindow.is() && !xDockWindow->isFloating() )
4155 {
4156 aUIElement.m_bFloating = true;
4157 implts_writeWindowStateData( aUIElement );
4158 xDockWindow->setFloatingMode( true );
4159
4160 implts_setLayoutDirty();
4127 ReadGuard aReadLock( m_aLock );
4128 if ( m_aUIElements.size() > 0 )
4129 {
4130 sal_uInt32 nCount(0);
4131 UIElementVector::iterator pIter;
4132 for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
4133 {
4134 if ( pIter->m_xUIElement.is() )

--- 18 unchanged lines hidden (view full) ---

4153 uno::Reference< awt::XDockableWindow > xDockWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
4154 if ( xDockWindow.is() && !xDockWindow->isFloating() )
4155 {
4156 aUIElement.m_bFloating = true;
4157 implts_writeWindowStateData( aUIElement );
4158 xDockWindow->setFloatingMode( true );
4159
4160 implts_setLayoutDirty();
4161 implts_setToolbar( aUIElement );
4161 implts_setToolbar( aUIElement );
4162 return true;
4163 }
4164 }
4165 catch ( lang::DisposedException& ) {}
4166 }
4167
4168 return false;
4169}

--- 8 unchanged lines hidden (view full) ---

4178 uno::Reference< awt::XDockableWindow > xDockWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
4179 if ( xDockWindow.is() && !xDockWindow->isFloating() && !xDockWindow->isLocked() )
4180 {
4181 aUIElement.m_aDockedData.m_bLocked = true;
4182 implts_writeWindowStateData( aUIElement );
4183 xDockWindow->lock();
4184
4185 implts_setLayoutDirty();
4162 return true;
4163 }
4164 }
4165 catch ( lang::DisposedException& ) {}
4166 }
4167
4168 return false;
4169}

--- 8 unchanged lines hidden (view full) ---

4178 uno::Reference< awt::XDockableWindow > xDockWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
4179 if ( xDockWindow.is() && !xDockWindow->isFloating() && !xDockWindow->isLocked() )
4180 {
4181 aUIElement.m_aDockedData.m_bLocked = true;
4182 implts_writeWindowStateData( aUIElement );
4183 xDockWindow->lock();
4184
4185 implts_setLayoutDirty();
4186 implts_setToolbar( aUIElement );
4186 implts_setToolbar( aUIElement );
4187 return true;
4188 }
4189 }
4190 catch ( lang::DisposedException& ) {}
4191 }
4192
4193 return false;
4194}

--- 8 unchanged lines hidden (view full) ---

4203 uno::Reference< awt::XDockableWindow > xDockWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
4204 if ( xDockWindow.is() && !xDockWindow->isFloating() && xDockWindow->isLocked() )
4205 {
4206 aUIElement.m_aDockedData.m_bLocked = false;
4207 implts_writeWindowStateData( aUIElement );
4208 xDockWindow->unlock();
4209
4210 implts_setLayoutDirty();
4187 return true;
4188 }
4189 }
4190 catch ( lang::DisposedException& ) {}
4191 }
4192
4193 return false;
4194}

--- 8 unchanged lines hidden (view full) ---

4203 uno::Reference< awt::XDockableWindow > xDockWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
4204 if ( xDockWindow.is() && !xDockWindow->isFloating() && xDockWindow->isLocked() )
4205 {
4206 aUIElement.m_aDockedData.m_bLocked = false;
4207 implts_writeWindowStateData( aUIElement );
4208 xDockWindow->unlock();
4209
4210 implts_setLayoutDirty();
4211 implts_setToolbar( aUIElement );
4211 implts_setToolbar( aUIElement );
4212 return true;
4213 }
4214 }
4215 catch ( lang::DisposedException& ) {}
4216 }
4217
4218 return false;
4219}

--- 8 unchanged lines hidden (view full) ---

4228{
4229 uno::Reference< awt::XDockableWindow > xDockWindow( implts_getXWindow( rResourceURL ), uno::UNO_QUERY );
4230 return ( xDockWindow.is() && xDockWindow->isFloating() );
4231}
4232
4233bool ToolbarLayoutManager::isToolbarDocked( const ::rtl::OUString& rResourceURL )
4234{
4235 return !isToolbarFloating( rResourceURL );
4212 return true;
4213 }
4214 }
4215 catch ( lang::DisposedException& ) {}
4216 }
4217
4218 return false;
4219}

--- 8 unchanged lines hidden (view full) ---

4228{
4229 uno::Reference< awt::XDockableWindow > xDockWindow( implts_getXWindow( rResourceURL ), uno::UNO_QUERY );
4230 return ( xDockWindow.is() && xDockWindow->isFloating() );
4231}
4232
4233bool ToolbarLayoutManager::isToolbarDocked( const ::rtl::OUString& rResourceURL )
4234{
4235 return !isToolbarFloating( rResourceURL );
4236}
4236}
4237
4238bool ToolbarLayoutManager::isToolbarLocked( const ::rtl::OUString& rResourceURL )
4239{
4240 uno::Reference< awt::XDockableWindow > xDockWindow( implts_getXWindow( rResourceURL ), uno::UNO_QUERY );
4241 return ( xDockWindow.is() && xDockWindow->isLocked() );
4242}
4243
4244awt::Size ToolbarLayoutManager::getToolbarSize( const ::rtl::OUString& rResourceURL )
4245{
4246 Window* pWindow = implts_getWindow( rResourceURL );
4237
4238bool ToolbarLayoutManager::isToolbarLocked( const ::rtl::OUString& rResourceURL )
4239{
4240 uno::Reference< awt::XDockableWindow > xDockWindow( implts_getXWindow( rResourceURL ), uno::UNO_QUERY );
4241 return ( xDockWindow.is() && xDockWindow->isLocked() );
4242}
4243
4244awt::Size ToolbarLayoutManager::getToolbarSize( const ::rtl::OUString& rResourceURL )
4245{
4246 Window* pWindow = implts_getWindow( rResourceURL );
4247
4247
4248 vos::OGuard aGuard( Application::GetSolarMutex() );
4249 if ( pWindow )
4250 {
4251 ::Size aSize = pWindow->GetSizePixel();
4252 awt::Size aWinSize;
4253 aWinSize.Width = aSize.Width();
4254 aWinSize.Height = aSize.Height();
4255 return aWinSize;
4256 }
4257
4258 return awt::Size();
4259}
4260
4261awt::Point ToolbarLayoutManager::getToolbarPos( const ::rtl::OUString& rResourceURL )
4262{
4263 awt::Point aPos;
4248 vos::OGuard aGuard( Application::GetSolarMutex() );
4249 if ( pWindow )
4250 {
4251 ::Size aSize = pWindow->GetSizePixel();
4252 awt::Size aWinSize;
4253 aWinSize.Width = aSize.Width();
4254 aWinSize.Height = aSize.Height();
4255 return aWinSize;
4256 }
4257
4258 return awt::Size();
4259}
4260
4261awt::Point ToolbarLayoutManager::getToolbarPos( const ::rtl::OUString& rResourceURL )
4262{
4263 awt::Point aPos;
4264 UIElement aUIElement = implts_findToolbar( rResourceURL );
4265
4264 UIElement aUIElement = implts_findToolbar( rResourceURL );
4265
4266 uno::Reference< awt::XWindow > xWindow( implts_getXWindow( rResourceURL ));
4267 if ( xWindow.is() )
4268 {
4269 if ( aUIElement.m_bFloating )
4270 {
4271 awt::Rectangle aRect = xWindow->getPosSize();
4272 aPos.X = aRect.X;
4273 aPos.Y = aRect.Y;
4274 }
4275 else
4276 {
4277 ::Point aVirtualPos = aUIElement.m_aDockedData.m_aPos;
4278 aPos.X = aVirtualPos.X();
4279 aPos.Y = aVirtualPos.Y();
4280 }
4281 }
4266 uno::Reference< awt::XWindow > xWindow( implts_getXWindow( rResourceURL ));
4267 if ( xWindow.is() )
4268 {
4269 if ( aUIElement.m_bFloating )
4270 {
4271 awt::Rectangle aRect = xWindow->getPosSize();
4272 aPos.X = aRect.X;
4273 aPos.Y = aRect.Y;
4274 }
4275 else
4276 {
4277 ::Point aVirtualPos = aUIElement.m_aDockedData.m_aPos;
4278 aPos.X = aVirtualPos.X();
4279 aPos.Y = aVirtualPos.Y();
4280 }
4281 }
4282
4282
4283 return aPos;
4284}
4285
4286void ToolbarLayoutManager::setToolbarSize( const ::rtl::OUString& rResourceURL, const awt::Size& aSize )
4287{
4288 uno::Reference< awt::XWindow2 > xWindow( implts_getXWindow( rResourceURL ), uno::UNO_QUERY );
4289 uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
4290 UIElement aUIElement = implts_findToolbar( rResourceURL );
4283 return aPos;
4284}
4285
4286void ToolbarLayoutManager::setToolbarSize( const ::rtl::OUString& rResourceURL, const awt::Size& aSize )
4287{
4288 uno::Reference< awt::XWindow2 > xWindow( implts_getXWindow( rResourceURL ), uno::UNO_QUERY );
4289 uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
4290 UIElement aUIElement = implts_findToolbar( rResourceURL );
4291
4291
4292 if ( xWindow.is() && xDockWindow.is() && xDockWindow->isFloating() )
4293 {
4294 xWindow->setOutputSize( aSize );
4295 aUIElement.m_aFloatingData.m_aSize = ::Size( aSize.Width, aSize.Height );
4296 implts_setToolbar( aUIElement );
4297 implts_writeWindowStateData( aUIElement );
4298 implts_sortUIElements();
4299 }
4300}
4301
4302void ToolbarLayoutManager::setToolbarPos( const ::rtl::OUString& rResourceURL, const awt::Point& aPos )
4303{
4304 uno::Reference< awt::XWindow > xWindow( implts_getXWindow( rResourceURL ));
4305 uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
4306 UIElement aUIElement = implts_findToolbar( rResourceURL );
4292 if ( xWindow.is() && xDockWindow.is() && xDockWindow->isFloating() )
4293 {
4294 xWindow->setOutputSize( aSize );
4295 aUIElement.m_aFloatingData.m_aSize = ::Size( aSize.Width, aSize.Height );
4296 implts_setToolbar( aUIElement );
4297 implts_writeWindowStateData( aUIElement );
4298 implts_sortUIElements();
4299 }
4300}
4301
4302void ToolbarLayoutManager::setToolbarPos( const ::rtl::OUString& rResourceURL, const awt::Point& aPos )
4303{
4304 uno::Reference< awt::XWindow > xWindow( implts_getXWindow( rResourceURL ));
4305 uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
4306 UIElement aUIElement = implts_findToolbar( rResourceURL );
4307
4307
4308 if ( xWindow.is() && xDockWindow.is() && xDockWindow->isFloating() )
4309 {
4310 xWindow->setPosSize( aPos.X, aPos.Y, 0, 0, awt::PosSize::POS );
4311 aUIElement.m_aFloatingData.m_aPos = ::Point( aPos.X, aPos.Y );
4312 implts_setToolbar( aUIElement );
4313 implts_writeWindowStateData( aUIElement );
4314 implts_sortUIElements();
4315 }
4316}
4317
4318void ToolbarLayoutManager::setToolbarPosSize( const ::rtl::OUString& rResourceURL, const awt::Point& aPos, const awt::Size& aSize )
4319{
4320 setToolbarPos( rResourceURL, aPos );
4321 setToolbarSize( rResourceURL, aSize );
4322}
4323
4324} // namespace framework
4308 if ( xWindow.is() && xDockWindow.is() && xDockWindow->isFloating() )
4309 {
4310 xWindow->setPosSize( aPos.X, aPos.Y, 0, 0, awt::PosSize::POS );
4311 aUIElement.m_aFloatingData.m_aPos = ::Point( aPos.X, aPos.Y );
4312 implts_setToolbar( aUIElement );
4313 implts_writeWindowStateData( aUIElement );
4314 implts_sortUIElements();
4315 }
4316}
4317
4318void ToolbarLayoutManager::setToolbarPosSize( const ::rtl::OUString& rResourceURL, const awt::Point& aPos, const awt::Size& aSize )
4319{
4320 setToolbarPos( rResourceURL, aPos );
4321 setToolbarSize( rResourceURL, aSize );
4322}
4323
4324} // namespace framework
4325