bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / func / fuchar.cxx
blob174391ac74da9f37a7735396e540e93d368ffef3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "fuchar.hxx"
21 #include <svx/dialogs.hrc>
22 #include <sfx2/viewfrm.hxx>
24 #include <editeng/editdata.hxx>
25 #include <svx/svxids.hrc>
26 #include <editeng/eeitem.hxx>
27 #include <vcl/msgbox.hxx>
28 #include <sfx2/bindings.hxx>
29 #include <sfx2/request.hxx>
30 #include "View.hxx"
31 #include "drawview.hxx"
32 #include "drawdoc.hxx"
33 #include "DrawViewShell.hxx"
34 #include "ViewShell.hxx"
35 #include "DrawDocShell.hxx"
36 #include "sdabstdlg.hxx"
37 #include <boost/scoped_ptr.hpp>
39 namespace sd {
41 TYPEINIT1( FuChar, FuPoor );
43 FuChar::FuChar (
44 ViewShell* pViewSh,
45 ::sd::Window* pWin,
46 ::sd::View* pView,
47 SdDrawDocument* pDoc,
48 SfxRequest& rReq)
49 : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
53 rtl::Reference<FuPoor> FuChar::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
55 rtl::Reference<FuPoor> xFunc( new FuChar( pViewSh, pWin, pView, pDoc, rReq ) );
56 xFunc->DoExecute(rReq);
57 return xFunc;
60 void FuChar::DoExecute( SfxRequest& rReq )
62 const SfxItemSet* pArgs = rReq.GetArgs();
64 if( !pArgs )
66 SfxItemSet aEditAttr( mpDoc->GetPool() );
67 mpView->GetAttributes( aEditAttr );
69 SfxItemSet aNewAttr( mpViewShell->GetPool(),
70 EE_ITEMS_START, EE_ITEMS_END );
71 aNewAttr.Put( aEditAttr, false );
73 SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
74 boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact ? pFact->CreateSdTabCharDialog( NULL, &aNewAttr, mpDoc->GetDocSh() ) : 0);
75 sal_uInt16 nResult = RET_CANCEL;
76 if( pDlg )
78 if (rReq.GetSlot() == SID_CHAR_DLG_EFFECT)
80 pDlg->SetCurPageId("RID_SVXPAGE_CHAR_EFFECTS");
83 nResult = pDlg->Execute();
85 if( nResult == RET_OK )
87 rReq.Done( *( pDlg->GetOutputItemSet() ) );
88 pArgs = rReq.GetArgs();
91 if( nResult != RET_OK )
93 return;
96 mpView->SetAttributes(*pArgs);
98 // invalidate the Slots which are in DrTxtObjBar
99 static sal_uInt16 SidArray[] = {
100 SID_ATTR_CHAR_FONT,
101 SID_ATTR_CHAR_POSTURE,
102 SID_ATTR_CHAR_WEIGHT,
103 SID_ATTR_CHAR_SHADOWED,
104 SID_ATTR_CHAR_STRIKEOUT,
105 SID_ATTR_CHAR_UNDERLINE,
106 SID_ATTR_CHAR_FONTHEIGHT,
107 SID_ATTR_CHAR_COLOR,
108 SID_ATTR_CHAR_KERNING,
109 SID_SET_SUPER_SCRIPT,
110 SID_SET_SUB_SCRIPT,
111 0 };
113 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
115 if( mpDoc->GetOnlineSpell() )
117 const SfxPoolItem* pItem;
118 if( SfxItemState::SET == pArgs->GetItemState(EE_CHAR_LANGUAGE, false, &pItem ) ||
119 SfxItemState::SET == pArgs->GetItemState(EE_CHAR_LANGUAGE_CJK, false, &pItem ) ||
120 SfxItemState::SET == pArgs->GetItemState(EE_CHAR_LANGUAGE_CTL, false, &pItem ) )
122 mpDoc->StopOnlineSpelling();
123 mpDoc->StartOnlineSpelling();
128 void FuChar::Activate()
132 void FuChar::Deactivate()
136 } // end of namespace sd
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */