LibreOffice Module sd (master) 1
drviewsg.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <DrawViewShell.hxx>
22
23#include <svx/svxids.hrc>
24#include <svx/imapdlg.hxx>
25#include <sfx2/request.hxx>
26#include <sfx2/viewfrm.hxx>
27#include <svx/svdograf.hxx>
28#include <svx/ImageMapInfo.hxx>
29
30#include <app.hrc>
31
32#include <drawdoc.hxx>
33#include <sdmod.hxx>
34#include <optsitem.hxx>
35#include <FrameView.hxx>
36#include <drawview.hxx>
37
38namespace sd {
39
41{
42 // during a slide show, nothing is executed!
43 if(HasCurrentFunction(SID_PRESENTATION) )
44 return;
45
46 if ( rReq.GetSlot() != SID_IMAP_EXEC )
47 return;
48
49 SdrMark* pMark = mpDrawView->GetMarkedObjectList().GetMark(0);
50
51 if ( !pMark )
52 return;
53
54 SdrObject* pSdrObj = pMark->GetMarkedSdrObj();
56
57 if ( pDlg->GetEditingObject() == static_cast<void*>(pSdrObj) )
58 {
59 const ImageMap& rImageMap = pDlg->GetImageMap();
60 SvxIMapInfo* pIMapInfo = SvxIMapInfo::GetIMapInfo( pSdrObj );
61
62 if ( !pIMapInfo )
63 pSdrObj->AppendUserData( std::unique_ptr<SdrObjUserData>(new SvxIMapInfo( rImageMap )) );
64 else
65 pIMapInfo->SetImageMap( rImageMap );
66
67 GetDoc()->SetChanged();
68 }
69}
70
72{
73 bool bDisable = true;
74
75 if( GetViewFrame()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) )
76 {
77 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
78
79 if ( rMarkList.GetMarkCount() == 1 )
80 {
81 const SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
82
84 if ( ( dynamic_cast< const SdrGrafObj *>( pObj ) != nullptr /*|| pObj->ISA( SdrOle2Obj )*/ )
85 && pImageMapDialog!=nullptr
86 && ( pImageMapDialog->GetEditingObject() == static_cast<void const *>(pObj) ) )
87 {
88 bDisable = false;
89 }
90 }
91 }
92
93 rSet.Put( SfxBoolItem( SID_IMAP_EXEC, bDisable ) );
94}
95
97{
98 // during a slide show, nothing is executed!
99 if(HasCurrentFunction(SID_PRESENTATION))
100 return;
101
102 bool bDefault = false;
103 sal_uInt16 nSlot = rReq.GetSlot();
104
105 SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
106
107 switch( nSlot )
108 {
109 case SID_SOLID_CREATE:
110 pOptions->SetSolidDragging( !mpDrawView->IsSolidDragging() );
111 break;
112
113 // Grid- / Help lines option
114 case SID_GRID_VISIBLE: // not here yet!
115 {
116 pOptions->SetGridVisible( !mpDrawView->IsGridVisible() );
117 }
118 break;
119
120 case SID_GRID_USE:
121 {
122 pOptions->SetUseGridSnap( !mpDrawView->IsGridSnap() );
123 }
124 break;
125
126 case SID_HELPLINES_VISIBLE: // not here yet!
127 {
128 pOptions->SetHelplines( !mpDrawView->IsHlplVisible() );
129 }
130 break;
131
132 case SID_HELPLINES_USE:
133 {
134 pOptions->SetSnapHelplines( !mpDrawView->IsHlplSnap() );
135 }
136 break;
137
138 case SID_HELPLINES_MOVE:
139 {
140 pOptions->SetDragStripes( !mpDrawView->IsDragStripes() );
141 }
142 break;
143
144 case SID_SNAP_BORDER:
145 {
146 pOptions->SetSnapBorder( !mpDrawView->IsBordSnap() );
147 }
148 break;
149
150 case SID_SNAP_FRAME:
151 {
152 pOptions->SetSnapFrame( !mpDrawView->IsOFrmSnap() );
153 }
154 break;
155
156 case SID_SNAP_POINTS:
157 {
158 pOptions->SetSnapPoints( !mpDrawView->IsOPntSnap() );
159 }
160 break;
161
162 case SID_QUICKEDIT:
163 {
164 pOptions->SetQuickEdit( !mpDrawView->IsQuickTextEditMode() );
165 }
166 break;
167
168 case SID_PICK_THROUGH:
169 {
170 pOptions->SetPickThrough(
171 !mpDrawView->GetModel().IsPickThroughTransparentTextFrames() );
172 }
173 break;
174
175 case SID_DOUBLECLICK_TEXTEDIT:
176 {
178 }
179 break;
180
181 case SID_CLICK_CHANGE_ROTATION:
182 {
184 }
185 break;
186
187 default:
188 bDefault = true;
189 break;
190 }
191
192 if( bDefault )
193 return;
194
195 pOptions->StoreConfig();
196
197 // Saves the configuration IMMEDIATELY
198 // SfxGetpApp()->SaveConfiguration();
200
201 mpFrameView->Update( pOptions );
203
204 Invalidate( nSlot );
205 rReq.Done();
206
207}
208
210{
211 rSet.Put( SfxBoolItem( SID_SOLID_CREATE, mpDrawView->IsSolidDragging() ) );
212 rSet.Put( SfxBoolItem( SID_GRID_VISIBLE, mpDrawView->IsGridVisible() ) );
213 rSet.Put( SfxBoolItem( SID_GRID_USE, mpDrawView->IsGridSnap() ) );
214 rSet.Put( SfxBoolItem( SID_HELPLINES_VISIBLE, mpDrawView->IsHlplVisible() ) );
215 rSet.Put( SfxBoolItem( SID_HELPLINES_USE, mpDrawView->IsHlplSnap() ) );
216 rSet.Put( SfxBoolItem( SID_HELPLINES_MOVE, mpDrawView->IsDragStripes() ) );
217
218 rSet.Put( SfxBoolItem( SID_SNAP_BORDER, mpDrawView->IsBordSnap() ) );
219 rSet.Put( SfxBoolItem( SID_SNAP_FRAME, mpDrawView->IsOFrmSnap() ) );
220 rSet.Put( SfxBoolItem( SID_SNAP_POINTS, mpDrawView->IsOPntSnap() ) );
221
222 rSet.Put( SfxBoolItem( SID_QUICKEDIT, mpDrawView->IsQuickTextEditMode() ) );
223 rSet.Put( SfxBoolItem( SID_PICK_THROUGH,
224 mpDrawView->GetModel().IsPickThroughTransparentTextFrames() ) );
225
226 rSet.Put( SfxBoolItem( SID_DOUBLECLICK_TEXTEDIT, mpFrameView->IsDoubleClickTextEdit() ) );
227 rSet.Put( SfxBoolItem( SID_CLICK_CHANGE_ROTATION, mpFrameView->IsClickChangeRotation() ) );
228}
229
230} // end of namespace sd
231
232/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual SAL_DLLPRIVATE void SetChanged(bool bFlag=true) override
Definition: drawdoc.cxx:658
void SetUseGridSnap(bool bSet)
Definition: optsitem.hxx:460
void SetGridVisible(bool bSet)
Definition: optsitem.hxx:462
void SetDragStripes(bool bOn)
Definition: optsitem.hxx:141
void SetHelplines(bool bOn)
Definition: optsitem.hxx:143
void SetDoubleClickTextEdit(bool bOn)
Definition: optsitem.hxx:294
void SetSolidDragging(bool bOn)
Definition: optsitem.hxx:308
void SetQuickEdit(bool bOn)
Definition: optsitem.hxx:290
void SetPickThrough(bool bOn)
Definition: optsitem.hxx:293
void SetClickChangeRotation(bool bOn)
Definition: optsitem.hxx:295
void SetSnapFrame(bool bOn)
Definition: optsitem.hxx:380
void SetSnapPoints(bool bOn)
Definition: optsitem.hxx:381
void SetSnapHelplines(bool bOn)
Definition: optsitem.hxx:378
void SetSnapBorder(bool bOn)
Definition: optsitem.hxx:379
void StoreConfig()
Definition: optsitem.cxx:1401
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
SdrObject * GetMarkedSdrObj() const
void AppendUserData(std::unique_ptr< SdrObjUserData > pData)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
sal_uInt16 GetSlot() const
void Done(bool bRemove=false)
virtual void Invalidate(sal_uInt16 nId=0)
const void * GetEditingObject() const
const ImageMap & GetImageMap() const
void SetImageMap(const ImageMap &rIMap)
static SvxIMapInfo * GetIMapInfo(const SdrObject *pObject)
std::unique_ptr< DrawView > mpDrawView
void GetOptionsBarState(SfxItemSet &rSet)
Definition: drviewsg.cxx:209
virtual void WriteFrameViewData() override
Apply data of the current view on the FrameView.
Definition: drviews5.cxx:311
void GetIMapState(SfxItemSet &rSet)
Definition: drviewsg.cxx:71
void ExecIMap(SfxRequest const &rReq)
Definition: drviewsg.cxx:40
virtual void ReadFrameViewData(FrameView *pView) override
Apply data of the FrameView on the current view.
Definition: drviews5.cxx:131
void ExecOptionsBar(SfxRequest &rReq)
Definition: drviewsg.cxx:96
bool IsClickChangeRotation() const
Definition: FrameView.hxx:130
bool IsDoubleClickTextEdit() const
Definition: FrameView.hxx:127
void Update(SdOptions const *pOptions)
Update with data from the specified SdOptions.
Definition: frmview.cxx:277
static SvxIMapDlg * GetImageMapDialog()
Return a pointer to the image map dialog that is displayed in some child window.
FrameView * mpFrameView
Definition: ViewShell.hxx:453
SdDrawDocument * GetDoc() const
Definition: viewshel.cxx:1412
SD_DLLPUBLIC SfxViewFrame * GetViewFrame() const
Definition: viewshel.cxx:118
bool HasCurrentFunction() const
Definition: ViewShell.hxx:252
#define SD_MOD()
Definition: sdmod.hxx:184
static SfxItemSet & rSet