xref: /aoo4110/main/sd/source/ui/func/fuchar.cxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sd.hxx"
26 
27 
28 #include "fuchar.hxx"
29 #include <svx/dialogs.hrc>
30 #include <sfx2/viewfrm.hxx>
31 
32 #include <editeng/editdata.hxx>
33 #include <svx/svxids.hrc>
34 #include <editeng/eeitem.hxx>
35 #include <vcl/msgbox.hxx>
36 #include <sfx2/bindings.hxx>
37 #include <sfx2/request.hxx>
38 #include "View.hxx"
39 #include "drawview.hxx"
40 #include "drawdoc.hxx"
41 #include "DrawViewShell.hxx"
42 #include "ViewShell.hxx"
43 #include "DrawDocShell.hxx"
44 #include "sdabstdlg.hxx"
45 
46 namespace sd {
47 
48 TYPEINIT1( FuChar, FuPoor );
49 
50 /*************************************************************************
51 |*
52 |* Konstruktor
53 |*
54 \************************************************************************/
55 
FuChar(ViewShell * pViewSh,::sd::Window * pWin,::sd::View * pView,SdDrawDocument * pDoc,SfxRequest & rReq)56 FuChar::FuChar (
57     ViewShell* pViewSh,
58     ::sd::Window* pWin,
59     ::sd::View* pView,
60     SdDrawDocument* pDoc,
61     SfxRequest& rReq)
62     : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
63 {
64 }
65 
Create(ViewShell * pViewSh,::sd::Window * pWin,::sd::View * pView,SdDrawDocument * pDoc,SfxRequest & rReq)66 FunctionReference FuChar::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
67 {
68 	FunctionReference xFunc( new FuChar( pViewSh, pWin, pView, pDoc, rReq ) );
69 	xFunc->DoExecute(rReq);
70 	return xFunc;
71 }
72 
DoExecute(SfxRequest & rReq)73 void FuChar::DoExecute( SfxRequest& rReq )
74 {
75 	const SfxItemSet* pArgs = rReq.GetArgs();
76 
77 	if( !pArgs )
78 	{
79 		SfxItemSet aEditAttr( mpDoc->GetPool() );
80 		mpView->GetAttributes( aEditAttr );
81 
82 		SfxItemSet aNewAttr( mpViewShell->GetPool(),
83 								EE_ITEMS_START, EE_ITEMS_END );
84 		aNewAttr.Put( aEditAttr, sal_False );
85 
86 		SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
87 		SfxAbstractTabDialog* pDlg = pFact ? pFact->CreateSdTabCharDialog( NULL, &aNewAttr, mpDoc->GetDocSh() ) : 0;
88 		if( pDlg )
89 		{
90 			if (rReq.GetSlot() == SID_CHAR_DLG_EFFECT)
91 			{
92 				pDlg->SetCurPageId(RID_SVXPAGE_CHAR_EFFECTS);
93 			}
94 			sal_uInt16 nResult = pDlg->Execute();
95 
96 			if( nResult == RET_OK )
97 			{
98 				rReq.Done( *( pDlg->GetOutputItemSet() ) );
99 				pArgs = rReq.GetArgs();
100 			}
101 
102 			delete pDlg;
103 
104 			if( nResult != RET_OK )
105 			{
106 				return;
107 			}
108 		}
109 	}
110 	mpView->SetAttributes(*pArgs);
111 
112 	// invalidieren der Slots, die in der DrTxtObjBar auftauchen
113 	static sal_uInt16 SidArray[] = {
114 					SID_ATTR_CHAR_FONT,
115 					SID_ATTR_CHAR_POSTURE,
116 					SID_ATTR_CHAR_WEIGHT,
117 					SID_ATTR_CHAR_SHADOWED,
118 					SID_ATTR_CHAR_STRIKEOUT,
119 					SID_ATTR_CHAR_UNDERLINE,
120 					SID_ATTR_CHAR_FONTHEIGHT,
121 					SID_ATTR_CHAR_COLOR,
122 					SID_ATTR_CHAR_KERNING,
123 					SID_SET_SUPER_SCRIPT,
124 					SID_SET_SUB_SCRIPT,
125 					0 };
126 
127 	mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
128 
129 	if( mpDoc->GetOnlineSpell() )
130 	{
131 		const SfxPoolItem* pItem;
132 		if( SFX_ITEM_SET == pArgs->GetItemState(EE_CHAR_LANGUAGE, sal_False, &pItem ) ||
133 			SFX_ITEM_SET == pArgs->GetItemState(EE_CHAR_LANGUAGE_CJK, sal_False, &pItem ) ||
134 			SFX_ITEM_SET == pArgs->GetItemState(EE_CHAR_LANGUAGE_CTL, sal_False, &pItem ) )
135 		{
136 			mpDoc->StopOnlineSpelling();
137 			mpDoc->StartOnlineSpelling();
138 		}
139 	}
140 }
141 
Activate()142 void FuChar::Activate()
143 {
144 }
145 
Deactivate()146 void FuChar::Deactivate()
147 {
148 }
149 
150 } // end of namespace sd
151