1*6d739b60SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*6d739b60SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*6d739b60SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*6d739b60SAndrew Rist  * distributed with this work for additional information
6*6d739b60SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*6d739b60SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*6d739b60SAndrew Rist  * "License"); you may not use this file except in compliance
9*6d739b60SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*6d739b60SAndrew Rist  *
11*6d739b60SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*6d739b60SAndrew Rist  *
13*6d739b60SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*6d739b60SAndrew Rist  * software distributed under the License is distributed on an
15*6d739b60SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*6d739b60SAndrew Rist  * KIND, either express or implied.  See the License for the
17*6d739b60SAndrew Rist  * specific language governing permissions and limitations
18*6d739b60SAndrew Rist  * under the License.
19*6d739b60SAndrew Rist  *
20*6d739b60SAndrew Rist  *************************************************************/
21*6d739b60SAndrew Rist 
22*6d739b60SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_framework.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //_________________________________________________________________________________________________________________
28cdf0e10cSrcweir //	my own includes
29cdf0e10cSrcweir //_________________________________________________________________________________________________________________
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <uielement/uielement.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir //_________________________________________________________________________________________________________________
34cdf0e10cSrcweir //	interface includes
35cdf0e10cSrcweir //_________________________________________________________________________________________________________________
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include <com/sun/star/ui/DockingArea.hpp>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir //_________________________________________________________________________________________________________________
40cdf0e10cSrcweir //	namespace
41cdf0e10cSrcweir //_________________________________________________________________________________________________________________
42cdf0e10cSrcweir 
43cdf0e10cSrcweir using namespace ::com::sun::star;
44cdf0e10cSrcweir 
45cdf0e10cSrcweir namespace framework
46cdf0e10cSrcweir {
47cdf0e10cSrcweir 
operator <(const::framework::UIElement & aUIElement) const48cdf0e10cSrcweir     bool UIElement::operator< ( const ::framework::UIElement& aUIElement ) const
49cdf0e10cSrcweir {
50cdf0e10cSrcweir     if ( !m_xUIElement.is() && aUIElement.m_xUIElement.is() )
51cdf0e10cSrcweir         return false;
52cdf0e10cSrcweir     else if ( m_xUIElement.is() && !aUIElement.m_xUIElement.is() )
53cdf0e10cSrcweir         return true;
54cdf0e10cSrcweir     else if ( !m_bVisible && aUIElement.m_bVisible )
55cdf0e10cSrcweir         return false;
56cdf0e10cSrcweir     else if ( m_bVisible && !aUIElement.m_bVisible )
57cdf0e10cSrcweir         return true;
58cdf0e10cSrcweir     else if ( !m_bFloating && aUIElement.m_bFloating )
59cdf0e10cSrcweir         return true;
60cdf0e10cSrcweir     else if ( m_bFloating && !aUIElement.m_bFloating )
61cdf0e10cSrcweir         return false;
62cdf0e10cSrcweir     else
63cdf0e10cSrcweir     {
64cdf0e10cSrcweir         if ( m_bFloating )
65cdf0e10cSrcweir         {
66cdf0e10cSrcweir             bool bEqual = ( m_aFloatingData.m_aPos.Y() == aUIElement.m_aFloatingData.m_aPos.Y() );
67cdf0e10cSrcweir             if ( bEqual )
68cdf0e10cSrcweir                 return ( m_aFloatingData.m_aPos.X() < aUIElement.m_aFloatingData.m_aPos.X() );
69cdf0e10cSrcweir             else
70cdf0e10cSrcweir                 return ( m_aFloatingData.m_aPos.Y() < aUIElement.m_aFloatingData.m_aPos.Y() );
71cdf0e10cSrcweir         }
72cdf0e10cSrcweir         else
73cdf0e10cSrcweir         {
74cdf0e10cSrcweir             if ( m_aDockedData.m_nDockedArea < aUIElement.m_aDockedData.m_nDockedArea )
75cdf0e10cSrcweir                 return true;
76cdf0e10cSrcweir             else if ( m_aDockedData.m_nDockedArea > aUIElement.m_aDockedData.m_nDockedArea )
77cdf0e10cSrcweir                 return false;
78cdf0e10cSrcweir             else
79cdf0e10cSrcweir             {
80cdf0e10cSrcweir                 if ( m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_TOP ||
81cdf0e10cSrcweir                      m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_BOTTOM )
82cdf0e10cSrcweir                 {
83cdf0e10cSrcweir                     if ( !( m_aDockedData.m_aPos.Y() == aUIElement.m_aDockedData.m_aPos.Y() ) )
84cdf0e10cSrcweir                         return  ( m_aDockedData.m_aPos.Y() < aUIElement.m_aDockedData.m_aPos.Y() );
85cdf0e10cSrcweir                     else
86cdf0e10cSrcweir                     {
87cdf0e10cSrcweir                         bool bEqual = ( m_aDockedData.m_aPos.X() == aUIElement.m_aDockedData.m_aPos.X() );
88cdf0e10cSrcweir                         if ( bEqual )
89cdf0e10cSrcweir                         {
90cdf0e10cSrcweir                             if ( m_bUserActive && !aUIElement.m_bUserActive )
91cdf0e10cSrcweir                                 return sal_True;
92cdf0e10cSrcweir                             else if ( !m_bUserActive && aUIElement.m_bUserActive )
93cdf0e10cSrcweir                                 return sal_False;
94cdf0e10cSrcweir                             else
95cdf0e10cSrcweir                                 return sal_False;
96cdf0e10cSrcweir                         }
97cdf0e10cSrcweir                         else
98cdf0e10cSrcweir                             return ( m_aDockedData.m_aPos.X() <= aUIElement.m_aDockedData.m_aPos.X() );
99cdf0e10cSrcweir                     }
100cdf0e10cSrcweir                 }
101cdf0e10cSrcweir                 else
102cdf0e10cSrcweir                 {
103cdf0e10cSrcweir                     if ( !( m_aDockedData.m_aPos.X() == aUIElement.m_aDockedData.m_aPos.X() ) )
104cdf0e10cSrcweir                         return ( m_aDockedData.m_aPos.X() < aUIElement.m_aDockedData.m_aPos.X() );
105cdf0e10cSrcweir                     else
106cdf0e10cSrcweir                     {
107cdf0e10cSrcweir                         bool bEqual = ( m_aDockedData.m_aPos.Y() == aUIElement.m_aDockedData.m_aPos.Y() );
108cdf0e10cSrcweir                         if ( bEqual )
109cdf0e10cSrcweir                         {
110cdf0e10cSrcweir                             if ( m_bUserActive && !aUIElement.m_bUserActive )
111cdf0e10cSrcweir                                 return sal_True;
112cdf0e10cSrcweir                             else if ( !m_bUserActive && aUIElement.m_bUserActive )
113cdf0e10cSrcweir                                 return sal_False;
114cdf0e10cSrcweir                             else
115cdf0e10cSrcweir                                 return sal_False;
116cdf0e10cSrcweir                         }
117cdf0e10cSrcweir                         else
118cdf0e10cSrcweir                             return ( m_aDockedData.m_aPos.Y() <= aUIElement.m_aDockedData.m_aPos.Y() );
119cdf0e10cSrcweir                     }
120cdf0e10cSrcweir                 }
121cdf0e10cSrcweir             }
122cdf0e10cSrcweir         }
123cdf0e10cSrcweir     }
124cdf0e10cSrcweir }
125cdf0e10cSrcweir 
operator =(const UIElement & rUIElement)126cdf0e10cSrcweir UIElement& UIElement::operator= ( const UIElement& rUIElement )
127cdf0e10cSrcweir {
128cdf0e10cSrcweir     if (&rUIElement != this)
129cdf0e10cSrcweir     {
130cdf0e10cSrcweir         m_aType             = rUIElement.m_aType;
131cdf0e10cSrcweir         m_aName             = rUIElement.m_aName;
132cdf0e10cSrcweir         m_aUIName           = rUIElement.m_aUIName;
133cdf0e10cSrcweir         m_xUIElement        = rUIElement.m_xUIElement;
134cdf0e10cSrcweir         m_bFloating         = rUIElement.m_bFloating;
135cdf0e10cSrcweir         m_bVisible          = rUIElement.m_bVisible;
136cdf0e10cSrcweir         m_bUserActive       = rUIElement.m_bUserActive;
137cdf0e10cSrcweir         m_bCreateNewRowCol0 = rUIElement.m_bCreateNewRowCol0;
138cdf0e10cSrcweir         m_bDeactiveHide     = rUIElement.m_bDeactiveHide;
139cdf0e10cSrcweir         m_bMasterHide       = rUIElement.m_bMasterHide;
140cdf0e10cSrcweir         m_bContextSensitive = rUIElement.m_bContextSensitive;
141cdf0e10cSrcweir         m_bContextActive    = rUIElement.m_bContextActive;
142cdf0e10cSrcweir         m_bNoClose          = rUIElement.m_bNoClose;
143cdf0e10cSrcweir         m_bSoftClose        = rUIElement.m_bSoftClose;
144cdf0e10cSrcweir         m_bStateRead        = rUIElement.m_bStateRead;
145cdf0e10cSrcweir         m_nStyle            = rUIElement.m_nStyle;
146cdf0e10cSrcweir         m_aDockedData       = rUIElement.m_aDockedData;
147cdf0e10cSrcweir         m_aFloatingData     = rUIElement.m_aFloatingData;
148cdf0e10cSrcweir     }
149cdf0e10cSrcweir     return *this;
150cdf0e10cSrcweir }
151cdf0e10cSrcweir 
152cdf0e10cSrcweir } // namespace framework
153