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