/src/libreoffice/sd/source/ui/func/fuchar.cxx
Line | Count | Source |
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 <sfx2/viewfrm.hxx> |
22 | | #include <sfx2/sfxdlg.hxx> |
23 | | |
24 | | #include <svx/svxids.hrc> |
25 | | #include <editeng/eeitem.hxx> |
26 | | #include <editeng/colritem.hxx> |
27 | | #include <editeng/brushitem.hxx> |
28 | | #include <sfx2/bindings.hxx> |
29 | | #include <sfx2/request.hxx> |
30 | | #include <View.hxx> |
31 | | #include <drawdoc.hxx> |
32 | | #include <ViewShell.hxx> |
33 | | #include <DrawDocShell.hxx> |
34 | | #include <sdabstdlg.hxx> |
35 | | |
36 | | namespace sd { |
37 | | |
38 | | |
39 | | FuChar::FuChar ( |
40 | | ViewShell& rViewSh, |
41 | | ::sd::Window* pWin, |
42 | | ::sd::View* pView, |
43 | | SdDrawDocument& rDoc, |
44 | | SfxRequest& rReq) |
45 | 0 | : FuPoor(rViewSh, pWin, pView, rDoc, rReq) |
46 | 0 | { |
47 | 0 | } |
48 | | |
49 | | rtl::Reference<FuPoor> FuChar::Create( ViewShell& rViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument& rDoc, SfxRequest& rReq ) |
50 | 0 | { |
51 | 0 | rtl::Reference<FuPoor> xFunc( new FuChar( rViewSh, pWin, pView, rDoc, rReq ) ); |
52 | 0 | xFunc->DoExecute(rReq); |
53 | 0 | return xFunc; |
54 | 0 | } |
55 | | |
56 | | void FuChar::DoExecute( SfxRequest& rReq ) |
57 | 0 | { |
58 | 0 | const SfxItemSet* pArgs = rReq.GetArgs(); |
59 | |
|
60 | 0 | if( !pArgs ) |
61 | 0 | { |
62 | 0 | SfxItemSet aEditAttr( mrDoc.GetPool() ); |
63 | 0 | mpView->GetAttributes( aEditAttr ); |
64 | |
|
65 | 0 | SfxItemSetFixed<XATTR_FILLSTYLE, XATTR_FILLCOLOR, EE_ITEMS_START, EE_ITEMS_END> aNewAttr(mrViewShell.GetPool()); |
66 | 0 | aNewAttr.Put( aEditAttr, false ); |
67 | |
|
68 | 0 | SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); |
69 | 0 | ScopedVclPtr<SfxAbstractTabDialog> pDlg( pFact->CreateSdTabCharDialog(mrViewShell.GetFrameWeld(), &aNewAttr, mrDoc.GetDocSh() ) ); |
70 | 0 | if (rReq.GetSlot() == SID_CHAR_DLG_EFFECT) |
71 | 0 | { |
72 | 0 | pDlg->SetCurPageId(u"fonteffects"_ustr); |
73 | 0 | } |
74 | |
|
75 | 0 | sal_uInt16 nResult = pDlg->Execute(); |
76 | |
|
77 | 0 | if( nResult != RET_OK ) |
78 | 0 | return; |
79 | | |
80 | 0 | const SfxItemSet* pOutputSet = pDlg->GetOutputItemSet(); |
81 | 0 | SfxItemSet aOtherSet( *pOutputSet ); |
82 | | |
83 | | // and now the reverse process |
84 | 0 | const SvxBrushItem* pBrushItem = aOtherSet.GetItem<SvxBrushItem>( SID_ATTR_BRUSH_CHAR ); |
85 | |
|
86 | 0 | if ( pBrushItem ) |
87 | 0 | { |
88 | 0 | SvxColorItem aBackColorItem( pBrushItem->GetColor(), EE_CHAR_BKGCOLOR ); |
89 | 0 | aOtherSet.ClearItem( SID_ATTR_BRUSH_CHAR ); |
90 | 0 | aOtherSet.Put( aBackColorItem ); |
91 | 0 | } |
92 | |
|
93 | 0 | rReq.Done( aOtherSet ); |
94 | 0 | pArgs = rReq.GetArgs(); |
95 | 0 | } |
96 | 0 | mpView->SetAttributes(*pArgs); |
97 | | |
98 | | // invalidate the Slots which are in DrTxtObjBar |
99 | 0 | static const sal_uInt16 SidArray[] = { |
100 | 0 | SID_ATTR_CHAR_FONT, |
101 | 0 | SID_ATTR_CHAR_POSTURE, |
102 | 0 | SID_ATTR_CHAR_WEIGHT, |
103 | 0 | SID_ATTR_CHAR_SHADOWED, |
104 | 0 | SID_ATTR_CHAR_STRIKEOUT, |
105 | 0 | SID_ATTR_CHAR_UNDERLINE, |
106 | 0 | SID_ATTR_CHAR_FONTHEIGHT, |
107 | 0 | SID_ATTR_CHAR_COLOR, |
108 | 0 | SID_ATTR_CHAR_KERNING, |
109 | 0 | SID_ATTR_CHAR_CASEMAP, |
110 | 0 | SID_SET_SUPER_SCRIPT, |
111 | 0 | SID_SET_SUB_SCRIPT, |
112 | 0 | SID_ATTR_CHAR_BACK_COLOR, |
113 | 0 | 0 }; |
114 | |
|
115 | 0 | mrViewShell.GetViewFrame()->GetBindings().Invalidate( SidArray ); |
116 | |
|
117 | 0 | if( mrDoc.GetOnlineSpell() ) |
118 | 0 | { |
119 | 0 | if( SfxItemState::SET == pArgs->GetItemState(EE_CHAR_LANGUAGE, false ) || |
120 | 0 | SfxItemState::SET == pArgs->GetItemState(EE_CHAR_LANGUAGE_CJK, false ) || |
121 | 0 | SfxItemState::SET == pArgs->GetItemState(EE_CHAR_LANGUAGE_CTL, false ) ) |
122 | 0 | { |
123 | 0 | mrDoc.StopOnlineSpelling(); |
124 | 0 | mrDoc.StartOnlineSpelling(); |
125 | 0 | } |
126 | 0 | } |
127 | 0 | } |
128 | | |
129 | | void FuChar::Activate() |
130 | 0 | { |
131 | 0 | } |
132 | | |
133 | | void FuChar::Deactivate() |
134 | 0 | { |
135 | 0 | } |
136 | | |
137 | | } // end of namespace sd |
138 | | |
139 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |