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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_framework.hxx"
26 
27 //_________________________________________________________________________________________________________________
28 //	my own includes
29 //_________________________________________________________________________________________________________________
30 
31 #include <uielement/uielement.hxx>
32 
33 //_________________________________________________________________________________________________________________
34 //	interface includes
35 //_________________________________________________________________________________________________________________
36 
37 #include <com/sun/star/ui/DockingArea.hpp>
38 
39 //_________________________________________________________________________________________________________________
40 //	namespace
41 //_________________________________________________________________________________________________________________
42 
43 using namespace ::com::sun::star;
44 
45 namespace framework
46 {
47 
operator <(const::framework::UIElement & aUIElement) const48     bool UIElement::operator< ( const ::framework::UIElement& aUIElement ) const
49 {
50     if ( !m_xUIElement.is() && aUIElement.m_xUIElement.is() )
51         return false;
52     else if ( m_xUIElement.is() && !aUIElement.m_xUIElement.is() )
53         return true;
54     else if ( !m_bVisible && aUIElement.m_bVisible )
55         return false;
56     else if ( m_bVisible && !aUIElement.m_bVisible )
57         return true;
58     else if ( !m_bFloating && aUIElement.m_bFloating )
59         return true;
60     else if ( m_bFloating && !aUIElement.m_bFloating )
61         return false;
62     else
63     {
64         if ( m_bFloating )
65         {
66             bool bEqual = ( m_aFloatingData.m_aPos.Y() == aUIElement.m_aFloatingData.m_aPos.Y() );
67             if ( bEqual )
68                 return ( m_aFloatingData.m_aPos.X() < aUIElement.m_aFloatingData.m_aPos.X() );
69             else
70                 return ( m_aFloatingData.m_aPos.Y() < aUIElement.m_aFloatingData.m_aPos.Y() );
71         }
72         else
73         {
74             if ( m_aDockedData.m_nDockedArea < aUIElement.m_aDockedData.m_nDockedArea )
75                 return true;
76             else if ( m_aDockedData.m_nDockedArea > aUIElement.m_aDockedData.m_nDockedArea )
77                 return false;
78             else
79             {
80                 if ( m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_TOP ||
81                      m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_BOTTOM )
82                 {
83                     if ( !( m_aDockedData.m_aPos.Y() == aUIElement.m_aDockedData.m_aPos.Y() ) )
84                         return  ( m_aDockedData.m_aPos.Y() < aUIElement.m_aDockedData.m_aPos.Y() );
85                     else
86                     {
87                         bool bEqual = ( m_aDockedData.m_aPos.X() == aUIElement.m_aDockedData.m_aPos.X() );
88                         if ( bEqual )
89                         {
90                             if ( m_bUserActive && !aUIElement.m_bUserActive )
91                                 return sal_True;
92                             else if ( !m_bUserActive && aUIElement.m_bUserActive )
93                                 return sal_False;
94                             else
95                                 return sal_False;
96                         }
97                         else
98                             return ( m_aDockedData.m_aPos.X() <= aUIElement.m_aDockedData.m_aPos.X() );
99                     }
100                 }
101                 else
102                 {
103                     if ( !( m_aDockedData.m_aPos.X() == aUIElement.m_aDockedData.m_aPos.X() ) )
104                         return ( m_aDockedData.m_aPos.X() < aUIElement.m_aDockedData.m_aPos.X() );
105                     else
106                     {
107                         bool bEqual = ( m_aDockedData.m_aPos.Y() == aUIElement.m_aDockedData.m_aPos.Y() );
108                         if ( bEqual )
109                         {
110                             if ( m_bUserActive && !aUIElement.m_bUserActive )
111                                 return sal_True;
112                             else if ( !m_bUserActive && aUIElement.m_bUserActive )
113                                 return sal_False;
114                             else
115                                 return sal_False;
116                         }
117                         else
118                             return ( m_aDockedData.m_aPos.Y() <= aUIElement.m_aDockedData.m_aPos.Y() );
119                     }
120                 }
121             }
122         }
123     }
124 }
125 
operator =(const UIElement & rUIElement)126 UIElement& UIElement::operator= ( const UIElement& rUIElement )
127 {
128     if (&rUIElement != this)
129     {
130         m_aType             = rUIElement.m_aType;
131         m_aName             = rUIElement.m_aName;
132         m_aUIName           = rUIElement.m_aUIName;
133         m_xUIElement        = rUIElement.m_xUIElement;
134         m_bFloating         = rUIElement.m_bFloating;
135         m_bVisible          = rUIElement.m_bVisible;
136         m_bUserActive       = rUIElement.m_bUserActive;
137         m_bCreateNewRowCol0 = rUIElement.m_bCreateNewRowCol0;
138         m_bDeactiveHide     = rUIElement.m_bDeactiveHide;
139         m_bMasterHide       = rUIElement.m_bMasterHide;
140         m_bContextSensitive = rUIElement.m_bContextSensitive;
141         m_bContextActive    = rUIElement.m_bContextActive;
142         m_bNoClose          = rUIElement.m_bNoClose;
143         m_bSoftClose        = rUIElement.m_bSoftClose;
144         m_bStateRead        = rUIElement.m_bStateRead;
145         m_nStyle            = rUIElement.m_nStyle;
146         m_aDockedData       = rUIElement.m_aDockedData;
147         m_aFloatingData     = rUIElement.m_aFloatingData;
148     }
149     return *this;
150 }
151 
152 } // namespace framework
153