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