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 : FunctionReference FuChar::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
54 : {
55 0 : FunctionReference 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, sal_False );
72 :
73 0 : SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
74 0 : SfxAbstractTabDialog* pDlg = pFact ? pFact->CreateSdTabCharDialog( NULL, &aNewAttr, mpDoc->GetDocSh() ) : 0;
75 0 : if( pDlg )
76 : {
77 0 : if (rReq.GetSlot() == SID_CHAR_DLG_EFFECT)
78 : {
79 0 : pDlg->SetCurPageId(RID_SVXPAGE_CHAR_EFFECTS);
80 : }
81 0 : sal_uInt16 nResult = pDlg->Execute();
82 :
83 0 : if( nResult == RET_OK )
84 : {
85 0 : rReq.Done( *( pDlg->GetOutputItemSet() ) );
86 0 : pArgs = rReq.GetArgs();
87 : }
88 :
89 0 : delete pDlg;
90 :
91 0 : if( nResult != RET_OK )
92 : {
93 0 : return;
94 : }
95 0 : }
96 : }
97 0 : mpView->SetAttributes(*pArgs);
98 :
99 : // invalidate the Slots which are in DrTxtObjBar
100 : static sal_uInt16 SidArray[] = {
101 : SID_ATTR_CHAR_FONT,
102 : SID_ATTR_CHAR_POSTURE,
103 : SID_ATTR_CHAR_WEIGHT,
104 : SID_ATTR_CHAR_SHADOWED,
105 : SID_ATTR_CHAR_STRIKEOUT,
106 : SID_ATTR_CHAR_UNDERLINE,
107 : SID_ATTR_CHAR_FONTHEIGHT,
108 : SID_ATTR_CHAR_COLOR,
109 : SID_ATTR_CHAR_KERNING,
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( SFX_ITEM_SET == pArgs->GetItemState(EE_CHAR_LANGUAGE, sal_False, &pItem ) ||
120 0 : SFX_ITEM_SET == pArgs->GetItemState(EE_CHAR_LANGUAGE_CJK, sal_False, &pItem ) ||
121 0 : SFX_ITEM_SET == pArgs->GetItemState(EE_CHAR_LANGUAGE_CTL, sal_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 33 : } // end of namespace sd
138 :
139 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|