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