1*5b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*5b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*5b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*5b190011SAndrew Rist * distributed with this work for additional information
6*5b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*5b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*5b190011SAndrew Rist * "License"); you may not use this file except in compliance
9*5b190011SAndrew Rist * with the License. You may obtain a copy of the License at
10*5b190011SAndrew Rist *
11*5b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*5b190011SAndrew Rist *
13*5b190011SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*5b190011SAndrew Rist * software distributed under the License is distributed on an
15*5b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*5b190011SAndrew Rist * KIND, either express or implied. See the License for the
17*5b190011SAndrew Rist * specific language governing permissions and limitations
18*5b190011SAndrew Rist * under the License.
19*5b190011SAndrew Rist *
20*5b190011SAndrew Rist *************************************************************/
21*5b190011SAndrew Rist
22*5b190011SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include "DrawViewShell.hxx"
28cdf0e10cSrcweir #include "ViewShellImplementation.hxx"
29cdf0e10cSrcweir
30cdf0e10cSrcweir #ifndef _SVXIDS_HRC
31cdf0e10cSrcweir #include <svx/svxids.hrc>
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #ifndef _IMAPDLG_HXX
34cdf0e10cSrcweir #include <svx/imapdlg.hxx>
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #include <sfx2/request.hxx>
37cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
38cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
39cdf0e10cSrcweir #include <svx/svdograf.hxx>
40cdf0e10cSrcweir #include <svx/svdoole2.hxx>
41cdf0e10cSrcweir
42cdf0e10cSrcweir
43cdf0e10cSrcweir #include "app.hrc"
44cdf0e10cSrcweir
45cdf0e10cSrcweir #include "drawdoc.hxx"
46cdf0e10cSrcweir #include "slideshow.hxx"
47cdf0e10cSrcweir #include "imapinfo.hxx"
48cdf0e10cSrcweir #include "sdmod.hxx"
49cdf0e10cSrcweir #include "optsitem.hxx"
50cdf0e10cSrcweir #ifndef SD_FRAME_VIEW
51cdf0e10cSrcweir #include "FrameView.hxx"
52cdf0e10cSrcweir #endif
53cdf0e10cSrcweir #include "drawview.hxx"
54cdf0e10cSrcweir
55cdf0e10cSrcweir #include "fupoor.hxx"
56cdf0e10cSrcweir
57cdf0e10cSrcweir namespace sd {
58cdf0e10cSrcweir
59cdf0e10cSrcweir /*************************************************************************
60cdf0e10cSrcweir |*
61cdf0e10cSrcweir |*
62cdf0e10cSrcweir |*
63cdf0e10cSrcweir \************************************************************************/
64cdf0e10cSrcweir
ExecIMap(SfxRequest & rReq)65cdf0e10cSrcweir void DrawViewShell::ExecIMap( SfxRequest& rReq )
66cdf0e10cSrcweir {
67cdf0e10cSrcweir // waehrend einer Diashow wird nichts ausgefuehrt!
68cdf0e10cSrcweir if(HasCurrentFunction(SID_PRESENTATION) )
69cdf0e10cSrcweir return;
70cdf0e10cSrcweir
71cdf0e10cSrcweir if ( rReq.GetSlot() == SID_IMAP_EXEC )
72cdf0e10cSrcweir {
73cdf0e10cSrcweir SdrMark* pMark = mpDrawView->GetMarkedObjectList().GetMark(0);
74cdf0e10cSrcweir
75cdf0e10cSrcweir if ( pMark )
76cdf0e10cSrcweir {
77cdf0e10cSrcweir SdrObject* pSdrObj = pMark->GetMarkedSdrObj();
78cdf0e10cSrcweir SvxIMapDlg* pDlg = ViewShell::Implementation::GetImageMapDialog();
79cdf0e10cSrcweir
80cdf0e10cSrcweir if ( pDlg->GetEditingObject() == (void*) pSdrObj )
81cdf0e10cSrcweir {
82cdf0e10cSrcweir const ImageMap& rImageMap = pDlg->GetImageMap();
83cdf0e10cSrcweir SdIMapInfo* pIMapInfo = GetDoc()->GetIMapInfo( pSdrObj );
84cdf0e10cSrcweir
85cdf0e10cSrcweir if ( !pIMapInfo )
86cdf0e10cSrcweir pSdrObj->InsertUserData( new SdIMapInfo( rImageMap ) );
87cdf0e10cSrcweir else
88cdf0e10cSrcweir pIMapInfo->SetImageMap( rImageMap );
89cdf0e10cSrcweir
90cdf0e10cSrcweir GetDoc()->SetChanged( sal_True );
91cdf0e10cSrcweir }
92cdf0e10cSrcweir }
93cdf0e10cSrcweir }
94cdf0e10cSrcweir }
95cdf0e10cSrcweir
96cdf0e10cSrcweir
97cdf0e10cSrcweir /*************************************************************************
98cdf0e10cSrcweir |*
99cdf0e10cSrcweir |*
100cdf0e10cSrcweir |*
101cdf0e10cSrcweir \************************************************************************/
102cdf0e10cSrcweir
GetIMapState(SfxItemSet & rSet)103cdf0e10cSrcweir void DrawViewShell::GetIMapState( SfxItemSet& rSet )
104cdf0e10cSrcweir {
105cdf0e10cSrcweir sal_Bool bDisable = sal_True;
106cdf0e10cSrcweir
107cdf0e10cSrcweir if( GetViewFrame()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) )
108cdf0e10cSrcweir {
109cdf0e10cSrcweir const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
110cdf0e10cSrcweir const SdrObject* pObj = NULL;
111cdf0e10cSrcweir sal_uLong nMarkCount = rMarkList.GetMarkCount();
112cdf0e10cSrcweir
113cdf0e10cSrcweir if ( nMarkCount == 1 )
114cdf0e10cSrcweir {
115cdf0e10cSrcweir pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
116cdf0e10cSrcweir
117cdf0e10cSrcweir SvxIMapDlg* pImageMapDialog = ViewShell::Implementation::GetImageMapDialog();
118cdf0e10cSrcweir if ( ( pObj->ISA( SdrGrafObj ) /*|| pObj->ISA( SdrOle2Obj )*/ )
119cdf0e10cSrcweir && pImageMapDialog!=NULL
120cdf0e10cSrcweir && ( pImageMapDialog->GetEditingObject() == (void*) pObj ) )
121cdf0e10cSrcweir {
122cdf0e10cSrcweir bDisable = sal_False;
123cdf0e10cSrcweir }
124cdf0e10cSrcweir }
125cdf0e10cSrcweir }
126cdf0e10cSrcweir
127cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_IMAP_EXEC, bDisable ) );
128cdf0e10cSrcweir }
129cdf0e10cSrcweir
130cdf0e10cSrcweir /*************************************************************************
131cdf0e10cSrcweir |*
132cdf0e10cSrcweir |* Execute-Methode der Optionsleiste
133cdf0e10cSrcweir |*
134cdf0e10cSrcweir \************************************************************************/
135cdf0e10cSrcweir
ExecOptionsBar(SfxRequest & rReq)136cdf0e10cSrcweir void DrawViewShell::ExecOptionsBar( SfxRequest& rReq )
137cdf0e10cSrcweir {
138cdf0e10cSrcweir // waehrend einer Diashow wird nichts ausgefuehrt!
139cdf0e10cSrcweir if(HasCurrentFunction(SID_PRESENTATION))
140cdf0e10cSrcweir return;
141cdf0e10cSrcweir
142cdf0e10cSrcweir sal_Bool bDefault = sal_False;
143cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot();
144cdf0e10cSrcweir
145cdf0e10cSrcweir SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
146cdf0e10cSrcweir
147cdf0e10cSrcweir switch( nSlot )
148cdf0e10cSrcweir {
149cdf0e10cSrcweir case SID_HANDLES_DRAFT:
150cdf0e10cSrcweir pOptions->SetSolidMarkHdl( !mpDrawView->IsSolidMarkHdl() );
151cdf0e10cSrcweir break;
152cdf0e10cSrcweir
153cdf0e10cSrcweir case SID_SOLID_CREATE:
154cdf0e10cSrcweir pOptions->SetSolidDragging( !mpDrawView->IsSolidDragging() );
155cdf0e10cSrcweir break;
156cdf0e10cSrcweir
157cdf0e10cSrcweir
158cdf0e10cSrcweir // Raster- / Hilfslinien-Optionen
159cdf0e10cSrcweir case SID_GRID_VISIBLE: // noch nicht hier !
160cdf0e10cSrcweir {
161cdf0e10cSrcweir pOptions->SetGridVisible( !mpDrawView->IsGridVisible() );
162cdf0e10cSrcweir }
163cdf0e10cSrcweir break;
164cdf0e10cSrcweir
165cdf0e10cSrcweir case SID_GRID_USE:
166cdf0e10cSrcweir {
167cdf0e10cSrcweir pOptions->SetUseGridSnap( !mpDrawView->IsGridSnap() );
168cdf0e10cSrcweir }
169cdf0e10cSrcweir break;
170cdf0e10cSrcweir
171cdf0e10cSrcweir case SID_HELPLINES_VISIBLE: // noch nicht hier !
172cdf0e10cSrcweir {
173cdf0e10cSrcweir pOptions->SetHelplines( !mpDrawView->IsHlplVisible() );
174cdf0e10cSrcweir }
175cdf0e10cSrcweir break;
176cdf0e10cSrcweir
177cdf0e10cSrcweir case SID_HELPLINES_USE:
178cdf0e10cSrcweir {
179cdf0e10cSrcweir pOptions->SetSnapHelplines( !mpDrawView->IsHlplSnap() );
180cdf0e10cSrcweir }
181cdf0e10cSrcweir break;
182cdf0e10cSrcweir
183cdf0e10cSrcweir case SID_HELPLINES_MOVE:
184cdf0e10cSrcweir {
185cdf0e10cSrcweir pOptions->SetDragStripes( !mpDrawView->IsDragStripes() );
186cdf0e10cSrcweir }
187cdf0e10cSrcweir break;
188cdf0e10cSrcweir
189cdf0e10cSrcweir
190cdf0e10cSrcweir case SID_SNAP_BORDER:
191cdf0e10cSrcweir {
192cdf0e10cSrcweir pOptions->SetSnapBorder( !mpDrawView->IsBordSnap() );
193cdf0e10cSrcweir }
194cdf0e10cSrcweir break;
195cdf0e10cSrcweir
196cdf0e10cSrcweir case SID_SNAP_FRAME:
197cdf0e10cSrcweir {
198cdf0e10cSrcweir pOptions->SetSnapFrame( !mpDrawView->IsOFrmSnap() );
199cdf0e10cSrcweir }
200cdf0e10cSrcweir break;
201cdf0e10cSrcweir
202cdf0e10cSrcweir case SID_SNAP_POINTS:
203cdf0e10cSrcweir {
204cdf0e10cSrcweir pOptions->SetSnapPoints( !mpDrawView->IsOPntSnap() );
205cdf0e10cSrcweir }
206cdf0e10cSrcweir break;
207cdf0e10cSrcweir
208cdf0e10cSrcweir
209cdf0e10cSrcweir case SID_QUICKEDIT:
210cdf0e10cSrcweir {
211cdf0e10cSrcweir pOptions->SetQuickEdit( !mpDrawView->IsQuickTextEditMode() );
212cdf0e10cSrcweir }
213cdf0e10cSrcweir break;
214cdf0e10cSrcweir
215cdf0e10cSrcweir case SID_PICK_THROUGH:
216cdf0e10cSrcweir {
217cdf0e10cSrcweir pOptions->SetPickThrough(
218cdf0e10cSrcweir !mpDrawView->GetModel()->IsPickThroughTransparentTextFrames() );
219cdf0e10cSrcweir }
220cdf0e10cSrcweir break;
221cdf0e10cSrcweir
222cdf0e10cSrcweir case SID_BIG_HANDLES:
223cdf0e10cSrcweir {
224cdf0e10cSrcweir pOptions->SetBigHandles( !mpFrameView->IsBigHandles() );
225cdf0e10cSrcweir }
226cdf0e10cSrcweir break;
227cdf0e10cSrcweir
228cdf0e10cSrcweir case SID_DOUBLECLICK_TEXTEDIT:
229cdf0e10cSrcweir {
230cdf0e10cSrcweir pOptions->SetDoubleClickTextEdit( !mpFrameView->IsDoubleClickTextEdit() );
231cdf0e10cSrcweir }
232cdf0e10cSrcweir break;
233cdf0e10cSrcweir
234cdf0e10cSrcweir case SID_CLICK_CHANGE_ROTATION:
235cdf0e10cSrcweir {
236cdf0e10cSrcweir pOptions->SetClickChangeRotation( !mpFrameView->IsClickChangeRotation() );
237cdf0e10cSrcweir }
238cdf0e10cSrcweir break;
239cdf0e10cSrcweir
240cdf0e10cSrcweir default:
241cdf0e10cSrcweir bDefault = sal_True;
242cdf0e10cSrcweir break;
243cdf0e10cSrcweir }
244cdf0e10cSrcweir
245cdf0e10cSrcweir if( !bDefault )
246cdf0e10cSrcweir {
247cdf0e10cSrcweir pOptions->StoreConfig();
248cdf0e10cSrcweir
249cdf0e10cSrcweir // Speichert die Konfiguration SOFORT
250cdf0e10cSrcweir // SFX_APP()->SaveConfiguration();
251cdf0e10cSrcweir WriteFrameViewData();
252cdf0e10cSrcweir
253cdf0e10cSrcweir mpFrameView->Update( pOptions );
254cdf0e10cSrcweir ReadFrameViewData( mpFrameView );
255cdf0e10cSrcweir
256cdf0e10cSrcweir Invalidate( nSlot );
257cdf0e10cSrcweir rReq.Done();
258cdf0e10cSrcweir }
259cdf0e10cSrcweir
260cdf0e10cSrcweir }
261cdf0e10cSrcweir
262cdf0e10cSrcweir
263cdf0e10cSrcweir /*************************************************************************
264cdf0e10cSrcweir |*
265cdf0e10cSrcweir |* State-Methode der Optionsleiste
266cdf0e10cSrcweir |*
267cdf0e10cSrcweir \************************************************************************/
268cdf0e10cSrcweir
GetOptionsBarState(SfxItemSet & rSet)269cdf0e10cSrcweir void DrawViewShell::GetOptionsBarState( SfxItemSet& rSet )
270cdf0e10cSrcweir {
271cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_HANDLES_DRAFT, !mpDrawView->IsSolidMarkHdl() ) );
272cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_SOLID_CREATE, mpDrawView->IsSolidDragging() ) );
273cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_GRID_VISIBLE, mpDrawView->IsGridVisible() ) );
274cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_GRID_USE, mpDrawView->IsGridSnap() ) );
275cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_HELPLINES_VISIBLE, mpDrawView->IsHlplVisible() ) );
276cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_HELPLINES_USE, mpDrawView->IsHlplSnap() ) );
277cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_HELPLINES_MOVE, mpDrawView->IsDragStripes() ) );
278cdf0e10cSrcweir
279cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_SNAP_BORDER, mpDrawView->IsBordSnap() ) );
280cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_SNAP_FRAME, mpDrawView->IsOFrmSnap() ) );
281cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_SNAP_POINTS, mpDrawView->IsOPntSnap() ) );
282cdf0e10cSrcweir
283cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_QUICKEDIT, mpDrawView->IsQuickTextEditMode() ) );
284cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_PICK_THROUGH, (sal_Bool)
285cdf0e10cSrcweir mpDrawView->GetModel()->IsPickThroughTransparentTextFrames() ) );
286cdf0e10cSrcweir
287cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_BIG_HANDLES, mpFrameView->IsBigHandles() ) );
288cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_DOUBLECLICK_TEXTEDIT, mpFrameView->IsDoubleClickTextEdit() ) );
289cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_CLICK_CHANGE_ROTATION, mpFrameView->IsClickChangeRotation() ) );
290cdf0e10cSrcweir }
291cdf0e10cSrcweir
292cdf0e10cSrcweir } // end of namespace sd
293