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 :
38 : namespace sd {
39 :
40 0 : TYPEINIT1( FuChar, FuPoor );
41 :
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 : 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 : delete pDlg;
92 : }
93 0 : if( nResult != RET_OK )
94 : {
95 0 : return;
96 0 : }
97 : }
98 0 : mpView->SetAttributes(*pArgs);
99 :
100 : // invalidate the Slots which are in DrTxtObjBar
101 : static sal_uInt16 SidArray[] = {
102 : SID_ATTR_CHAR_FONT,
103 : SID_ATTR_CHAR_POSTURE,
104 : SID_ATTR_CHAR_WEIGHT,
105 : SID_ATTR_CHAR_SHADOWED,
106 : SID_ATTR_CHAR_STRIKEOUT,
107 : SID_ATTR_CHAR_UNDERLINE,
108 : SID_ATTR_CHAR_FONTHEIGHT,
109 : SID_ATTR_CHAR_COLOR,
110 : SID_ATTR_CHAR_KERNING,
111 : SID_SET_SUPER_SCRIPT,
112 : SID_SET_SUB_SCRIPT,
113 : 0 };
114 :
115 0 : mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
116 :
117 0 : if( mpDoc->GetOnlineSpell() )
118 : {
119 : const SfxPoolItem* pItem;
120 0 : if( SFX_ITEM_SET == pArgs->GetItemState(EE_CHAR_LANGUAGE, false, &pItem ) ||
121 0 : SFX_ITEM_SET == pArgs->GetItemState(EE_CHAR_LANGUAGE_CJK, false, &pItem ) ||
122 0 : SFX_ITEM_SET == pArgs->GetItemState(EE_CHAR_LANGUAGE_CTL, false, &pItem ) )
123 : {
124 0 : mpDoc->StopOnlineSpelling();
125 0 : mpDoc->StartOnlineSpelling();
126 : }
127 : }
128 : }
129 :
130 0 : void FuChar::Activate()
131 : {
132 0 : }
133 :
134 0 : void FuChar::Deactivate()
135 : {
136 0 : }
137 :
138 0 : } // end of namespace sd
139 :
140 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|