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