1 /**************************************************************
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
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
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.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef __FRAMEWORK_LAYOUTMANAGER_HELPERS_HXX_
25 #define __FRAMEWORK_LAYOUTMANAGER_HELPERS_HXX_
26 
27 // my own includes
28 #include <macros/generic.hxx>
29 #include <stdtypes.h>
30 #include <properties.h>
31 
32 // interface includes
33 #include <com/sun/star/awt/XWindowPeer.hpp>
34 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
35 #include <com/sun/star/frame/XFrame.hpp>
36 #include <com/sun/star/ui/XUIElement.hpp>
37 #include <com/sun/star/awt/Rectangle.hpp>
38 #include <com/sun/star/ui/DockingArea.hpp>
39 #include <com/sun/star/awt/Point.hpp>
40 
41 // other includes
42 #include <vcl/window.hxx>
43 #include <vcl/toolbox.hxx>
44 
45 #define UIRESOURCE_PROTOCO_ASCII        "private:"
46 #define UIRESOURCE_RESOURCE_ASCII       "resource"
47 #define UIRESOURCE_URL_ASCII            "private:resource"
48 #define UIRESOURCE_URL                  rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( UIRESOURCE_URL_ASCII ))
49 #define UIRESOURCETYPE_TOOLBAR          "toolbar"
50 #define UIRESOURCETYPE_STATUSBAR        "statusbar"
51 #define UIRESOURCETYPE_MENUBAR          "menubar"
52 
53 namespace framework
54 {
55 
56 bool hasEmptySize( const:: Size& aSize );
57 bool hasDefaultPosValue( const ::Point& aPos );
58 bool isDefaultPos( const ::com::sun::star::awt::Point& aPos );
59 bool isDefaultPos( const ::Point& aPos );
60 bool isToolboxHorizontalAligned( ToolBox* pToolBox );
61 bool isReverseOrderDockingArea( const sal_Int32 nDockArea );
62 bool isHorizontalDockingArea( const sal_Int32 nDockArea );
63 bool isHorizontalDockingArea( const ::com::sun::star::ui::DockingArea& nDockArea );
64 ::rtl::OUString retrieveToolbarNameFromHelpURL( Window* pWindow );
65 ToolBox* getToolboxPtr( Window* pWindow );
66 Window* getWindowFromXUIElement( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& xUIElement );
67 SystemWindow* getTopSystemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& xWindow );
68 bool equalRectangles( const css::awt::Rectangle& rRect1, const css::awt::Rectangle& rRect2 );
69 void setZeroRectangle( ::Rectangle& rRect );
70 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);
71 ::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 );
72 WindowAlign ImplConvertAlignment( sal_Int16 aAlignment );
73 ::rtl::OUString getElementTypeFromResourceURL( const ::rtl::OUString& aResourceURL );
74 void parseResourceURL( const rtl::OUString& aResourceURL, rtl::OUString& aElementType, rtl::OUString& aElementName );
75 ::Rectangle putAWTToRectangle( const ::com::sun::star::awt::Rectangle& rRect );
76 ::com::sun::star::awt::Rectangle putRectangleValueToAWT( const ::Rectangle& rRect );
77 ::com::sun::star::awt::Rectangle convertRectangleToAWT( const ::Rectangle& rRect );
78 ::Rectangle convertAWTToRectangle( const ::com::sun::star::awt::Rectangle& rRect );
79 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > impl_getModelFromFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
80 sal_Bool implts_isPreviewModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
81 sal_Bool implts_isFrameOrWindowTop( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame );
82 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 );
83 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 );
84 ::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 );
85 
86 }
87 
88 #endif // __FRAMEWORK_LAYOUTMANAGER_HELPERS_HXX_
89