Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2008 by Sun Microsystems, Inc.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <uielement/uielement.hxx>
30 : :
31 : : #include <com/sun/star/ui/DockingArea.hpp>
32 : :
33 : : using namespace ::com::sun::star;
34 : :
35 : : namespace framework
36 : : {
37 : :
38 : 6239 : bool UIElement::operator< ( const ::framework::UIElement& aUIElement ) const
39 : : {
40 [ - + ][ # # ]: 6239 : if ( !m_xUIElement.is() && aUIElement.m_xUIElement.is() )
[ - + ]
41 : 0 : return false;
42 [ + - ][ - + ]: 6239 : else if ( m_xUIElement.is() && !aUIElement.m_xUIElement.is() )
[ - + ]
43 : 0 : return true;
44 [ + + ][ + - ]: 6239 : else if ( !m_bVisible && aUIElement.m_bVisible )
45 : 2 : return false;
46 [ + - ][ - + ]: 6237 : else if ( m_bVisible && !aUIElement.m_bVisible )
47 : 0 : return true;
48 [ + - ][ - + ]: 6237 : else if ( !m_bFloating && aUIElement.m_bFloating )
49 : 0 : return true;
50 [ - + ][ # # ]: 6237 : else if ( m_bFloating && !aUIElement.m_bFloating )
51 : 0 : return false;
52 : : else
53 : : {
54 [ - + ]: 6237 : if ( m_bFloating )
55 : : {
56 : 0 : bool bEqual = ( m_aFloatingData.m_aPos.Y == aUIElement.m_aFloatingData.m_aPos.Y );
57 [ # # ]: 0 : if ( bEqual )
58 : 0 : return ( m_aFloatingData.m_aPos.X < aUIElement.m_aFloatingData.m_aPos.X );
59 : : else
60 : 0 : return ( m_aFloatingData.m_aPos.Y < aUIElement.m_aFloatingData.m_aPos.Y );
61 : : }
62 : : else
63 : : {
64 [ + + ]: 6237 : if ( m_aDockedData.m_nDockedArea < aUIElement.m_aDockedData.m_nDockedArea )
65 : 241 : return true;
66 [ + + ]: 5996 : else if ( m_aDockedData.m_nDockedArea > aUIElement.m_aDockedData.m_nDockedArea )
67 : 808 : return false;
68 : : else
69 : : {
70 [ - + ][ # # ]: 5188 : if ( m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_TOP ||
71 : : m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_BOTTOM )
72 : : {
73 [ + + ]: 5188 : if ( !( m_aDockedData.m_aPos.Y == aUIElement.m_aDockedData.m_aPos.Y ) )
74 : 4932 : return ( m_aDockedData.m_aPos.Y < aUIElement.m_aDockedData.m_aPos.Y );
75 : : else
76 : : {
77 : 256 : bool bEqual = ( m_aDockedData.m_aPos.X == aUIElement.m_aDockedData.m_aPos.X );
78 [ + + ]: 256 : if ( bEqual )
79 : : {
80 [ - + ][ # # ]: 138 : if ( m_bUserActive && !aUIElement.m_bUserActive )
81 : 0 : return sal_True;
82 : : else
83 : 138 : return sal_False;
84 : : }
85 : : else
86 : 118 : return ( m_aDockedData.m_aPos.X <= aUIElement.m_aDockedData.m_aPos.X );
87 : : }
88 : : }
89 : : else
90 : : {
91 [ # # ]: 0 : if ( !( m_aDockedData.m_aPos.X == aUIElement.m_aDockedData.m_aPos.X ) )
92 : 0 : return ( m_aDockedData.m_aPos.X < aUIElement.m_aDockedData.m_aPos.X );
93 : : else
94 : : {
95 : 0 : bool bEqual = ( m_aDockedData.m_aPos.Y == aUIElement.m_aDockedData.m_aPos.Y );
96 [ # # ]: 0 : if ( bEqual )
97 : : {
98 [ # # ][ # # ]: 0 : if ( m_bUserActive && !aUIElement.m_bUserActive )
99 : 0 : return sal_True;
100 : : else
101 : 0 : return sal_False;
102 : : }
103 : : else
104 : 6239 : return ( m_aDockedData.m_aPos.Y <= aUIElement.m_aDockedData.m_aPos.Y );
105 : : }
106 : : }
107 : : }
108 : : }
109 : : }
110 : : }
111 : :
112 : 27277 : UIElement& UIElement::operator= ( const UIElement& rUIElement )
113 : : {
114 [ + - ]: 27277 : if (&rUIElement != this)
115 : : {
116 : 27277 : m_aType = rUIElement.m_aType;
117 : 27277 : m_aName = rUIElement.m_aName;
118 : 27277 : m_aUIName = rUIElement.m_aUIName;
119 : 27277 : m_xUIElement = rUIElement.m_xUIElement;
120 : 27277 : m_bFloating = rUIElement.m_bFloating;
121 : 27277 : m_bVisible = rUIElement.m_bVisible;
122 : 27277 : m_bUserActive = rUIElement.m_bUserActive;
123 : 27277 : m_bCreateNewRowCol0 = rUIElement.m_bCreateNewRowCol0;
124 : 27277 : m_bDeactiveHide = rUIElement.m_bDeactiveHide;
125 : 27277 : m_bMasterHide = rUIElement.m_bMasterHide;
126 : 27277 : m_bContextSensitive = rUIElement.m_bContextSensitive;
127 : 27277 : m_bContextActive = rUIElement.m_bContextActive;
128 : 27277 : m_bNoClose = rUIElement.m_bNoClose;
129 : 27277 : m_bSoftClose = rUIElement.m_bSoftClose;
130 : 27277 : m_bStateRead = rUIElement.m_bStateRead;
131 : 27277 : m_nStyle = rUIElement.m_nStyle;
132 : 27277 : m_aDockedData = rUIElement.m_aDockedData;
133 : 27277 : m_aFloatingData = rUIElement.m_aFloatingData;
134 : : }
135 : 27277 : return *this;
136 : : }
137 : :
138 : : } // namespace framework
139 : :
140 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|