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: drawvie3.cxx,v $
10 * $Revision: 1.16.32.1 $
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_sc.hxx"
36 // INCLUDE ---------------------------------------------------------------
38 #include <svx/svdograf.hxx>
39 #include <svx/svdoole2.hxx>
40 #include <sfx2/app.hxx>
41 #include <sfx2/viewfrm.hxx>
43 #include "drawview.hxx"
44 #include "drwlayer.hxx"
45 #include "viewdata.hxx"
47 #include "document.hxx"
48 #include "userdat.hxx"
49 #include "tabvwsh.hxx"
52 void ScIMapDlgSet( const Graphic
& rGraphic
, const ImageMap
* pImageMap
,
53 const TargetList
* pTargetList
, void* pEditingObj
); // imapwrap
54 USHORT
ScIMapChildWindowId();
56 // STATIC DATA -----------------------------------------------------------
58 ScDrawView::ScDrawView( OutputDevice
* pOut
, ScViewData
* pData
) :
59 FmFormView( pData
->GetDocument()->GetDrawLayer(), pOut
),
62 pDoc( pData
->GetDocument() ),
63 nTab( pData
->GetTabNo() ),
67 //HMHbDisableHdl( FALSE )
69 // #i73602# Use default from the configuration
70 SetBufferedOverlayAllowed(getOptionsDrawinglayer().IsOverlayBuffer_Calc());
72 // #i74769#, #i75172# Use default from the configuration
73 SetBufferedOutputAllowed(getOptionsDrawinglayer().IsPaintBuffer_Calc());
80 void ScDrawView::SetAnchor( ScAnchorType eType
)
82 SdrObject
* pObj
= NULL
;
83 if( AreObjectsMarked() )
85 const SdrMarkList
* pMark
= &GetMarkedObjectList();
86 ULONG nCount
= pMark
->GetMarkCount();
87 for( ULONG i
=0; i
<nCount
; i
++ )
89 pObj
= pMark
->GetMark(i
)->GetMarkedSdrObj();
90 ScDrawLayer::SetAnchor( pObj
, eType
);
94 pViewData
->GetDocShell()->SetDrawModified();
98 ScAnchorType
ScDrawView::GetAnchor() const
102 const SdrObject
* pObj
= NULL
;
103 if( AreObjectsMarked() )
105 const SdrMarkList
* pMark
= &GetMarkedObjectList();
106 ULONG nCount
= pMark
->GetMarkCount();
108 for( ULONG i
=0; i
<nCount
; i
++ )
110 pObj
= pMark
->GetMark(i
)->GetMarkedSdrObj();
111 if( ScDrawLayer::GetAnchor( pObj
) == SCA_CELL
)
117 if( bPage
&& !bCell
)
119 if( !bPage
&& bCell
)
124 void __EXPORT
ScDrawView::Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
)
126 if (rHint
.ISA(ScTabDeletedHint
)) // Tabelle geloescht
128 SCTAB nDelTab
= ((ScTabDeletedHint
&)rHint
).GetTab();
129 if (ValidTab(nDelTab
))
131 // used to be: HidePagePgNum(nDelTab) - hide only if the deleted sheet is shown here
132 if ( nDelTab
== nTab
)
136 else if (rHint
.ISA(ScTabSizeChangedHint
)) // Groesse geaendert
138 if ( nTab
== ((ScTabSizeChangedHint
&)rHint
).GetTab() )
142 FmFormView::Notify( rBC
,rHint
);
145 void ScDrawView::UpdateIMap( SdrObject
* pObj
)
148 pViewData
->GetViewShell()->GetViewFrame()->HasChildWindow( ScIMapChildWindowId() ) &&
149 pObj
&& ( pObj
->ISA(SdrGrafObj
) || pObj
->ISA(SdrOle2Obj
) ) )
152 TargetList aTargetList
;
153 ScIMapInfo
* pIMapInfo
= ScDrawLayer::GetIMapInfo( pObj
);
154 const ImageMap
* pImageMap
= NULL
;
156 pImageMap
= &pIMapInfo
->GetImageMap();
158 // Target-Liste besorgen
159 pViewData
->GetViewShell()->GetViewFrame()->GetTargetList( aTargetList
);
161 // Grafik vom Objekt besorgen
162 if ( pObj
->ISA( SdrGrafObj
) )
163 aGraphic
= ( (SdrGrafObj
*) pObj
)->GetGraphic();
166 Graphic
* pGraphic
= ((const SdrOle2Obj
*) pObj
)->GetGraphic();
168 aGraphic
= *pGraphic
;
171 ScIMapDlgSet( aGraphic
, pImageMap
, &aTargetList
, pObj
); // aus imapwrap
173 // TargetListe kann von uns wieder geloescht werden
174 String
* pEntry
= aTargetList
.First();
178 pEntry
= aTargetList
.Next();