1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  *   Licensed to the Apache Software Foundation (ASF) under one or more
12  *   contributor license agreements. See the NOTICE file distributed
13  *   with this work for additional information regarding copyright
14  *   ownership. The ASF licenses this file to you under the Apache
15  *   License, Version 2.0 (the "License"); you may not use this file
16  *   except in compliance with the License. You may obtain a copy of
17  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_FRAMEWORK_SOURCE_LAYOUTMANAGER_HELPERS_HXX
21 #define INCLUDED_FRAMEWORK_SOURCE_LAYOUTMANAGER_HELPERS_HXX
22 
23 #include <com/sun/star/awt/XWindowPeer.hpp>
24 #include <com/sun/star/uno/XComponentContext.hpp>
25 #include <com/sun/star/frame/XFrame.hpp>
26 #include <com/sun/star/ui/XUIElement.hpp>
27 #include <com/sun/star/awt/Rectangle.hpp>
28 #include <com/sun/star/ui/DockingArea.hpp>
29 #include <com/sun/star/awt/Point.hpp>
30 
31 #include <vcl/window.hxx>
32 #include <vcl/toolbox.hxx>
33 
34 #define UIRESOURCE_URL                  "private:resource"
35 #define UIRESOURCETYPE_TOOLBAR          "toolbar"
36 #define UIRESOURCETYPE_MENUBAR          "menubar"
37 
38 namespace framework
39 {
40 
41 bool hasEmptySize( const css::awt::Size& rSize );
42 bool hasDefaultPosValue( const css::awt::Point& rPos );
43 bool isDefaultPos( const css::awt::Point& rPos );
44 bool isToolboxHorizontalAligned( ToolBox const * pToolBox );
45 bool isReverseOrderDockingArea( const sal_Int32 nDockArea );
46 bool isHorizontalDockingArea( const sal_Int32 nDockArea );
47 bool isHorizontalDockingArea( const css::ui::DockingArea& nDockArea );
48 OUString retrieveToolbarNameFromHelpURL( vcl::Window* pWindow );
49 ToolBox* getToolboxPtr( vcl::Window* pWindow );
50 vcl::Window* getWindowFromXUIElement( const css::uno::Reference< css::ui::XUIElement >& xUIElement );
51 SystemWindow* getTopSystemWindow( const css::uno::Reference< css::awt::XWindow >& xWindow );
52 bool equalRectangles( const css::awt::Rectangle& rRect1, const css::awt::Rectangle& rRect2 );
53 void setZeroRectangle( ::tools::Rectangle& rRect );
54 bool lcl_checkUIElement(const css::uno::Reference< css::ui::XUIElement >& xUIElement,css::awt::Rectangle& _rPosSize, css::uno::Reference< css::awt::XWindow >& _xWindow);
55 css::uno::Reference< css::awt::XWindowPeer > createToolkitWindow( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::awt::XWindowPeer >& rParent, const char* pService );
56 WindowAlign ImplConvertAlignment( css::ui::DockingArea aAlignment );
57 OUString getElementTypeFromResourceURL( const OUString& aResourceURL );
58 void parseResourceURL( const OUString& aResourceURL, OUString& aElementType, OUString& aElementName );
59 ::tools::Rectangle putAWTToRectangle( const css::awt::Rectangle& rRect );
60 css::awt::Rectangle putRectangleValueToAWT( const ::tools::Rectangle& rRect );
61 css::uno::Reference< css::frame::XModel > impl_getModelFromFrame( const css::uno::Reference< css::frame::XFrame >& rFrame );
62 bool implts_isPreviewModel( const css::uno::Reference< css::frame::XModel >& xModel );
63 bool implts_isFrameOrWindowTop( const css::uno::Reference< css::frame::XFrame >& xFrame );
64 void impl_setDockingWindowVisibility( const css::uno::Reference< css::uno::XComponentContext>& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, const OUString& rDockingWindowName, bool bVisible );
65 void impl_addWindowListeners( const css::uno::Reference< css::uno::XInterface >& xThis, const css::uno::Reference< css::ui::XUIElement >& xUIElement );
66 
67 }
68 
69 #endif // INCLUDED_FRAMEWORK_SOURCE_LAYOUTMANAGER_HELPERS_HXX
70 
71 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
72