Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
30 : : #include <com/sun/star/beans/XPropertySet.hpp>
31 : : #include <com/sun/star/container/XNameAccess.hpp>
32 : :
33 : : #include "futempl.hxx"
34 : :
35 : : #include <editeng/editdata.hxx>
36 : : #include <editeng/bulitem.hxx>
37 : : #include <svx/svxids.hrc> // fuer SID_OBJECT_SELECT
38 : : #include <sfx2/bindings.hxx>
39 : : #include <svl/aeitem.hxx>
40 : : #include <sfx2/dispatch.hxx>
41 : : #include <vcl/msgbox.hxx>
42 : : #include <editeng/eeitem.hxx>
43 : : #include <sfx2/request.hxx>
44 : : #include <editeng/numitem.hxx>
45 : : #include <editeng/editeng.hxx>
46 : : #include <editeng/lrspitem.hxx>
47 : : #include <svx/svdopage.hxx>
48 : : #include <svx/svditer.hxx>
49 : : #include <svx/sdr/properties/properties.hxx>
50 : :
51 : : #include <sfx2/viewfrm.hxx>
52 : : #include <svx/xlndsit.hxx>
53 : : #include <svx/xlnstit.hxx>
54 : : #include <svx/xlnedit.hxx>
55 : : #include "app.hrc"
56 : : #include "stlsheet.hxx"
57 : : #include "sdpage.hxx"
58 : : #include "stlpool.hxx"
59 : : #include "app.hxx"
60 : : #include "View.hxx"
61 : : #include "Window.hxx"
62 : : #include "drawview.hxx"
63 : : #include "drawdoc.hxx"
64 : : #include "DrawDocShell.hxx"
65 : : #include "DrawViewShell.hxx"
66 : : #include "ViewShell.hxx"
67 : : #include "res_bmp.hrc"
68 : : #include "glob.hrc"
69 : : #include "prlayout.hxx" // enum PresentationObjects
70 : : #include "prltempl.hrc" // TAB_PRES_LAYOUT_TEMPLATE_x
71 : : #include <svx/xfillit.hxx>
72 : : #include "sdresid.hxx"
73 : : #include "OutlineViewShell.hxx"
74 : : #include "strings.hrc"
75 : : #include "helpids.h"
76 : : #include "sdabstdlg.hxx"
77 : :
78 : : using rtl::OUString;
79 : : using namespace com::sun::star::uno;
80 : : using namespace com::sun::star::container;
81 : : using namespace com::sun::star::beans;
82 : : using namespace com::sun::star::style;
83 : :
84 : : namespace sd
85 : : {
86 : :
87 [ # # ][ # # ]: 0 : TYPEINIT1( FuTemplate, FuPoor );
88 : :
89 : : /*************************************************************************
90 : : |*
91 : : |* Konstruktor
92 : : |*
93 : : \************************************************************************/
94 : :
95 : 0 : FuTemplate::FuTemplate (
96 : : ViewShell* pViewSh,
97 : : ::sd::Window* pWin,
98 : : ::sd::View* pView,
99 : : SdDrawDocument* pDoc,
100 : : SfxRequest& rReq )
101 : 0 : : FuPoor( pViewSh, pWin, pView, pDoc, rReq )
102 : : {
103 : 0 : }
104 : :
105 : 0 : FunctionReference FuTemplate::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
106 : : {
107 [ # # ][ # # ]: 0 : FunctionReference xFunc( new FuTemplate( pViewSh, pWin, pView, pDoc, rReq ) );
108 [ # # ]: 0 : xFunc->DoExecute(rReq);
109 : 0 : return xFunc;
110 : : }
111 : :
112 : 0 : void FuTemplate::DoExecute( SfxRequest& rReq )
113 : : {
114 : 0 : const SfxItemSet* pArgs = rReq.GetArgs();
115 : 0 : sal_uInt16 nSId = rReq.GetSlot();
116 : :
117 : : // StyleSheet-Parameter holen
118 [ # # ]: 0 : SfxStyleSheetBasePool* pSSPool = mpDoc->GetDocSh()->GetStyleSheetPool();
119 : 0 : SfxStyleSheetBase* pStyleSheet = NULL;
120 : :
121 : : const SfxPoolItem* pItem;
122 : 0 : sal_uInt16 nFamily = USHRT_MAX;
123 [ # # ][ # # ]: 0 : if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_FAMILY,
[ # # ]
124 [ # # ]: 0 : sal_False, &pItem ))
125 : : {
126 [ # # ]: 0 : nFamily = ( (const SfxUInt16Item &) pArgs->Get( SID_STYLE_FAMILY ) ).GetValue();
127 : : }
128 : : else
129 [ # # ][ # # ]: 0 : if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_FAMILYNAME,
[ # # ]
130 [ # # ]: 0 : sal_False, &pItem ))
131 : : {
132 [ # # ][ # # ]: 0 : String sFamily = ( (const SfxStringItem &) pArgs->Get( SID_STYLE_FAMILYNAME ) ).GetValue();
133 [ # # ][ # # ]: 0 : if (sFamily.CompareToAscii("graphics") == COMPARE_EQUAL)
134 : 0 : nFamily = SD_STYLE_FAMILY_GRAPHICS;
135 : : else
136 [ # # ]: 0 : nFamily = SD_STYLE_FAMILY_PSEUDO;
137 : : }
138 : :
139 [ # # ]: 0 : String aStyleName;
140 : 0 : sal_uInt16 nRetMask = 0xffff;
141 : :
142 [ # # ]: 0 : switch( nSId )
143 : : {
144 : : case SID_STYLE_APPLY:
145 : : case SID_STYLE_EDIT:
146 : : case SID_STYLE_DELETE:
147 : : case SID_STYLE_FAMILY:
148 : : case SID_STYLE_NEW_BY_EXAMPLE:
149 : : {
150 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, SID_APPLY_STYLE, sal_False );
151 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG( rReq, pFamilyItem, SfxStringItem, SID_STYLE_FAMILYNAME, sal_False );
152 [ # # ][ # # ]: 0 : if ( pFamilyItem && pNameItem )
153 : : {
154 : : try
155 : : {
156 [ # # ][ # # ]: 0 : Reference< XStyleFamiliesSupplier > xModel(mpDoc->GetDocSh()->GetModel(), UNO_QUERY_THROW );
157 [ # # ][ # # ]: 0 : Reference< XNameAccess > xCont( xModel->getStyleFamilies() );
158 [ # # ][ # # ]: 0 : Reference< XNameAccess > xStyles( xCont->getByName(pFamilyItem->GetValue()), UNO_QUERY_THROW );
[ # # ][ # # ]
159 [ # # ][ # # ]: 0 : Reference< XPropertySet > xInfo( xStyles->getByName( pNameItem->GetValue() ), UNO_QUERY_THROW );
[ # # ][ # # ]
160 : :
161 : 0 : OUString aUIName;
162 [ # # ][ # # ]: 0 : xInfo->getPropertyValue( "DisplayName" ) >>= aUIName;
163 [ # # ]: 0 : if ( !aUIName.isEmpty() )
164 [ # # ][ # # ]: 0 : rReq.AppendItem( SfxStringItem( nSId, aUIName ) );
[ # # ][ # # ]
[ # # ][ # # ]
165 : : }
166 [ # # ]: 0 : catch( Exception& )
167 : : {
168 : : }
169 : : }
170 : :
171 [ # # ][ # # ]: 0 : if (pArgs->GetItemState(nSId) == SFX_ITEM_SET)
172 [ # # ][ # # ]: 0 : aStyleName = ( ( (const SfxStringItem &) pArgs->Get( nSId ) ).GetValue() );
173 : : }
174 : : }
175 : :
176 [ # # # # : 0 : switch( nSId )
# # # ]
177 : : {
178 : : case SID_STYLE_NEW:
179 : : {
180 [ # # ]: 0 : SfxStyleSheetBase *p = pSSPool->Find(aStyleName, (SfxStyleFamily) nFamily, SFXSTYLEBIT_ALL );
181 [ # # ]: 0 : if(p)
182 : : {
183 [ # # ]: 0 : pSSPool->Remove(p);
184 : 0 : p = 0;
185 : : }
186 [ # # ]: 0 : pStyleSheet = &pSSPool->Make( aStyleName, (SfxStyleFamily) nFamily, SFXSTYLEBIT_USERDEF );
187 : :
188 [ # # ][ # # ]: 0 : if (pArgs->GetItemState(SID_STYLE_REFERENCE) == SFX_ITEM_ON)
189 : : {
190 [ # # ][ # # ]: 0 : String aParentName(((const SfxStringItem&) pArgs->Get(SID_STYLE_REFERENCE)).GetValue());
191 [ # # ][ # # ]: 0 : pStyleSheet->SetParent(aParentName);
192 : : }
193 : : else
194 : : {
195 [ # # ][ # # ]: 0 : pStyleSheet->SetParent(String(SdResId(STR_STANDARD_STYLESHEET_NAME)));
[ # # ][ # # ]
196 : : }
197 : : }
198 : 0 : break;
199 : :
200 : : case SID_STYLE_NEW_BY_EXAMPLE:
201 : : {
202 : : // Z.Z. geht immer noch der Dialog auf, um den Namen
203 : : // der Vorlage einzugeben.
204 : 0 : mpView->AreObjectsMarked();
205 : : if( sal_True )
206 : : {
207 [ # # ]: 0 : SfxStyleSheetBase *p = pSSPool->Find(aStyleName, (SfxStyleFamily) nFamily, SFXSTYLEBIT_ALL );
208 [ # # ]: 0 : if(p)
209 : : {
210 [ # # ]: 0 : pSSPool->Remove(p);
211 : 0 : p = 0;
212 : : }
213 [ # # ]: 0 : pStyleSheet = &pSSPool->Make( aStyleName, (SfxStyleFamily) nFamily, SFXSTYLEBIT_USERDEF );
214 [ # # ][ # # ]: 0 : pStyleSheet->SetParent(String(SdResId(STR_STANDARD_STYLESHEET_NAME)));
[ # # ][ # # ]
215 : : }
216 : : }
217 : 0 : break;
218 : :
219 : : case SID_STYLE_EDIT:
220 [ # # ]: 0 : pStyleSheet = pSSPool->Find( aStyleName, (SfxStyleFamily) nFamily);
221 : 0 : break;
222 : :
223 : : case SID_STYLE_DELETE:
224 [ # # ]: 0 : pStyleSheet = pSSPool->Find( aStyleName, (SfxStyleFamily) nFamily);
225 [ # # ]: 0 : if( pStyleSheet )
226 : : {
227 [ # # ]: 0 : pSSPool->Remove( pStyleSheet );
228 : 0 : nRetMask = sal_True;
229 [ # # ]: 0 : mpDoc->SetChanged(sal_True);
230 : : }
231 : : else
232 : : {
233 : 0 : nRetMask = sal_False;
234 : : }
235 : 0 : break;
236 : :
237 : : case SID_STYLE_APPLY:
238 : : // Anwenden der Vorlage auf das Dokument
239 [ # # ]: 0 : pStyleSheet = pSSPool->Find( aStyleName, (SfxStyleFamily) nFamily);
240 : :
241 : : // do not set presentation styles, they will be set implicit
242 [ # # ][ # # ]: 0 : if ( pStyleSheet && pStyleSheet->GetFamily() != SD_STYLE_FAMILY_PSEUDO )
[ # # ]
243 : : {
244 [ # # ]: 0 : SfxStyleSheet* pOldStyleSheet = mpView->GetStyleSheet();
245 [ # # ]: 0 : String aStr;
246 : :
247 [ # # # # ]: 0 : if( // if the object had no style sheet, allow all
[ # # # #
# # ][ # # ]
248 : : !pOldStyleSheet ||
249 : :
250 : : // allow if old and new style sheet has same family
251 : 0 : pStyleSheet->GetFamily() == pOldStyleSheet->GetFamily() ||
252 : :
253 : : // allow if old was background objects and new is graphics
254 [ # # ]: 0 : pStyleSheet->GetFamily() == (SD_STYLE_FAMILY_GRAPHICS && pOldStyleSheet->GetHelpId( aStr ) == HID_PSEUDOSHEET_BACKGROUNDOBJECTS) ||
255 : :
256 : : // allow if old was presentation and we are a drawing document
257 : 0 : (pOldStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE && mpDoc->GetDocumentType() == DOCUMENT_TYPE_DRAW) )
258 : : {
259 [ # # ]: 0 : mpView->SetStyleSheet( (SfxStyleSheet*) pStyleSheet);
260 [ # # ]: 0 : mpDoc->SetChanged(sal_True);
261 [ # # ][ # # ]: 0 : mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
262 [ # # ]: 0 : }
263 : : }
264 : 0 : break;
265 : :
266 : : case SID_STYLE_WATERCAN:
267 : : {
268 [ # # ][ # # ]: 0 : if( !SD_MOD()->GetWaterCan() )
269 : : {
270 [ # # ][ # # ]: 0 : if( pArgs->GetItemState( nSId ) == SFX_ITEM_SET )
271 : : {
272 [ # # ][ # # ]: 0 : aStyleName = ( ( (const SfxStringItem &) pArgs->Get( nSId ) ).GetValue() );
273 [ # # ]: 0 : SD_MOD()->SetWaterCan( sal_True );
274 [ # # ]: 0 : pStyleSheet = pSSPool->Find( aStyleName, (SfxStyleFamily) nFamily);
275 : : }
276 : : // keine Praesentationsobjektvorlagen, die werden nur
277 : : // implizit zugewiesen
278 [ # # ][ # # ]: 0 : if( pStyleSheet && pStyleSheet->GetFamily() != SD_STYLE_FAMILY_PSEUDO )
[ # # ]
279 : : {
280 : 0 : ( (SdStyleSheetPool*) pSSPool )->SetActualStyleSheet( pStyleSheet );
281 : :
282 : : // Es wird explizit in den Selektionsmodus geschaltet
283 : : mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_OBJECT_SELECT,
284 [ # # ][ # # ]: 0 : SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
285 : :
286 : : }
287 : : else
288 [ # # ]: 0 : SD_MOD()->SetWaterCan( sal_False );
289 : : }
290 : : else
291 : : {
292 [ # # ]: 0 : SD_MOD()->SetWaterCan( sal_False );
293 : : // Werkzeugleiste muss wieder enabled werden
294 [ # # ]: 0 : mpViewShell->Invalidate();
295 : : }
296 : : }
297 : 0 : break;
298 : :
299 : : default:
300 : 0 : break;
301 : : }
302 : :
303 [ # # # # ]: 0 : switch( nSId )
304 : : {
305 : : case SID_STYLE_NEW:
306 : : case SID_STYLE_EDIT:
307 : : {
308 : 0 : PresentationObjects ePO = PO_OUTLINE_1;
309 : :
310 [ # # ]: 0 : if( pStyleSheet )
311 : : {
312 : 0 : SfxAbstractTabDialog* pStdDlg = NULL;
313 : 0 : SfxAbstractTabDialog* pPresDlg = NULL;
314 [ # # ]: 0 : SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
315 : 0 : sal_Bool bOldDocInOtherLanguage = sal_False;
316 [ # # ][ # # ]: 0 : SfxItemSet aOriSet( pStyleSheet->GetItemSet() );
317 : :
318 : 0 : SfxStyleFamily eFamily = pStyleSheet->GetFamily();
319 : :
320 [ # # ]: 0 : if (eFamily == SD_STYLE_FAMILY_GRAPHICS)
321 : : {
322 [ # # ][ # # ]: 0 : pStdDlg = pFact ? pFact->CreateSdTabTemplateDlg( 0, mpDoc->GetDocSh(), *pStyleSheet, mpDoc, mpView ) : 0;
323 : : }
324 [ # # ]: 0 : else if (eFamily == SD_STYLE_FAMILY_PSEUDO)
325 : : {
326 [ # # ][ # # ]: 0 : String aName(pStyleSheet->GetName());
327 : 0 : sal_uInt16 nDlgId = 0;
328 : :
329 [ # # ][ # # ]: 0 : if (aName == String(SdResId(STR_PSEUDOSHEET_TITLE)))
[ # # ][ # # ]
[ # # ]
330 : : {
331 : 0 : nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
332 : 0 : ePO = PO_TITLE;
333 : : }
334 [ # # ][ # # ]: 0 : else if (aName == String(SdResId(STR_PSEUDOSHEET_SUBTITLE)))
[ # # ][ # # ]
[ # # ]
335 : : {
336 : 0 : nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
337 : 0 : ePO = PO_SUBTITLE;
338 : : }
339 [ # # ]: 0 : else if (aName ==
340 [ # # ][ # # ]: 0 : String(SdResId(STR_PSEUDOSHEET_BACKGROUND)))
[ # # ][ # # ]
341 : : {
342 : 0 : nDlgId = TAB_PRES_LAYOUT_TEMPLATE_BACKGROUND;
343 : 0 : ePO = PO_BACKGROUND;
344 : : }
345 [ # # ]: 0 : else if (aName ==
346 [ # # ][ # # ]: 0 : String(SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS)))
[ # # ][ # # ]
347 : : {
348 : 0 : nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
349 : 0 : ePO = PO_BACKGROUNDOBJECTS;
350 : : }
351 [ # # ]: 0 : else if (aName ==
352 [ # # ][ # # ]: 0 : String(SdResId(STR_PSEUDOSHEET_NOTES)))
[ # # ][ # # ]
353 : : {
354 : 0 : nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
355 : 0 : ePO = PO_NOTES;
356 : : }
357 [ # # ][ # # ]: 0 : else if(aName.Search(String(SdResId(STR_PSEUDOSHEET_OUTLINE))) !=
[ # # ][ # # ]
[ # # ]
358 : : STRING_NOTFOUND)
359 : : {
360 : 0 : nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
361 : :
362 [ # # ][ # # ]: 0 : String aOutlineStr((SdResId(STR_PSEUDOSHEET_OUTLINE)));
363 : : // die Nummer ermitteln; ein Leerzeichen zwischen
364 : : // Name und Nummer beachten
365 [ # # ]: 0 : String aNumStr(aName.Copy(aOutlineStr.Len() + 1));
366 [ # # ]: 0 : sal_uInt16 nLevel = (sal_uInt16)aNumStr.ToInt32();
367 [ # # # # : 0 : switch (nLevel)
# # # # #
# ]
368 : : {
369 : 0 : case 1: ePO = PO_OUTLINE_1; break;
370 : 0 : case 2: ePO = PO_OUTLINE_2; break;
371 : 0 : case 3: ePO = PO_OUTLINE_3; break;
372 : 0 : case 4: ePO = PO_OUTLINE_4; break;
373 : 0 : case 5: ePO = PO_OUTLINE_5; break;
374 : 0 : case 6: ePO = PO_OUTLINE_6; break;
375 : 0 : case 7: ePO = PO_OUTLINE_7; break;
376 : 0 : case 8: ePO = PO_OUTLINE_8; break;
377 : 0 : case 9: ePO = PO_OUTLINE_9; break;
378 [ # # ][ # # ]: 0 : }
379 : : }
380 : : else
381 : : {
382 : : OSL_FAIL("Vorlage aus aelterer anderssprachiger Version");
383 : 0 : bOldDocInOtherLanguage = sal_True;
384 : : }
385 : :
386 [ # # ]: 0 : if( !bOldDocInOtherLanguage )
387 : : {
388 [ # # ][ # # ]: 0 : pPresDlg = pFact ? pFact->CreateSdPresLayoutTemplateDlg( mpDocSh, NULL, SdResId(nDlgId), *pStyleSheet, ePO, pSSPool ) : 0;
[ # # ][ # # ]
[ # # ]
389 [ # # ]: 0 : }
390 : : }
391 : : else if (eFamily == SD_STYLE_FAMILY_CELL)
392 : : {
393 : : }
394 : :
395 : 0 : sal_uInt16 nResult = RET_CANCEL;
396 : 0 : const SfxItemSet* pOutSet = NULL;
397 [ # # ]: 0 : if (pStdDlg)
398 : : {
399 [ # # ]: 0 : nResult = pStdDlg->Execute();
400 [ # # ]: 0 : pOutSet = pStdDlg->GetOutputItemSet();
401 : : }
402 [ # # ]: 0 : else if( pPresDlg )
403 : : {
404 [ # # ]: 0 : nResult = pPresDlg->Execute();
405 [ # # ]: 0 : pOutSet = pPresDlg->GetOutputItemSet();
406 : : }
407 : :
408 [ # # ]: 0 : switch( nResult )
409 : : {
410 : : case RET_OK:
411 : : {
412 : 0 : nRetMask = pStyleSheet->GetMask();
413 : :
414 [ # # ]: 0 : if (eFamily == SD_STYLE_FAMILY_PSEUDO)
415 : : {
416 [ # # ]: 0 : SfxItemSet aTempSet(*pOutSet);
417 [ # # ]: 0 : ((SdStyleSheet*)pStyleSheet)->AdjustToFontHeight(aTempSet);
418 : :
419 : : // Sonderbehandlung: die INVALIDS auf NULL-Pointer
420 : : // zurueckgesetzen (sonst landen INVALIDs oder
421 : : // Pointer auf die DefaultItems in der Vorlage;
422 : : // beides wuerde die Attribut-Vererbung unterbinden)
423 [ # # ]: 0 : aTempSet.ClearInvalidItems();
424 : :
425 : : // EE_PARA_NUMBULLET item is only valid in first outline template
426 [ # # ][ # # ]: 0 : if( (ePO >= PO_OUTLINE_2) && (ePO <= PO_OUTLINE_9) )
427 : : {
428 [ # # ][ # # ]: 0 : if (aTempSet.GetItemState(EE_PARA_NUMBULLET) == SFX_ITEM_SET)
429 : : {
430 [ # # ][ # # ]: 0 : SvxNumRule aRule(*((SvxNumBulletItem*)aTempSet.GetItem(EE_PARA_NUMBULLET))->GetNumRule());
431 : :
432 [ # # ][ # # ]: 0 : String sStyleName((SdResId(STR_PSEUDOSHEET_OUTLINE)));
433 [ # # ]: 0 : sStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) );
434 [ # # ]: 0 : SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( sStyleName, SD_STYLE_FAMILY_PSEUDO);
435 : :
436 [ # # ]: 0 : if(pFirstStyleSheet)
437 : : {
438 [ # # ][ # # ]: 0 : pFirstStyleSheet->GetItemSet().Put( SvxNumBulletItem( aRule, EE_PARA_NUMBULLET ));
[ # # ][ # # ]
439 [ # # ]: 0 : SdStyleSheet* pRealSheet = ((SdStyleSheet*)pFirstStyleSheet)->GetRealStyleSheet();
440 [ # # ][ # # ]: 0 : pRealSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
[ # # ]
441 : : }
442 : :
443 [ # # ][ # # ]: 0 : aTempSet.ClearItem( EE_PARA_NUMBULLET );
[ # # ]
444 : : }
445 : : }
446 : :
447 [ # # ][ # # ]: 0 : String sStyleName((SdResId(STR_PSEUDOSHEET_OUTLINE)));
448 [ # # ]: 0 : sStyleName.Append( sal_Unicode( ' ' ));
449 : :
450 [ # # ][ # # ]: 0 : pStyleSheet->GetItemSet().Put(aTempSet);
451 [ # # ]: 0 : SdStyleSheet* pRealSheet =((SdStyleSheet*)pStyleSheet)->GetRealStyleSheet();
452 [ # # ][ # # ]: 0 : pRealSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
[ # # ]
453 : :
454 [ # # ][ # # ]: 0 : if( (ePO >= PO_OUTLINE_1) && (ePO <= PO_OUTLINE_8) )
455 : : {
456 [ # # ]: 0 : for( sal_uInt16 n = (sal_uInt16)(ePO - PO_OUTLINE_1 + 2); n < 10; n++ )
457 : : {
458 [ # # ]: 0 : String aName( sStyleName );
459 [ # # ][ # # ]: 0 : aName.Append( String::CreateFromInt32( (sal_Int32) n ));
[ # # ]
460 : :
461 [ # # ]: 0 : SfxStyleSheetBase* pSheet = pSSPool->Find( aName, SD_STYLE_FAMILY_PSEUDO);
462 : :
463 [ # # ]: 0 : if(pSheet)
464 : : {
465 [ # # ]: 0 : SdStyleSheet* pRealStyleSheet = ((SdStyleSheet*)pSheet)->GetRealStyleSheet();
466 [ # # ][ # # ]: 0 : pRealStyleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
[ # # ]
467 : : }
468 [ # # ]: 0 : }
469 [ # # ][ # # ]: 0 : }
470 : : }
471 : :
472 [ # # ]: 0 : SfxItemSet& rAttr = pStyleSheet->GetItemSet();
473 : :
474 [ # # ]: 0 : sdr::properties::CleanupFillProperties( rAttr );
475 : :
476 : : // check for unique names of named items for xml
477 [ # # ][ # # ]: 0 : if( rAttr.GetItemState( XATTR_FILLBITMAP ) == SFX_ITEM_SET )
478 : : {
479 [ # # ]: 0 : const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLBITMAP );
480 [ # # ]: 0 : SfxPoolItem* pNewItem = ((XFillBitmapItem*)pOldItem)->checkForUniqueItem( mpDoc );
481 [ # # ]: 0 : if( pOldItem != pNewItem )
482 : : {
483 [ # # ]: 0 : rAttr.Put( *pNewItem );
484 [ # # ][ # # ]: 0 : delete pNewItem;
485 : : }
486 : : }
487 [ # # ][ # # ]: 0 : if( rAttr.GetItemState( XATTR_LINEDASH ) == SFX_ITEM_SET )
488 : : {
489 [ # # ]: 0 : const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_LINEDASH );
490 [ # # ]: 0 : SfxPoolItem* pNewItem = ((XLineDashItem*)pOldItem)->checkForUniqueItem( mpDoc );
491 [ # # ]: 0 : if( pOldItem != pNewItem )
492 : : {
493 [ # # ]: 0 : rAttr.Put( *pNewItem );
494 [ # # ][ # # ]: 0 : delete pNewItem;
495 : : }
496 : : }
497 [ # # ][ # # ]: 0 : if( rAttr.GetItemState( XATTR_LINESTART ) == SFX_ITEM_SET )
498 : : {
499 [ # # ]: 0 : const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_LINESTART );
500 [ # # ]: 0 : SfxPoolItem* pNewItem = ((XLineStartItem*)pOldItem)->checkForUniqueItem( mpDoc );
501 [ # # ]: 0 : if( pOldItem != pNewItem )
502 : : {
503 [ # # ]: 0 : rAttr.Put( *pNewItem );
504 [ # # ][ # # ]: 0 : delete pNewItem;
505 : : }
506 : : }
507 [ # # ][ # # ]: 0 : if( rAttr.GetItemState( XATTR_LINEEND ) == SFX_ITEM_SET )
508 : : {
509 [ # # ]: 0 : const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_LINEEND );
510 [ # # ]: 0 : SfxPoolItem* pNewItem = ((XLineEndItem*)pOldItem)->checkForUniqueItem( mpDoc );
511 [ # # ]: 0 : if( pOldItem != pNewItem )
512 : : {
513 [ # # ]: 0 : rAttr.Put( *pNewItem );
514 [ # # ][ # # ]: 0 : delete pNewItem;
515 : : }
516 : : }
517 [ # # ][ # # ]: 0 : if( rAttr.GetItemState( XATTR_FILLGRADIENT ) == SFX_ITEM_SET )
518 : : {
519 [ # # ]: 0 : const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLGRADIENT );
520 [ # # ]: 0 : SfxPoolItem* pNewItem = ((XFillGradientItem*)pOldItem)->checkForUniqueItem( mpDoc );
521 [ # # ]: 0 : if( pOldItem != pNewItem )
522 : : {
523 [ # # ]: 0 : rAttr.Put( *pNewItem );
524 [ # # ][ # # ]: 0 : delete pNewItem;
525 : : }
526 : : }
527 [ # # ][ # # ]: 0 : if( rAttr.GetItemState( XATTR_FILLFLOATTRANSPARENCE ) == SFX_ITEM_SET )
528 : : {
529 [ # # ]: 0 : const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLFLOATTRANSPARENCE );
530 [ # # ]: 0 : SfxPoolItem* pNewItem = ((XFillFloatTransparenceItem*)pOldItem)->checkForUniqueItem( mpDoc );
531 [ # # ]: 0 : if( pOldItem != pNewItem )
532 : : {
533 [ # # ]: 0 : rAttr.Put( *pNewItem );
534 [ # # ][ # # ]: 0 : delete pNewItem;
535 : : }
536 : : }
537 [ # # ][ # # ]: 0 : if( rAttr.GetItemState( XATTR_FILLHATCH ) == SFX_ITEM_SET )
538 : : {
539 [ # # ]: 0 : const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLHATCH );
540 [ # # ]: 0 : SfxPoolItem* pNewItem = ((XFillHatchItem*)pOldItem)->checkForUniqueItem( mpDoc );
541 [ # # ]: 0 : if( pOldItem != pNewItem )
542 : : {
543 [ # # ]: 0 : rAttr.Put( *pNewItem );
544 [ # # ][ # # ]: 0 : delete pNewItem;
545 : : }
546 : : }
547 : :
548 [ # # ][ # # ]: 0 : ( (SfxStyleSheet*) pStyleSheet )->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
[ # # ]
549 : :
550 [ # # ]: 0 : DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >( mpViewShell );
551 [ # # ]: 0 : if( pDrawViewShell )
552 : : {
553 : 0 : PageKind ePageKind = pDrawViewShell->GetPageKind();
554 [ # # ][ # # ]: 0 : if( ePageKind == PK_NOTES || ePageKind == PK_HANDOUT )
555 : : {
556 [ # # ]: 0 : SdPage* pPage = mpViewShell->GetActualPage();
557 : :
558 [ # # ]: 0 : if(pDrawViewShell->GetEditMode() == EM_MASTERPAGE)
559 : : {
560 [ # # ]: 0 : pPage = static_cast<SdPage*>((&(pPage->TRG_GetMasterPage())));
561 : : }
562 : :
563 [ # # ]: 0 : if( pPage )
564 : : {
565 [ # # ]: 0 : SdrObjListIter aIter( *pPage );
566 [ # # ]: 0 : while( aIter.IsMore() )
567 : : {
568 [ # # ]: 0 : SdrObject* pObj = aIter.Next();
569 [ # # ][ # # ]: 0 : if( pObj->ISA(SdrPageObj) )
[ # # ]
570 : : {
571 : : // repaint only
572 [ # # ]: 0 : pObj->ActionChanged();
573 : : // pObj->SendRepaintBroadcast();
574 : : }
575 : 0 : }
576 : : }
577 : : }
578 : : }
579 : :
580 [ # # ]: 0 : if( mpDoc->GetOnlineSpell() )
581 : : {
582 : : const SfxPoolItem* pTempItem;
583 [ # # ][ # # ]: 0 : if( SFX_ITEM_SET == rAttr.GetItemState(EE_CHAR_LANGUAGE, sal_False, &pTempItem ) ||
[ # # ][ # # ]
[ # # ]
584 [ # # ]: 0 : SFX_ITEM_SET == rAttr.GetItemState(EE_CHAR_LANGUAGE_CJK, sal_False, &pTempItem ) ||
585 [ # # ]: 0 : SFX_ITEM_SET == rAttr.GetItemState(EE_CHAR_LANGUAGE_CTL, sal_False, &pTempItem ) )
586 : : {
587 [ # # ]: 0 : mpDoc->StopOnlineSpelling();
588 [ # # ]: 0 : mpDoc->StartOnlineSpelling();
589 : : }
590 : : }
591 : :
592 [ # # ]: 0 : mpDoc->SetChanged(sal_True);
593 : : }
594 : 0 : break;
595 : :
596 : : default:
597 : : {
598 [ # # ]: 0 : if( nSId == SID_STYLE_NEW )
599 [ # # ]: 0 : pSSPool->Remove( pStyleSheet );
600 [ # # ][ # # ]: 0 : delete pStdDlg;
601 [ # # ][ # # ]: 0 : delete pPresDlg;
602 : : }
603 : 0 : return; // Abbruch
604 : : }
605 [ # # ][ # # ]: 0 : delete pStdDlg;
606 [ # # ][ # # ]: 0 : delete pPresDlg;
[ # # ][ # # ]
607 : : }
608 : : }
609 : 0 : break;
610 : :
611 : : case SID_STYLE_NEW_BY_EXAMPLE:
612 : : {
613 [ # # ]: 0 : if( pStyleSheet )
614 : : {
615 : 0 : nRetMask = pStyleSheet->GetMask();
616 [ # # ]: 0 : SfxItemSet aCoreSet( mpDoc->GetPool() );
617 [ # # ]: 0 : mpView->GetAttributes( aCoreSet, sal_True );
618 : :
619 : : // wenn das Objekt eine Vorlage hatte, wird diese Parent
620 : : // der neuen Vorlage
621 [ # # ]: 0 : SfxStyleSheet* pOldStyle = mpView->GetStyleSheet();
622 : :
623 : : // Wenn pOldStyle == pStyleSheet -> Rekursion
624 [ # # ]: 0 : if( pOldStyle != pStyleSheet )
625 : : {
626 [ # # ]: 0 : if (pOldStyle)
627 : : {
628 [ # # ][ # # ]: 0 : pStyleSheet->SetParent(pOldStyle->GetName());
629 : : }
630 : :
631 [ # # ]: 0 : SfxItemSet* pStyleSet = &pStyleSheet->GetItemSet();
632 [ # # ]: 0 : pStyleSet->Put(aCoreSet);
633 : :
634 : : // Vorlage anwenden (Aber nicht, wenn gerade ein Text
635 : : // editiert wird, denn dazu muesste die Edit Engine
636 : : // Vorlagen auf Zeichenebene beherrschen.)
637 [ # # ][ # # ]: 0 : if (!mpView->GetTextEditObject())
638 : : {
639 [ # # ]: 0 : mpView->SetStyleSheet( (SfxStyleSheet*) pStyleSheet);
640 : : }
641 : :
642 [ # # ][ # # ]: 0 : ( (SfxStyleSheet*) pStyleSheet )->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
[ # # ]
643 [ # # ]: 0 : mpDoc->SetChanged(sal_True);
644 : :
645 [ # # ][ # # ]: 0 : mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
646 [ # # ]: 0 : }
647 : : }
648 : : }
649 : 0 : break;
650 : :
651 : : case SID_STYLE_UPDATE_BY_EXAMPLE:
652 : : {
653 [ # # ][ # # ]: 0 : if ((mpView->AreObjectsMarked() && mpView->GetMarkedObjectList().GetMarkCount() == 1) ||
[ # # ][ # # ]
654 [ # # ][ # # ]: 0 : mpView->ISA(OutlineView))
655 : : {
656 [ # # ]: 0 : pStyleSheet = mpView->GetStyleSheet();
657 : :
658 [ # # ]: 0 : if( pStyleSheet )
659 : : {
660 : 0 : nRetMask = pStyleSheet->GetMask();
661 [ # # ]: 0 : SfxItemSet aCoreSet( mpDoc->GetPool() );
662 [ # # ]: 0 : mpView->GetAttributes( aCoreSet );
663 : :
664 [ # # ]: 0 : SfxItemSet* pStyleSet = &pStyleSheet->GetItemSet();
665 [ # # ]: 0 : pStyleSet->Put( aCoreSet );
666 : :
667 [ # # ]: 0 : mpView->SetStyleSheet( (SfxStyleSheet*) pStyleSheet);
668 : :
669 [ # # ][ # # ]: 0 : ( (SfxStyleSheet*) pStyleSheet )->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
[ # # ]
670 [ # # ]: 0 : mpDoc->SetChanged(sal_True);
671 [ # # ][ # # ]: 0 : mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
[ # # ]
672 : : }
673 : : }
674 : : }
675 : 0 : break;
676 : :
677 : : }
678 [ # # ]: 0 : if( nRetMask != 0xffff )
679 [ # # ][ # # ]: 0 : rReq.SetReturnValue( SfxUInt16Item( nSId, nRetMask ) );
[ # # ][ # # ]
[ # # ]
680 : : }
681 : :
682 : 0 : void FuTemplate::Activate()
683 : : {
684 : 0 : }
685 : :
686 : 0 : void FuTemplate::Deactivate()
687 : : {
688 : 0 : }
689 : :
690 : : } // end of namespace sd
691 : :
692 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|