Update ooo320-m1
[ooovba.git] / sd / source / ui / func / fuchar.cxx
blob001d51203032ae9c715fdaaaae3086db82d9db5d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fuchar.cxx,v $
10 * $Revision: 1.11 $
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"
35 #include "fuchar.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>
45 #include "View.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"
53 namespace sd {
55 TYPEINIT1( FuChar, FuPoor );
57 /*************************************************************************
59 |* Konstruktor
61 \************************************************************************/
63 FuChar::FuChar (
64 ViewShell* pViewSh,
65 ::sd::Window* pWin,
66 ::sd::View* pView,
67 SdDrawDocument* pDoc,
68 SfxRequest& rReq)
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);
77 return xFunc;
80 void FuChar::DoExecute( SfxRequest& rReq )
82 const SfxItemSet* pArgs = rReq.GetArgs();
84 if( !pArgs )
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;
95 if( pDlg )
97 USHORT nResult = pDlg->Execute();
99 if( nResult == RET_OK )
101 rReq.Done( *( pDlg->GetOutputItemSet() ) );
102 pArgs = rReq.GetArgs();
105 delete pDlg;
107 if( nResult != RET_OK )
109 return;
113 mpView->SetAttributes(*pArgs);
115 // invalidieren der Slots, die in der DrTxtObjBar auftauchen
116 static USHORT SidArray[] = {
117 SID_ATTR_CHAR_FONT,
118 SID_ATTR_CHAR_POSTURE,
119 SID_ATTR_CHAR_WEIGHT,
120 SID_ATTR_CHAR_UNDERLINE,
121 SID_ATTR_CHAR_FONTHEIGHT,
122 SID_ATTR_CHAR_COLOR,
123 SID_SET_SUPER_SCRIPT,
124 SID_SET_SUB_SCRIPT,
125 0 };
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