/src/libreoffice/framework/source/layoutmanager/uielement.cxx
Line | Count | Source (jump to first uncovered line) |
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 | | #include <uielement/uielement.hxx> |
21 | | |
22 | | #include <com/sun/star/ui/DockingArea.hpp> |
23 | | |
24 | | using namespace ::com::sun::star; |
25 | | |
26 | | namespace framework |
27 | | { |
28 | | |
29 | | bool UIElement::operator< ( const ::framework::UIElement& aUIElement ) const |
30 | 0 | { |
31 | 0 | if ( !m_xUIElement.is() && aUIElement.m_xUIElement.is() ) |
32 | 0 | return false; |
33 | 0 | else if ( m_xUIElement.is() && !aUIElement.m_xUIElement.is() ) |
34 | 0 | return true; |
35 | 0 | else if ( !m_bVisible && aUIElement.m_bVisible ) |
36 | 0 | return false; |
37 | 0 | else if ( m_bVisible && !aUIElement.m_bVisible ) |
38 | 0 | return true; |
39 | 0 | else if ( !m_bFloating && aUIElement.m_bFloating ) |
40 | 0 | return true; |
41 | 0 | else if ( m_bFloating && !aUIElement.m_bFloating ) |
42 | 0 | return false; |
43 | 0 | else |
44 | 0 | { |
45 | 0 | if ( m_bFloating ) |
46 | 0 | { |
47 | 0 | bool bEqual = ( m_aFloatingData.m_aPos.Y == aUIElement.m_aFloatingData.m_aPos.Y ); |
48 | 0 | if ( bEqual ) |
49 | 0 | return ( m_aFloatingData.m_aPos.X < aUIElement.m_aFloatingData.m_aPos.X ); |
50 | 0 | else |
51 | 0 | return ( m_aFloatingData.m_aPos.Y < aUIElement.m_aFloatingData.m_aPos.Y ); |
52 | 0 | } |
53 | 0 | else |
54 | 0 | { |
55 | 0 | if ( m_aDockedData.m_nDockedArea < aUIElement.m_aDockedData.m_nDockedArea ) |
56 | 0 | return true; |
57 | 0 | else if ( m_aDockedData.m_nDockedArea > aUIElement.m_aDockedData.m_nDockedArea ) |
58 | 0 | return false; |
59 | 0 | else |
60 | 0 | { |
61 | 0 | if ( m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_TOP || |
62 | 0 | m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_BOTTOM ) |
63 | 0 | { |
64 | 0 | if ( m_aDockedData.m_aPos.Y != aUIElement.m_aDockedData.m_aPos.Y ) |
65 | 0 | return ( m_aDockedData.m_aPos.Y < aUIElement.m_aDockedData.m_aPos.Y ); |
66 | 0 | else |
67 | 0 | { |
68 | 0 | bool bEqual = ( m_aDockedData.m_aPos.X == aUIElement.m_aDockedData.m_aPos.X ); |
69 | 0 | if ( bEqual ) |
70 | 0 | { |
71 | 0 | return m_bUserActive && !aUIElement.m_bUserActive; |
72 | 0 | } |
73 | 0 | else |
74 | 0 | return ( m_aDockedData.m_aPos.X <= aUIElement.m_aDockedData.m_aPos.X ); |
75 | 0 | } |
76 | 0 | } |
77 | 0 | else |
78 | 0 | { |
79 | 0 | if ( m_aDockedData.m_aPos.X != aUIElement.m_aDockedData.m_aPos.X ) |
80 | 0 | return ( m_aDockedData.m_aPos.X < aUIElement.m_aDockedData.m_aPos.X ); |
81 | 0 | else |
82 | 0 | { |
83 | 0 | bool bEqual = ( m_aDockedData.m_aPos.Y == aUIElement.m_aDockedData.m_aPos.Y ); |
84 | 0 | if ( bEqual ) |
85 | 0 | { |
86 | 0 | return m_bUserActive && !aUIElement.m_bUserActive; |
87 | 0 | } |
88 | 0 | else |
89 | 0 | return ( m_aDockedData.m_aPos.Y <= aUIElement.m_aDockedData.m_aPos.Y ); |
90 | 0 | } |
91 | 0 | } |
92 | 0 | } |
93 | 0 | } |
94 | 0 | } |
95 | 0 | } |
96 | | |
97 | | } // namespace framework |
98 | | |
99 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |