1*b3f79822SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*b3f79822SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*b3f79822SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*b3f79822SAndrew Rist * distributed with this work for additional information
6*b3f79822SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*b3f79822SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*b3f79822SAndrew Rist * "License"); you may not use this file except in compliance
9*b3f79822SAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11*b3f79822SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13*b3f79822SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*b3f79822SAndrew Rist * software distributed under the License is distributed on an
15*b3f79822SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b3f79822SAndrew Rist * KIND, either express or implied. See the License for the
17*b3f79822SAndrew Rist * specific language governing permissions and limitations
18*b3f79822SAndrew Rist * under the License.
19cdf0e10cSrcweir *
20*b3f79822SAndrew Rist *************************************************************/
21*b3f79822SAndrew Rist
22*b3f79822SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sc.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir
28cdf0e10cSrcweir
29cdf0e10cSrcweir // INCLUDE ---------------------------------------------------------------
30cdf0e10cSrcweir
31cdf0e10cSrcweir #include <svx/svdograf.hxx>
32cdf0e10cSrcweir #include <svx/svdoole2.hxx>
33cdf0e10cSrcweir #include <sfx2/app.hxx>
34cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
35cdf0e10cSrcweir
36cdf0e10cSrcweir #include "drawview.hxx"
37cdf0e10cSrcweir #include "drwlayer.hxx"
38cdf0e10cSrcweir #include "viewdata.hxx"
39cdf0e10cSrcweir #include "dbfunc.hxx"
40cdf0e10cSrcweir #include "document.hxx"
41cdf0e10cSrcweir #include "userdat.hxx"
42cdf0e10cSrcweir #include "tabvwsh.hxx"
43cdf0e10cSrcweir #include "docsh.hxx"
44cdf0e10cSrcweir
45cdf0e10cSrcweir void ScIMapDlgSet( const Graphic& rGraphic, const ImageMap* pImageMap,
46cdf0e10cSrcweir const TargetList* pTargetList, void* pEditingObj ); // imapwrap
47cdf0e10cSrcweir sal_uInt16 ScIMapChildWindowId();
48cdf0e10cSrcweir
49cdf0e10cSrcweir // STATIC DATA -----------------------------------------------------------
50cdf0e10cSrcweir
ScDrawView(OutputDevice * pOut,ScViewData * pData)51cdf0e10cSrcweir ScDrawView::ScDrawView( OutputDevice* pOut, ScViewData* pData ) :
52cdf0e10cSrcweir FmFormView( pData->GetDocument()->GetDrawLayer(), pOut ),
53cdf0e10cSrcweir pViewData( pData ),
54cdf0e10cSrcweir pDev( pOut ),
55cdf0e10cSrcweir pDoc( pData->GetDocument() ),
56cdf0e10cSrcweir nTab( pData->GetTabNo() ),
57cdf0e10cSrcweir pDropMarker( NULL ),
58cdf0e10cSrcweir pDropMarkObj( NULL ),
59cdf0e10cSrcweir bInConstruct( sal_True )
60cdf0e10cSrcweir //HMHbDisableHdl( sal_False )
61cdf0e10cSrcweir {
62cdf0e10cSrcweir // #i73602# Use default from the configuration
63cdf0e10cSrcweir SetBufferedOverlayAllowed(getOptionsDrawinglayer().IsOverlayBuffer_Calc());
64cdf0e10cSrcweir
65cdf0e10cSrcweir // #i74769#, #i75172# Use default from the configuration
66cdf0e10cSrcweir SetBufferedOutputAllowed(getOptionsDrawinglayer().IsPaintBuffer_Calc());
67cdf0e10cSrcweir
68cdf0e10cSrcweir Construct();
69cdf0e10cSrcweir }
70cdf0e10cSrcweir
71cdf0e10cSrcweir // Verankerung setzen
72cdf0e10cSrcweir
SetAnchor(ScAnchorType eType)73cdf0e10cSrcweir void ScDrawView::SetAnchor( ScAnchorType eType )
74cdf0e10cSrcweir {
75cdf0e10cSrcweir SdrObject* pObj = NULL;
76cdf0e10cSrcweir if( AreObjectsMarked() )
77cdf0e10cSrcweir {
78cdf0e10cSrcweir const SdrMarkList* pMark = &GetMarkedObjectList();
79cdf0e10cSrcweir sal_uLong nCount = pMark->GetMarkCount();
80cdf0e10cSrcweir for( sal_uLong i=0; i<nCount; i++ )
81cdf0e10cSrcweir {
82cdf0e10cSrcweir pObj = pMark->GetMark(i)->GetMarkedSdrObj();
83cdf0e10cSrcweir ScDrawLayer::SetAnchor( pObj, eType );
84cdf0e10cSrcweir }
85cdf0e10cSrcweir
86cdf0e10cSrcweir if ( pViewData )
87cdf0e10cSrcweir pViewData->GetDocShell()->SetDrawModified();
88cdf0e10cSrcweir }
89cdf0e10cSrcweir }
90cdf0e10cSrcweir
GetAnchor() const91cdf0e10cSrcweir ScAnchorType ScDrawView::GetAnchor() const
92cdf0e10cSrcweir {
93cdf0e10cSrcweir sal_Bool bPage = sal_False;
94cdf0e10cSrcweir sal_Bool bCell = sal_False;
95cdf0e10cSrcweir const SdrObject* pObj = NULL;
96cdf0e10cSrcweir if( AreObjectsMarked() )
97cdf0e10cSrcweir {
98cdf0e10cSrcweir const SdrMarkList* pMark = &GetMarkedObjectList();
99cdf0e10cSrcweir sal_uLong nCount = pMark->GetMarkCount();
100cdf0e10cSrcweir Point p0;
101cdf0e10cSrcweir for( sal_uLong i=0; i<nCount; i++ )
102cdf0e10cSrcweir {
103cdf0e10cSrcweir pObj = pMark->GetMark(i)->GetMarkedSdrObj();
104cdf0e10cSrcweir if( ScDrawLayer::GetAnchor( pObj ) == SCA_CELL )
105cdf0e10cSrcweir bCell =sal_True;
106cdf0e10cSrcweir else
107cdf0e10cSrcweir bPage = sal_True;
108cdf0e10cSrcweir }
109cdf0e10cSrcweir }
110cdf0e10cSrcweir if( bPage && !bCell )
111cdf0e10cSrcweir return SCA_PAGE;
112cdf0e10cSrcweir if( !bPage && bCell )
113cdf0e10cSrcweir return SCA_CELL;
114cdf0e10cSrcweir return SCA_DONTKNOW;
115cdf0e10cSrcweir }
116cdf0e10cSrcweir
Notify(SfxBroadcaster & rBC,const SfxHint & rHint)117cdf0e10cSrcweir void __EXPORT ScDrawView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
118cdf0e10cSrcweir {
119cdf0e10cSrcweir if (rHint.ISA(ScTabDeletedHint)) // Tabelle geloescht
120cdf0e10cSrcweir {
121cdf0e10cSrcweir SCTAB nDelTab = ((ScTabDeletedHint&)rHint).GetTab();
122cdf0e10cSrcweir if (ValidTab(nDelTab))
123cdf0e10cSrcweir {
124cdf0e10cSrcweir // used to be: HidePagePgNum(nDelTab) - hide only if the deleted sheet is shown here
125cdf0e10cSrcweir if ( nDelTab == nTab )
126cdf0e10cSrcweir HideSdrPage();
127cdf0e10cSrcweir }
128cdf0e10cSrcweir }
129cdf0e10cSrcweir else if (rHint.ISA(ScTabSizeChangedHint)) // Groesse geaendert
130cdf0e10cSrcweir {
131cdf0e10cSrcweir if ( nTab == ((ScTabSizeChangedHint&)rHint).GetTab() )
132cdf0e10cSrcweir UpdateWorkArea();
133cdf0e10cSrcweir }
134cdf0e10cSrcweir else
135cdf0e10cSrcweir FmFormView::Notify( rBC,rHint );
136cdf0e10cSrcweir }
137cdf0e10cSrcweir
UpdateIMap(SdrObject * pObj)138cdf0e10cSrcweir void ScDrawView::UpdateIMap( SdrObject* pObj )
139cdf0e10cSrcweir {
140cdf0e10cSrcweir if ( pViewData &&
141cdf0e10cSrcweir pViewData->GetViewShell()->GetViewFrame()->HasChildWindow( ScIMapChildWindowId() ) &&
142cdf0e10cSrcweir pObj && ( pObj->ISA(SdrGrafObj) || pObj->ISA(SdrOle2Obj) ) )
143cdf0e10cSrcweir {
144cdf0e10cSrcweir Graphic aGraphic;
145cdf0e10cSrcweir TargetList aTargetList;
146cdf0e10cSrcweir ScIMapInfo* pIMapInfo = ScDrawLayer::GetIMapInfo( pObj );
147cdf0e10cSrcweir const ImageMap* pImageMap = NULL;
148cdf0e10cSrcweir if ( pIMapInfo )
149cdf0e10cSrcweir pImageMap = &pIMapInfo->GetImageMap();
150cdf0e10cSrcweir
151cdf0e10cSrcweir // Target-Liste besorgen
152cdf0e10cSrcweir pViewData->GetViewShell()->GetViewFrame()->GetTargetList( aTargetList );
153cdf0e10cSrcweir
154cdf0e10cSrcweir // Grafik vom Objekt besorgen
155cdf0e10cSrcweir if ( pObj->ISA( SdrGrafObj ) )
156cdf0e10cSrcweir aGraphic = ( (SdrGrafObj*) pObj )->GetGraphic();
157cdf0e10cSrcweir else
158cdf0e10cSrcweir {
159cdf0e10cSrcweir Graphic* pGraphic = ((const SdrOle2Obj*) pObj )->GetGraphic();
160cdf0e10cSrcweir if ( pGraphic )
161cdf0e10cSrcweir aGraphic = *pGraphic;
162cdf0e10cSrcweir }
163cdf0e10cSrcweir
164cdf0e10cSrcweir ScIMapDlgSet( aGraphic, pImageMap, &aTargetList, pObj ); // aus imapwrap
165cdf0e10cSrcweir
166cdf0e10cSrcweir // TargetListe kann von uns wieder geloescht werden
167cdf0e10cSrcweir String* pEntry = aTargetList.First();
168cdf0e10cSrcweir while( pEntry )
169cdf0e10cSrcweir {
170cdf0e10cSrcweir delete pEntry;
171cdf0e10cSrcweir pEntry = aTargetList.Next();
172cdf0e10cSrcweir }
173cdf0e10cSrcweir }
174cdf0e10cSrcweir }
175cdf0e10cSrcweir
176cdf0e10cSrcweir
177cdf0e10cSrcweir
178cdf0e10cSrcweir
179