xref: /aoo41x/main/sd/source/ui/func/fuolbull.cxx (revision 5b190011)
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 "fuolbull.hxx"
29 #include <vcl/msgbox.hxx>
30 #include <svl/intitem.hxx>
31 #include <editeng/outliner.hxx>
32 #include <editeng/eeitem.hxx>
33 #include <sfx2/request.hxx>
34 #include <svl/intitem.hxx>
35 
36 #include <editeng/editdata.hxx>
37 #include <svx/svxids.hrc>
38 #include "OutlineView.hxx"
39 #include "OutlineViewShell.hxx"
40 #include "DrawViewShell.hxx"
41 #ifndef SD_WINDOW_SHELL_HXX
42 #include "Window.hxx"
43 #endif
44 #include "drawdoc.hxx"
45 #include "sdabstdlg.hxx"
46 
47 namespace sd {
48 
49 TYPEINIT1( FuOutlineBullet, FuPoor );
50 
51 /*************************************************************************
52 |*
53 |* Konstruktor
54 |*
55 \************************************************************************/
56 
57 FuOutlineBullet::FuOutlineBullet(ViewShell* pViewShell, ::sd::Window* pWindow,
58 								 ::sd::View* pView, SdDrawDocument* pDoc,
59 								 SfxRequest& rReq)
60 	   : FuPoor(pViewShell, pWindow, pView, pDoc, rReq)
61 {
62 }
63 
64 FunctionReference FuOutlineBullet::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
65 {
66 	FunctionReference xFunc( new FuOutlineBullet( pViewSh, pWin, pView, pDoc, rReq ) );
67 	xFunc->DoExecute(rReq);
68 	return xFunc;
69 }
70 
71 void FuOutlineBullet::DoExecute( SfxRequest& rReq )
72 {
73 	const SfxItemSet* pArgs = rReq.GetArgs();
74 
75 	if( !pArgs )
76 	{
77 		// ItemSet fuer Dialog fuellen
78 		SfxItemSet aEditAttr( mpDoc->GetPool() );
79 		mpView->GetAttributes( aEditAttr );
80 
81 		SfxItemSet aNewAttr( mpViewShell->GetPool(),
82 							 EE_ITEMS_START, EE_ITEMS_END );
83 		aNewAttr.Put( aEditAttr, sal_False );
84 
85 		// Dialog hochfahren und ausfuehren
86 		SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
87 		SfxAbstractTabDialog* pDlg = pFact ? pFact->CreateSdOutlineBulletTabDlg( NULL, &aNewAttr, mpView ) : 0;
88 		if( pDlg )
89 		{
90 			sal_uInt16 nResult = pDlg->Execute();
91 
92 			switch( nResult )
93 			{
94 				case RET_OK:
95 				{
96 					SfxItemSet aSet( *pDlg->GetOutputItemSet() );
97 
98 	                OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
99 
100 	                std::auto_ptr< OutlineViewModelChangeGuard > aGuard;
101 
102 	                if (mpView->ISA(OutlineView))
103 	                {
104 		                pOLV = static_cast<OutlineView*>(mpView)
105                             ->GetViewByWindow(mpViewShell->GetActiveWindow());
106 
107 		                aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) );
108 	                }
109 
110                     if( pOLV )
111                         pOLV->EnableBullets();
112 
113 					rReq.Done( aSet );
114 					pArgs = rReq.GetArgs();
115 				}
116 				break;
117 
118 				default:
119 				{
120 					delete pDlg;
121 					return;
122 				}
123 			}
124 
125 			delete pDlg;
126 		}
127 	}
128 
129 	// nicht direkt an pOlView, damit SdDrawView::SetAttributes
130 	// Aenderungen auf der Masterpage abfangen und in eine
131 	// Vorlage umleiten kann
132 	mpView->SetAttributes(*pArgs);
133 
134 /* #i35937#
135 	// evtl. Betroffene Felder invalidieren
136 	mpViewShell->Invalidate( FN_NUM_BULLET_ON );
137 */
138 }
139 
140 
141 
142 } // end of namespace sd
143