xref: /AOO41X/main/sw/source/ui/shells/grfsh.cxx (revision 8ef2f12b1aeba1404ab3c221e6e26281826cc4fc)
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 
SFX_IMPL_INTERFACE(SwGrfShell,SwBaseShell,SW_RES (STR_SHELLNAME_GRAPHIC))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 
Execute(SfxRequest & rReq)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:
11652f1c2eeSArmin Le Grand         {
11752f1c2eeSArmin Le Grand             // #123922# implement slot independent from the two below to
11852f1c2eeSArmin Le Grand             // bring up the insert graphic dialog and associated actions
11952f1c2eeSArmin Le Grand             SwView& rView = GetView();
12052f1c2eeSArmin Le Grand             rReq.SetReturnValue(SfxBoolItem(nSlot, rView.InsertGraphicDlg( rReq )));
12152f1c2eeSArmin Le Grand             break;
12252f1c2eeSArmin Le Grand         }
123cdf0e10cSrcweir 		case FN_FORMAT_GRAFIC_DLG:
124395b75f9SOliver-Rainer Wittmann 		case FN_DRAW_WRAP_DLG:
125cdf0e10cSrcweir 		{
126cdf0e10cSrcweir 			SwFlyFrmAttrMgr aMgr( sal_False, &rSh, rSh.IsFrmSelected() ?
127cdf0e10cSrcweir 											   FRMMGR_TYPE_NONE : FRMMGR_TYPE_GRF);
128cdf0e10cSrcweir 			const SwViewOption* pVOpt = rSh.GetViewOptions();
129cdf0e10cSrcweir 			SwViewOption aUsrPref( *pVOpt );
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 			SfxItemSet aSet(GetPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1,
132cdf0e10cSrcweir 							RES_GRFATR_MIRRORGRF, 	RES_GRFATR_CROPGRF,
133cdf0e10cSrcweir 							SID_ATTR_BORDER_INNER, 	SID_ATTR_BORDER_INNER,
134cdf0e10cSrcweir 							SID_ATTR_GRAF_KEEP_ZOOM, SID_ATTR_GRAF_KEEP_ZOOM,
135cdf0e10cSrcweir 							SID_ATTR_GRAF_FRMSIZE, SID_ATTR_GRAF_FRMSIZE,
136cdf0e10cSrcweir 							SID_ATTR_GRAF_FRMSIZE_PERCENT, SID_ATTR_GRAF_FRMSIZE_PERCENT,
137cdf0e10cSrcweir 							SID_ATTR_GRAF_GRAPHIC, SID_ATTR_GRAF_GRAPHIC,
138cdf0e10cSrcweir 							FN_PARAM_GRF_CONNECT, 	FN_PARAM_GRF_CONNECT,
139cdf0e10cSrcweir 							SID_ATTR_PAGE_SIZE, 	SID_ATTR_PAGE_SIZE,
140cdf0e10cSrcweir 							FN_GET_PRINT_AREA, 		FN_GET_PRINT_AREA,
141cdf0e10cSrcweir 							FN_SET_FRM_NAME, 		FN_KEEP_ASPECT_RATIO,
142cdf0e10cSrcweir 							FN_PARAM_GRF_DIALOG, 	FN_PARAM_GRF_DIALOG,
143cdf0e10cSrcweir 							SID_DOCFRAME, 			SID_DOCFRAME,
144cdf0e10cSrcweir 							SID_HTML_MODE, 			SID_HTML_MODE,
145cdf0e10cSrcweir 							FN_SET_FRM_ALT_NAME,	FN_SET_FRM_ALT_NAME,
146cdf0e10cSrcweir 							0);
147cdf0e10cSrcweir 
148cdf0e10cSrcweir 			sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
149cdf0e10cSrcweir 			aSet.Put(SfxUInt16Item(SID_HTML_MODE, nHtmlMode));
150cdf0e10cSrcweir 			FieldUnit eMetric = ::GetDfltMetric((0 != (nHtmlMode&HTMLMODE_ON)));
151cdf0e10cSrcweir             SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
152cdf0e10cSrcweir 
153cdf0e10cSrcweir 			const SwRect* pRect = &rSh.GetAnyCurRect(RECT_PAGE);
154cdf0e10cSrcweir 			SwFmtFrmSize aFrmSize( ATT_VAR_SIZE, pRect->Width(), pRect->Height());
155cdf0e10cSrcweir 			aFrmSize.SetWhich( GetPool().GetWhich( SID_ATTR_PAGE_SIZE ) );
156cdf0e10cSrcweir 			aSet.Put( aFrmSize );
157cdf0e10cSrcweir 
158cdf0e10cSrcweir 			aSet.Put(SfxStringItem(FN_SET_FRM_NAME, rSh.GetFlyName()));
159cdf0e10cSrcweir             if ( nSlot == FN_FORMAT_GRAFIC_DLG )
160cdf0e10cSrcweir             {
161cdf0e10cSrcweir                 aSet.Put( SfxStringItem( FN_SET_FRM_ALT_NAME, rSh.GetObjTitle() ) );
162cdf0e10cSrcweir             }
163cdf0e10cSrcweir 
164cdf0e10cSrcweir 			pRect = &rSh.GetAnyCurRect(RECT_PAGE_PRT);
165cdf0e10cSrcweir 			aFrmSize.SetWidth( pRect->Width() );
166cdf0e10cSrcweir 			aFrmSize.SetHeight( pRect->Height() );
167cdf0e10cSrcweir 			aFrmSize.SetWhich( GetPool().GetWhich(FN_GET_PRINT_AREA) );
168cdf0e10cSrcweir 			aSet.Put( aFrmSize );
169cdf0e10cSrcweir 
170cdf0e10cSrcweir 			aSet.Put( aMgr.GetAttrSet() );
171cdf0e10cSrcweir 			aSet.SetParent( aMgr.GetAttrSet().GetParent() );
172cdf0e10cSrcweir 
173cdf0e10cSrcweir 			// Bei %-Werten Groesse initialisieren
174cdf0e10cSrcweir 			SwFmtFrmSize aSizeCopy = (const SwFmtFrmSize&)aSet.Get(RES_FRM_SIZE);
175cdf0e10cSrcweir 			if (aSizeCopy.GetWidthPercent() && aSizeCopy.GetWidthPercent() != 0xff)
176cdf0e10cSrcweir 				aSizeCopy.SetWidth(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Width());
177cdf0e10cSrcweir 			if (aSizeCopy.GetHeightPercent() && aSizeCopy.GetHeightPercent() != 0xff)
178cdf0e10cSrcweir 				aSizeCopy.SetHeight(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Height());
179cdf0e10cSrcweir 
180cdf0e10cSrcweir 			// and now set the size for "external" tabpages
181cdf0e10cSrcweir 			{
182cdf0e10cSrcweir 				SvxSizeItem aSzItm( SID_ATTR_GRAF_FRMSIZE, aSizeCopy.GetSize() );
183cdf0e10cSrcweir 				aSet.Put( aSzItm );
184cdf0e10cSrcweir 
185cdf0e10cSrcweir 				Size aSz( aSizeCopy.GetWidthPercent(), aSizeCopy.GetHeightPercent() );
186cdf0e10cSrcweir 				if( 0xff == aSz.Width() ) 	aSz.Width() = 0;
187cdf0e10cSrcweir 				if( 0xff == aSz.Height() )  aSz.Height() = 0;
188cdf0e10cSrcweir 
189cdf0e10cSrcweir 				aSzItm.SetSize( aSz );
190cdf0e10cSrcweir 				aSzItm.SetWhich( SID_ATTR_GRAF_FRMSIZE_PERCENT );
191cdf0e10cSrcweir 				aSet.Put( aSzItm );
192cdf0e10cSrcweir 			}
193cdf0e10cSrcweir 
194cdf0e10cSrcweir 			String sGrfNm, sFilterNm;
195cdf0e10cSrcweir 			rSh.GetGrfNms( &sGrfNm, &sFilterNm );
196cdf0e10cSrcweir 			if( sGrfNm.Len() )
197cdf0e10cSrcweir 			{
198cdf0e10cSrcweir 				aSet.Put( SvxBrushItem( INetURLObject::decode( sGrfNm,
199cdf0e10cSrcweir 										INET_HEX_ESCAPE,
200cdf0e10cSrcweir 						   				INetURLObject::DECODE_UNAMBIGUOUS,
201cdf0e10cSrcweir 										RTL_TEXTENCODING_UTF8 ),
202cdf0e10cSrcweir 										sFilterNm, GPOS_LT,
203cdf0e10cSrcweir 										SID_ATTR_GRAF_GRAPHIC ));
204cdf0e10cSrcweir 			}
205cdf0e10cSrcweir 			else
206cdf0e10cSrcweir 			{
207cdf0e10cSrcweir                 // --> OD 2005-02-09 #119353# - robust
208cdf0e10cSrcweir                 const GraphicObject* pGrfObj = rSh.GetGraphicObj();
209cdf0e10cSrcweir                 if ( pGrfObj )
210cdf0e10cSrcweir                 {
211cdf0e10cSrcweir                     aSet.Put( SvxBrushItem( *pGrfObj, GPOS_LT,
212cdf0e10cSrcweir                                             SID_ATTR_GRAF_GRAPHIC ) );
213cdf0e10cSrcweir                 }
214cdf0e10cSrcweir                 // <--
215cdf0e10cSrcweir 			}
216cdf0e10cSrcweir             aSet.Put( SfxBoolItem( FN_PARAM_GRF_CONNECT, sGrfNm.Len() > 0 ) );
217cdf0e10cSrcweir 
218cdf0e10cSrcweir 			// get Mirror and Crop
219cdf0e10cSrcweir 			{
220cdf0e10cSrcweir 				SfxItemSet aTmpSet( rSh.GetAttrPool(),
221cdf0e10cSrcweir 								RES_GRFATR_MIRRORGRF, RES_GRFATR_CROPGRF );
222cdf0e10cSrcweir 
223cdf0e10cSrcweir                 rSh.GetCurAttr( aTmpSet );
224cdf0e10cSrcweir 				aSet.Put( aTmpSet );
225cdf0e10cSrcweir 			}
226cdf0e10cSrcweir 
227cdf0e10cSrcweir 			aSet.Put(SfxBoolItem(FN_KEEP_ASPECT_RATIO, aUsrPref.IsKeepRatio()));
228cdf0e10cSrcweir 			aSet.Put(SfxBoolItem( SID_ATTR_GRAF_KEEP_ZOOM, aUsrPref.IsGrfKeepZoom()));
229cdf0e10cSrcweir 
230cdf0e10cSrcweir 			aSet.Put(SfxFrameItem( SID_DOCFRAME, &GetView().GetViewFrame()->GetTopFrame()));
231cdf0e10cSrcweir 
232cdf0e10cSrcweir 			SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
233cdf0e10cSrcweir             DBG_ASSERT(pFact, "Dialogdiet fail!");
234cdf0e10cSrcweir             SfxAbstractTabDialog* pDlg = pFact->CreateFrmTabDialog( DLG_FRM_GRF,
235cdf0e10cSrcweir 													GetView().GetViewFrame(),
236cdf0e10cSrcweir 													GetView().GetWindow(),
237cdf0e10cSrcweir 													aSet, sal_False, DLG_FRM_GRF);
238cdf0e10cSrcweir             DBG_ASSERT(pDlg, "Dialogdiet fail!");
239f120fe41SAndre Fischer 
240395b75f9SOliver-Rainer Wittmann             if (nSlot == FN_DRAW_WRAP_DLG)
241f120fe41SAndre Fischer                 pDlg->SetCurPageId(TP_FRM_WRAP);
242f120fe41SAndre Fischer 
243cdf0e10cSrcweir 			if( pDlg->Execute() )
244cdf0e10cSrcweir 			{
245cdf0e10cSrcweir 				rSh.StartAllAction();
246cdf0e10cSrcweir 				rSh.StartUndo(UNDO_START);
247cdf0e10cSrcweir 				const SfxPoolItem* pItem;
248cdf0e10cSrcweir 				SfxItemSet* pSet = (SfxItemSet*)pDlg->GetOutputItemSet();
249cdf0e10cSrcweir                 rReq.Done(*pSet);
250cdf0e10cSrcweir 				// change the 2 frmsize SizeItems to the correct SwFrmSizeItem
251cdf0e10cSrcweir 				if( SFX_ITEM_SET == pSet->GetItemState(
252cdf0e10cSrcweir 								SID_ATTR_GRAF_FRMSIZE, sal_False, &pItem ))
253cdf0e10cSrcweir 				{
254cdf0e10cSrcweir 					SwFmtFrmSize aSize;
255cdf0e10cSrcweir 					const Size& rSz = ((SvxSizeItem*)pItem)->GetSize();
256cdf0e10cSrcweir 					aSize.SetWidth( rSz.Width() );
257cdf0e10cSrcweir 					aSize.SetHeight( rSz.Height() );
258cdf0e10cSrcweir 
259cdf0e10cSrcweir 					if( SFX_ITEM_SET == pSet->GetItemState(
260cdf0e10cSrcweir 							SID_ATTR_GRAF_FRMSIZE_PERCENT, sal_False, &pItem ))
261cdf0e10cSrcweir 					{
262cdf0e10cSrcweir                         const Size& rRelativeSize = ((SvxSizeItem*)pItem)->GetSize();
263cdf0e10cSrcweir                         aSize.SetWidthPercent( static_cast< sal_uInt8 >( rRelativeSize.Width() ) );
264cdf0e10cSrcweir                         aSize.SetHeightPercent( static_cast< sal_uInt8 >( rRelativeSize.Height() ) );
265cdf0e10cSrcweir 					}
266cdf0e10cSrcweir 					pSet->Put( aSize );
267cdf0e10cSrcweir 				}
268cdf0e10cSrcweir 
269cdf0e10cSrcweir 				// Vorlagen-AutoUpdate
270cdf0e10cSrcweir 				SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
271cdf0e10cSrcweir 				if(pFmt && pFmt->IsAutoUpdateFmt())
272cdf0e10cSrcweir 				{
273cdf0e10cSrcweir                     pFmt->SetFmtAttr(*pSet);
274cdf0e10cSrcweir 					SfxItemSet aShellSet(GetPool(), RES_FRM_SIZE,	RES_FRM_SIZE,
275cdf0e10cSrcweir 													RES_SURROUND, 	RES_SURROUND,
276cdf0e10cSrcweir 													RES_ANCHOR,		RES_ANCHOR,
277cdf0e10cSrcweir 													RES_VERT_ORIENT,RES_HORI_ORIENT,
278cdf0e10cSrcweir 													0);
279cdf0e10cSrcweir 					aShellSet.Put(*pSet);
280cdf0e10cSrcweir 					aMgr.SetAttrSet(aShellSet);
281cdf0e10cSrcweir 				}
282cdf0e10cSrcweir 				else
283cdf0e10cSrcweir 				{
284cdf0e10cSrcweir 					aMgr.SetAttrSet(*pSet);
285cdf0e10cSrcweir 				}
286cdf0e10cSrcweir 				aMgr.UpdateFlyFrm();
287cdf0e10cSrcweir 
288cdf0e10cSrcweir 				sal_Bool bApplyUsrPref = sal_False;
289cdf0e10cSrcweir 				if (SFX_ITEM_SET == pSet->GetItemState(
290cdf0e10cSrcweir 					FN_KEEP_ASPECT_RATIO, sal_True, &pItem ))
291cdf0e10cSrcweir 				{
292cdf0e10cSrcweir 					aUsrPref.SetKeepRatio(
293cdf0e10cSrcweir 									((const SfxBoolItem*)pItem)->GetValue() );
294cdf0e10cSrcweir 					bApplyUsrPref = sal_True;
295cdf0e10cSrcweir 				}
296cdf0e10cSrcweir 				if( SFX_ITEM_SET == pSet->GetItemState(
297cdf0e10cSrcweir 					SID_ATTR_GRAF_KEEP_ZOOM, sal_True, &pItem ))
298cdf0e10cSrcweir 				{
299cdf0e10cSrcweir 					aUsrPref.SetGrfKeepZoom(
300cdf0e10cSrcweir 									((const SfxBoolItem*)pItem)->GetValue() );
301cdf0e10cSrcweir 					bApplyUsrPref = sal_True;
302cdf0e10cSrcweir 				}
303cdf0e10cSrcweir 
304cdf0e10cSrcweir 				if( bApplyUsrPref )
305cdf0e10cSrcweir 					SW_MOD()->ApplyUsrPref(aUsrPref, &GetView());
306cdf0e10cSrcweir 
307cdf0e10cSrcweir 				// and now set all the graphic attributes and other stuff
308cdf0e10cSrcweir 				if( SFX_ITEM_SET == pSet->GetItemState(
309cdf0e10cSrcweir 										SID_ATTR_GRAF_GRAPHIC, sal_True, &pItem ))
310cdf0e10cSrcweir 				{
311cdf0e10cSrcweir 					if( ((SvxBrushItem*)pItem)->GetGraphicLink() )
312cdf0e10cSrcweir 						sGrfNm = *((SvxBrushItem*)pItem)->GetGraphicLink();
313cdf0e10cSrcweir 					else
314cdf0e10cSrcweir 						sGrfNm.Erase();
315cdf0e10cSrcweir 
316cdf0e10cSrcweir 					if( ((SvxBrushItem*)pItem)->GetGraphicFilter() )
317cdf0e10cSrcweir 						sFilterNm = *((SvxBrushItem*)pItem)->GetGraphicFilter();
318cdf0e10cSrcweir 					else
319cdf0e10cSrcweir 						sFilterNm.Erase();
320cdf0e10cSrcweir 
321cdf0e10cSrcweir 					if( sGrfNm.Len() )
322cdf0e10cSrcweir 					{
323cdf0e10cSrcweir                         SwDocShell* pDocSh = GetView().GetDocShell();
324*8ef2f12bSOliver-Rainer Wittmann                         SwWait aWait( *pDocSh, true );
325cdf0e10cSrcweir                         SfxMedium* pMedium = pDocSh->GetMedium();
326cdf0e10cSrcweir                         INetURLObject aAbs;
327cdf0e10cSrcweir                         if( pMedium )
328cdf0e10cSrcweir                             aAbs = pMedium->GetURLObject();
329cdf0e10cSrcweir                         rSh.ReRead( URIHelper::SmartRel2Abs(
330cdf0e10cSrcweir                                         aAbs, sGrfNm,
331cdf0e10cSrcweir                                         URIHelper::GetMaybeFileHdl() ),
332cdf0e10cSrcweir 								 	sFilterNm, 0 );
333cdf0e10cSrcweir 					}
334cdf0e10cSrcweir 				}
335cdf0e10cSrcweir                 if ( SFX_ITEM_SET == pSet->GetItemState(
336cdf0e10cSrcweir 										FN_SET_FRM_ALT_NAME, sal_True, &pItem ))
337cdf0e10cSrcweir                 {
338cdf0e10cSrcweir                     // --> OD 2009-07-13 #i73249#
339cdf0e10cSrcweir //                    rSh.SetAlternateText(
340cdf0e10cSrcweir //                                ((const SfxStringItem*)pItem)->GetValue() );
341cdf0e10cSrcweir                     rSh.SetObjTitle( ((const SfxStringItem*)pItem)->GetValue() );
342cdf0e10cSrcweir                     // <--
343cdf0e10cSrcweir                 }
344cdf0e10cSrcweir 
345cdf0e10cSrcweir 				SfxItemSet aGrfSet( rSh.GetAttrPool(), RES_GRFATR_BEGIN,
346cdf0e10cSrcweir 													   RES_GRFATR_END-1 );
347cdf0e10cSrcweir 				aGrfSet.Put( *pSet );
348cdf0e10cSrcweir 				if( aGrfSet.Count() )
34969a74367SOliver-Rainer Wittmann 					rSh.SetAttrSet( aGrfSet );
350cdf0e10cSrcweir 
351cdf0e10cSrcweir 				rSh.EndUndo(UNDO_END);
352cdf0e10cSrcweir 				rSh.EndAllAction();
353cdf0e10cSrcweir 			}
354cdf0e10cSrcweir 			delete pDlg;
355cdf0e10cSrcweir 		}
356cdf0e10cSrcweir 		break;
357cdf0e10cSrcweir 
358cdf0e10cSrcweir 		case FN_GRAPHIC_MIRROR_ON_EVEN_PAGES:
359cdf0e10cSrcweir 		{
360cdf0e10cSrcweir 			SfxItemSet aSet(rSh.GetAttrPool(), RES_GRFATR_MIRRORGRF, RES_GRFATR_MIRRORGRF);
361cdf0e10cSrcweir             rSh.GetCurAttr( aSet );
362cdf0e10cSrcweir 			SwMirrorGrf aGrf((const SwMirrorGrf &)aSet.Get(RES_GRFATR_MIRRORGRF));
363cdf0e10cSrcweir 			aGrf.SetGrfToggle(!aGrf.IsGrfToggle());
36469a74367SOliver-Rainer Wittmann 			rSh.SetAttrItem(aGrf);
365cdf0e10cSrcweir 		}
366cdf0e10cSrcweir 		break;
367cdf0e10cSrcweir 
368cdf0e10cSrcweir 		default:
369cdf0e10cSrcweir 			ASSERT(!this, falscher Dispatcher);
370cdf0e10cSrcweir 			return;
371cdf0e10cSrcweir 	}
372cdf0e10cSrcweir }
373cdf0e10cSrcweir 
374cdf0e10cSrcweir 
ExecAttr(SfxRequest & rReq)375cdf0e10cSrcweir void SwGrfShell::ExecAttr( SfxRequest &rReq )
376cdf0e10cSrcweir {
377cdf0e10cSrcweir 	sal_uInt16 nGrfType;
378cdf0e10cSrcweir 	if( CNT_GRF == GetShell().GetCntType() &&
379cdf0e10cSrcweir 		( GRAPHIC_BITMAP == ( nGrfType = GetShell().GetGraphicType()) ||
380cdf0e10cSrcweir 		  GRAPHIC_GDIMETAFILE == nGrfType ))
381cdf0e10cSrcweir 	{
382cdf0e10cSrcweir 		SfxItemSet aGrfSet( GetShell().GetAttrPool(), RES_GRFATR_BEGIN,
383cdf0e10cSrcweir 													  RES_GRFATR_END -1 );
384cdf0e10cSrcweir     	const SfxItemSet *pArgs = rReq.GetArgs();
385cdf0e10cSrcweir     	const SfxPoolItem* pItem;
386cdf0e10cSrcweir     	sal_uInt16 nSlot = rReq.GetSlot();
387cdf0e10cSrcweir 	    if( !pArgs || SFX_ITEM_SET != pArgs->GetItemState( nSlot, sal_False, &pItem ))
388cdf0e10cSrcweir 			pItem = 0;
389cdf0e10cSrcweir 
390cdf0e10cSrcweir         switch( nSlot )
391cdf0e10cSrcweir         {
392ee093554SAndre Fischer             case SID_FLIP_VERTICAL:
393ee093554SAndre Fischer             case SID_FLIP_HORIZONTAL:
394cdf0e10cSrcweir             {
395cdf0e10cSrcweir                 GetShell().GetCurAttr( aGrfSet );
396261e9a4bSOliver-Rainer Wittmann                 SwMirrorGrf aMirror( (SwMirrorGrf&)aGrfSet.Get( RES_GRFATR_MIRRORGRF ) );
397cdf0e10cSrcweir                 sal_uInt16 nMirror = aMirror.GetValue();
398261e9a4bSOliver-Rainer Wittmann                 if ( nSlot==SID_FLIP_HORIZONTAL )
399cdf0e10cSrcweir                     switch( nMirror )
400cdf0e10cSrcweir                     {
401cdf0e10cSrcweir                     case RES_MIRROR_GRAPH_DONT: nMirror = RES_MIRROR_GRAPH_VERT;
402cdf0e10cSrcweir                                                 break;
403cdf0e10cSrcweir                     case RES_MIRROR_GRAPH_HOR:  nMirror = RES_MIRROR_GRAPH_BOTH;
404cdf0e10cSrcweir                                                 break;
405cdf0e10cSrcweir                     case RES_MIRROR_GRAPH_VERT:   nMirror = RES_MIRROR_GRAPH_DONT;
406cdf0e10cSrcweir                                                 break;
407cdf0e10cSrcweir                     case RES_MIRROR_GRAPH_BOTH: nMirror = RES_MIRROR_GRAPH_HOR;
408cdf0e10cSrcweir                                                 break;
409cdf0e10cSrcweir                     }
410cdf0e10cSrcweir                 else
411cdf0e10cSrcweir                     switch( nMirror )
412cdf0e10cSrcweir                     {
413cdf0e10cSrcweir                     case RES_MIRROR_GRAPH_DONT: nMirror = RES_MIRROR_GRAPH_HOR;
414cdf0e10cSrcweir                                                 break;
415cdf0e10cSrcweir                     case RES_MIRROR_GRAPH_VERT: nMirror = RES_MIRROR_GRAPH_BOTH;
416cdf0e10cSrcweir                                                 break;
417cdf0e10cSrcweir                     case RES_MIRROR_GRAPH_HOR:    nMirror = RES_MIRROR_GRAPH_DONT;
418cdf0e10cSrcweir                                                 break;
419cdf0e10cSrcweir                     case RES_MIRROR_GRAPH_BOTH: nMirror = RES_MIRROR_GRAPH_VERT;
420cdf0e10cSrcweir                                                 break;
421cdf0e10cSrcweir                     }
422cdf0e10cSrcweir                 aMirror.SetValue( nMirror );
423cdf0e10cSrcweir                 aGrfSet.ClearItem();
424cdf0e10cSrcweir                 aGrfSet.Put( aMirror );
425cdf0e10cSrcweir             }
426cdf0e10cSrcweir             break;
427cdf0e10cSrcweir 
428cdf0e10cSrcweir 		case SID_ATTR_GRAF_LUMINANCE:
429cdf0e10cSrcweir 			if( pItem )
430cdf0e10cSrcweir 				aGrfSet.Put( SwLuminanceGrf(
431cdf0e10cSrcweir 							((SfxInt16Item*)pItem)->GetValue() ));
432cdf0e10cSrcweir 			break;
433cdf0e10cSrcweir 		case SID_ATTR_GRAF_CONTRAST:
434cdf0e10cSrcweir 			if( pItem )
435cdf0e10cSrcweir 				aGrfSet.Put( SwContrastGrf(
436cdf0e10cSrcweir 							((SfxInt16Item*)pItem)->GetValue() ));
437cdf0e10cSrcweir 			break;
438cdf0e10cSrcweir 		case SID_ATTR_GRAF_RED:
439cdf0e10cSrcweir 			if( pItem )
440cdf0e10cSrcweir 				aGrfSet.Put( SwChannelRGrf(
441cdf0e10cSrcweir 							((SfxInt16Item*)pItem)->GetValue() ));
442cdf0e10cSrcweir 			break;
443cdf0e10cSrcweir 		case SID_ATTR_GRAF_GREEN:
444cdf0e10cSrcweir 			if( pItem )
445cdf0e10cSrcweir 				aGrfSet.Put( SwChannelGGrf(
446cdf0e10cSrcweir 							((SfxInt16Item*)pItem)->GetValue() ));
447cdf0e10cSrcweir 			break;
448cdf0e10cSrcweir 		case SID_ATTR_GRAF_BLUE:
449cdf0e10cSrcweir 			if( pItem )
450cdf0e10cSrcweir 				aGrfSet.Put( SwChannelBGrf(
451cdf0e10cSrcweir 							((SfxInt16Item*)pItem)->GetValue() ));
452cdf0e10cSrcweir 			break;
453cdf0e10cSrcweir 		case SID_ATTR_GRAF_GAMMA:
454cdf0e10cSrcweir 			if( pItem )
455cdf0e10cSrcweir 			{
456cdf0e10cSrcweir 				double fVal = ((SfxUInt32Item*)pItem)->GetValue();
457cdf0e10cSrcweir 				aGrfSet.Put( SwGammaGrf(fVal/100. ));
458cdf0e10cSrcweir 			}
459cdf0e10cSrcweir 			break;
460cdf0e10cSrcweir 		case SID_ATTR_GRAF_TRANSPARENCE:
461cdf0e10cSrcweir 			if( pItem )
462cdf0e10cSrcweir                 aGrfSet.Put( SwTransparencyGrf(
463cdf0e10cSrcweir                     static_cast< sal_Int8 >( ( (SfxUInt16Item*)pItem )->GetValue() ) ) );
464cdf0e10cSrcweir 			break;
465cdf0e10cSrcweir 		case SID_ATTR_GRAF_INVERT:
466cdf0e10cSrcweir 			if( pItem )
467cdf0e10cSrcweir 				aGrfSet.Put( SwInvertGrf(
468cdf0e10cSrcweir 							((SfxBoolItem*)pItem)->GetValue() ));
469cdf0e10cSrcweir 			break;
470cdf0e10cSrcweir 
471cdf0e10cSrcweir 		case SID_ATTR_GRAF_MODE:
472cdf0e10cSrcweir 			if( pItem )
473cdf0e10cSrcweir 				aGrfSet.Put( SwDrawModeGrf(
474cdf0e10cSrcweir 							((SfxUInt16Item*)pItem)->GetValue() ));
475cdf0e10cSrcweir 			break;
476cdf0e10cSrcweir 
477cdf0e10cSrcweir         case SID_COLOR_SETTINGS:
478cdf0e10cSrcweir         {
479cdf0e10cSrcweir             svx::ToolboxAccess aToolboxAccess( TOOLBOX_NAME );
480cdf0e10cSrcweir             aToolboxAccess.toggleToolbox();
481cdf0e10cSrcweir             break;
482cdf0e10cSrcweir         }
483cdf0e10cSrcweir         case SID_GRFFILTER:
484cdf0e10cSrcweir         case SID_GRFFILTER_INVERT:
485cdf0e10cSrcweir 		case SID_GRFFILTER_SMOOTH:
486cdf0e10cSrcweir 		case SID_GRFFILTER_SHARPEN:
487cdf0e10cSrcweir 		case SID_GRFFILTER_REMOVENOISE:
488cdf0e10cSrcweir 		case SID_GRFFILTER_SOBEL:
489cdf0e10cSrcweir 		case SID_GRFFILTER_MOSAIC:
490cdf0e10cSrcweir 		case SID_GRFFILTER_EMBOSS:
491cdf0e10cSrcweir 		case SID_GRFFILTER_POSTER:
492cdf0e10cSrcweir 		case SID_GRFFILTER_POPART:
493cdf0e10cSrcweir 		case SID_GRFFILTER_SEPIA:
494cdf0e10cSrcweir 		case SID_GRFFILTER_SOLARIZE:
495cdf0e10cSrcweir 			if( GRAPHIC_BITMAP == nGrfType )
496cdf0e10cSrcweir 			{
497cdf0e10cSrcweir                 // --> OD 2005-02-09 #119353# - robust
498cdf0e10cSrcweir                 const GraphicObject* pFilterObj( GetShell().GetGraphicObj() );
499cdf0e10cSrcweir                 if ( pFilterObj )
500cdf0e10cSrcweir                 {
501cdf0e10cSrcweir                     GraphicObject aFilterObj( *pFilterObj );
502cdf0e10cSrcweir                     if( SVX_GRAPHICFILTER_ERRCODE_NONE ==
503cdf0e10cSrcweir                         SvxGraphicFilter::ExecuteGrfFilterSlot( rReq, aFilterObj ))
504cdf0e10cSrcweir                         GetShell().ReRead( aEmptyStr, aEmptyStr,
505cdf0e10cSrcweir                                            &aFilterObj.GetGraphic() );
506cdf0e10cSrcweir                 }
507cdf0e10cSrcweir                 // <--
508cdf0e10cSrcweir 			}
509cdf0e10cSrcweir 			break;
510cdf0e10cSrcweir 
511cdf0e10cSrcweir 		default:
512cdf0e10cSrcweir 			ASSERT(!this, falscher Dispatcher);
513cdf0e10cSrcweir 		}
514cdf0e10cSrcweir 		if( aGrfSet.Count() )
51569a74367SOliver-Rainer Wittmann 			GetShell().SetAttrSet( aGrfSet );
516cdf0e10cSrcweir 	}
517cdf0e10cSrcweir 	GetView().GetViewFrame()->GetBindings().Invalidate(rReq.GetSlot());
518cdf0e10cSrcweir }
519cdf0e10cSrcweir 
GetAttrState(SfxItemSet & rSet)520cdf0e10cSrcweir void SwGrfShell::GetAttrState(SfxItemSet &rSet)
521cdf0e10cSrcweir {
522cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
523cdf0e10cSrcweir     SfxItemSet aCoreSet( GetPool(), aNoTxtNodeSetRange );
524cdf0e10cSrcweir     rSh.GetCurAttr( aCoreSet );
525cdf0e10cSrcweir     sal_Bool bParentCntProt = 0 != rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT );
526cdf0e10cSrcweir     sal_Bool bIsGrfCntnt = CNT_GRF == GetShell().GetCntType();
527cdf0e10cSrcweir 
528cdf0e10cSrcweir     SetGetStateSet( &rSet );
529cdf0e10cSrcweir 
530cdf0e10cSrcweir     SfxWhichIter aIter( rSet );
531cdf0e10cSrcweir     sal_uInt16 nWhich = aIter.FirstWhich();
532cdf0e10cSrcweir     while( nWhich )
533cdf0e10cSrcweir     {
534cdf0e10cSrcweir         sal_Bool bDisable = bParentCntProt;
535cdf0e10cSrcweir         switch( nWhich )
536cdf0e10cSrcweir         {
537cdf0e10cSrcweir         case SID_INSERT_GRAPHIC:
538cdf0e10cSrcweir         case FN_FORMAT_GRAFIC_DLG:
539cdf0e10cSrcweir         case SID_TWAIN_TRANSFER:
540cdf0e10cSrcweir             if( bParentCntProt || !bIsGrfCntnt )
541cdf0e10cSrcweir                 bDisable = sal_True;
54269a74367SOliver-Rainer Wittmann             else if ( nWhich == SID_INSERT_GRAPHIC
54369a74367SOliver-Rainer Wittmann                       && rSh.CrsrInsideInputFld() )
54469a74367SOliver-Rainer Wittmann             {
54569a74367SOliver-Rainer Wittmann                 bDisable = sal_True;
54669a74367SOliver-Rainer Wittmann             }
547cdf0e10cSrcweir             break;
54869a74367SOliver-Rainer Wittmann 
549cdf0e10cSrcweir         case FN_SAVE_GRAPHIC:
550cdf0e10cSrcweir             if( rSh.GetGraphicType() == GRAPHIC_NONE )
551cdf0e10cSrcweir                 bDisable = sal_True;
552cdf0e10cSrcweir             break;
55369a74367SOliver-Rainer Wittmann 
554cdf0e10cSrcweir         case SID_COLOR_SETTINGS:
555cdf0e10cSrcweir         {
556cdf0e10cSrcweir             if ( bParentCntProt || !bIsGrfCntnt )
557cdf0e10cSrcweir                 bDisable = sal_True;
558cdf0e10cSrcweir             else
559cdf0e10cSrcweir             {
560cdf0e10cSrcweir                 svx::ToolboxAccess aToolboxAccess( TOOLBOX_NAME );
561cdf0e10cSrcweir                 rSet.Put( SfxBoolItem( nWhich, aToolboxAccess.isToolboxVisible() ) );
562cdf0e10cSrcweir             }
563cdf0e10cSrcweir             break;
564cdf0e10cSrcweir         }
565cdf0e10cSrcweir 
566261e9a4bSOliver-Rainer Wittmann         case SID_FLIP_HORIZONTAL:
567cdf0e10cSrcweir             if( !bParentCntProt )
568cdf0e10cSrcweir             {
569cdf0e10cSrcweir                 MirrorGraph nState = static_cast< MirrorGraph >(((const SwMirrorGrf &) aCoreSet.Get(
570cdf0e10cSrcweir                                         RES_GRFATR_MIRRORGRF )).GetValue());
571cdf0e10cSrcweir 
572cdf0e10cSrcweir                 rSet.Put(SfxBoolItem( nWhich, nState == RES_MIRROR_GRAPH_VERT ||
573cdf0e10cSrcweir                                               nState == RES_MIRROR_GRAPH_BOTH));
574cdf0e10cSrcweir             }
575cdf0e10cSrcweir             break;
576cdf0e10cSrcweir 
577261e9a4bSOliver-Rainer Wittmann         case SID_FLIP_VERTICAL:
578cdf0e10cSrcweir             if( !bParentCntProt )
579cdf0e10cSrcweir             {
580cdf0e10cSrcweir                 MirrorGraph nState = static_cast< MirrorGraph >(((const SwMirrorGrf &) aCoreSet.Get(
581cdf0e10cSrcweir                                         RES_GRFATR_MIRRORGRF )).GetValue());
582cdf0e10cSrcweir 
583cdf0e10cSrcweir                 rSet.Put(SfxBoolItem( nWhich, nState == RES_MIRROR_GRAPH_HOR ||
584cdf0e10cSrcweir                                               nState == RES_MIRROR_GRAPH_BOTH));
585cdf0e10cSrcweir             }
586cdf0e10cSrcweir             break;
587cdf0e10cSrcweir 
588cdf0e10cSrcweir 
589cdf0e10cSrcweir 		case SID_ATTR_GRAF_LUMINANCE:
590cdf0e10cSrcweir 			if( !bParentCntProt )
591cdf0e10cSrcweir 				rSet.Put( SfxInt16Item( nWhich, ((SwLuminanceGrf&)
592cdf0e10cSrcweir 						aCoreSet.Get(RES_GRFATR_LUMINANCE)).GetValue() ));
593cdf0e10cSrcweir 			break;
594cdf0e10cSrcweir 		case SID_ATTR_GRAF_CONTRAST:
595cdf0e10cSrcweir 			if( !bParentCntProt )
596cdf0e10cSrcweir 				rSet.Put( SfxInt16Item( nWhich, ((SwContrastGrf&)
597cdf0e10cSrcweir 						aCoreSet.Get(RES_GRFATR_CONTRAST)).GetValue() ));
598cdf0e10cSrcweir 			break;
599cdf0e10cSrcweir 		case SID_ATTR_GRAF_RED:
600cdf0e10cSrcweir 			if( !bParentCntProt )
601cdf0e10cSrcweir 				rSet.Put( SfxInt16Item( nWhich, ((SwChannelRGrf&)
602cdf0e10cSrcweir 						aCoreSet.Get(RES_GRFATR_CHANNELR)).GetValue() ));
603cdf0e10cSrcweir 			break;
604cdf0e10cSrcweir 		case SID_ATTR_GRAF_GREEN:
605cdf0e10cSrcweir 			if( !bParentCntProt )
606cdf0e10cSrcweir 				rSet.Put( SfxInt16Item( nWhich, ((SwChannelGGrf&)
607cdf0e10cSrcweir 						aCoreSet.Get(RES_GRFATR_CHANNELG)).GetValue() ));
608cdf0e10cSrcweir 			break;
609cdf0e10cSrcweir 		case SID_ATTR_GRAF_BLUE:
610cdf0e10cSrcweir 			if( !bParentCntProt )
611cdf0e10cSrcweir 				rSet.Put( SfxInt16Item( nWhich, ((SwChannelBGrf&)
612cdf0e10cSrcweir 						aCoreSet.Get(RES_GRFATR_CHANNELB)).GetValue() ));
613cdf0e10cSrcweir 			break;
614cdf0e10cSrcweir 
615cdf0e10cSrcweir 		case SID_ATTR_GRAF_GAMMA:
616cdf0e10cSrcweir 			if( !bParentCntProt )
617cdf0e10cSrcweir                 rSet.Put( SfxUInt32Item( nWhich, static_cast< sal_uInt32 >(
618cdf0e10cSrcweir                     ( (SwGammaGrf&)aCoreSet.Get( RES_GRFATR_GAMMA ) ).GetValue() * 100 ) ) );
619cdf0e10cSrcweir 			break;
620cdf0e10cSrcweir 		case SID_ATTR_GRAF_TRANSPARENCE:
621cdf0e10cSrcweir 			if( !bParentCntProt )
622cdf0e10cSrcweir 			{
623cdf0e10cSrcweir                 // --> OD 2005-02-09 #119353# - robust
624cdf0e10cSrcweir                 const GraphicObject* pGrafObj = rSh.GetGraphicObj();
625cdf0e10cSrcweir                 if ( pGrafObj )
626cdf0e10cSrcweir                 {
627cdf0e10cSrcweir                     if( pGrafObj->IsAnimated() ||
628cdf0e10cSrcweir                         GRAPHIC_GDIMETAFILE == pGrafObj->GetType() )
629cdf0e10cSrcweir                         bDisable = sal_True;
630cdf0e10cSrcweir                     else
631cdf0e10cSrcweir                         rSet.Put( SfxUInt16Item( nWhich, ((SwTransparencyGrf&)
632cdf0e10cSrcweir                             aCoreSet.Get(RES_GRFATR_TRANSPARENCY)).GetValue() ));
633cdf0e10cSrcweir                 }
634cdf0e10cSrcweir 			}
635cdf0e10cSrcweir 			break;
636cdf0e10cSrcweir 		case SID_ATTR_GRAF_INVERT:
637cdf0e10cSrcweir 			if( !bParentCntProt )
638cdf0e10cSrcweir 				rSet.Put( SfxBoolItem( nWhich, ((SwInvertGrf&)
639cdf0e10cSrcweir 						aCoreSet.Get(RES_GRFATR_INVERT)).GetValue() ));
640cdf0e10cSrcweir 			break;
641cdf0e10cSrcweir 
642cdf0e10cSrcweir 		case SID_ATTR_GRAF_MODE:
643cdf0e10cSrcweir 			if( !bParentCntProt )
644cdf0e10cSrcweir                 rSet.Put( SfxUInt16Item( nWhich, ((SwDrawModeGrf&)
645cdf0e10cSrcweir 						aCoreSet.Get(RES_GRFATR_DRAWMODE)).GetValue() ));
646cdf0e10cSrcweir 			break;
647cdf0e10cSrcweir 
648cdf0e10cSrcweir         case SID_GRFFILTER:
649cdf0e10cSrcweir         case SID_GRFFILTER_INVERT:
650cdf0e10cSrcweir         case SID_GRFFILTER_SMOOTH:
651cdf0e10cSrcweir         case SID_GRFFILTER_SHARPEN:
652cdf0e10cSrcweir         case SID_GRFFILTER_REMOVENOISE:
653cdf0e10cSrcweir         case SID_GRFFILTER_SOBEL:
654cdf0e10cSrcweir         case SID_GRFFILTER_MOSAIC:
655cdf0e10cSrcweir         case SID_GRFFILTER_EMBOSS:
656cdf0e10cSrcweir         case SID_GRFFILTER_POSTER:
657cdf0e10cSrcweir         case SID_GRFFILTER_POPART:
658cdf0e10cSrcweir         case SID_GRFFILTER_SEPIA:
659cdf0e10cSrcweir         case SID_GRFFILTER_SOLARIZE:
660cdf0e10cSrcweir             {
661cdf0e10cSrcweir                 if( bParentCntProt || !bIsGrfCntnt )
662cdf0e10cSrcweir                     bDisable = sal_True;
663cdf0e10cSrcweir                 else
664cdf0e10cSrcweir                 {
665cdf0e10cSrcweir                     const sal_uInt16 eGraphicType( rSh.GetGraphicType() );
666cdf0e10cSrcweir                     if ( ( eGraphicType == GRAPHIC_NONE ||
667cdf0e10cSrcweir                            eGraphicType == GRAPHIC_DEFAULT ) &&
668cdf0e10cSrcweir                          rSh.IsGrfSwapOut( sal_True ) )
669cdf0e10cSrcweir                     {
670cdf0e10cSrcweir                         rSet.DisableItem( nWhich );
671cdf0e10cSrcweir                         if( AddGrfUpdateSlot( nWhich ))
672cdf0e10cSrcweir                             rSh.GetGraphic(sal_False);  // start the loading
673cdf0e10cSrcweir                     }
674cdf0e10cSrcweir                     else
675cdf0e10cSrcweir                     {
676cdf0e10cSrcweir                         bDisable = eGraphicType != GRAPHIC_BITMAP;
677cdf0e10cSrcweir                     }
678cdf0e10cSrcweir                 }
679cdf0e10cSrcweir                 // <--
680cdf0e10cSrcweir             }
681cdf0e10cSrcweir             break;
682cdf0e10cSrcweir 
683cdf0e10cSrcweir         default:
684cdf0e10cSrcweir             bDisable = sal_False;
685cdf0e10cSrcweir         }
686cdf0e10cSrcweir 
687cdf0e10cSrcweir         if( bDisable )
688cdf0e10cSrcweir             rSet.DisableItem( nWhich );
689cdf0e10cSrcweir         nWhich = aIter.NextWhich();
690cdf0e10cSrcweir     }
691cdf0e10cSrcweir     SetGetStateSet( 0 );
692cdf0e10cSrcweir }
693cdf0e10cSrcweir 
694cdf0e10cSrcweir 
SwGrfShell(SwView & _rView)695cdf0e10cSrcweir SwGrfShell::SwGrfShell(SwView &_rView) :
696cdf0e10cSrcweir     SwBaseShell(_rView)
697cdf0e10cSrcweir 
698cdf0e10cSrcweir {
699cdf0e10cSrcweir 	SetName(String::CreateFromAscii("Graphic"));
700cdf0e10cSrcweir 	SetHelpId(SW_GRFSHELL);
701f120fe41SAndre Fischer     SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Graphic));
702cdf0e10cSrcweir }
703