xref: /trunk/main/sd/source/ui/func/fuolbull.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sd.hxx"
30 
31 
32 #include "fuolbull.hxx"
33 #include <vcl/msgbox.hxx>
34 #include <svl/intitem.hxx>
35 #include <editeng/outliner.hxx>
36 #include <editeng/eeitem.hxx>
37 #include <sfx2/request.hxx>
38 #include <svl/intitem.hxx>
39 
40 #include <editeng/editdata.hxx>
41 #include <svx/svxids.hrc>
42 #include "OutlineView.hxx"
43 #include "OutlineViewShell.hxx"
44 #include "DrawViewShell.hxx"
45 #ifndef SD_WINDOW_SHELL_HXX
46 #include "Window.hxx"
47 #endif
48 #include "drawdoc.hxx"
49 #include "sdabstdlg.hxx"
50 
51 namespace sd {
52 
53 TYPEINIT1( FuOutlineBullet, FuPoor );
54 
55 /*************************************************************************
56 |*
57 |* Konstruktor
58 |*
59 \************************************************************************/
60 
61 FuOutlineBullet::FuOutlineBullet(ViewShell* pViewShell, ::sd::Window* pWindow,
62                                  ::sd::View* pView, SdDrawDocument* pDoc,
63                                  SfxRequest& rReq)
64        : FuPoor(pViewShell, pWindow, pView, pDoc, rReq)
65 {
66 }
67 
68 FunctionReference FuOutlineBullet::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
69 {
70     FunctionReference xFunc( new FuOutlineBullet( pViewSh, pWin, pView, pDoc, rReq ) );
71     xFunc->DoExecute(rReq);
72     return xFunc;
73 }
74 
75 void FuOutlineBullet::DoExecute( SfxRequest& rReq )
76 {
77     const SfxItemSet* pArgs = rReq.GetArgs();
78 
79     if( !pArgs )
80     {
81         // ItemSet fuer Dialog fuellen
82         SfxItemSet aEditAttr( mpDoc->GetPool() );
83         mpView->GetAttributes( aEditAttr );
84 
85         SfxItemSet aNewAttr( mpViewShell->GetPool(),
86                              EE_ITEMS_START, EE_ITEMS_END );
87         aNewAttr.Put( aEditAttr, sal_False );
88 
89         // Dialog hochfahren und ausfuehren
90         SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
91         SfxAbstractTabDialog* pDlg = pFact ? pFact->CreateSdOutlineBulletTabDlg( NULL, &aNewAttr, mpView ) : 0;
92         if( pDlg )
93         {
94             sal_uInt16 nResult = pDlg->Execute();
95 
96             switch( nResult )
97             {
98                 case RET_OK:
99                 {
100                     SfxItemSet aSet( *pDlg->GetOutputItemSet() );
101 
102                     OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
103 
104                     std::auto_ptr< OutlineViewModelChangeGuard > aGuard;
105 
106                     if (mpView->ISA(OutlineView))
107                     {
108                         pOLV = static_cast<OutlineView*>(mpView)
109                             ->GetViewByWindow(mpViewShell->GetActiveWindow());
110 
111                         aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) );
112                     }
113 
114                     if( pOLV )
115                         pOLV->EnableBullets();
116 
117                     rReq.Done( aSet );
118                     pArgs = rReq.GetArgs();
119                 }
120                 break;
121 
122                 default:
123                 {
124                     delete pDlg;
125                     return;
126                 }
127             }
128 
129             delete pDlg;
130         }
131     }
132 
133     // nicht direkt an pOlView, damit SdDrawView::SetAttributes
134     // Aenderungen auf der Masterpage abfangen und in eine
135     // Vorlage umleiten kann
136     mpView->SetAttributes(*pArgs);
137 
138 /* #i35937#
139     // evtl. Betroffene Felder invalidieren
140     mpViewShell->Invalidate( FN_NUM_BULLET_ON );
141 */
142 }
143 
144 
145 
146 } // end of namespace sd
147