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: fuchar.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_sd.hxx"
37 #include <sfx2/viewfrm.hxx>
39 #include <svx/editdata.hxx>
40 #include <svx/svxids.hrc>
41 #include <svx/eeitem.hxx>
42 #include <vcl/msgbox.hxx>
43 #include <sfx2/bindings.hxx>
44 #include <sfx2/request.hxx>
46 #include "drawview.hxx"
47 #include "drawdoc.hxx"
48 #include "DrawViewShell.hxx"
49 #include "ViewShell.hxx"
50 #include "DrawDocShell.hxx"
51 #include "sdabstdlg.hxx"
55 TYPEINIT1( FuChar
, FuPoor
);
57 /*************************************************************************
61 \************************************************************************/
69 : FuPoor(pViewSh
, pWin
, pView
, pDoc
, rReq
)
73 FunctionReference
FuChar::Create( ViewShell
* pViewSh
, ::sd::Window
* pWin
, ::sd::View
* pView
, SdDrawDocument
* pDoc
, SfxRequest
& rReq
)
75 FunctionReference
xFunc( new FuChar( pViewSh
, pWin
, pView
, pDoc
, rReq
) );
76 xFunc
->DoExecute(rReq
);
80 void FuChar::DoExecute( SfxRequest
& rReq
)
82 const SfxItemSet
* pArgs
= rReq
.GetArgs();
86 SfxItemSet
aEditAttr( mpDoc
->GetPool() );
87 mpView
->GetAttributes( aEditAttr
);
89 SfxItemSet
aNewAttr( mpViewShell
->GetPool(),
90 EE_ITEMS_START
, EE_ITEMS_END
);
91 aNewAttr
.Put( aEditAttr
, FALSE
);
93 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
94 SfxAbstractTabDialog
* pDlg
= pFact
? pFact
->CreateSdTabCharDialog( NULL
, &aNewAttr
, mpDoc
->GetDocSh() ) : 0;
97 USHORT nResult
= pDlg
->Execute();
99 if( nResult
== RET_OK
)
101 rReq
.Done( *( pDlg
->GetOutputItemSet() ) );
102 pArgs
= rReq
.GetArgs();
107 if( nResult
!= RET_OK
)
113 mpView
->SetAttributes(*pArgs
);
115 // invalidieren der Slots, die in der DrTxtObjBar auftauchen
116 static USHORT SidArray
[] = {
118 SID_ATTR_CHAR_POSTURE
,
119 SID_ATTR_CHAR_WEIGHT
,
120 SID_ATTR_CHAR_UNDERLINE
,
121 SID_ATTR_CHAR_FONTHEIGHT
,
123 SID_SET_SUPER_SCRIPT
,
127 mpViewShell
->GetViewFrame()->GetBindings().Invalidate( SidArray
);
129 if( mpDoc
->GetOnlineSpell() )
131 const SfxPoolItem
* pItem
;
132 if( SFX_ITEM_SET
== pArgs
->GetItemState(EE_CHAR_LANGUAGE
, FALSE
, &pItem
) ||
133 SFX_ITEM_SET
== pArgs
->GetItemState(EE_CHAR_LANGUAGE_CJK
, FALSE
, &pItem
) ||
134 SFX_ITEM_SET
== pArgs
->GetItemState(EE_CHAR_LANGUAGE_CTL
, FALSE
, &pItem
) )
136 mpDoc
->StopOnlineSpelling();
137 mpDoc
->StartOnlineSpelling();
142 void FuChar::Activate()
146 void FuChar::Deactivate()
150 } // end of namespace sd