xref: /AOO41X/main/sw/source/ui/shells/grfsh.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_sw.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir #ifndef _CMDID_H
35*cdf0e10cSrcweir #include <cmdid.h>
36*cdf0e10cSrcweir #endif
37*cdf0e10cSrcweir #include <hintids.hxx>
38*cdf0e10cSrcweir #include <tools/urlobj.hxx>
39*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
40*cdf0e10cSrcweir #include <svl/stritem.hxx>
41*cdf0e10cSrcweir #include <svl/whiter.hxx>
42*cdf0e10cSrcweir #include <svl/urihelper.hxx>
43*cdf0e10cSrcweir #include <sfx2/docfile.hxx>
44*cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir #include <sfx2/objface.hxx>
47*cdf0e10cSrcweir #include <editeng/sizeitem.hxx>
48*cdf0e10cSrcweir #include <editeng/protitem.hxx>
49*cdf0e10cSrcweir #include <sfx2/request.hxx>
50*cdf0e10cSrcweir #include <svl/srchitem.hxx>
51*cdf0e10cSrcweir #include <svx/htmlmode.hxx>
52*cdf0e10cSrcweir #include <svx/sdgluitm.hxx>
53*cdf0e10cSrcweir #include <svx/sdgcoitm.hxx>
54*cdf0e10cSrcweir #include <svx/sdggaitm.hxx>
55*cdf0e10cSrcweir #include <svx/sdgtritm.hxx>
56*cdf0e10cSrcweir #include <svx/sdginitm.hxx>
57*cdf0e10cSrcweir #include <svx/sdgmoitm.hxx>
58*cdf0e10cSrcweir #include <editeng/brshitem.hxx>
59*cdf0e10cSrcweir #include <svx/grfflt.hxx>
60*cdf0e10cSrcweir #include <svx/tbxcolor.hxx>
61*cdf0e10cSrcweir #include <fmturl.hxx>
62*cdf0e10cSrcweir #include <view.hxx>
63*cdf0e10cSrcweir #include <wrtsh.hxx>
64*cdf0e10cSrcweir #include <viewopt.hxx>
65*cdf0e10cSrcweir #include <swmodule.hxx>
66*cdf0e10cSrcweir #include <frmatr.hxx>
67*cdf0e10cSrcweir #include <swundo.hxx>
68*cdf0e10cSrcweir #include <uitool.hxx>
69*cdf0e10cSrcweir #include <docsh.hxx>
70*cdf0e10cSrcweir #include <grfsh.hxx>
71*cdf0e10cSrcweir #include <frmmgr.hxx>
72*cdf0e10cSrcweir #include <frmdlg.hxx>
73*cdf0e10cSrcweir #include <frmfmt.hxx>
74*cdf0e10cSrcweir #include <grfatr.hxx>
75*cdf0e10cSrcweir #include <usrpref.hxx>
76*cdf0e10cSrcweir #include <edtwin.hxx>
77*cdf0e10cSrcweir #include <swwait.hxx>
78*cdf0e10cSrcweir #include <shells.hrc>
79*cdf0e10cSrcweir #include <popup.hrc>
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir #define SwGrfShell
82*cdf0e10cSrcweir #include <sfx2/msg.hxx>
83*cdf0e10cSrcweir #include "swslots.hxx"
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir #include "swabstdlg.hxx"
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir #define TOOLBOX_NAME    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "colorbar" ) )
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir SFX_IMPL_INTERFACE(SwGrfShell, SwBaseShell, SW_RES(STR_SHELLNAME_GRAPHIC))
90*cdf0e10cSrcweir {
91*cdf0e10cSrcweir 	SFX_POPUPMENU_REGISTRATION(SW_RES(MN_GRF_POPUPMENU));
92*cdf0e10cSrcweir 	SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_GRAFIK_TOOLBOX));
93*cdf0e10cSrcweir }
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir void SwGrfShell::Execute(SfxRequest &rReq)
96*cdf0e10cSrcweir {
97*cdf0e10cSrcweir 	SwWrtShell &rSh = GetShell();
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir 	sal_uInt16 nSlot = rReq.GetSlot();
100*cdf0e10cSrcweir 	switch(nSlot)
101*cdf0e10cSrcweir 	{
102*cdf0e10cSrcweir 		case SID_TWAIN_TRANSFER:
103*cdf0e10cSrcweir 		{
104*cdf0e10cSrcweir             GetView().ExecuteScan( rReq );
105*cdf0e10cSrcweir 			break;
106*cdf0e10cSrcweir 		}
107*cdf0e10cSrcweir         case FN_SAVE_GRAPHIC:
108*cdf0e10cSrcweir         {
109*cdf0e10cSrcweir             const Graphic *pGraphic;
110*cdf0e10cSrcweir             if(0 != (pGraphic = rSh.GetGraphic()))
111*cdf0e10cSrcweir             {
112*cdf0e10cSrcweir 			    String sGrfNm, sFilterNm;
113*cdf0e10cSrcweir 			    rSh.GetGrfNms( &sGrfNm, &sFilterNm );
114*cdf0e10cSrcweir                 ExportGraphic( *pGraphic, sGrfNm );
115*cdf0e10cSrcweir             }
116*cdf0e10cSrcweir         }
117*cdf0e10cSrcweir         break;
118*cdf0e10cSrcweir 		case SID_INSERT_GRAPHIC:
119*cdf0e10cSrcweir 		case FN_FORMAT_GRAFIC_DLG:
120*cdf0e10cSrcweir 		{
121*cdf0e10cSrcweir 			SwFlyFrmAttrMgr aMgr( sal_False, &rSh, rSh.IsFrmSelected() ?
122*cdf0e10cSrcweir 											   FRMMGR_TYPE_NONE : FRMMGR_TYPE_GRF);
123*cdf0e10cSrcweir 			const SwViewOption* pVOpt = rSh.GetViewOptions();
124*cdf0e10cSrcweir 			SwViewOption aUsrPref( *pVOpt );
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir 			SfxItemSet aSet(GetPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1,
127*cdf0e10cSrcweir 							RES_GRFATR_MIRRORGRF, 	RES_GRFATR_CROPGRF,
128*cdf0e10cSrcweir 							SID_ATTR_BORDER_INNER, 	SID_ATTR_BORDER_INNER,
129*cdf0e10cSrcweir 							SID_ATTR_GRAF_KEEP_ZOOM, SID_ATTR_GRAF_KEEP_ZOOM,
130*cdf0e10cSrcweir 							SID_ATTR_GRAF_FRMSIZE, SID_ATTR_GRAF_FRMSIZE,
131*cdf0e10cSrcweir 							SID_ATTR_GRAF_FRMSIZE_PERCENT, SID_ATTR_GRAF_FRMSIZE_PERCENT,
132*cdf0e10cSrcweir 							SID_ATTR_GRAF_GRAPHIC, SID_ATTR_GRAF_GRAPHIC,
133*cdf0e10cSrcweir 							FN_PARAM_GRF_CONNECT, 	FN_PARAM_GRF_CONNECT,
134*cdf0e10cSrcweir 							SID_ATTR_PAGE_SIZE, 	SID_ATTR_PAGE_SIZE,
135*cdf0e10cSrcweir 							FN_GET_PRINT_AREA, 		FN_GET_PRINT_AREA,
136*cdf0e10cSrcweir 							FN_SET_FRM_NAME, 		FN_KEEP_ASPECT_RATIO,
137*cdf0e10cSrcweir 							FN_PARAM_GRF_DIALOG, 	FN_PARAM_GRF_DIALOG,
138*cdf0e10cSrcweir 							SID_DOCFRAME, 			SID_DOCFRAME,
139*cdf0e10cSrcweir 							SID_HTML_MODE, 			SID_HTML_MODE,
140*cdf0e10cSrcweir 							FN_SET_FRM_ALT_NAME,	FN_SET_FRM_ALT_NAME,
141*cdf0e10cSrcweir 							0);
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir 			sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
144*cdf0e10cSrcweir 			aSet.Put(SfxUInt16Item(SID_HTML_MODE, nHtmlMode));
145*cdf0e10cSrcweir 			FieldUnit eMetric = ::GetDfltMetric((0 != (nHtmlMode&HTMLMODE_ON)));
146*cdf0e10cSrcweir             SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir 			const SwRect* pRect = &rSh.GetAnyCurRect(RECT_PAGE);
149*cdf0e10cSrcweir 			SwFmtFrmSize aFrmSize( ATT_VAR_SIZE, pRect->Width(), pRect->Height());
150*cdf0e10cSrcweir 			aFrmSize.SetWhich( GetPool().GetWhich( SID_ATTR_PAGE_SIZE ) );
151*cdf0e10cSrcweir 			aSet.Put( aFrmSize );
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir 			aSet.Put(SfxStringItem(FN_SET_FRM_NAME, rSh.GetFlyName()));
154*cdf0e10cSrcweir             if ( nSlot == FN_FORMAT_GRAFIC_DLG )
155*cdf0e10cSrcweir             {
156*cdf0e10cSrcweir                 // --> OD 2009-07-13 #i73249#
157*cdf0e10cSrcweir //                aSet.Put(SfxStringItem(FN_SET_FRM_ALT_NAME, rSh.GetAlternateText()));
158*cdf0e10cSrcweir                 aSet.Put( SfxStringItem( FN_SET_FRM_ALT_NAME, rSh.GetObjTitle() ) );
159*cdf0e10cSrcweir                 // <--
160*cdf0e10cSrcweir             }
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir 			pRect = &rSh.GetAnyCurRect(RECT_PAGE_PRT);
163*cdf0e10cSrcweir 			aFrmSize.SetWidth( pRect->Width() );
164*cdf0e10cSrcweir 			aFrmSize.SetHeight( pRect->Height() );
165*cdf0e10cSrcweir 			aFrmSize.SetWhich( GetPool().GetWhich(FN_GET_PRINT_AREA) );
166*cdf0e10cSrcweir 			aSet.Put( aFrmSize );
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir 			aSet.Put( aMgr.GetAttrSet() );
169*cdf0e10cSrcweir 			aSet.SetParent( aMgr.GetAttrSet().GetParent() );
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir 			// Bei %-Werten Groesse initialisieren
172*cdf0e10cSrcweir 			SwFmtFrmSize aSizeCopy = (const SwFmtFrmSize&)aSet.Get(RES_FRM_SIZE);
173*cdf0e10cSrcweir 			if (aSizeCopy.GetWidthPercent() && aSizeCopy.GetWidthPercent() != 0xff)
174*cdf0e10cSrcweir 				aSizeCopy.SetWidth(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Width());
175*cdf0e10cSrcweir 			if (aSizeCopy.GetHeightPercent() && aSizeCopy.GetHeightPercent() != 0xff)
176*cdf0e10cSrcweir 				aSizeCopy.SetHeight(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Height());
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir 			// and now set the size for "external" tabpages
179*cdf0e10cSrcweir 			{
180*cdf0e10cSrcweir 				SvxSizeItem aSzItm( SID_ATTR_GRAF_FRMSIZE, aSizeCopy.GetSize() );
181*cdf0e10cSrcweir 				aSet.Put( aSzItm );
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir 				Size aSz( aSizeCopy.GetWidthPercent(), aSizeCopy.GetHeightPercent() );
184*cdf0e10cSrcweir 				if( 0xff == aSz.Width() ) 	aSz.Width() = 0;
185*cdf0e10cSrcweir 				if( 0xff == aSz.Height() )  aSz.Height() = 0;
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir 				aSzItm.SetSize( aSz );
188*cdf0e10cSrcweir 				aSzItm.SetWhich( SID_ATTR_GRAF_FRMSIZE_PERCENT );
189*cdf0e10cSrcweir 				aSet.Put( aSzItm );
190*cdf0e10cSrcweir 			}
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir 			String sGrfNm, sFilterNm;
193*cdf0e10cSrcweir 			rSh.GetGrfNms( &sGrfNm, &sFilterNm );
194*cdf0e10cSrcweir 			if( sGrfNm.Len() )
195*cdf0e10cSrcweir 			{
196*cdf0e10cSrcweir 				aSet.Put( SvxBrushItem( INetURLObject::decode( sGrfNm,
197*cdf0e10cSrcweir 										INET_HEX_ESCAPE,
198*cdf0e10cSrcweir 						   				INetURLObject::DECODE_UNAMBIGUOUS,
199*cdf0e10cSrcweir 										RTL_TEXTENCODING_UTF8 ),
200*cdf0e10cSrcweir 										sFilterNm, GPOS_LT,
201*cdf0e10cSrcweir 										SID_ATTR_GRAF_GRAPHIC ));
202*cdf0e10cSrcweir 			}
203*cdf0e10cSrcweir 			else
204*cdf0e10cSrcweir 			{
205*cdf0e10cSrcweir                 // --> OD 2005-02-09 #119353# - robust
206*cdf0e10cSrcweir                 const GraphicObject* pGrfObj = rSh.GetGraphicObj();
207*cdf0e10cSrcweir                 if ( pGrfObj )
208*cdf0e10cSrcweir                 {
209*cdf0e10cSrcweir                     aSet.Put( SvxBrushItem( *pGrfObj, GPOS_LT,
210*cdf0e10cSrcweir                                             SID_ATTR_GRAF_GRAPHIC ) );
211*cdf0e10cSrcweir                 }
212*cdf0e10cSrcweir                 // <--
213*cdf0e10cSrcweir 			}
214*cdf0e10cSrcweir             aSet.Put( SfxBoolItem( FN_PARAM_GRF_CONNECT, sGrfNm.Len() > 0 ) );
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir 			// get Mirror and Crop
217*cdf0e10cSrcweir 			{
218*cdf0e10cSrcweir 				SfxItemSet aTmpSet( rSh.GetAttrPool(),
219*cdf0e10cSrcweir 								RES_GRFATR_MIRRORGRF, RES_GRFATR_CROPGRF );
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir                 rSh.GetCurAttr( aTmpSet );
222*cdf0e10cSrcweir 				aSet.Put( aTmpSet );
223*cdf0e10cSrcweir 			}
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir 			aSet.Put(SfxBoolItem(FN_KEEP_ASPECT_RATIO, aUsrPref.IsKeepRatio()));
226*cdf0e10cSrcweir 			aSet.Put(SfxBoolItem( SID_ATTR_GRAF_KEEP_ZOOM, aUsrPref.IsGrfKeepZoom()));
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir 			aSet.Put(SfxFrameItem( SID_DOCFRAME, &GetView().GetViewFrame()->GetTopFrame()));
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir 			SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
231*cdf0e10cSrcweir             DBG_ASSERT(pFact, "Dialogdiet fail!");
232*cdf0e10cSrcweir             SfxAbstractTabDialog* pDlg = pFact->CreateFrmTabDialog( DLG_FRM_GRF,
233*cdf0e10cSrcweir 													GetView().GetViewFrame(),
234*cdf0e10cSrcweir 													GetView().GetWindow(),
235*cdf0e10cSrcweir 													aSet, sal_False, DLG_FRM_GRF);
236*cdf0e10cSrcweir             DBG_ASSERT(pDlg, "Dialogdiet fail!");
237*cdf0e10cSrcweir 			if( pDlg->Execute() )
238*cdf0e10cSrcweir 			{
239*cdf0e10cSrcweir 				rSh.StartAllAction();
240*cdf0e10cSrcweir 				rSh.StartUndo(UNDO_START);
241*cdf0e10cSrcweir 				const SfxPoolItem* pItem;
242*cdf0e10cSrcweir 				SfxItemSet* pSet = (SfxItemSet*)pDlg->GetOutputItemSet();
243*cdf0e10cSrcweir                 rReq.Done(*pSet);
244*cdf0e10cSrcweir 				// change the 2 frmsize SizeItems to the correct SwFrmSizeItem
245*cdf0e10cSrcweir 				if( SFX_ITEM_SET == pSet->GetItemState(
246*cdf0e10cSrcweir 								SID_ATTR_GRAF_FRMSIZE, sal_False, &pItem ))
247*cdf0e10cSrcweir 				{
248*cdf0e10cSrcweir 					SwFmtFrmSize aSize;
249*cdf0e10cSrcweir 					const Size& rSz = ((SvxSizeItem*)pItem)->GetSize();
250*cdf0e10cSrcweir 					aSize.SetWidth( rSz.Width() );
251*cdf0e10cSrcweir 					aSize.SetHeight( rSz.Height() );
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir 					if( SFX_ITEM_SET == pSet->GetItemState(
254*cdf0e10cSrcweir 							SID_ATTR_GRAF_FRMSIZE_PERCENT, sal_False, &pItem ))
255*cdf0e10cSrcweir 					{
256*cdf0e10cSrcweir                         const Size& rRelativeSize = ((SvxSizeItem*)pItem)->GetSize();
257*cdf0e10cSrcweir                         aSize.SetWidthPercent( static_cast< sal_uInt8 >( rRelativeSize.Width() ) );
258*cdf0e10cSrcweir                         aSize.SetHeightPercent( static_cast< sal_uInt8 >( rRelativeSize.Height() ) );
259*cdf0e10cSrcweir 					}
260*cdf0e10cSrcweir 					pSet->Put( aSize );
261*cdf0e10cSrcweir 				}
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir 				// Vorlagen-AutoUpdate
264*cdf0e10cSrcweir 				SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
265*cdf0e10cSrcweir 				if(pFmt && pFmt->IsAutoUpdateFmt())
266*cdf0e10cSrcweir 				{
267*cdf0e10cSrcweir                     pFmt->SetFmtAttr(*pSet);
268*cdf0e10cSrcweir 					SfxItemSet aShellSet(GetPool(), RES_FRM_SIZE,	RES_FRM_SIZE,
269*cdf0e10cSrcweir 													RES_SURROUND, 	RES_SURROUND,
270*cdf0e10cSrcweir 													RES_ANCHOR,		RES_ANCHOR,
271*cdf0e10cSrcweir 													RES_VERT_ORIENT,RES_HORI_ORIENT,
272*cdf0e10cSrcweir 													0);
273*cdf0e10cSrcweir 					aShellSet.Put(*pSet);
274*cdf0e10cSrcweir 					aMgr.SetAttrSet(aShellSet);
275*cdf0e10cSrcweir 				}
276*cdf0e10cSrcweir 				else
277*cdf0e10cSrcweir 				{
278*cdf0e10cSrcweir 					aMgr.SetAttrSet(*pSet);
279*cdf0e10cSrcweir 				}
280*cdf0e10cSrcweir 				aMgr.UpdateFlyFrm();
281*cdf0e10cSrcweir 
282*cdf0e10cSrcweir 				sal_Bool bApplyUsrPref = sal_False;
283*cdf0e10cSrcweir 				if (SFX_ITEM_SET == pSet->GetItemState(
284*cdf0e10cSrcweir 					FN_KEEP_ASPECT_RATIO, sal_True, &pItem ))
285*cdf0e10cSrcweir 				{
286*cdf0e10cSrcweir 					aUsrPref.SetKeepRatio(
287*cdf0e10cSrcweir 									((const SfxBoolItem*)pItem)->GetValue() );
288*cdf0e10cSrcweir 					bApplyUsrPref = sal_True;
289*cdf0e10cSrcweir 				}
290*cdf0e10cSrcweir 				if( SFX_ITEM_SET == pSet->GetItemState(
291*cdf0e10cSrcweir 					SID_ATTR_GRAF_KEEP_ZOOM, sal_True, &pItem ))
292*cdf0e10cSrcweir 				{
293*cdf0e10cSrcweir 					aUsrPref.SetGrfKeepZoom(
294*cdf0e10cSrcweir 									((const SfxBoolItem*)pItem)->GetValue() );
295*cdf0e10cSrcweir 					bApplyUsrPref = sal_True;
296*cdf0e10cSrcweir 				}
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir 				if( bApplyUsrPref )
299*cdf0e10cSrcweir 					SW_MOD()->ApplyUsrPref(aUsrPref, &GetView());
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir 				// and now set all the graphic attributes and other stuff
302*cdf0e10cSrcweir 				if( SFX_ITEM_SET == pSet->GetItemState(
303*cdf0e10cSrcweir 										SID_ATTR_GRAF_GRAPHIC, sal_True, &pItem ))
304*cdf0e10cSrcweir 				{
305*cdf0e10cSrcweir 					if( ((SvxBrushItem*)pItem)->GetGraphicLink() )
306*cdf0e10cSrcweir 						sGrfNm = *((SvxBrushItem*)pItem)->GetGraphicLink();
307*cdf0e10cSrcweir 					else
308*cdf0e10cSrcweir 						sGrfNm.Erase();
309*cdf0e10cSrcweir 
310*cdf0e10cSrcweir 					if( ((SvxBrushItem*)pItem)->GetGraphicFilter() )
311*cdf0e10cSrcweir 						sFilterNm = *((SvxBrushItem*)pItem)->GetGraphicFilter();
312*cdf0e10cSrcweir 					else
313*cdf0e10cSrcweir 						sFilterNm.Erase();
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir 					if( sGrfNm.Len() )
316*cdf0e10cSrcweir 					{
317*cdf0e10cSrcweir                         SwDocShell* pDocSh = GetView().GetDocShell();
318*cdf0e10cSrcweir                         SwWait aWait( *pDocSh, sal_True );
319*cdf0e10cSrcweir                         SfxMedium* pMedium = pDocSh->GetMedium();
320*cdf0e10cSrcweir                         INetURLObject aAbs;
321*cdf0e10cSrcweir                         if( pMedium )
322*cdf0e10cSrcweir                             aAbs = pMedium->GetURLObject();
323*cdf0e10cSrcweir                         rSh.ReRead( URIHelper::SmartRel2Abs(
324*cdf0e10cSrcweir                                         aAbs, sGrfNm,
325*cdf0e10cSrcweir                                         URIHelper::GetMaybeFileHdl() ),
326*cdf0e10cSrcweir 								 	sFilterNm, 0 );
327*cdf0e10cSrcweir 					}
328*cdf0e10cSrcweir 				}
329*cdf0e10cSrcweir                 if ( SFX_ITEM_SET == pSet->GetItemState(
330*cdf0e10cSrcweir 										FN_SET_FRM_ALT_NAME, sal_True, &pItem ))
331*cdf0e10cSrcweir                 {
332*cdf0e10cSrcweir                     // --> OD 2009-07-13 #i73249#
333*cdf0e10cSrcweir //                    rSh.SetAlternateText(
334*cdf0e10cSrcweir //                                ((const SfxStringItem*)pItem)->GetValue() );
335*cdf0e10cSrcweir                     rSh.SetObjTitle( ((const SfxStringItem*)pItem)->GetValue() );
336*cdf0e10cSrcweir                     // <--
337*cdf0e10cSrcweir                 }
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir 				SfxItemSet aGrfSet( rSh.GetAttrPool(), RES_GRFATR_BEGIN,
340*cdf0e10cSrcweir 													   RES_GRFATR_END-1 );
341*cdf0e10cSrcweir 				aGrfSet.Put( *pSet );
342*cdf0e10cSrcweir 				if( aGrfSet.Count() )
343*cdf0e10cSrcweir 					rSh.SetAttr( aGrfSet );
344*cdf0e10cSrcweir 
345*cdf0e10cSrcweir 				rSh.EndUndo(UNDO_END);
346*cdf0e10cSrcweir 				rSh.EndAllAction();
347*cdf0e10cSrcweir 			}
348*cdf0e10cSrcweir 			delete pDlg;
349*cdf0e10cSrcweir 		}
350*cdf0e10cSrcweir 		break;
351*cdf0e10cSrcweir 
352*cdf0e10cSrcweir 		case FN_GRAPHIC_MIRROR_ON_EVEN_PAGES:
353*cdf0e10cSrcweir 		{
354*cdf0e10cSrcweir 			SfxItemSet aSet(rSh.GetAttrPool(), RES_GRFATR_MIRRORGRF, RES_GRFATR_MIRRORGRF);
355*cdf0e10cSrcweir             rSh.GetCurAttr( aSet );
356*cdf0e10cSrcweir 			SwMirrorGrf aGrf((const SwMirrorGrf &)aSet.Get(RES_GRFATR_MIRRORGRF));
357*cdf0e10cSrcweir 			aGrf.SetGrfToggle(!aGrf.IsGrfToggle());
358*cdf0e10cSrcweir 			rSh.SetAttr(aGrf);
359*cdf0e10cSrcweir 		}
360*cdf0e10cSrcweir 		break;
361*cdf0e10cSrcweir 
362*cdf0e10cSrcweir 		default:
363*cdf0e10cSrcweir 			ASSERT(!this, falscher Dispatcher);
364*cdf0e10cSrcweir 			return;
365*cdf0e10cSrcweir 	}
366*cdf0e10cSrcweir }
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir 
369*cdf0e10cSrcweir void SwGrfShell::ExecAttr( SfxRequest &rReq )
370*cdf0e10cSrcweir {
371*cdf0e10cSrcweir 	sal_uInt16 nGrfType;
372*cdf0e10cSrcweir 	if( CNT_GRF == GetShell().GetCntType() &&
373*cdf0e10cSrcweir 		( GRAPHIC_BITMAP == ( nGrfType = GetShell().GetGraphicType()) ||
374*cdf0e10cSrcweir 		  GRAPHIC_GDIMETAFILE == nGrfType ))
375*cdf0e10cSrcweir 	{
376*cdf0e10cSrcweir 		SfxItemSet aGrfSet( GetShell().GetAttrPool(), RES_GRFATR_BEGIN,
377*cdf0e10cSrcweir 													  RES_GRFATR_END -1 );
378*cdf0e10cSrcweir     	const SfxItemSet *pArgs = rReq.GetArgs();
379*cdf0e10cSrcweir     	const SfxPoolItem* pItem;
380*cdf0e10cSrcweir     	sal_uInt16 nSlot = rReq.GetSlot();
381*cdf0e10cSrcweir 	    if( !pArgs || SFX_ITEM_SET != pArgs->GetItemState( nSlot, sal_False, &pItem ))
382*cdf0e10cSrcweir 			pItem = 0;
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir 		switch( nSlot )
385*cdf0e10cSrcweir 		{
386*cdf0e10cSrcweir 			case FN_FLIP_VERT_GRAFIC:
387*cdf0e10cSrcweir 			case FN_FLIP_HORZ_GRAFIC:
388*cdf0e10cSrcweir 			{
389*cdf0e10cSrcweir                 GetShell().GetCurAttr( aGrfSet );
390*cdf0e10cSrcweir 				SwMirrorGrf aMirror( (SwMirrorGrf&)aGrfSet.Get(
391*cdf0e10cSrcweir 													RES_GRFATR_MIRRORGRF ) );
392*cdf0e10cSrcweir 				sal_uInt16 nMirror = aMirror.GetValue();
393*cdf0e10cSrcweir 				if( FN_FLIP_VERT_GRAFIC == nSlot )
394*cdf0e10cSrcweir 					switch( nMirror )
395*cdf0e10cSrcweir 					{
396*cdf0e10cSrcweir                     case RES_MIRROR_GRAPH_DONT: nMirror = RES_MIRROR_GRAPH_VERT;
397*cdf0e10cSrcweir 												break;
398*cdf0e10cSrcweir                     case RES_MIRROR_GRAPH_HOR:  nMirror = RES_MIRROR_GRAPH_BOTH;
399*cdf0e10cSrcweir 												break;
400*cdf0e10cSrcweir                     case RES_MIRROR_GRAPH_VERT:   nMirror = RES_MIRROR_GRAPH_DONT;
401*cdf0e10cSrcweir 												break;
402*cdf0e10cSrcweir                     case RES_MIRROR_GRAPH_BOTH: nMirror = RES_MIRROR_GRAPH_HOR;
403*cdf0e10cSrcweir 												break;
404*cdf0e10cSrcweir 					}
405*cdf0e10cSrcweir 				else
406*cdf0e10cSrcweir 					switch( nMirror )
407*cdf0e10cSrcweir 					{
408*cdf0e10cSrcweir                     case RES_MIRROR_GRAPH_DONT: nMirror = RES_MIRROR_GRAPH_HOR;
409*cdf0e10cSrcweir 												break;
410*cdf0e10cSrcweir                     case RES_MIRROR_GRAPH_VERT: nMirror = RES_MIRROR_GRAPH_BOTH;
411*cdf0e10cSrcweir 												break;
412*cdf0e10cSrcweir                     case RES_MIRROR_GRAPH_HOR:    nMirror = RES_MIRROR_GRAPH_DONT;
413*cdf0e10cSrcweir 												break;
414*cdf0e10cSrcweir                     case RES_MIRROR_GRAPH_BOTH: nMirror = RES_MIRROR_GRAPH_VERT;
415*cdf0e10cSrcweir 												break;
416*cdf0e10cSrcweir 					}
417*cdf0e10cSrcweir 				aMirror.SetValue( nMirror );
418*cdf0e10cSrcweir 				aGrfSet.ClearItem();
419*cdf0e10cSrcweir 				aGrfSet.Put( aMirror );
420*cdf0e10cSrcweir 			}
421*cdf0e10cSrcweir 			break;
422*cdf0e10cSrcweir 
423*cdf0e10cSrcweir 		case SID_ATTR_GRAF_LUMINANCE:
424*cdf0e10cSrcweir 			if( pItem )
425*cdf0e10cSrcweir 				aGrfSet.Put( SwLuminanceGrf(
426*cdf0e10cSrcweir 							((SfxInt16Item*)pItem)->GetValue() ));
427*cdf0e10cSrcweir 			break;
428*cdf0e10cSrcweir 		case SID_ATTR_GRAF_CONTRAST:
429*cdf0e10cSrcweir 			if( pItem )
430*cdf0e10cSrcweir 				aGrfSet.Put( SwContrastGrf(
431*cdf0e10cSrcweir 							((SfxInt16Item*)pItem)->GetValue() ));
432*cdf0e10cSrcweir 			break;
433*cdf0e10cSrcweir 		case SID_ATTR_GRAF_RED:
434*cdf0e10cSrcweir 			if( pItem )
435*cdf0e10cSrcweir 				aGrfSet.Put( SwChannelRGrf(
436*cdf0e10cSrcweir 							((SfxInt16Item*)pItem)->GetValue() ));
437*cdf0e10cSrcweir 			break;
438*cdf0e10cSrcweir 		case SID_ATTR_GRAF_GREEN:
439*cdf0e10cSrcweir 			if( pItem )
440*cdf0e10cSrcweir 				aGrfSet.Put( SwChannelGGrf(
441*cdf0e10cSrcweir 							((SfxInt16Item*)pItem)->GetValue() ));
442*cdf0e10cSrcweir 			break;
443*cdf0e10cSrcweir 		case SID_ATTR_GRAF_BLUE:
444*cdf0e10cSrcweir 			if( pItem )
445*cdf0e10cSrcweir 				aGrfSet.Put( SwChannelBGrf(
446*cdf0e10cSrcweir 							((SfxInt16Item*)pItem)->GetValue() ));
447*cdf0e10cSrcweir 			break;
448*cdf0e10cSrcweir 		case SID_ATTR_GRAF_GAMMA:
449*cdf0e10cSrcweir 			if( pItem )
450*cdf0e10cSrcweir 			{
451*cdf0e10cSrcweir 				double fVal = ((SfxUInt32Item*)pItem)->GetValue();
452*cdf0e10cSrcweir 				aGrfSet.Put( SwGammaGrf(fVal/100. ));
453*cdf0e10cSrcweir 			}
454*cdf0e10cSrcweir 			break;
455*cdf0e10cSrcweir 		case SID_ATTR_GRAF_TRANSPARENCE:
456*cdf0e10cSrcweir 			if( pItem )
457*cdf0e10cSrcweir                 aGrfSet.Put( SwTransparencyGrf(
458*cdf0e10cSrcweir                     static_cast< sal_Int8 >( ( (SfxUInt16Item*)pItem )->GetValue() ) ) );
459*cdf0e10cSrcweir 			break;
460*cdf0e10cSrcweir 		case SID_ATTR_GRAF_INVERT:
461*cdf0e10cSrcweir 			if( pItem )
462*cdf0e10cSrcweir 				aGrfSet.Put( SwInvertGrf(
463*cdf0e10cSrcweir 							((SfxBoolItem*)pItem)->GetValue() ));
464*cdf0e10cSrcweir 			break;
465*cdf0e10cSrcweir 
466*cdf0e10cSrcweir 		case SID_ATTR_GRAF_MODE:
467*cdf0e10cSrcweir 			if( pItem )
468*cdf0e10cSrcweir 				aGrfSet.Put( SwDrawModeGrf(
469*cdf0e10cSrcweir 							((SfxUInt16Item*)pItem)->GetValue() ));
470*cdf0e10cSrcweir 			break;
471*cdf0e10cSrcweir 
472*cdf0e10cSrcweir         case SID_COLOR_SETTINGS:
473*cdf0e10cSrcweir         {
474*cdf0e10cSrcweir             svx::ToolboxAccess aToolboxAccess( TOOLBOX_NAME );
475*cdf0e10cSrcweir             aToolboxAccess.toggleToolbox();
476*cdf0e10cSrcweir             break;
477*cdf0e10cSrcweir         }
478*cdf0e10cSrcweir         case SID_GRFFILTER:
479*cdf0e10cSrcweir         case SID_GRFFILTER_INVERT:
480*cdf0e10cSrcweir 		case SID_GRFFILTER_SMOOTH:
481*cdf0e10cSrcweir 		case SID_GRFFILTER_SHARPEN:
482*cdf0e10cSrcweir 		case SID_GRFFILTER_REMOVENOISE:
483*cdf0e10cSrcweir 		case SID_GRFFILTER_SOBEL:
484*cdf0e10cSrcweir 		case SID_GRFFILTER_MOSAIC:
485*cdf0e10cSrcweir 		case SID_GRFFILTER_EMBOSS:
486*cdf0e10cSrcweir 		case SID_GRFFILTER_POSTER:
487*cdf0e10cSrcweir 		case SID_GRFFILTER_POPART:
488*cdf0e10cSrcweir 		case SID_GRFFILTER_SEPIA:
489*cdf0e10cSrcweir 		case SID_GRFFILTER_SOLARIZE:
490*cdf0e10cSrcweir 			if( GRAPHIC_BITMAP == nGrfType )
491*cdf0e10cSrcweir 			{
492*cdf0e10cSrcweir                 // --> OD 2005-02-09 #119353# - robust
493*cdf0e10cSrcweir                 const GraphicObject* pFilterObj( GetShell().GetGraphicObj() );
494*cdf0e10cSrcweir                 if ( pFilterObj )
495*cdf0e10cSrcweir                 {
496*cdf0e10cSrcweir                     GraphicObject aFilterObj( *pFilterObj );
497*cdf0e10cSrcweir                     if( SVX_GRAPHICFILTER_ERRCODE_NONE ==
498*cdf0e10cSrcweir                         SvxGraphicFilter::ExecuteGrfFilterSlot( rReq, aFilterObj ))
499*cdf0e10cSrcweir                         GetShell().ReRead( aEmptyStr, aEmptyStr,
500*cdf0e10cSrcweir                                            &aFilterObj.GetGraphic() );
501*cdf0e10cSrcweir                 }
502*cdf0e10cSrcweir                 // <--
503*cdf0e10cSrcweir 			}
504*cdf0e10cSrcweir 			break;
505*cdf0e10cSrcweir 
506*cdf0e10cSrcweir 		default:
507*cdf0e10cSrcweir 			ASSERT(!this, falscher Dispatcher);
508*cdf0e10cSrcweir 		}
509*cdf0e10cSrcweir 		if( aGrfSet.Count() )
510*cdf0e10cSrcweir 			GetShell().SetAttr( aGrfSet );
511*cdf0e10cSrcweir 	}
512*cdf0e10cSrcweir 	GetView().GetViewFrame()->GetBindings().Invalidate(rReq.GetSlot());
513*cdf0e10cSrcweir }
514*cdf0e10cSrcweir 
515*cdf0e10cSrcweir void SwGrfShell::GetAttrState(SfxItemSet &rSet)
516*cdf0e10cSrcweir {
517*cdf0e10cSrcweir 	SwWrtShell &rSh = GetShell();
518*cdf0e10cSrcweir 	SfxItemSet aCoreSet( GetPool(), aNoTxtNodeSetRange );
519*cdf0e10cSrcweir     rSh.GetCurAttr( aCoreSet );
520*cdf0e10cSrcweir 	sal_Bool bParentCntProt = 0 != rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT );
521*cdf0e10cSrcweir 	sal_Bool bIsGrfCntnt = CNT_GRF == GetShell().GetCntType();
522*cdf0e10cSrcweir //    const GraphicObject* pGrfObj = ( bIsGrfCntnt ? rSh.GetGraphicObj() : NULL );
523*cdf0e10cSrcweir //    sal_Bool bIsRenderGraphicGrfCntnt = ( pGrfObj && pGrfObj->IsRenderGraphic() );
524*cdf0e10cSrcweir 
525*cdf0e10cSrcweir     // --> OD 2006-11-03 #i59688#
526*cdf0e10cSrcweir //    sal_Bool bSwappedOut = rSh.IsGrfSwapOut( sal_True );
527*cdf0e10cSrcweir //    sal_Bool bBitmapType = !bSwappedOut && GRAPHIC_BITMAP == rSh.GetGraphicType();
528*cdf0e10cSrcweir     // <--
529*cdf0e10cSrcweir 
530*cdf0e10cSrcweir     SetGetStateSet( &rSet );
531*cdf0e10cSrcweir 
532*cdf0e10cSrcweir 	SfxWhichIter aIter( rSet );
533*cdf0e10cSrcweir 	sal_uInt16 nWhich = aIter.FirstWhich();
534*cdf0e10cSrcweir 	while( nWhich )
535*cdf0e10cSrcweir 	{
536*cdf0e10cSrcweir 		sal_Bool bDisable = bParentCntProt;
537*cdf0e10cSrcweir 		switch( nWhich )
538*cdf0e10cSrcweir 		{
539*cdf0e10cSrcweir 		case SID_INSERT_GRAPHIC:
540*cdf0e10cSrcweir         case FN_FORMAT_GRAFIC_DLG:
541*cdf0e10cSrcweir 		case SID_TWAIN_TRANSFER:
542*cdf0e10cSrcweir 			if( bParentCntProt || !bIsGrfCntnt )
543*cdf0e10cSrcweir 				bDisable = sal_True;
544*cdf0e10cSrcweir 			break;
545*cdf0e10cSrcweir         case FN_SAVE_GRAPHIC:
546*cdf0e10cSrcweir 			if( rSh.GetGraphicType() == GRAPHIC_NONE )
547*cdf0e10cSrcweir 			    bDisable = sal_True;
548*cdf0e10cSrcweir         break;
549*cdf0e10cSrcweir         case SID_COLOR_SETTINGS:
550*cdf0e10cSrcweir         {
551*cdf0e10cSrcweir             if ( bParentCntProt || !bIsGrfCntnt )
552*cdf0e10cSrcweir                 bDisable = sal_True;
553*cdf0e10cSrcweir             else
554*cdf0e10cSrcweir             {
555*cdf0e10cSrcweir                 svx::ToolboxAccess aToolboxAccess( TOOLBOX_NAME );
556*cdf0e10cSrcweir                 rSet.Put( SfxBoolItem( nWhich, aToolboxAccess.isToolboxVisible() ) );
557*cdf0e10cSrcweir             }
558*cdf0e10cSrcweir             break;
559*cdf0e10cSrcweir         }
560*cdf0e10cSrcweir 
561*cdf0e10cSrcweir         case FN_FLIP_VERT_GRAFIC:
562*cdf0e10cSrcweir 			if( !bParentCntProt )
563*cdf0e10cSrcweir 			{
564*cdf0e10cSrcweir                 MirrorGraph nState = static_cast< MirrorGraph >(((const SwMirrorGrf &) aCoreSet.Get(
565*cdf0e10cSrcweir                                         RES_GRFATR_MIRRORGRF )).GetValue());
566*cdf0e10cSrcweir 
567*cdf0e10cSrcweir                 rSet.Put(SfxBoolItem( nWhich, nState == RES_MIRROR_GRAPH_VERT ||
568*cdf0e10cSrcweir                                               nState == RES_MIRROR_GRAPH_BOTH));
569*cdf0e10cSrcweir 			}
570*cdf0e10cSrcweir 			break;
571*cdf0e10cSrcweir 
572*cdf0e10cSrcweir 		case FN_FLIP_HORZ_GRAFIC:
573*cdf0e10cSrcweir 			if( !bParentCntProt )
574*cdf0e10cSrcweir 			{
575*cdf0e10cSrcweir                 MirrorGraph nState = static_cast< MirrorGraph >(((const SwMirrorGrf &) aCoreSet.Get(
576*cdf0e10cSrcweir                                         RES_GRFATR_MIRRORGRF )).GetValue());
577*cdf0e10cSrcweir 
578*cdf0e10cSrcweir                 rSet.Put(SfxBoolItem( nWhich, nState == RES_MIRROR_GRAPH_HOR ||
579*cdf0e10cSrcweir                                               nState == RES_MIRROR_GRAPH_BOTH));
580*cdf0e10cSrcweir 			}
581*cdf0e10cSrcweir 			break;
582*cdf0e10cSrcweir 
583*cdf0e10cSrcweir 
584*cdf0e10cSrcweir 		case SID_ATTR_GRAF_LUMINANCE:
585*cdf0e10cSrcweir 			if( !bParentCntProt )
586*cdf0e10cSrcweir 				rSet.Put( SfxInt16Item( nWhich, ((SwLuminanceGrf&)
587*cdf0e10cSrcweir 						aCoreSet.Get(RES_GRFATR_LUMINANCE)).GetValue() ));
588*cdf0e10cSrcweir 			break;
589*cdf0e10cSrcweir 		case SID_ATTR_GRAF_CONTRAST:
590*cdf0e10cSrcweir 			if( !bParentCntProt )
591*cdf0e10cSrcweir 				rSet.Put( SfxInt16Item( nWhich, ((SwContrastGrf&)
592*cdf0e10cSrcweir 						aCoreSet.Get(RES_GRFATR_CONTRAST)).GetValue() ));
593*cdf0e10cSrcweir 			break;
594*cdf0e10cSrcweir 		case SID_ATTR_GRAF_RED:
595*cdf0e10cSrcweir 			if( !bParentCntProt )
596*cdf0e10cSrcweir 				rSet.Put( SfxInt16Item( nWhich, ((SwChannelRGrf&)
597*cdf0e10cSrcweir 						aCoreSet.Get(RES_GRFATR_CHANNELR)).GetValue() ));
598*cdf0e10cSrcweir 			break;
599*cdf0e10cSrcweir 		case SID_ATTR_GRAF_GREEN:
600*cdf0e10cSrcweir 			if( !bParentCntProt )
601*cdf0e10cSrcweir 				rSet.Put( SfxInt16Item( nWhich, ((SwChannelGGrf&)
602*cdf0e10cSrcweir 						aCoreSet.Get(RES_GRFATR_CHANNELG)).GetValue() ));
603*cdf0e10cSrcweir 			break;
604*cdf0e10cSrcweir 		case SID_ATTR_GRAF_BLUE:
605*cdf0e10cSrcweir 			if( !bParentCntProt )
606*cdf0e10cSrcweir 				rSet.Put( SfxInt16Item( nWhich, ((SwChannelBGrf&)
607*cdf0e10cSrcweir 						aCoreSet.Get(RES_GRFATR_CHANNELB)).GetValue() ));
608*cdf0e10cSrcweir 			break;
609*cdf0e10cSrcweir 
610*cdf0e10cSrcweir 		case SID_ATTR_GRAF_GAMMA:
611*cdf0e10cSrcweir 			if( !bParentCntProt )
612*cdf0e10cSrcweir                 rSet.Put( SfxUInt32Item( nWhich, static_cast< sal_uInt32 >(
613*cdf0e10cSrcweir                     ( (SwGammaGrf&)aCoreSet.Get( RES_GRFATR_GAMMA ) ).GetValue() * 100 ) ) );
614*cdf0e10cSrcweir 			break;
615*cdf0e10cSrcweir 		case SID_ATTR_GRAF_TRANSPARENCE:
616*cdf0e10cSrcweir 			if( !bParentCntProt )
617*cdf0e10cSrcweir 			{
618*cdf0e10cSrcweir                 // --> OD 2005-02-09 #119353# - robust
619*cdf0e10cSrcweir                 const GraphicObject* pGrafObj = rSh.GetGraphicObj();
620*cdf0e10cSrcweir                 if ( pGrafObj )
621*cdf0e10cSrcweir                 {
622*cdf0e10cSrcweir                     if( pGrafObj->IsAnimated() ||
623*cdf0e10cSrcweir                         GRAPHIC_GDIMETAFILE == pGrafObj->GetType() )
624*cdf0e10cSrcweir                         bDisable = sal_True;
625*cdf0e10cSrcweir                     else
626*cdf0e10cSrcweir                         rSet.Put( SfxUInt16Item( nWhich, ((SwTransparencyGrf&)
627*cdf0e10cSrcweir                             aCoreSet.Get(RES_GRFATR_TRANSPARENCY)).GetValue() ));
628*cdf0e10cSrcweir                 }
629*cdf0e10cSrcweir 			}
630*cdf0e10cSrcweir 			break;
631*cdf0e10cSrcweir 		case SID_ATTR_GRAF_INVERT:
632*cdf0e10cSrcweir 			if( !bParentCntProt )
633*cdf0e10cSrcweir 				rSet.Put( SfxBoolItem( nWhich, ((SwInvertGrf&)
634*cdf0e10cSrcweir 						aCoreSet.Get(RES_GRFATR_INVERT)).GetValue() ));
635*cdf0e10cSrcweir 			break;
636*cdf0e10cSrcweir 
637*cdf0e10cSrcweir 		case SID_ATTR_GRAF_MODE:
638*cdf0e10cSrcweir 			if( !bParentCntProt )
639*cdf0e10cSrcweir                 rSet.Put( SfxUInt16Item( nWhich, ((SwDrawModeGrf&)
640*cdf0e10cSrcweir 						aCoreSet.Get(RES_GRFATR_DRAWMODE)).GetValue() ));
641*cdf0e10cSrcweir 			break;
642*cdf0e10cSrcweir 
643*cdf0e10cSrcweir 		case SID_GRFFILTER:
644*cdf0e10cSrcweir 		case SID_GRFFILTER_INVERT:
645*cdf0e10cSrcweir 		case SID_GRFFILTER_SMOOTH:
646*cdf0e10cSrcweir 		case SID_GRFFILTER_SHARPEN:
647*cdf0e10cSrcweir 		case SID_GRFFILTER_REMOVENOISE:
648*cdf0e10cSrcweir 		case SID_GRFFILTER_SOBEL:
649*cdf0e10cSrcweir 		case SID_GRFFILTER_MOSAIC:
650*cdf0e10cSrcweir 		case SID_GRFFILTER_EMBOSS:
651*cdf0e10cSrcweir 		case SID_GRFFILTER_POSTER:
652*cdf0e10cSrcweir 		case SID_GRFFILTER_POPART:
653*cdf0e10cSrcweir 		case SID_GRFFILTER_SEPIA:
654*cdf0e10cSrcweir 		case SID_GRFFILTER_SOLARIZE:
655*cdf0e10cSrcweir             {
656*cdf0e10cSrcweir                 if( bParentCntProt || !bIsGrfCntnt )
657*cdf0e10cSrcweir                     bDisable = sal_True;
658*cdf0e10cSrcweir                 // --> OD 2006-11-03 #i59688#
659*cdf0e10cSrcweir                 // load graphic only if type is unknown
660*cdf0e10cSrcweir //                else if( bSwappedOut )
661*cdf0e10cSrcweir //                {
662*cdf0e10cSrcweir //                    rSet.DisableItem( nWhich );
663*cdf0e10cSrcweir //                    if( AddGrfUpdateSlot( nWhich ))
664*cdf0e10cSrcweir //                        rSh.GetGraphic(sal_False);  // start the loading
665*cdf0e10cSrcweir //                }
666*cdf0e10cSrcweir //                else
667*cdf0e10cSrcweir //                    bDisable = !bBitmapType;
668*cdf0e10cSrcweir                 else
669*cdf0e10cSrcweir                 {
670*cdf0e10cSrcweir                     const sal_uInt16 eGraphicType( rSh.GetGraphicType() );
671*cdf0e10cSrcweir                     if ( ( eGraphicType == GRAPHIC_NONE ||
672*cdf0e10cSrcweir                            eGraphicType == GRAPHIC_DEFAULT ) &&
673*cdf0e10cSrcweir                          rSh.IsGrfSwapOut( sal_True ) )
674*cdf0e10cSrcweir                     {
675*cdf0e10cSrcweir                         rSet.DisableItem( nWhich );
676*cdf0e10cSrcweir                         if( AddGrfUpdateSlot( nWhich ))
677*cdf0e10cSrcweir                             rSh.GetGraphic(sal_False);  // start the loading
678*cdf0e10cSrcweir                     }
679*cdf0e10cSrcweir                     else
680*cdf0e10cSrcweir                     {
681*cdf0e10cSrcweir                         bDisable = eGraphicType != GRAPHIC_BITMAP;
682*cdf0e10cSrcweir                     }
683*cdf0e10cSrcweir                 }
684*cdf0e10cSrcweir                 // <--
685*cdf0e10cSrcweir             }
686*cdf0e10cSrcweir 			break;
687*cdf0e10cSrcweir 
688*cdf0e10cSrcweir 		default:
689*cdf0e10cSrcweir 			bDisable = sal_False;
690*cdf0e10cSrcweir 		}
691*cdf0e10cSrcweir 
692*cdf0e10cSrcweir 		if( bDisable )
693*cdf0e10cSrcweir 			rSet.DisableItem( nWhich );
694*cdf0e10cSrcweir 		nWhich = aIter.NextWhich();
695*cdf0e10cSrcweir 	}
696*cdf0e10cSrcweir 	SetGetStateSet( 0 );
697*cdf0e10cSrcweir }
698*cdf0e10cSrcweir 
699*cdf0e10cSrcweir 
700*cdf0e10cSrcweir SwGrfShell::SwGrfShell(SwView &_rView) :
701*cdf0e10cSrcweir     SwBaseShell(_rView)
702*cdf0e10cSrcweir 
703*cdf0e10cSrcweir {
704*cdf0e10cSrcweir 	SetName(String::CreateFromAscii("Graphic"));
705*cdf0e10cSrcweir 	SetHelpId(SW_GRFSHELL);
706*cdf0e10cSrcweir }
707