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