1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2008 by Sun Microsystems, Inc.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * $RCSfile: layoutmanager.hxx,v $
10  * $Revision: 1.34 $
11  *
12  * This file is part of OpenOffice.org.
13  *
14  * OpenOffice.org is free software: you can redistribute it and/or modify
15  * it under the terms of the GNU Lesser General Public License version 3
16  * only, as published by the Free Software Foundation.
17  *
18  * OpenOffice.org is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU Lesser General Public License version 3 for more details
22  * (a copy is included in the LICENSE file that accompanied this code).
23  *
24  * You should have received a copy of the GNU Lesser General Public License
25  * version 3 along with OpenOffice.org.  If not, see
26  * <http://www.openoffice.org/license.html>
27  * for a copy of the LGPLv3 License.
28  *
29  ************************************************************************/
30 
31 #ifndef __FRAMEWORK_LAYOUTMANAGER_HELPERS_HXX_
32 #define __FRAMEWORK_LAYOUTMANAGER_HELPERS_HXX_
33 
34 // my own includes
35 #include <macros/generic.hxx>
36 #include <stdtypes.h>
37 #include <properties.h>
38 
39 // interface includes
40 #include <com/sun/star/awt/XWindowPeer.hpp>
41 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
42 #include <com/sun/star/frame/XFrame.hpp>
43 #include <com/sun/star/ui/XUIElement.hpp>
44 #include <com/sun/star/awt/Rectangle.hpp>
45 #include <com/sun/star/ui/DockingArea.hpp>
46 #include <com/sun/star/awt/Point.hpp>
47 
48 // other includes
49 #include <vcl/window.hxx>
50 #include <vcl/toolbox.hxx>
51 
52 #define UIRESOURCE_PROTOCO_ASCII        "private:"
53 #define UIRESOURCE_RESOURCE_ASCII       "resource"
54 #define UIRESOURCE_URL_ASCII            "private:resource"
55 #define UIRESOURCE_URL                  rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( UIRESOURCE_URL_ASCII ))
56 #define UIRESOURCETYPE_TOOLBAR          "toolbar"
57 #define UIRESOURCETYPE_STATUSBAR        "statusbar"
58 #define UIRESOURCETYPE_MENUBAR          "menubar"
59 
60 namespace framework
61 {
62 
63 bool hasEmptySize( const:: Size& aSize );
64 bool hasDefaultPosValue( const ::Point& aPos );
65 bool isDefaultPos( const ::com::sun::star::awt::Point& aPos );
66 bool isDefaultPos( const ::Point& aPos );
67 bool isToolboxHorizontalAligned( ToolBox* pToolBox );
68 bool isReverseOrderDockingArea( const sal_Int32 nDockArea );
69 bool isHorizontalDockingArea( const sal_Int32 nDockArea );
70 bool isHorizontalDockingArea( const ::com::sun::star::ui::DockingArea& nDockArea );
71 ::rtl::OUString retrieveToolbarNameFromHelpURL( Window* pWindow );
72 ToolBox* getToolboxPtr( Window* pWindow );
73 Window* getWindowFromXUIElement( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& xUIElement );
74 SystemWindow* getTopSystemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& xWindow );
75 bool equalRectangles( const css::awt::Rectangle& rRect1, const css::awt::Rectangle& rRect2 );
76 void setZeroRectangle( ::Rectangle& rRect );
77 bool lcl_checkUIElement(const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& xUIElement,::com::sun::star::awt::Rectangle& _rPosSize, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xWindow);
78 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > createToolkitWindow( const css::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rFactory, const css::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rParent, const char* pService );
79 WindowAlign ImplConvertAlignment( sal_Int16 aAlignment );
80 ::rtl::OUString getElementTypeFromResourceURL( const ::rtl::OUString& aResourceURL );
81 void parseResourceURL( const rtl::OUString& aResourceURL, rtl::OUString& aElementType, rtl::OUString& aElementName );
82 ::Rectangle putAWTToRectangle( const ::com::sun::star::awt::Rectangle& rRect );
83 ::com::sun::star::awt::Rectangle putRectangleValueToAWT( const ::Rectangle& rRect );
84 ::com::sun::star::awt::Rectangle convertRectangleToAWT( const ::Rectangle& rRect );
85 ::Rectangle convertAWTToRectangle( const ::com::sun::star::awt::Rectangle& rRect );
86 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > impl_getModelFromFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
87 sal_Bool implts_isPreviewModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
88 sal_Bool implts_isFrameOrWindowTop( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame );
89 void impl_setDockingWindowVisibility( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& rSMGR, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& rDockingWindowName, bool bVisible );
90 void impl_addWindowListeners( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xThis, const ::com::sun::star::uno::Reference< css::ui::XUIElement >& xUIElement );
91 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > implts_createToolkitWindow( const css::uno::Reference< ::com::sun::star::awt::XToolkit >& rToolkit, const css::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rParent );
92 
93 }
94 
95 #endif // __FRAMEWORK_LAYOUTMANAGER_HELPERS_HXX_
96