1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: grfsh.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
40 #include <hintids.hxx>
41 #include <tools/urlobj.hxx>
42 #include <vcl/msgbox.hxx>
43 #include <svtools/stritem.hxx>
44 #include <svtools/whiter.hxx>
45 #include <svtools/urihelper.hxx>
46 #include <sfx2/docfile.hxx>
47 #include <sfx2/dispatch.hxx>
49 #include <sfx2/objface.hxx>
50 #include <svx/sizeitem.hxx>
51 #include <svx/protitem.hxx>
52 #include <sfx2/request.hxx>
53 #include <svx/srchitem.hxx>
54 #include <svx/htmlmode.hxx>
55 #include <svx/sdgluitm.hxx>
56 #include <svx/sdgcoitm.hxx>
57 #include <svx/sdggaitm.hxx>
58 #include <svx/sdgtritm.hxx>
59 #include <svx/sdginitm.hxx>
60 #include <svx/sdgmoitm.hxx>
61 #include <svx/brshitem.hxx>
62 #include <svx/grfflt.hxx>
63 #include <svx/tbxcolor.hxx>
67 #include <viewopt.hxx>
68 #include <swmodule.hxx>
78 #include <usrpref.hxx>
85 #include <sfx2/msg.hxx>
86 #include "swslots.hxx"
88 #include "swabstdlg.hxx"
90 #define TOOLBOX_NAME ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "colorbar" ) )
92 SFX_IMPL_INTERFACE(SwGrfShell
, SwBaseShell
, SW_RES(STR_SHELLNAME_GRAPHIC
))
94 SFX_POPUPMENU_REGISTRATION(SW_RES(MN_GRF_POPUPMENU
));
95 SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT
, SW_RES(RID_GRAFIK_TOOLBOX
));
98 void SwGrfShell::Execute(SfxRequest
&rReq
)
100 SwWrtShell
&rSh
= GetShell();
102 USHORT nSlot
= rReq
.GetSlot();
105 case SID_TWAIN_TRANSFER
:
107 GetView().ExecuteScan( rReq
);
110 case FN_SAVE_GRAPHIC
:
112 const Graphic
*pGraphic
;
113 if(0 != (pGraphic
= rSh
.GetGraphic()))
115 String sGrfNm
, sFilterNm
;
116 rSh
.GetGrfNms( &sGrfNm
, &sFilterNm
);
117 ExportGraphic( *pGraphic
, sGrfNm
);
121 case SID_INSERT_GRAPHIC
:
122 case FN_FORMAT_GRAFIC_DLG
:
124 SwFlyFrmAttrMgr
aMgr( FALSE
, &rSh
, rSh
.IsFrmSelected() ?
125 FRMMGR_TYPE_NONE
: FRMMGR_TYPE_GRF
);
126 const SwViewOption
* pVOpt
= rSh
.GetViewOptions();
127 SwViewOption
aUsrPref( *pVOpt
);
129 SfxItemSet
aSet(GetPool(), RES_FRMATR_BEGIN
, RES_FRMATR_END
-1,
130 RES_GRFATR_MIRRORGRF
, RES_GRFATR_CROPGRF
,
131 SID_ATTR_BORDER_INNER
, SID_ATTR_BORDER_INNER
,
132 SID_ATTR_GRAF_KEEP_ZOOM
, SID_ATTR_GRAF_KEEP_ZOOM
,
133 SID_ATTR_GRAF_FRMSIZE
, SID_ATTR_GRAF_FRMSIZE
,
134 SID_ATTR_GRAF_FRMSIZE_PERCENT
, SID_ATTR_GRAF_FRMSIZE_PERCENT
,
135 SID_ATTR_GRAF_GRAPHIC
, SID_ATTR_GRAF_GRAPHIC
,
136 FN_PARAM_GRF_CONNECT
, FN_PARAM_GRF_CONNECT
,
137 SID_ATTR_PAGE_SIZE
, SID_ATTR_PAGE_SIZE
,
138 FN_GET_PRINT_AREA
, FN_GET_PRINT_AREA
,
139 FN_SET_FRM_NAME
, FN_KEEP_ASPECT_RATIO
,
140 FN_PARAM_GRF_DIALOG
, FN_PARAM_GRF_DIALOG
,
141 SID_DOCFRAME
, SID_DOCFRAME
,
142 SID_HTML_MODE
, SID_HTML_MODE
,
143 FN_SET_FRM_ALT_NAME
, FN_SET_FRM_ALT_NAME
,
146 USHORT nHtmlMode
= ::GetHtmlMode(GetView().GetDocShell());
147 aSet
.Put(SfxUInt16Item(SID_HTML_MODE
, nHtmlMode
));
148 FieldUnit eMetric
= ::GetDfltMetric((0 != (nHtmlMode
&HTMLMODE_ON
)));
149 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC
, static_cast< UINT16
>(eMetric
)) );
151 const SwRect
* pRect
= &rSh
.GetAnyCurRect(RECT_PAGE
);
152 SwFmtFrmSize
aFrmSize( ATT_VAR_SIZE
, pRect
->Width(), pRect
->Height());
153 aFrmSize
.SetWhich( GetPool().GetWhich( SID_ATTR_PAGE_SIZE
) );
154 aSet
.Put( aFrmSize
);
156 aSet
.Put(SfxStringItem(FN_SET_FRM_NAME
, rSh
.GetFlyName()));
157 if ( nSlot
== FN_FORMAT_GRAFIC_DLG
)
159 // --> OD 2009-07-13 #i73249#
160 // aSet.Put(SfxStringItem(FN_SET_FRM_ALT_NAME, rSh.GetAlternateText()));
161 aSet
.Put( SfxStringItem( FN_SET_FRM_ALT_NAME
, rSh
.GetObjTitle() ) );
165 pRect
= &rSh
.GetAnyCurRect(RECT_PAGE_PRT
);
166 aFrmSize
.SetWidth( pRect
->Width() );
167 aFrmSize
.SetHeight( pRect
->Height() );
168 aFrmSize
.SetWhich( GetPool().GetWhich(FN_GET_PRINT_AREA
) );
169 aSet
.Put( aFrmSize
);
171 aSet
.Put( aMgr
.GetAttrSet() );
172 aSet
.SetParent( aMgr
.GetAttrSet().GetParent() );
174 // Bei %-Werten Groesse initialisieren
175 SwFmtFrmSize aSizeCopy
= (const SwFmtFrmSize
&)aSet
.Get(RES_FRM_SIZE
);
176 if (aSizeCopy
.GetWidthPercent() && aSizeCopy
.GetWidthPercent() != 0xff)
177 aSizeCopy
.SetWidth(rSh
.GetAnyCurRect(RECT_FLY_EMBEDDED
).Width());
178 if (aSizeCopy
.GetHeightPercent() && aSizeCopy
.GetHeightPercent() != 0xff)
179 aSizeCopy
.SetHeight(rSh
.GetAnyCurRect(RECT_FLY_EMBEDDED
).Height());
181 // and now set the size for "external" tabpages
183 SvxSizeItem
aSzItm( SID_ATTR_GRAF_FRMSIZE
, aSizeCopy
.GetSize() );
186 Size
aSz( aSizeCopy
.GetWidthPercent(), aSizeCopy
.GetHeightPercent() );
187 if( 0xff == aSz
.Width() ) aSz
.Width() = 0;
188 if( 0xff == aSz
.Height() ) aSz
.Height() = 0;
190 aSzItm
.SetSize( aSz
);
191 aSzItm
.SetWhich( SID_ATTR_GRAF_FRMSIZE_PERCENT
);
195 String sGrfNm
, sFilterNm
;
196 rSh
.GetGrfNms( &sGrfNm
, &sFilterNm
);
199 aSet
.Put( SvxBrushItem( INetURLObject::decode( sGrfNm
,
201 INetURLObject::DECODE_UNAMBIGUOUS
,
202 RTL_TEXTENCODING_UTF8
),
204 SID_ATTR_GRAF_GRAPHIC
));
208 // --> OD 2005-02-09 #119353# - robust
209 const GraphicObject
* pGrfObj
= rSh
.GetGraphicObj();
212 aSet
.Put( SvxBrushItem( *pGrfObj
, GPOS_LT
,
213 SID_ATTR_GRAF_GRAPHIC
) );
217 aSet
.Put( SfxBoolItem( FN_PARAM_GRF_CONNECT
, sGrfNm
.Len() > 0 ) );
219 // get Mirror and Crop
221 SfxItemSet
aTmpSet( rSh
.GetAttrPool(),
222 RES_GRFATR_MIRRORGRF
, RES_GRFATR_CROPGRF
);
224 rSh
.GetCurAttr( aTmpSet
);
228 aSet
.Put(SfxBoolItem(FN_KEEP_ASPECT_RATIO
, aUsrPref
.IsKeepRatio()));
229 aSet
.Put(SfxBoolItem( SID_ATTR_GRAF_KEEP_ZOOM
, aUsrPref
.IsGrfKeepZoom()));
231 aSet
.Put(SfxFrameItem( SID_DOCFRAME
, GetView().GetViewFrame()->GetTopFrame()));
233 SwAbstractDialogFactory
* pFact
= SwAbstractDialogFactory::Create();
234 DBG_ASSERT(pFact
, "Dialogdiet fail!");
235 SfxAbstractTabDialog
* pDlg
= pFact
->CreateFrmTabDialog( DLG_FRM_GRF
,
236 GetView().GetViewFrame(),
237 GetView().GetWindow(),
238 aSet
, FALSE
, DLG_FRM_GRF
);
239 DBG_ASSERT(pDlg
, "Dialogdiet fail!");
240 if( pDlg
->Execute() )
242 rSh
.StartAllAction();
243 rSh
.StartUndo(UNDO_START
);
244 const SfxPoolItem
* pItem
;
245 SfxItemSet
* pSet
= (SfxItemSet
*)pDlg
->GetOutputItemSet();
247 // change the 2 frmsize SizeItems to the correct SwFrmSizeItem
248 if( SFX_ITEM_SET
== pSet
->GetItemState(
249 SID_ATTR_GRAF_FRMSIZE
, FALSE
, &pItem
))
252 const Size
& rSz
= ((SvxSizeItem
*)pItem
)->GetSize();
253 aSize
.SetWidth( rSz
.Width() );
254 aSize
.SetHeight( rSz
.Height() );
256 if( SFX_ITEM_SET
== pSet
->GetItemState(
257 SID_ATTR_GRAF_FRMSIZE_PERCENT
, FALSE
, &pItem
))
259 const Size
& rRelativeSize
= ((SvxSizeItem
*)pItem
)->GetSize();
260 aSize
.SetWidthPercent( static_cast< BYTE
>( rRelativeSize
.Width() ) );
261 aSize
.SetHeightPercent( static_cast< BYTE
>( rRelativeSize
.Height() ) );
266 // Vorlagen-AutoUpdate
267 SwFrmFmt
* pFmt
= rSh
.GetCurFrmFmt();
268 if(pFmt
&& pFmt
->IsAutoUpdateFmt())
270 pFmt
->SetFmtAttr(*pSet
);
271 SfxItemSet
aShellSet(GetPool(), RES_FRM_SIZE
, RES_FRM_SIZE
,
272 RES_SURROUND
, RES_SURROUND
,
273 RES_ANCHOR
, RES_ANCHOR
,
274 RES_VERT_ORIENT
,RES_HORI_ORIENT
,
276 aShellSet
.Put(*pSet
);
277 aMgr
.SetAttrSet(aShellSet
);
281 aMgr
.SetAttrSet(*pSet
);
285 BOOL bApplyUsrPref
= FALSE
;
286 if (SFX_ITEM_SET
== pSet
->GetItemState(
287 FN_KEEP_ASPECT_RATIO
, TRUE
, &pItem
))
289 aUsrPref
.SetKeepRatio(
290 ((const SfxBoolItem
*)pItem
)->GetValue() );
291 bApplyUsrPref
= TRUE
;
293 if( SFX_ITEM_SET
== pSet
->GetItemState(
294 SID_ATTR_GRAF_KEEP_ZOOM
, TRUE
, &pItem
))
296 aUsrPref
.SetGrfKeepZoom(
297 ((const SfxBoolItem
*)pItem
)->GetValue() );
298 bApplyUsrPref
= TRUE
;
302 SW_MOD()->ApplyUsrPref(aUsrPref
, &GetView());
304 // and now set all the graphic attributes and other stuff
305 if( SFX_ITEM_SET
== pSet
->GetItemState(
306 SID_ATTR_GRAF_GRAPHIC
, TRUE
, &pItem
))
308 if( ((SvxBrushItem
*)pItem
)->GetGraphicLink() )
309 sGrfNm
= *((SvxBrushItem
*)pItem
)->GetGraphicLink();
313 if( ((SvxBrushItem
*)pItem
)->GetGraphicFilter() )
314 sFilterNm
= *((SvxBrushItem
*)pItem
)->GetGraphicFilter();
320 SwDocShell
* pDocSh
= GetView().GetDocShell();
321 SwWait
aWait( *pDocSh
, TRUE
);
322 SfxMedium
* pMedium
= pDocSh
->GetMedium();
325 aAbs
= pMedium
->GetURLObject();
326 rSh
.ReRead( URIHelper::SmartRel2Abs(
328 URIHelper::GetMaybeFileHdl() ),
332 if ( SFX_ITEM_SET
== pSet
->GetItemState(
333 FN_SET_FRM_ALT_NAME
, TRUE
, &pItem
))
335 // --> OD 2009-07-13 #i73249#
336 // rSh.SetAlternateText(
337 // ((const SfxStringItem*)pItem)->GetValue() );
338 rSh
.SetObjTitle( ((const SfxStringItem
*)pItem
)->GetValue() );
342 SfxItemSet
aGrfSet( rSh
.GetAttrPool(), RES_GRFATR_BEGIN
,
344 aGrfSet
.Put( *pSet
);
345 if( aGrfSet
.Count() )
346 rSh
.SetAttr( aGrfSet
);
348 rSh
.EndUndo(UNDO_END
);
355 case FN_GRAPHIC_MIRROR_ON_EVEN_PAGES
:
357 SfxItemSet
aSet(rSh
.GetAttrPool(), RES_GRFATR_MIRRORGRF
, RES_GRFATR_MIRRORGRF
);
358 rSh
.GetCurAttr( aSet
);
359 SwMirrorGrf
aGrf((const SwMirrorGrf
&)aSet
.Get(RES_GRFATR_MIRRORGRF
));
360 aGrf
.SetGrfToggle(!aGrf
.IsGrfToggle());
366 ASSERT(!this, falscher Dispatcher
);
372 void SwGrfShell::ExecAttr( SfxRequest
&rReq
)
375 if( CNT_GRF
== GetShell().GetCntType() &&
376 ( GRAPHIC_BITMAP
== ( nGrfType
= GetShell().GetGraphicType()) ||
377 GRAPHIC_GDIMETAFILE
== nGrfType
))
379 SfxItemSet
aGrfSet( GetShell().GetAttrPool(), RES_GRFATR_BEGIN
,
381 const SfxItemSet
*pArgs
= rReq
.GetArgs();
382 const SfxPoolItem
* pItem
;
383 USHORT nSlot
= rReq
.GetSlot();
384 if( !pArgs
|| SFX_ITEM_SET
!= pArgs
->GetItemState( nSlot
, FALSE
, &pItem
))
389 case FN_FLIP_VERT_GRAFIC
:
390 case FN_FLIP_HORZ_GRAFIC
:
392 GetShell().GetCurAttr( aGrfSet
);
393 SwMirrorGrf
aMirror( (SwMirrorGrf
&)aGrfSet
.Get(
394 RES_GRFATR_MIRRORGRF
) );
395 USHORT nMirror
= aMirror
.GetValue();
396 if( FN_FLIP_VERT_GRAFIC
== nSlot
)
399 case RES_MIRROR_GRAPH_DONT
: nMirror
= RES_MIRROR_GRAPH_VERT
;
401 case RES_MIRROR_GRAPH_HOR
: nMirror
= RES_MIRROR_GRAPH_BOTH
;
403 case RES_MIRROR_GRAPH_VERT
: nMirror
= RES_MIRROR_GRAPH_DONT
;
405 case RES_MIRROR_GRAPH_BOTH
: nMirror
= RES_MIRROR_GRAPH_HOR
;
411 case RES_MIRROR_GRAPH_DONT
: nMirror
= RES_MIRROR_GRAPH_HOR
;
413 case RES_MIRROR_GRAPH_VERT
: nMirror
= RES_MIRROR_GRAPH_BOTH
;
415 case RES_MIRROR_GRAPH_HOR
: nMirror
= RES_MIRROR_GRAPH_DONT
;
417 case RES_MIRROR_GRAPH_BOTH
: nMirror
= RES_MIRROR_GRAPH_VERT
;
420 aMirror
.SetValue( nMirror
);
422 aGrfSet
.Put( aMirror
);
426 case SID_ATTR_GRAF_LUMINANCE
:
428 aGrfSet
.Put( SwLuminanceGrf(
429 ((SfxInt16Item
*)pItem
)->GetValue() ));
431 case SID_ATTR_GRAF_CONTRAST
:
433 aGrfSet
.Put( SwContrastGrf(
434 ((SfxInt16Item
*)pItem
)->GetValue() ));
436 case SID_ATTR_GRAF_RED
:
438 aGrfSet
.Put( SwChannelRGrf(
439 ((SfxInt16Item
*)pItem
)->GetValue() ));
441 case SID_ATTR_GRAF_GREEN
:
443 aGrfSet
.Put( SwChannelGGrf(
444 ((SfxInt16Item
*)pItem
)->GetValue() ));
446 case SID_ATTR_GRAF_BLUE
:
448 aGrfSet
.Put( SwChannelBGrf(
449 ((SfxInt16Item
*)pItem
)->GetValue() ));
451 case SID_ATTR_GRAF_GAMMA
:
454 double fVal
= ((SfxUInt32Item
*)pItem
)->GetValue();
455 aGrfSet
.Put( SwGammaGrf(fVal
/100. ));
458 case SID_ATTR_GRAF_TRANSPARENCE
:
460 aGrfSet
.Put( SwTransparencyGrf(
461 static_cast< sal_Int8
>( ( (SfxUInt16Item
*)pItem
)->GetValue() ) ) );
463 case SID_ATTR_GRAF_INVERT
:
465 aGrfSet
.Put( SwInvertGrf(
466 ((SfxBoolItem
*)pItem
)->GetValue() ));
469 case SID_ATTR_GRAF_MODE
:
471 aGrfSet
.Put( SwDrawModeGrf(
472 ((SfxUInt16Item
*)pItem
)->GetValue() ));
475 case SID_COLOR_SETTINGS
:
477 svx::ToolboxAccess
aToolboxAccess( TOOLBOX_NAME
);
478 aToolboxAccess
.toggleToolbox();
482 case SID_GRFFILTER_INVERT
:
483 case SID_GRFFILTER_SMOOTH
:
484 case SID_GRFFILTER_SHARPEN
:
485 case SID_GRFFILTER_REMOVENOISE
:
486 case SID_GRFFILTER_SOBEL
:
487 case SID_GRFFILTER_MOSAIC
:
488 case SID_GRFFILTER_EMBOSS
:
489 case SID_GRFFILTER_POSTER
:
490 case SID_GRFFILTER_POPART
:
491 case SID_GRFFILTER_SEPIA
:
492 case SID_GRFFILTER_SOLARIZE
:
493 if( GRAPHIC_BITMAP
== nGrfType
)
495 // --> OD 2005-02-09 #119353# - robust
496 const GraphicObject
* pFilterObj( GetShell().GetGraphicObj() );
499 GraphicObject
aFilterObj( *pFilterObj
);
500 if( SVX_GRAPHICFILTER_ERRCODE_NONE
==
501 SvxGraphicFilter::ExecuteGrfFilterSlot( rReq
, aFilterObj
))
502 GetShell().ReRead( aEmptyStr
, aEmptyStr
,
503 &aFilterObj
.GetGraphic() );
510 ASSERT(!this, falscher Dispatcher
);
512 if( aGrfSet
.Count() )
513 GetShell().SetAttr( aGrfSet
);
515 GetView().GetViewFrame()->GetBindings().Invalidate(rReq
.GetSlot());
518 void SwGrfShell::GetAttrState(SfxItemSet
&rSet
)
520 SwWrtShell
&rSh
= GetShell();
521 SfxItemSet
aCoreSet( GetPool(), aNoTxtNodeSetRange
);
522 rSh
.GetCurAttr( aCoreSet
);
523 BOOL bParentCntProt
= 0 != rSh
.IsSelObjProtected( FLYPROTECT_CONTENT
|FLYPROTECT_PARENT
);
524 BOOL bIsGrfCntnt
= CNT_GRF
== GetShell().GetCntType();
525 // --> OD 2006-11-03 #i59688#
526 // BOOL bSwappedOut = rSh.IsGrfSwapOut( TRUE );
527 // BOOL bBitmapType = !bSwappedOut && GRAPHIC_BITMAP == rSh.GetGraphicType();
530 SetGetStateSet( &rSet
);
532 SfxWhichIter
aIter( rSet
);
533 USHORT nWhich
= aIter
.FirstWhich();
536 BOOL bDisable
= bParentCntProt
;
539 case SID_INSERT_GRAPHIC
:
540 case FN_FORMAT_GRAFIC_DLG
:
541 case SID_TWAIN_TRANSFER
:
542 if( bParentCntProt
|| !bIsGrfCntnt
)
545 case FN_SAVE_GRAPHIC
:
546 if( rSh
.GetGraphicType() == GRAPHIC_NONE
)
549 case SID_COLOR_SETTINGS
:
551 if ( bParentCntProt
|| !bIsGrfCntnt
)
555 svx::ToolboxAccess
aToolboxAccess( TOOLBOX_NAME
);
556 rSet
.Put( SfxBoolItem( nWhich
, aToolboxAccess
.isToolboxVisible() ) );
561 case FN_FLIP_VERT_GRAFIC
:
562 if( !bParentCntProt
)
564 MirrorGraph nState
= static_cast< MirrorGraph
>(((const SwMirrorGrf
&) aCoreSet
.Get(
565 RES_GRFATR_MIRRORGRF
)).GetValue());
567 rSet
.Put(SfxBoolItem( nWhich
, nState
== RES_MIRROR_GRAPH_VERT
||
568 nState
== RES_MIRROR_GRAPH_BOTH
));
572 case FN_FLIP_HORZ_GRAFIC
:
573 if( !bParentCntProt
)
575 MirrorGraph nState
= static_cast< MirrorGraph
>(((const SwMirrorGrf
&) aCoreSet
.Get(
576 RES_GRFATR_MIRRORGRF
)).GetValue());
578 rSet
.Put(SfxBoolItem( nWhich
, nState
== RES_MIRROR_GRAPH_HOR
||
579 nState
== RES_MIRROR_GRAPH_BOTH
));
584 case SID_ATTR_GRAF_LUMINANCE
:
585 if( !bParentCntProt
)
586 rSet
.Put( SfxInt16Item( nWhich
, ((SwLuminanceGrf
&)
587 aCoreSet
.Get(RES_GRFATR_LUMINANCE
)).GetValue() ));
589 case SID_ATTR_GRAF_CONTRAST
:
590 if( !bParentCntProt
)
591 rSet
.Put( SfxInt16Item( nWhich
, ((SwContrastGrf
&)
592 aCoreSet
.Get(RES_GRFATR_CONTRAST
)).GetValue() ));
594 case SID_ATTR_GRAF_RED
:
595 if( !bParentCntProt
)
596 rSet
.Put( SfxInt16Item( nWhich
, ((SwChannelRGrf
&)
597 aCoreSet
.Get(RES_GRFATR_CHANNELR
)).GetValue() ));
599 case SID_ATTR_GRAF_GREEN
:
600 if( !bParentCntProt
)
601 rSet
.Put( SfxInt16Item( nWhich
, ((SwChannelGGrf
&)
602 aCoreSet
.Get(RES_GRFATR_CHANNELG
)).GetValue() ));
604 case SID_ATTR_GRAF_BLUE
:
605 if( !bParentCntProt
)
606 rSet
.Put( SfxInt16Item( nWhich
, ((SwChannelBGrf
&)
607 aCoreSet
.Get(RES_GRFATR_CHANNELB
)).GetValue() ));
610 case SID_ATTR_GRAF_GAMMA
:
611 if( !bParentCntProt
)
612 rSet
.Put( SfxUInt32Item( nWhich
, static_cast< UINT32
>(
613 ( (SwGammaGrf
&)aCoreSet
.Get( RES_GRFATR_GAMMA
) ).GetValue() * 100 ) ) );
615 case SID_ATTR_GRAF_TRANSPARENCE
:
616 if( !bParentCntProt
)
618 // --> OD 2005-02-09 #119353# - robust
619 const GraphicObject
* pGrfObj
= rSh
.GetGraphicObj();
622 if( pGrfObj
->IsAnimated() ||
623 GRAPHIC_GDIMETAFILE
== pGrfObj
->GetType() )
626 rSet
.Put( SfxUInt16Item( nWhich
, ((SwTransparencyGrf
&)
627 aCoreSet
.Get(RES_GRFATR_TRANSPARENCY
)).GetValue() ));
631 case SID_ATTR_GRAF_INVERT
:
632 if( !bParentCntProt
)
633 rSet
.Put( SfxBoolItem( nWhich
, ((SwInvertGrf
&)
634 aCoreSet
.Get(RES_GRFATR_INVERT
)).GetValue() ));
637 case SID_ATTR_GRAF_MODE
:
638 if( !bParentCntProt
)
639 rSet
.Put( SfxUInt16Item( nWhich
, ((SwDrawModeGrf
&)
640 aCoreSet
.Get(RES_GRFATR_DRAWMODE
)).GetValue() ));
644 case SID_GRFFILTER_INVERT
:
645 case SID_GRFFILTER_SMOOTH
:
646 case SID_GRFFILTER_SHARPEN
:
647 case SID_GRFFILTER_REMOVENOISE
:
648 case SID_GRFFILTER_SOBEL
:
649 case SID_GRFFILTER_MOSAIC
:
650 case SID_GRFFILTER_EMBOSS
:
651 case SID_GRFFILTER_POSTER
:
652 case SID_GRFFILTER_POPART
:
653 case SID_GRFFILTER_SEPIA
:
654 case SID_GRFFILTER_SOLARIZE
:
656 if( bParentCntProt
|| !bIsGrfCntnt
)
658 // --> OD 2006-11-03 #i59688#
659 // load graphic only if type is unknown
660 // else if( bSwappedOut )
662 // rSet.DisableItem( nWhich );
663 // if( AddGrfUpdateSlot( nWhich ))
664 // rSh.GetGraphic(FALSE); // start the loading
667 // bDisable = !bBitmapType;
670 const USHORT
eGraphicType( rSh
.GetGraphicType() );
671 if ( ( eGraphicType
== GRAPHIC_NONE
||
672 eGraphicType
== GRAPHIC_DEFAULT
) &&
673 rSh
.IsGrfSwapOut( TRUE
) )
675 rSet
.DisableItem( nWhich
);
676 if( AddGrfUpdateSlot( nWhich
))
677 rSh
.GetGraphic(FALSE
); // start the loading
681 bDisable
= eGraphicType
!= GRAPHIC_BITMAP
;
693 rSet
.DisableItem( nWhich
);
694 nWhich
= aIter
.NextWhich();
700 SwGrfShell::SwGrfShell(SwView
&_rView
) :
704 SetName(String::CreateFromAscii("Graphic"));
705 SetHelpId(SW_GRFSHELL
);