xref: /aoo41x/main/sd/source/ui/view/drawview.cxx (revision cba0c2bc)
15b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
35b190011SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
45b190011SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
55b190011SAndrew Rist  * distributed with this work for additional information
65b190011SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
75b190011SAndrew Rist  * to you under the Apache License, Version 2.0 (the
85b190011SAndrew Rist  * "License"); you may not use this file except in compliance
95b190011SAndrew Rist  * with the License.  You may obtain a copy of the License at
105b190011SAndrew Rist  *
115b190011SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
125b190011SAndrew Rist  *
135b190011SAndrew Rist  * Unless required by applicable law or agreed to in writing,
145b190011SAndrew Rist  * software distributed under the License is distributed on an
155b190011SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b190011SAndrew Rist  * KIND, either express or implied.  See the License for the
175b190011SAndrew Rist  * specific language governing permissions and limitations
185b190011SAndrew Rist  * under the License.
195b190011SAndrew Rist  *
205b190011SAndrew Rist  *************************************************************/
215b190011SAndrew Rist 
225b190011SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
27cdf0e10cSrcweir #ifndef _MSGBOX_HXX //autogen
28cdf0e10cSrcweir #include <vcl/msgbox.hxx>
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #include <svx/svdpagv.hxx>
31cdf0e10cSrcweir #include <sfx2/request.hxx>
32cdf0e10cSrcweir #include <svl/style.hxx>
33cdf0e10cSrcweir #include <editeng/outliner.hxx>
34cdf0e10cSrcweir #ifndef _VIEW3D_HXX //autogen
35cdf0e10cSrcweir #include <svx/view3d.hxx>
36cdf0e10cSrcweir #endif
37cdf0e10cSrcweir #ifndef _SVXIDS_HRC //autogen
38cdf0e10cSrcweir #include <svx/svxids.hrc>
39cdf0e10cSrcweir #endif
40cdf0e10cSrcweir #include <svx/svdotext.hxx>
41cdf0e10cSrcweir #include <svx/svdograf.hxx>
42cdf0e10cSrcweir #include <svx/svdogrp.hxx>
43cdf0e10cSrcweir #include <svx/svdorect.hxx>
44cdf0e10cSrcweir #include <svl/poolitem.hxx>
45cdf0e10cSrcweir #include <editeng/eeitem.hxx>
46cdf0e10cSrcweir #include <editeng/bulitem.hxx>
47cdf0e10cSrcweir #include <svl/itempool.hxx>
48cdf0e10cSrcweir #include <editeng/numitem.hxx>
49cdf0e10cSrcweir #include <svl/whiter.hxx>
50cdf0e10cSrcweir 
51cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
52cdf0e10cSrcweir #include <sfx2/objface.hxx>
53cdf0e10cSrcweir #include "stlsheet.hxx"
54cdf0e10cSrcweir 
55cdf0e10cSrcweir #include <svx/svdoutl.hxx>
56cdf0e10cSrcweir #undef BMP_OLEOBJ
57cdf0e10cSrcweir #include <svx/svdstr.hrc>
58cdf0e10cSrcweir #include <svx/dialmgr.hxx>
59cdf0e10cSrcweir 
60cdf0e10cSrcweir #include "glob.hrc"
61cdf0e10cSrcweir #include "strings.hrc"
62cdf0e10cSrcweir #include "View.hxx"
63cdf0e10cSrcweir #include "sdattr.hxx"
64cdf0e10cSrcweir #include "drawview.hxx"
65cdf0e10cSrcweir #include "drawdoc.hxx"
66cdf0e10cSrcweir #include "DrawDocShell.hxx"
67cdf0e10cSrcweir #include "sdpage.hxx"
68cdf0e10cSrcweir #include "DrawViewShell.hxx"
69cdf0e10cSrcweir #include "pres.hxx"
70cdf0e10cSrcweir #include "sdresid.hxx"
71cdf0e10cSrcweir #include "Window.hxx"
72cdf0e10cSrcweir #include "unchss.hxx"
73cdf0e10cSrcweir #ifndef SD_FRAME_VIEW
74cdf0e10cSrcweir #include "FrameView.hxx"
75cdf0e10cSrcweir #endif
76cdf0e10cSrcweir #include "anminfo.hxx"
77cdf0e10cSrcweir #include "slideshow.hxx"
78cdf0e10cSrcweir #include <vcl/virdev.hxx>
79cdf0e10cSrcweir #include <svx/sdrpaintwindow.hxx>
80cdf0e10cSrcweir #include <svx/sdr/contact/viewobjectcontact.hxx>
81cdf0e10cSrcweir #include <svx/sdr/contact/viewcontact.hxx>
82cdf0e10cSrcweir #include <svx/sdr/contact/displayinfo.hxx>
83cdf0e10cSrcweir 
84cdf0e10cSrcweir #include "undo/undomanager.hxx"
85cdf0e10cSrcweir 
86cdf0e10cSrcweir using namespace ::com::sun::star;
87cdf0e10cSrcweir 
88cdf0e10cSrcweir namespace sd {
89cdf0e10cSrcweir 
90cdf0e10cSrcweir TYPEINIT1(DrawView, View);
91cdf0e10cSrcweir 
92cdf0e10cSrcweir /*************************************************************************
93cdf0e10cSrcweir |*
94cdf0e10cSrcweir |* Konstruktor
95cdf0e10cSrcweir |* zeigt die erste Seite des Dokuments auf Position 0,0 an;
96cdf0e10cSrcweir |* falls noch keine Seite vorhanden ist, wird eine erzeugt
97cdf0e10cSrcweir |*
98cdf0e10cSrcweir \************************************************************************/
99cdf0e10cSrcweir 
DrawView(DrawDocShell * pDocSh,OutputDevice * pOutDev,DrawViewShell * pShell)100cdf0e10cSrcweir DrawView::DrawView( DrawDocShell* pDocSh, OutputDevice* pOutDev, DrawViewShell* pShell)
101cdf0e10cSrcweir : ::sd::View(pDocSh->GetDoc(), pOutDev, pShell)
102cdf0e10cSrcweir , mpDocShell(pDocSh)
103cdf0e10cSrcweir , mpDrawViewShell(pShell)
104cdf0e10cSrcweir , mpVDev(NULL)
105cdf0e10cSrcweir , mnPOCHSmph(0)
106cdf0e10cSrcweir {
107cdf0e10cSrcweir 	SetCurrentObj(OBJ_RECT, SdrInventor);
108cdf0e10cSrcweir }
109cdf0e10cSrcweir 
110cdf0e10cSrcweir /*************************************************************************
111cdf0e10cSrcweir |*
112cdf0e10cSrcweir |* Destruktor
113cdf0e10cSrcweir |*
114cdf0e10cSrcweir \************************************************************************/
115cdf0e10cSrcweir 
~DrawView()116cdf0e10cSrcweir DrawView::~DrawView()
117cdf0e10cSrcweir {
118cdf0e10cSrcweir 	delete mpVDev;
119cdf0e10cSrcweir }
120cdf0e10cSrcweir 
121cdf0e10cSrcweir /*************************************************************************
122cdf0e10cSrcweir |*
123cdf0e10cSrcweir |* virtuelle Methode von SdrView, wird bei Selektionsaenderung gerufen
124cdf0e10cSrcweir |*
125cdf0e10cSrcweir \************************************************************************/
126cdf0e10cSrcweir 
MarkListHasChanged()127cdf0e10cSrcweir void DrawView::MarkListHasChanged()
128cdf0e10cSrcweir {
129cdf0e10cSrcweir 	::sd::View::MarkListHasChanged();
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 	if (mpDrawViewShell)
132cdf0e10cSrcweir 		mpDrawViewShell->SelectionHasChanged();
133cdf0e10cSrcweir }
134cdf0e10cSrcweir 
135cdf0e10cSrcweir /*************************************************************************
136cdf0e10cSrcweir |*
137cdf0e10cSrcweir |* virtuelle Methode von SdrView, wird bei Modelaenderung gerufen
138cdf0e10cSrcweir |*
139cdf0e10cSrcweir \************************************************************************/
140cdf0e10cSrcweir 
ModelHasChanged()141cdf0e10cSrcweir void DrawView::ModelHasChanged()
142cdf0e10cSrcweir {
143cdf0e10cSrcweir 	::sd::View::ModelHasChanged();
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 	// den Gestalter zur Neudarstellung zwingen
146cdf0e10cSrcweir 	SfxStyleSheetBasePool* pSSPool = mpDoc->GetStyleSheetPool();
147cdf0e10cSrcweir 	pSSPool->Broadcast(SfxStyleSheetPoolHint(SFX_STYLESHEETPOOL_CHANGES));
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 	if( mpDrawViewShell )
150cdf0e10cSrcweir 		mpDrawViewShell->ModelHasChanged();
151cdf0e10cSrcweir 
152cdf0e10cSrcweir }
153cdf0e10cSrcweir 
154cdf0e10cSrcweir /*************************************************************************
155cdf0e10cSrcweir |*
156cdf0e10cSrcweir |* Attribute auf Titel- und Gliederungtext und Hintergrundrechteck einer
157cdf0e10cSrcweir |* Masterpage in Vorlagen umlenken, sonst an Basisklasse weitergeben
158cdf0e10cSrcweir |*
159cdf0e10cSrcweir \************************************************************************/
160cdf0e10cSrcweir 
SetAttributes(const SfxItemSet & rSet,sal_Bool bReplaceAll)161cdf0e10cSrcweir sal_Bool DrawView::SetAttributes(const SfxItemSet& rSet,
162cdf0e10cSrcweir 											sal_Bool bReplaceAll)
163cdf0e10cSrcweir {
164cdf0e10cSrcweir 	sal_Bool bOk = sal_False;
165cdf0e10cSrcweir 
166cdf0e10cSrcweir 	// wird eine Masterpage bearbeitet?
167cdf0e10cSrcweir 	if ( mpDrawViewShell && mpDrawViewShell->GetEditMode() == EM_MASTERPAGE )
168cdf0e10cSrcweir 	{
169cdf0e10cSrcweir 		SfxStyleSheetBasePool* pStShPool = mpDoc->GetStyleSheetPool();
170cdf0e10cSrcweir 		SdPage& rPage = *mpDrawViewShell->getCurrentPage();
171cdf0e10cSrcweir 		String aLayoutName = rPage.GetName();
172cdf0e10cSrcweir 		SdrTextObj* pEditObject = static_cast< SdrTextObj* >( GetTextEditObject() );
173cdf0e10cSrcweir 
174cdf0e10cSrcweir 		if (pEditObject)
175cdf0e10cSrcweir 		{
176cdf0e10cSrcweir 			// Textedit
177cdf0e10cSrcweir 			String aTemplateName(aLayoutName);
178cdf0e10cSrcweir 
179cdf0e10cSrcweir 			sal_uInt32 nInv = pEditObject->GetObjInventor();
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 			if (nInv == SdrInventor)
182cdf0e10cSrcweir 			{
183cdf0e10cSrcweir 				sal_uInt16 eObjKind = pEditObject->GetObjIdentifier();
184cdf0e10cSrcweir 				PresObjKind ePresObjKind = rPage.GetPresObjKind(pEditObject);
185cdf0e10cSrcweir 
186cdf0e10cSrcweir 				if ( ePresObjKind == PRESOBJ_TITLE ||
187cdf0e10cSrcweir 				     ePresObjKind == PRESOBJ_NOTES )
188cdf0e10cSrcweir 				{
189cdf0e10cSrcweir 					// Presentation object (except outline)
190cdf0e10cSrcweir 					SfxStyleSheet* pSheet = rPage.GetStyleSheetForPresObj( ePresObjKind );
191cdf0e10cSrcweir 					DBG_ASSERT(pSheet, "StyleSheet nicht gefunden");
192cdf0e10cSrcweir 
193cdf0e10cSrcweir 					SfxItemSet aTempSet( pSheet->GetItemSet() );
194cdf0e10cSrcweir 					aTempSet.Put( rSet );
195cdf0e10cSrcweir 					aTempSet.ClearInvalidItems();
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 					// Undo-Action
198cdf0e10cSrcweir 					StyleSheetUndoAction* pAction = new StyleSheetUndoAction(mpDoc, pSheet, &aTempSet);
199cdf0e10cSrcweir 					mpDocSh->GetUndoManager()->AddUndoAction(pAction);
200cdf0e10cSrcweir 
201cdf0e10cSrcweir 					pSheet->GetItemSet().Put(aTempSet);
202cdf0e10cSrcweir 					pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
203cdf0e10cSrcweir 					bOk = sal_True;
204cdf0e10cSrcweir 				}
205cdf0e10cSrcweir 				else if (eObjKind == OBJ_OUTLINETEXT)
206cdf0e10cSrcweir 				{
207cdf0e10cSrcweir 					// Presentation object outline
208cdf0e10cSrcweir 					OutlinerView* pOV	= GetTextEditOutlinerView();
209cdf0e10cSrcweir 					::Outliner* pOutliner = pOV->GetOutliner();
210cdf0e10cSrcweir 					List*		  pList = (List*)pOV->CreateSelectionList();
211cdf0e10cSrcweir 					aTemplateName += String(SdResId(STR_LAYOUT_OUTLINE));
212cdf0e10cSrcweir 
213cdf0e10cSrcweir 					pOutliner->SetUpdateMode(sal_False);
214cdf0e10cSrcweir 					mpDocSh->SetWaitCursor( sal_True );
215cdf0e10cSrcweir 
216cdf0e10cSrcweir 					// Platzhalter durch Vorlagennamen ersetzen
217cdf0e10cSrcweir 					String aComment(SdResId(STR_UNDO_CHANGE_PRES_OBJECT));
218cdf0e10cSrcweir 					xub_StrLen nPos = aComment.Search( (sal_Unicode)'$' );
219cdf0e10cSrcweir 					aComment.Erase(nPos, 1);
220cdf0e10cSrcweir 					aComment.Insert( String((SdResId(STR_PSEUDOSHEET_OUTLINE))), nPos);
221cdf0e10cSrcweir 					mpDocSh->GetUndoManager()->EnterListAction( aComment, String() );
222cdf0e10cSrcweir 
223cdf0e10cSrcweir 					Paragraph* pPara = (Paragraph*)pList->Last();
224cdf0e10cSrcweir 					while (pPara)
225cdf0e10cSrcweir 					{
226cdf0e10cSrcweir 						sal_uLong nParaPos = pOutliner->GetAbsPos( pPara );
227cdf0e10cSrcweir 						sal_Int16 nDepth = pOutliner->GetDepth( (sal_uInt16) nParaPos );
228cdf0e10cSrcweir 						String aName(rPage.GetLayoutName());
229cdf0e10cSrcweir 						aName += (sal_Unicode)(' ');
230cdf0e10cSrcweir 						aName += String::CreateFromInt32( (nDepth <= 0) ? 1 : nDepth + 1 );
231cdf0e10cSrcweir 						SfxStyleSheet* pSheet = (SfxStyleSheet*)pStShPool->Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
232cdf0e10cSrcweir 						DBG_ASSERT(pSheet, "StyleSheet nicht gefunden");
233cdf0e10cSrcweir 
234cdf0e10cSrcweir 						SfxItemSet aTempSet( pSheet->GetItemSet() );
235cdf0e10cSrcweir 						aTempSet.Put( rSet );
236cdf0e10cSrcweir 						aTempSet.ClearInvalidItems();
237cdf0e10cSrcweir 
238cdf0e10cSrcweir 						if( nDepth > 0 && aTempSet.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON )
239cdf0e10cSrcweir 						{
240cdf0e10cSrcweir 							// no SvxNumBulletItem in outline level 1 to 8!
241cdf0e10cSrcweir 							aTempSet.ClearItem( EE_PARA_NUMBULLET );
242cdf0e10cSrcweir 						}
243cdf0e10cSrcweir 
244cdf0e10cSrcweir 						// Undo-Action
245cdf0e10cSrcweir 						StyleSheetUndoAction* pAction = new StyleSheetUndoAction(mpDoc, pSheet, &aTempSet);
246cdf0e10cSrcweir 						mpDocSh->GetUndoManager()->AddUndoAction(pAction);
247cdf0e10cSrcweir 
248cdf0e10cSrcweir 						pSheet->GetItemSet().Put(aTempSet);
249cdf0e10cSrcweir 						pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
250cdf0e10cSrcweir 
251cdf0e10cSrcweir 						// now also broadcast any child sheets
252cdf0e10cSrcweir 						sal_Int16 nChild;
253cdf0e10cSrcweir 						for( nChild = nDepth + 1; nChild < 9; nChild++ )
254cdf0e10cSrcweir 						{
255cdf0e10cSrcweir 							String aSheetName(rPage.GetLayoutName());
256cdf0e10cSrcweir 							aSheetName += (sal_Unicode)(' ');
257cdf0e10cSrcweir 							aSheetName += String::CreateFromInt32( nChild <= 0 ? 1 : nChild + 1 );
258cdf0e10cSrcweir 							SfxStyleSheet* pOutlSheet = static_cast< SfxStyleSheet* >(pStShPool->Find(aSheetName, SD_STYLE_FAMILY_MASTERPAGE));
259cdf0e10cSrcweir 
260cdf0e10cSrcweir 							if( pOutlSheet )
261cdf0e10cSrcweir 								pOutlSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
262cdf0e10cSrcweir 						}
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 						pPara = (Paragraph*)pList->Prev();
265cdf0e10cSrcweir 
266cdf0e10cSrcweir 						if( !pPara && nDepth > 0 &&  rSet.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON &&
267cdf0e10cSrcweir 						    pOutliner->GetDepth( (sal_uInt16) pOutliner->GetAbsPos( (Paragraph*) pList->First() ) ) > 0 )
268cdf0e10cSrcweir 							pPara = pOutliner->GetParagraph( 0 );  // Put NumBulletItem in outline level 1
269cdf0e10cSrcweir 					}
270cdf0e10cSrcweir 
271cdf0e10cSrcweir 					mpDocSh->SetWaitCursor( sal_False );
272cdf0e10cSrcweir 					pOV->GetOutliner()->SetUpdateMode(sal_True);
273cdf0e10cSrcweir 
274cdf0e10cSrcweir 					mpDocSh->GetUndoManager()->LeaveListAction();
275cdf0e10cSrcweir 
276cdf0e10cSrcweir 					delete pList;
277cdf0e10cSrcweir 					bOk = sal_True;
278cdf0e10cSrcweir 				}
279cdf0e10cSrcweir 				else
280cdf0e10cSrcweir 				{
281cdf0e10cSrcweir 					bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
282cdf0e10cSrcweir 				}
283cdf0e10cSrcweir 			}
284cdf0e10cSrcweir 		}
285cdf0e10cSrcweir 		else
286cdf0e10cSrcweir 		{
287cdf0e10cSrcweir 			// Selection
288cdf0e10cSrcweir 			const SdrMarkList& rList = GetMarkedObjectList();
289cdf0e10cSrcweir 			sal_uLong nMarkCount		 = rList.GetMarkCount();
290cdf0e10cSrcweir 			for (sal_uLong nMark = 0; nMark < nMarkCount; nMark++)
291cdf0e10cSrcweir 			{
292cdf0e10cSrcweir 				SdrObject* pObject = rList.GetMark(nMark)->GetMarkedSdrObj();
293cdf0e10cSrcweir 				sal_uInt32 nInv = pObject->GetObjInventor();
294cdf0e10cSrcweir 
295cdf0e10cSrcweir 				if (nInv == SdrInventor)
296cdf0e10cSrcweir 				{
297cdf0e10cSrcweir 					sal_uInt16 eObjKind = pObject->GetObjIdentifier();
298cdf0e10cSrcweir 					PresObjKind ePresObjKind = rPage.GetPresObjKind(pObject);
299cdf0e10cSrcweir 					String aTemplateName(aLayoutName);
300cdf0e10cSrcweir 
301cdf0e10cSrcweir 					if (ePresObjKind == PRESOBJ_TITLE ||
302cdf0e10cSrcweir 						ePresObjKind == PRESOBJ_NOTES)
303cdf0e10cSrcweir 					{
304cdf0e10cSrcweir 						// Presentation object (except outline)
305cdf0e10cSrcweir 						SfxStyleSheet* pSheet = rPage.GetStyleSheetForPresObj( ePresObjKind );
306cdf0e10cSrcweir 						DBG_ASSERT(pSheet, "StyleSheet not found");
307cdf0e10cSrcweir 
308cdf0e10cSrcweir 						SfxItemSet aTempSet( pSheet->GetItemSet() );
309cdf0e10cSrcweir 						aTempSet.Put( rSet );
310cdf0e10cSrcweir 						aTempSet.ClearInvalidItems();
311cdf0e10cSrcweir 
312cdf0e10cSrcweir 						// Undo-Action
313cdf0e10cSrcweir 						StyleSheetUndoAction* pAction = new StyleSheetUndoAction(mpDoc, pSheet, &aTempSet);
314cdf0e10cSrcweir 						mpDocSh->GetUndoManager()->AddUndoAction(pAction);
315cdf0e10cSrcweir 
316cdf0e10cSrcweir 						pSheet->GetItemSet().Put(aTempSet,false);
317cdf0e10cSrcweir 						pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
318cdf0e10cSrcweir 						bOk = sal_True;
319cdf0e10cSrcweir 					}
320cdf0e10cSrcweir 					else if (eObjKind == OBJ_OUTLINETEXT)
321cdf0e10cSrcweir 					{
322cdf0e10cSrcweir 						// Presentation object outline
323cdf0e10cSrcweir 						aTemplateName += String(SdResId(STR_LAYOUT_OUTLINE));
324cdf0e10cSrcweir 						for (sal_uInt16 nLevel = 9; nLevel > 0; nLevel--)
325cdf0e10cSrcweir 						{
326cdf0e10cSrcweir 							String aName(rPage.GetLayoutName());
327cdf0e10cSrcweir 							aName += (sal_Unicode)(' ');
328cdf0e10cSrcweir 							aName += String::CreateFromInt32( (sal_Int32)nLevel );
329cdf0e10cSrcweir 							SfxStyleSheet* pSheet = (SfxStyleSheet*)pStShPool->
330cdf0e10cSrcweir 												Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
331cdf0e10cSrcweir 							DBG_ASSERT(pSheet, "StyleSheet nicht gefunden");
332cdf0e10cSrcweir 
333cdf0e10cSrcweir 							SfxItemSet aTempSet( pSheet->GetItemSet() );
334cdf0e10cSrcweir 
335cdf0e10cSrcweir 							if( nLevel > 1 )
336cdf0e10cSrcweir 							{
337cdf0e10cSrcweir 								// for all levels over 1, clear all items that will be
338cdf0e10cSrcweir 								// hard set to level 1
339cdf0e10cSrcweir 								SfxWhichIter aWhichIter(rSet);
340cdf0e10cSrcweir 								sal_uInt16 nWhich(aWhichIter.FirstWhich());
341cdf0e10cSrcweir 								while( nWhich )
342cdf0e10cSrcweir 								{
343cdf0e10cSrcweir 									if( SFX_ITEM_ON == rSet.GetItemState( nWhich ) )
344cdf0e10cSrcweir 										aTempSet.ClearItem( nWhich );
345cdf0e10cSrcweir 									nWhich = aWhichIter.NextWhich();
346cdf0e10cSrcweir 								}
347cdf0e10cSrcweir 
348cdf0e10cSrcweir 							}
349cdf0e10cSrcweir 							else
350cdf0e10cSrcweir 							{
351cdf0e10cSrcweir 								// put the items hard into level one
352cdf0e10cSrcweir 								aTempSet.Put( rSet );
353cdf0e10cSrcweir 							}
354cdf0e10cSrcweir 
355cdf0e10cSrcweir 							aTempSet.ClearInvalidItems();
356cdf0e10cSrcweir 
357cdf0e10cSrcweir 							// Undo-Action
358cdf0e10cSrcweir 							StyleSheetUndoAction* pAction = new StyleSheetUndoAction(mpDoc, pSheet, &aTempSet);
359cdf0e10cSrcweir 							mpDocSh->GetUndoManager()->AddUndoAction(pAction);
360cdf0e10cSrcweir 
361cdf0e10cSrcweir 							pSheet->GetItemSet().Set(aTempSet,false);
362cdf0e10cSrcweir 							pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
363cdf0e10cSrcweir 						}
364cdf0e10cSrcweir 
365cdf0e10cSrcweir 						// remove all hard set items from shape that are now set in style
366cdf0e10cSrcweir 						SfxWhichIter aWhichIter(rSet);
367cdf0e10cSrcweir 						sal_uInt16 nWhich(aWhichIter.FirstWhich());
368cdf0e10cSrcweir 						while( nWhich )
369cdf0e10cSrcweir 						{
370cdf0e10cSrcweir 							if( SFX_ITEM_ON == rSet.GetItemState( nWhich ) )
371cdf0e10cSrcweir 								pObject->ClearMergedItem( nWhich );
372cdf0e10cSrcweir 							nWhich = aWhichIter.NextWhich();
373cdf0e10cSrcweir 						}
374cdf0e10cSrcweir 
375cdf0e10cSrcweir 						bOk = sal_True;
376cdf0e10cSrcweir 					}
377cdf0e10cSrcweir 				}
378cdf0e10cSrcweir 			}
379cdf0e10cSrcweir 
380cdf0e10cSrcweir 			if(!bOk)
381cdf0e10cSrcweir 				bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
382cdf0e10cSrcweir 		}
383cdf0e10cSrcweir 	}
384cdf0e10cSrcweir 	else	// nicht auf der Masterpage
385cdf0e10cSrcweir 	{
386cdf0e10cSrcweir 		bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
387cdf0e10cSrcweir 	}
388cdf0e10cSrcweir 
389cdf0e10cSrcweir 	return (bOk);
390cdf0e10cSrcweir }
391cdf0e10cSrcweir 
392cdf0e10cSrcweir /*************************************************************************
393cdf0e10cSrcweir |*
394cdf0e10cSrcweir |* Notify fuer Aenderung der Seitenanordnung
395cdf0e10cSrcweir |*
396cdf0e10cSrcweir \************************************************************************/
397cdf0e10cSrcweir 
Notify(SfxBroadcaster & rBC,const SfxHint & rHint)398cdf0e10cSrcweir void DrawView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
399cdf0e10cSrcweir {
400cdf0e10cSrcweir 	if ( mpDrawViewShell && rHint.ISA(SdrHint) )
401cdf0e10cSrcweir 	{
402cdf0e10cSrcweir 		SdrHintKind eHintKind = ( (SdrHint&) rHint).GetKind();
403cdf0e10cSrcweir 
404cdf0e10cSrcweir 		if ( mnPOCHSmph == 0 && eHintKind == HINT_PAGEORDERCHG )
405cdf0e10cSrcweir 		{
406cdf0e10cSrcweir 			mpDrawViewShell->ResetActualPage();
407cdf0e10cSrcweir 		}
408cdf0e10cSrcweir 		else if ( eHintKind == HINT_LAYERCHG || eHintKind == HINT_LAYERORDERCHG )
409cdf0e10cSrcweir 		{
410cdf0e10cSrcweir 			mpDrawViewShell->ResetActualLayer();
411cdf0e10cSrcweir 		}
412cdf0e10cSrcweir 
413cdf0e10cSrcweir 		// #94278# switch to that page when it's not a master page
414cdf0e10cSrcweir 		if(HINT_SWITCHTOPAGE == eHintKind)
415cdf0e10cSrcweir 		{
416cdf0e10cSrcweir 			const SdrPage* pPage = ((const SdrHint&)rHint).GetPage();
417cdf0e10cSrcweir 
418cdf0e10cSrcweir 			if(pPage && !pPage->IsMasterPage())
419cdf0e10cSrcweir 			{
420cdf0e10cSrcweir 				if(mpDrawViewShell->GetActualPage() != pPage)
421cdf0e10cSrcweir 				{
422cdf0e10cSrcweir 					sal_uInt16 nPageNum = (pPage->GetPageNum() - 1) / 2; // Sdr --> Sd
423cdf0e10cSrcweir 					mpDrawViewShell->SwitchPage(nPageNum);
424cdf0e10cSrcweir 				}
425cdf0e10cSrcweir 			}
426cdf0e10cSrcweir 		}
427cdf0e10cSrcweir 	}
428cdf0e10cSrcweir 
429cdf0e10cSrcweir 	::sd::View::Notify(rBC, rHint);
430cdf0e10cSrcweir }
431cdf0e10cSrcweir 
432cdf0e10cSrcweir /*************************************************************************
433cdf0e10cSrcweir |*
434cdf0e10cSrcweir |* PageOrderChangedHint blockieren/freigeben
435cdf0e10cSrcweir |*
436cdf0e10cSrcweir \************************************************************************/
437cdf0e10cSrcweir 
BlockPageOrderChangedHint(sal_Bool bBlock)438cdf0e10cSrcweir void DrawView::BlockPageOrderChangedHint(sal_Bool bBlock)
439cdf0e10cSrcweir {
440cdf0e10cSrcweir 	if (bBlock)
441cdf0e10cSrcweir 		mnPOCHSmph++;
442cdf0e10cSrcweir 	else
443cdf0e10cSrcweir 	{
444cdf0e10cSrcweir 		DBG_ASSERT(mnPOCHSmph, "Zaehlerunterlauf");
445cdf0e10cSrcweir 		mnPOCHSmph--;
446cdf0e10cSrcweir 	}
447cdf0e10cSrcweir }
448cdf0e10cSrcweir 
449cdf0e10cSrcweir /*************************************************************************
450cdf0e10cSrcweir |*
451cdf0e10cSrcweir |* StyleSheet-Setzen auf der Masterpage abfangen, wenn Praesentationsobjekte
452cdf0e10cSrcweir |* selektiert sind
453cdf0e10cSrcweir |*
454cdf0e10cSrcweir \************************************************************************/
455cdf0e10cSrcweir 
SetStyleSheet(SfxStyleSheet * pStyleSheet,sal_Bool bDontRemoveHardAttr)456cdf0e10cSrcweir sal_Bool DrawView::SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
457cdf0e10cSrcweir {
458cdf0e10cSrcweir 	sal_Bool bResult = sal_True;
459cdf0e10cSrcweir 
460cdf0e10cSrcweir 	// wird eine Masterpage bearbeitet?
461cdf0e10cSrcweir 	if (mpDrawViewShell && mpDrawViewShell->GetEditMode() == EM_MASTERPAGE)
462cdf0e10cSrcweir 	{
463cdf0e10cSrcweir 		if (IsPresObjSelected(sal_False, sal_True))
464cdf0e10cSrcweir 		{
465cdf0e10cSrcweir 
466cdf0e10cSrcweir 			InfoBox(mpDrawViewShell->GetActiveWindow(),
467cdf0e10cSrcweir 					String(SdResId(STR_ACTION_NOTPOSSIBLE))).Execute();
468cdf0e10cSrcweir 			bResult = sal_False;
469cdf0e10cSrcweir 		}
470cdf0e10cSrcweir 		else
471cdf0e10cSrcweir 		{
472cdf0e10cSrcweir 			bResult = ::sd::View::SetStyleSheet(pStyleSheet, bDontRemoveHardAttr);
473cdf0e10cSrcweir 		}
474cdf0e10cSrcweir 	}
475cdf0e10cSrcweir 	else
476cdf0e10cSrcweir 	{
477cdf0e10cSrcweir 		bResult = ::sd::View::SetStyleSheet(pStyleSheet, bDontRemoveHardAttr);
478cdf0e10cSrcweir 	}
479cdf0e10cSrcweir 	return bResult;
480cdf0e10cSrcweir }
481cdf0e10cSrcweir 
482cdf0e10cSrcweir /*************************************************************************
483cdf0e10cSrcweir |*
484cdf0e10cSrcweir |* Paint-Methode: das Ereignis wird an die View weitergeleitet
485cdf0e10cSrcweir |*
486cdf0e10cSrcweir \************************************************************************/
487cdf0e10cSrcweir 
CompleteRedraw(OutputDevice * pOutDev,const Region & rReg,sdr::contact::ViewObjectContactRedirector * pRedirector)488cdf0e10cSrcweir void DrawView::CompleteRedraw(OutputDevice* pOutDev, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector /*=0L*/)
489cdf0e10cSrcweir {
490cdf0e10cSrcweir 	if( mpVDev )
491cdf0e10cSrcweir 	{
492cdf0e10cSrcweir 		delete mpVDev;
493cdf0e10cSrcweir 		mpVDev = NULL;
494cdf0e10cSrcweir 	}
495cdf0e10cSrcweir 
496cdf0e10cSrcweir 	sal_Bool bStandardPaint = sal_True;
497cdf0e10cSrcweir 
498cdf0e10cSrcweir 	SdDrawDocument* pDoc = mpDocShell->GetDoc();
499cdf0e10cSrcweir 	if( pDoc && pDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS)
500cdf0e10cSrcweir 	{
501cdf0e10cSrcweir 		rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( pDoc ) );
502cdf0e10cSrcweir 		if(xSlideshow.is() && xSlideshow->isRunning())
503cdf0e10cSrcweir 		{
504cdf0e10cSrcweir 			OutputDevice* pShowWindow = ( OutputDevice* )xSlideshow->getShowWindow();
505cdf0e10cSrcweir 			if( (pShowWindow == pOutDev) || (xSlideshow->getAnimationMode() == ANIMATIONMODE_PREVIEW) )
506cdf0e10cSrcweir 			{
507cdf0e10cSrcweir 				if( pShowWindow == pOutDev )
508cdf0e10cSrcweir 					PresPaint(rReg);
509cdf0e10cSrcweir 				bStandardPaint = sal_False;
510cdf0e10cSrcweir 			}
511cdf0e10cSrcweir 		}
512cdf0e10cSrcweir 	}
513cdf0e10cSrcweir 
514cdf0e10cSrcweir 	if(bStandardPaint)
515cdf0e10cSrcweir 	{
516cdf0e10cSrcweir 		::sd::View::CompleteRedraw(pOutDev, rReg, pRedirector);
517cdf0e10cSrcweir 	}
518cdf0e10cSrcweir }
519cdf0e10cSrcweir 
520cdf0e10cSrcweir /*************************************************************************
521cdf0e10cSrcweir |*
522cdf0e10cSrcweir |* Paint-Event during running slide show
523cdf0e10cSrcweir |*
524cdf0e10cSrcweir \************************************************************************/
525cdf0e10cSrcweir 
PresPaint(const Region & rRegion)526cdf0e10cSrcweir void DrawView::PresPaint(const Region& rRegion)
527cdf0e10cSrcweir {
528cdf0e10cSrcweir 	if(mpViewSh)
529cdf0e10cSrcweir 	{
530cdf0e10cSrcweir 		rtl::Reference< SlideShow > xSlideshow( SlideShow::GetSlideShow( GetDoc() ) );
531cdf0e10cSrcweir 		if( xSlideshow.is() && xSlideshow->isRunning() )
532cdf0e10cSrcweir 			xSlideshow->paint( rRegion.GetBoundRect() );
533cdf0e10cSrcweir 	}
534cdf0e10cSrcweir }
535cdf0e10cSrcweir 
536cdf0e10cSrcweir /*************************************************************************
537cdf0e10cSrcweir |* entscheidet, ob ein Objekt markiert werden kann (z. B. noch nicht
538cdf0e10cSrcweir |* erschienene Animationsobjekte in der Diashow)
539cdf0e10cSrcweir \************************************************************************/
540cdf0e10cSrcweir 
IsObjMarkable(SdrObject * pObj,SdrPageView * pPV) const541cdf0e10cSrcweir sal_Bool DrawView::IsObjMarkable(SdrObject* pObj, SdrPageView* pPV) const
542cdf0e10cSrcweir {
543cdf0e10cSrcweir 	return FmFormView::IsObjMarkable(pObj, pPV);;
544cdf0e10cSrcweir }
545cdf0e10cSrcweir 
546cdf0e10cSrcweir /*************************************************************************
547cdf0e10cSrcweir |*
548cdf0e10cSrcweir |* Uebergebenen Bereich sichtbar machen (es wird ggf. gescrollt)
549cdf0e10cSrcweir |*
550cdf0e10cSrcweir \************************************************************************/
551cdf0e10cSrcweir 
MakeVisible(const Rectangle & rRect,::Window & rWin)552cdf0e10cSrcweir void DrawView::MakeVisible(const Rectangle& rRect, ::Window& rWin)
553cdf0e10cSrcweir {
554cdf0e10cSrcweir 	if (!rRect.IsEmpty())
555cdf0e10cSrcweir 	{
556cdf0e10cSrcweir 		mpDrawViewShell->MakeVisible(rRect, rWin);
557cdf0e10cSrcweir 	}
558cdf0e10cSrcweir }
559cdf0e10cSrcweir /*************************************************************************
560cdf0e10cSrcweir |*
561cdf0e10cSrcweir |* Seite wird gehided
562cdf0e10cSrcweir |*
563cdf0e10cSrcweir \************************************************************************/
564cdf0e10cSrcweir 
HideSdrPage()565cdf0e10cSrcweir void DrawView::HideSdrPage()
566cdf0e10cSrcweir {
567cdf0e10cSrcweir 	if (mpDrawViewShell)
568cdf0e10cSrcweir 	{
569cdf0e10cSrcweir 		mpDrawViewShell->HidePage();
570cdf0e10cSrcweir 	}
571cdf0e10cSrcweir 
572cdf0e10cSrcweir 	::sd::View::HideSdrPage();
573cdf0e10cSrcweir }
574cdf0e10cSrcweir 
DeleteMarked()575cdf0e10cSrcweir void DrawView::DeleteMarked()
576cdf0e10cSrcweir {
577cdf0e10cSrcweir 	OSL_TRACE( "DrawView::DeleteMarked() - enter" );
578cdf0e10cSrcweir 
579cdf0e10cSrcweir 	sd::UndoManager* pUndoManager = mpDoc->GetUndoManager();
580cdf0e10cSrcweir 	DBG_ASSERT( pUndoManager, "sd::DrawView::DeleteMarked(), ui action without undo manager!?" );
581cdf0e10cSrcweir 
582cdf0e10cSrcweir 	if( pUndoManager )
583cdf0e10cSrcweir 	{
584cdf0e10cSrcweir 		String aUndo( SVX_RES(STR_EditDelete) );
585cdf0e10cSrcweir 		String aSearchString(RTL_CONSTASCII_USTRINGPARAM("%1"));
586cdf0e10cSrcweir 		aUndo.SearchAndReplace(aSearchString, GetDescriptionOfMarkedObjects());
587cdf0e10cSrcweir 		pUndoManager->EnterListAction(aUndo, aUndo);
588cdf0e10cSrcweir 	}
589cdf0e10cSrcweir 
590cdf0e10cSrcweir 	SdPage* pPage = 0;
591cdf0e10cSrcweir 	bool bResetLayout = false;
592cdf0e10cSrcweir 
593cdf0e10cSrcweir 	const sal_uLong nMarkCount = GetMarkedObjectList().GetMarkCount();
594cdf0e10cSrcweir 	if( nMarkCount )
595cdf0e10cSrcweir 	{
596cdf0e10cSrcweir 		SdrMarkList aList( GetMarkedObjectList() );
597cdf0e10cSrcweir 		for (sal_uLong nMark = 0; nMark < nMarkCount; nMark++)
598cdf0e10cSrcweir 		{
599cdf0e10cSrcweir 			SdrObject* pObj = aList.GetMark(nMark)->GetMarkedSdrObj();
600cdf0e10cSrcweir 			if( pObj && !pObj->IsEmptyPresObj() && pObj->GetUserCall() )
601cdf0e10cSrcweir 			{
602cdf0e10cSrcweir 				pPage = static_cast< SdPage* >( pObj->GetPage() );
603cdf0e10cSrcweir 				PresObjKind ePresObjKind;
604cdf0e10cSrcweir 				if( pPage && ((ePresObjKind = pPage->GetPresObjKind(pObj)) != PRESOBJ_NONE))
605cdf0e10cSrcweir 				{
606cdf0e10cSrcweir 					switch( ePresObjKind )
607cdf0e10cSrcweir 					{
608cdf0e10cSrcweir 					case PRESOBJ_GRAPHIC:
609cdf0e10cSrcweir 					case PRESOBJ_OBJECT:
610cdf0e10cSrcweir 					case PRESOBJ_CHART:
611cdf0e10cSrcweir 					case PRESOBJ_ORGCHART:
612cdf0e10cSrcweir 					case PRESOBJ_TABLE:
613cdf0e10cSrcweir 					case PRESOBJ_CALC:
614cdf0e10cSrcweir 					case PRESOBJ_IMAGE:
615cdf0e10cSrcweir 					case PRESOBJ_MEDIA:
616cdf0e10cSrcweir 						ePresObjKind = PRESOBJ_OUTLINE;
617cdf0e10cSrcweir 						break;
618cdf0e10cSrcweir 					default:
619cdf0e10cSrcweir 						break;
620cdf0e10cSrcweir 					}
621cdf0e10cSrcweir 					SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
622cdf0e10cSrcweir 					bool bVertical = pTextObj && pTextObj->IsVerticalWriting();
623cdf0e10cSrcweir 					Rectangle aRect( pObj->GetLogicRect() );
624cdf0e10cSrcweir 					SdrObject* pNewObj = pPage->InsertAutoLayoutShape( 0, ePresObjKind, bVertical, aRect, true );
625cdf0e10cSrcweir 
626*cba0c2bcSAndre Fischer                     // Move the new PresObj to the position before the
627*cba0c2bcSAndre Fischer                     // object it will replace.
628*cba0c2bcSAndre Fischer                     pUndoManager->AddUndoAction(
629*cba0c2bcSAndre Fischer                         mpDoc->GetSdrUndoFactory().CreateUndoObjectOrdNum(
630*cba0c2bcSAndre Fischer                             *pNewObj,
631*cba0c2bcSAndre Fischer                             pNewObj->GetOrdNum(),
632*cba0c2bcSAndre Fischer                             pObj->GetOrdNum()));
633*cba0c2bcSAndre Fischer                     pPage->SetObjectOrdNum( pNewObj->GetOrdNum(), pObj->GetOrdNum() );
634cdf0e10cSrcweir 
635cdf0e10cSrcweir 					bResetLayout = true;
636cdf0e10cSrcweir 
637cdf0e10cSrcweir 					OSL_TRACE( "DrawView::InsertAutoLayoutShape() - InsertAutoLayoutShape" );
638cdf0e10cSrcweir 				}
639cdf0e10cSrcweir 			}
640cdf0e10cSrcweir 		}
641cdf0e10cSrcweir 	}
642cdf0e10cSrcweir 
643cdf0e10cSrcweir 	::sd::View::DeleteMarked();
644cdf0e10cSrcweir 
645cdf0e10cSrcweir 	if( pPage && bResetLayout )
646cdf0e10cSrcweir 		pPage->SetAutoLayout( pPage->GetAutoLayout() );
647cdf0e10cSrcweir 
648cdf0e10cSrcweir 	if( pUndoManager )
649cdf0e10cSrcweir 		pUndoManager->LeaveListAction();
650cdf0e10cSrcweir 
651cdf0e10cSrcweir 	OSL_TRACE( "DrawView::InsertAutoLayoutShape() - leave" );
652cdf0e10cSrcweir }
653cdf0e10cSrcweir 
654cdf0e10cSrcweir } // end of namespace sd
655