1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: zoomlist.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #include "zoomlist.hxx"
37 #include <svx/svxids.hrc>
39 #include <sfx2/bindings.hxx>
40 #include <sfx2/viewfrm.hxx>
41 #ifndef _SFXVIEWSHELL_HXX
42 #include <sfx2/viewsh.hxx>
46 #include "ViewShell.hxx"
52 /*************************************************************************
56 \************************************************************************/
58 ZoomList::ZoomList(ViewShell
* pViewShell
)
60 , mpViewShell (pViewShell
)
66 /*************************************************************************
70 \************************************************************************/
74 #if ( defined GCC && defined C272 )
75 for (ULONG nObject
=0; nObject
<List::Count(); nObject
++)
77 for (ULONG nObject
=0; nObject
<Count(); nObject
++)
80 // Ggf. ZoomRects loeschen
81 delete ((Rectangle
*) GetObject(nObject
));
86 /*************************************************************************
88 |* Neues ZoomRect aufnehmen
90 \************************************************************************/
92 void ZoomList::InsertZoomRect(const Rectangle
& rRect
)
94 ULONG nRectCount
= Count();
96 if (nRectCount
>= MAX_ENTRYS
)
98 delete ((Rectangle
*) GetObject(0));
101 else if (nRectCount
== 0)
110 Rectangle
* pRect
= new Rectangle(rRect
);
111 Insert(pRect
, mnCurPos
);
113 SfxBindings
& rBindings
= mpViewShell
->GetViewFrame()->GetBindings();
114 rBindings
.Invalidate( SID_ZOOM_NEXT
);
115 rBindings
.Invalidate( SID_ZOOM_PREV
);
119 /*************************************************************************
121 |* Aktuelles ZoomRect herausgeben
123 \************************************************************************/
125 Rectangle
ZoomList::GetCurrentZoomRect() const
127 Rectangle
aRect(*(Rectangle
*) GetObject(mnCurPos
));
131 /*************************************************************************
133 |* Naechstes ZoomRect herausgeben
135 \************************************************************************/
137 Rectangle
ZoomList::GetNextZoomRect()
140 ULONG nRectCount
= Count();
142 if (nRectCount
> 0 && mnCurPos
> nRectCount
- 1)
144 mnCurPos
= nRectCount
- 1;
147 SfxBindings
& rBindings
= mpViewShell
->GetViewFrame()->GetBindings();
148 rBindings
.Invalidate( SID_ZOOM_NEXT
);
149 rBindings
.Invalidate( SID_ZOOM_PREV
);
151 Rectangle
aRect(*(Rectangle
*) GetObject(mnCurPos
));
155 /*************************************************************************
157 |* Letztes ZoomRect herausgeben
159 \************************************************************************/
161 Rectangle
ZoomList::GetPreviousZoomRect()
168 SfxBindings
& rBindings
= mpViewShell
->GetViewFrame()->GetBindings();
169 rBindings
.Invalidate( SID_ZOOM_NEXT
);
170 rBindings
.Invalidate( SID_ZOOM_PREV
);
172 Rectangle
aRect(*(Rectangle
*) GetObject(mnCurPos
));
176 /*************************************************************************
178 |* Gibt es ein naechstes ZoomRect?
180 \************************************************************************/
182 BOOL
ZoomList::IsNextPossible() const
184 BOOL bPossible
= FALSE
;
185 ULONG nRectCount
= Count();
187 if (nRectCount
> 0 && mnCurPos
< nRectCount
- 1)
195 /*************************************************************************
197 |* Gibt es ein vorheriges ZoomRect?
199 \************************************************************************/
201 BOOL
ZoomList::IsPreviousPossible() const
203 BOOL bPossible
= FALSE
;
213 } // end of namespace sd