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 :
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 : |*
44 : |* Konstruktor
45 : |*
46 : \************************************************************************/
47 :
48 0 : FuChar::FuChar (
49 : ViewShell* pViewSh,
50 : ::sd::Window* pWin,
51 : ::sd::View* pView,
52 : SdDrawDocument* pDoc,
53 : SfxRequest& rReq)
54 0 : : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
55 : {
56 0 : }
57 :
58 0 : FunctionReference FuChar::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
59 : {
60 0 : FunctionReference xFunc( new FuChar( pViewSh, pWin, pView, pDoc, rReq ) );
61 0 : xFunc->DoExecute(rReq);
62 0 : return xFunc;
63 : }
64 :
65 0 : void FuChar::DoExecute( SfxRequest& rReq )
66 : {
67 0 : const SfxItemSet* pArgs = rReq.GetArgs();
68 :
69 0 : if( !pArgs )
70 : {
71 0 : SfxItemSet aEditAttr( mpDoc->GetPool() );
72 0 : mpView->GetAttributes( aEditAttr );
73 :
74 0 : SfxItemSet aNewAttr( mpViewShell->GetPool(),
75 0 : EE_ITEMS_START, EE_ITEMS_END );
76 0 : aNewAttr.Put( aEditAttr, sal_False );
77 :
78 0 : SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
79 0 : SfxAbstractTabDialog* pDlg = pFact ? pFact->CreateSdTabCharDialog( NULL, &aNewAttr, mpDoc->GetDocSh() ) : 0;
80 0 : if( pDlg )
81 : {
82 0 : sal_uInt16 nResult = pDlg->Execute();
83 :
84 0 : if( nResult == RET_OK )
85 : {
86 0 : rReq.Done( *( pDlg->GetOutputItemSet() ) );
87 0 : pArgs = rReq.GetArgs();
88 : }
89 :
90 0 : delete pDlg;
91 :
92 0 : if( nResult != RET_OK )
93 : {
94 0 : return;
95 : }
96 0 : }
97 : }
98 0 : mpView->SetAttributes(*pArgs);
99 :
100 : // invalidieren der Slots, die in der DrTxtObjBar auftauchen
101 : static sal_uInt16 SidArray[] = {
102 : SID_ATTR_CHAR_FONT,
103 : SID_ATTR_CHAR_POSTURE,
104 : SID_ATTR_CHAR_WEIGHT,
105 : SID_ATTR_CHAR_UNDERLINE,
106 : SID_ATTR_CHAR_FONTHEIGHT,
107 : SID_ATTR_CHAR_COLOR,
108 : SID_SET_SUPER_SCRIPT,
109 : SID_SET_SUB_SCRIPT,
110 : 0 };
111 :
112 0 : mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
113 :
114 0 : if( mpDoc->GetOnlineSpell() )
115 : {
116 : const SfxPoolItem* pItem;
117 0 : if( SFX_ITEM_SET == pArgs->GetItemState(EE_CHAR_LANGUAGE, sal_False, &pItem ) ||
118 0 : SFX_ITEM_SET == pArgs->GetItemState(EE_CHAR_LANGUAGE_CJK, sal_False, &pItem ) ||
119 0 : SFX_ITEM_SET == pArgs->GetItemState(EE_CHAR_LANGUAGE_CTL, sal_False, &pItem ) )
120 : {
121 0 : mpDoc->StopOnlineSpelling();
122 0 : mpDoc->StartOnlineSpelling();
123 : }
124 : }
125 : }
126 :
127 0 : void FuChar::Activate()
128 : {
129 0 : }
130 :
131 0 : void FuChar::Deactivate()
132 : {
133 0 : }
134 :
135 9 : } // end of namespace sd
136 :
137 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|