xref: /aoo41x/main/sd/source/ui/func/futxtatt.cxx (revision 79aad27f)
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 "futxtatt.hxx"
29 #include <vcl/msgbox.hxx>
30 #include <sfx2/request.hxx>
31 
32 #include <svx/svxdlg.hxx>
33 #include <svx/dialogs.hrc>
34 #include "View.hxx"
35 #include "ViewShell.hxx"
36 #include "drawdoc.hxx"
37 
38 namespace sd {
39 
40 TYPEINIT1( FuTextAttrDlg, FuPoor );
41 
42 /*************************************************************************
43 |*
44 |* Konstruktor
45 |*
46 \************************************************************************/
47 
FuTextAttrDlg(ViewShell * pViewSh,::sd::Window * pWin,::sd::View * pView,SdDrawDocument * pDoc,SfxRequest & rReq)48 FuTextAttrDlg::FuTextAttrDlg (
49     ViewShell* pViewSh,
50     ::sd::Window* pWin,
51     ::sd::View* pView,
52     SdDrawDocument* pDoc,
53     SfxRequest& rReq)
54     : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
55 {
56 }
57 
Create(ViewShell * pViewSh,::sd::Window * pWin,::sd::View * pView,SdDrawDocument * pDoc,SfxRequest & rReq)58 FunctionReference FuTextAttrDlg::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
59 {
60 	FunctionReference xFunc( new FuTextAttrDlg( pViewSh, pWin, pView, pDoc, rReq ) );
61 	xFunc->DoExecute(rReq);
62 	return xFunc;
63 }
64 
DoExecute(SfxRequest & rReq)65 void FuTextAttrDlg::DoExecute( SfxRequest& rReq )
66 {
67 	SfxItemSet aNewAttr( mpDoc->GetPool() );
68 	mpView->GetAttributes( aNewAttr );
69 
70 	const SfxItemSet* pArgs = rReq.GetArgs();
71 
72 	if( !pArgs )
73 	{
74 		SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
75 		SfxAbstractTabDialog *pDlg = pFact->CreateTextTabDialog( NULL, &aNewAttr, mpView );
76 
77 		sal_uInt16 nResult = pDlg->Execute();
78 
79 		switch( nResult )
80 		{
81 			case RET_OK:
82 			{
83 				rReq.Done( *( pDlg->GetOutputItemSet() ) );
84 
85 				pArgs = rReq.GetArgs();
86 			}
87 			break;
88 
89 			default:
90 			{
91 				delete( pDlg );
92 			}
93 			return; // Abbruch
94 		}
95 		delete( pDlg );
96 	}
97 	mpView->SetAttributes( *pArgs );
98 }
99 
100 
101 } // end of namespace sd
102