Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include "DrawViewShell.hxx"
31 : : #include "ViewShellImplementation.hxx"
32 : :
33 : : #include <svx/svxids.hrc>
34 : : #include <svx/imapdlg.hxx>
35 : : #include <sfx2/request.hxx>
36 : : #include <sfx2/dispatch.hxx>
37 : : #include <sfx2/viewfrm.hxx>
38 : : #include <svx/svdograf.hxx>
39 : : #include <svx/svdoole2.hxx>
40 : :
41 : :
42 : : #include "app.hrc"
43 : :
44 : : #include "drawdoc.hxx"
45 : : #include "slideshow.hxx"
46 : : #include "imapinfo.hxx"
47 : : #include "sdmod.hxx"
48 : : #include "optsitem.hxx"
49 : : #ifndef SD_FRAME_VIEW
50 : : #include "FrameView.hxx"
51 : : #endif
52 : : #include "drawview.hxx"
53 : :
54 : : #include "fupoor.hxx"
55 : :
56 : : namespace sd {
57 : :
58 : 0 : void DrawViewShell::ExecIMap( SfxRequest& rReq )
59 : : {
60 : : // waehrend einer Diashow wird nichts ausgefuehrt!
61 [ # # ]: 0 : if(HasCurrentFunction(SID_PRESENTATION) )
62 : 0 : return;
63 : :
64 [ # # ]: 0 : if ( rReq.GetSlot() == SID_IMAP_EXEC )
65 : : {
66 : 0 : SdrMark* pMark = mpDrawView->GetMarkedObjectList().GetMark(0);
67 : :
68 [ # # ]: 0 : if ( pMark )
69 : : {
70 : 0 : SdrObject* pSdrObj = pMark->GetMarkedSdrObj();
71 : 0 : SvxIMapDlg* pDlg = ViewShell::Implementation::GetImageMapDialog();
72 : :
73 [ # # ]: 0 : if ( pDlg->GetEditingObject() == (void*) pSdrObj )
74 : : {
75 : 0 : const ImageMap& rImageMap = pDlg->GetImageMap();
76 : 0 : SdIMapInfo* pIMapInfo = GetDoc()->GetIMapInfo( pSdrObj );
77 : :
78 [ # # ]: 0 : if ( !pIMapInfo )
79 [ # # ]: 0 : pSdrObj->AppendUserData( new SdIMapInfo( rImageMap ) );
80 : : else
81 : 0 : pIMapInfo->SetImageMap( rImageMap );
82 : :
83 : 0 : GetDoc()->SetChanged( sal_True );
84 : : }
85 : : }
86 : : }
87 : : }
88 : :
89 : 0 : void DrawViewShell::GetIMapState( SfxItemSet& rSet )
90 : : {
91 : 0 : sal_Bool bDisable = sal_True;
92 : :
93 [ # # ]: 0 : if( GetViewFrame()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) )
94 : : {
95 : 0 : const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
96 : 0 : const SdrObject* pObj = NULL;
97 : 0 : sal_uLong nMarkCount = rMarkList.GetMarkCount();
98 : :
99 [ # # ]: 0 : if ( nMarkCount == 1 )
100 : : {
101 : 0 : pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
102 : :
103 : 0 : SvxIMapDlg* pImageMapDialog = ViewShell::Implementation::GetImageMapDialog();
104 [ # # # # ]: 0 : if ( ( pObj->ISA( SdrGrafObj ) /*|| pObj->ISA( SdrOle2Obj )*/ )
[ # # ][ # # ]
105 : : && pImageMapDialog!=NULL
106 : 0 : && ( pImageMapDialog->GetEditingObject() == (void*) pObj ) )
107 : : {
108 : 0 : bDisable = sal_False;
109 : : }
110 : : }
111 : : }
112 : :
113 [ # # ]: 0 : rSet.Put( SfxBoolItem( SID_IMAP_EXEC, bDisable ) );
114 : 0 : }
115 : :
116 : : /*************************************************************************
117 : : |*
118 : : |* Execute-Methode der Optionsleiste
119 : : |*
120 : : \************************************************************************/
121 : :
122 : 0 : void DrawViewShell::ExecOptionsBar( SfxRequest& rReq )
123 : : {
124 : : // waehrend einer Diashow wird nichts ausgefuehrt!
125 [ # # ]: 0 : if(HasCurrentFunction(SID_PRESENTATION))
126 : 0 : return;
127 : :
128 : 0 : sal_Bool bDefault = sal_False;
129 : 0 : sal_uInt16 nSlot = rReq.GetSlot();
130 : :
131 : 0 : SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
132 : :
133 [ # # # # : 0 : switch( nSlot )
# # # # #
# # # #
# ]
134 : : {
135 : : case SID_SOLID_CREATE:
136 : 0 : pOptions->SetSolidDragging( !mpDrawView->IsSolidDragging() );
137 : 0 : break;
138 : :
139 : :
140 : : // Raster- / Hilfslinien-Optionen
141 : : case SID_GRID_VISIBLE: // noch nicht hier !
142 : : {
143 : 0 : pOptions->SetGridVisible( !mpDrawView->IsGridVisible() );
144 : : }
145 : 0 : break;
146 : :
147 : : case SID_GRID_USE:
148 : : {
149 : 0 : pOptions->SetUseGridSnap( !mpDrawView->IsGridSnap() );
150 : : }
151 : 0 : break;
152 : :
153 : : case SID_HELPLINES_VISIBLE: // noch nicht hier !
154 : : {
155 : 0 : pOptions->SetHelplines( !mpDrawView->IsHlplVisible() );
156 : : }
157 : 0 : break;
158 : :
159 : : case SID_HELPLINES_USE:
160 : : {
161 : 0 : pOptions->SetSnapHelplines( !mpDrawView->IsHlplSnap() );
162 : : }
163 : 0 : break;
164 : :
165 : : case SID_HELPLINES_MOVE:
166 : : {
167 : 0 : pOptions->SetDragStripes( !mpDrawView->IsDragStripes() );
168 : : }
169 : 0 : break;
170 : :
171 : :
172 : : case SID_SNAP_BORDER:
173 : : {
174 : 0 : pOptions->SetSnapBorder( !mpDrawView->IsBordSnap() );
175 : : }
176 : 0 : break;
177 : :
178 : : case SID_SNAP_FRAME:
179 : : {
180 : 0 : pOptions->SetSnapFrame( !mpDrawView->IsOFrmSnap() );
181 : : }
182 : 0 : break;
183 : :
184 : : case SID_SNAP_POINTS:
185 : : {
186 : 0 : pOptions->SetSnapPoints( !mpDrawView->IsOPntSnap() );
187 : : }
188 : 0 : break;
189 : :
190 : :
191 : : case SID_QUICKEDIT:
192 : : {
193 : 0 : pOptions->SetQuickEdit( !mpDrawView->IsQuickTextEditMode() );
194 : : }
195 : 0 : break;
196 : :
197 : : case SID_PICK_THROUGH:
198 : : {
199 : : pOptions->SetPickThrough(
200 : 0 : !mpDrawView->GetModel()->IsPickThroughTransparentTextFrames() );
201 : : }
202 : 0 : break;
203 : :
204 : : case SID_DOUBLECLICK_TEXTEDIT:
205 : : {
206 : 0 : pOptions->SetDoubleClickTextEdit( !mpFrameView->IsDoubleClickTextEdit() );
207 : : }
208 : 0 : break;
209 : :
210 : : case SID_CLICK_CHANGE_ROTATION:
211 : : {
212 : 0 : pOptions->SetClickChangeRotation( !mpFrameView->IsClickChangeRotation() );
213 : : }
214 : 0 : break;
215 : :
216 : : default:
217 : 0 : bDefault = sal_True;
218 : 0 : break;
219 : : }
220 : :
221 [ # # ]: 0 : if( !bDefault )
222 : : {
223 : 0 : pOptions->StoreConfig();
224 : :
225 : : // Speichert die Konfiguration SOFORT
226 : : // SFX_APP()->SaveConfiguration();
227 : 0 : WriteFrameViewData();
228 : :
229 : 0 : mpFrameView->Update( pOptions );
230 : 0 : ReadFrameViewData( mpFrameView );
231 : :
232 : 0 : Invalidate( nSlot );
233 : 0 : rReq.Done();
234 : : }
235 : :
236 : : }
237 : :
238 : :
239 : : /*************************************************************************
240 : : |*
241 : : |* State-Methode der Optionsleiste
242 : : |*
243 : : \************************************************************************/
244 : :
245 : 36 : void DrawViewShell::GetOptionsBarState( SfxItemSet& rSet )
246 : : {
247 [ + - ]: 36 : rSet.Put( SfxBoolItem( SID_SOLID_CREATE, mpDrawView->IsSolidDragging() ) );
248 [ + - ]: 36 : rSet.Put( SfxBoolItem( SID_GRID_VISIBLE, mpDrawView->IsGridVisible() ) );
249 [ + - ]: 36 : rSet.Put( SfxBoolItem( SID_GRID_USE, mpDrawView->IsGridSnap() ) );
250 [ + - ]: 36 : rSet.Put( SfxBoolItem( SID_HELPLINES_VISIBLE, mpDrawView->IsHlplVisible() ) );
251 [ + - ]: 36 : rSet.Put( SfxBoolItem( SID_HELPLINES_USE, mpDrawView->IsHlplSnap() ) );
252 [ + - ]: 36 : rSet.Put( SfxBoolItem( SID_HELPLINES_MOVE, mpDrawView->IsDragStripes() ) );
253 : :
254 [ + - ]: 36 : rSet.Put( SfxBoolItem( SID_SNAP_BORDER, mpDrawView->IsBordSnap() ) );
255 [ + - ]: 36 : rSet.Put( SfxBoolItem( SID_SNAP_FRAME, mpDrawView->IsOFrmSnap() ) );
256 [ + - ]: 36 : rSet.Put( SfxBoolItem( SID_SNAP_POINTS, mpDrawView->IsOPntSnap() ) );
257 : :
258 [ + - ]: 36 : rSet.Put( SfxBoolItem( SID_QUICKEDIT, mpDrawView->IsQuickTextEditMode() ) );
259 : : rSet.Put( SfxBoolItem( SID_PICK_THROUGH, (sal_Bool)
260 [ + - ]: 36 : mpDrawView->GetModel()->IsPickThroughTransparentTextFrames() ) );
261 : :
262 [ + - ]: 36 : rSet.Put( SfxBoolItem( SID_DOUBLECLICK_TEXTEDIT, mpFrameView->IsDoubleClickTextEdit() ) );
263 [ + - ]: 36 : rSet.Put( SfxBoolItem( SID_CLICK_CHANGE_ROTATION, mpFrameView->IsClickChangeRotation() ) );
264 : 36 : }
265 : :
266 : : } // end of namespace sd
267 : :
268 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|