Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include "fuchar.hxx"
21 : #include <svx/dialogs.hrc>
22 : #include <sfx2/viewfrm.hxx>
23 :
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>
38 :
39 : namespace sd {
40 :
41 0 : TYPEINIT1( FuChar, FuPoor );
42 :
43 0 : FuChar::FuChar (
44 : ViewShell* pViewSh,
45 : ::sd::Window* pWin,
46 : ::sd::View* pView,
47 : SdDrawDocument* pDoc,
48 : SfxRequest& rReq)
49 0 : : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
50 : {
51 0 : }
52 :
53 0 : rtl::Reference<FuPoor> FuChar::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
54 : {
55 0 : rtl::Reference<FuPoor> xFunc( new FuChar( pViewSh, pWin, pView, pDoc, rReq ) );
56 0 : xFunc->DoExecute(rReq);
57 0 : return xFunc;
58 : }
59 :
60 0 : void FuChar::DoExecute( SfxRequest& rReq )
61 : {
62 0 : const SfxItemSet* pArgs = rReq.GetArgs();
63 :
64 0 : if( !pArgs )
65 : {
66 0 : SfxItemSet aEditAttr( mpDoc->GetPool() );
67 0 : mpView->GetAttributes( aEditAttr );
68 :
69 0 : SfxItemSet aNewAttr( mpViewShell->GetPool(),
70 0 : EE_ITEMS_START, EE_ITEMS_END );
71 0 : aNewAttr.Put( aEditAttr, false );
72 :
73 0 : SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
74 0 : boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact ? pFact->CreateSdTabCharDialog( NULL, &aNewAttr, mpDoc->GetDocSh() ) : 0);
75 0 : sal_uInt16 nResult = RET_CANCEL;
76 0 : if( pDlg )
77 : {
78 0 : if (rReq.GetSlot() == SID_CHAR_DLG_EFFECT)
79 : {
80 0 : pDlg->SetCurPageId("RID_SVXPAGE_CHAR_EFFECTS");
81 : }
82 :
83 0 : nResult = pDlg->Execute();
84 :
85 0 : if( nResult == RET_OK )
86 : {
87 0 : rReq.Done( *( pDlg->GetOutputItemSet() ) );
88 0 : pArgs = rReq.GetArgs();
89 : }
90 : }
91 0 : if( nResult != RET_OK )
92 : {
93 0 : return;
94 0 : }
95 : }
96 0 : mpView->SetAttributes(*pArgs);
97 :
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_ATTR_CHAR_CASEMAP,
110 : SID_SET_SUPER_SCRIPT,
111 : SID_SET_SUB_SCRIPT,
112 : 0 };
113 :
114 0 : mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
115 :
116 0 : if( mpDoc->GetOnlineSpell() )
117 : {
118 : const SfxPoolItem* pItem;
119 0 : if( SfxItemState::SET == pArgs->GetItemState(EE_CHAR_LANGUAGE, false, &pItem ) ||
120 0 : SfxItemState::SET == pArgs->GetItemState(EE_CHAR_LANGUAGE_CJK, false, &pItem ) ||
121 0 : SfxItemState::SET == pArgs->GetItemState(EE_CHAR_LANGUAGE_CTL, false, &pItem ) )
122 : {
123 0 : mpDoc->StopOnlineSpelling();
124 0 : mpDoc->StartOnlineSpelling();
125 : }
126 : }
127 : }
128 :
129 0 : void FuChar::Activate()
130 : {
131 0 : }
132 :
133 0 : void FuChar::Deactivate()
134 : {
135 0 : }
136 :
137 66 : } // end of namespace sd
138 :
139 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|