xref: /AOO41X/main/sd/source/ui/view/drviews3.cxx (revision 5b1900111deff329a5580f97b99b67a25168e53d)
1*5b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*5b190011SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*5b190011SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*5b190011SAndrew Rist  * distributed with this work for additional information
6*5b190011SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*5b190011SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*5b190011SAndrew Rist  * "License"); you may not use this file except in compliance
9*5b190011SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*5b190011SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*5b190011SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*5b190011SAndrew Rist  * software distributed under the License is distributed on an
15*5b190011SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*5b190011SAndrew Rist  * KIND, either express or implied.  See the License for the
17*5b190011SAndrew Rist  * specific language governing permissions and limitations
18*5b190011SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*5b190011SAndrew Rist  *************************************************************/
21*5b190011SAndrew Rist 
22*5b190011SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "DrawViewShell.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
30cdf0e10cSrcweir #include <editeng/eeitem.hxx>
31cdf0e10cSrcweir #include <editeng/tstpitem.hxx>
32cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
33cdf0e10cSrcweir #include <editeng/protitem.hxx>
34cdf0e10cSrcweir #include <editeng/frmdiritem.hxx>
35cdf0e10cSrcweir #include <svx/ruler.hxx>
36cdf0e10cSrcweir #ifndef _SVX_RULERITEM_HXX
37cdf0e10cSrcweir #include <svx/rulritem.hxx>
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #include <svx/zoomitem.hxx>
40cdf0e10cSrcweir #ifndef _SVXIDS_HRC
41cdf0e10cSrcweir #include <svx/svxids.hrc>
42cdf0e10cSrcweir #endif
43cdf0e10cSrcweir #include <svx/svdpagv.hxx>
44cdf0e10cSrcweir #include <sfx2/request.hxx>
45cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
46cdf0e10cSrcweir #include <tools/urlobj.hxx>
47cdf0e10cSrcweir #include <svl/aeitem.hxx>
48cdf0e10cSrcweir #include <svl/eitem.hxx>
49cdf0e10cSrcweir #include <svl/rectitem.hxx>
50cdf0e10cSrcweir #include <svl/stritem.hxx>
51cdf0e10cSrcweir #include <svx/svdoole2.hxx>
52cdf0e10cSrcweir #include <svl/itempool.hxx>
53cdf0e10cSrcweir #include <svl/ptitem.hxx>
54cdf0e10cSrcweir #include <basic/sbstar.hxx>
55cdf0e10cSrcweir #include <basic/sberrors.hxx>
56cdf0e10cSrcweir #include <svx/fmshell.hxx>
57cdf0e10cSrcweir #include <svx/f3dchild.hxx>
58cdf0e10cSrcweir #include <svx/float3d.hxx>
59cdf0e10cSrcweir #include "optsitem.hxx"
60cdf0e10cSrcweir 
61cdf0e10cSrcweir #include "app.hrc"
62cdf0e10cSrcweir #include "glob.hrc"
63cdf0e10cSrcweir #include "strings.hrc"
64cdf0e10cSrcweir #include "res_bmp.hrc"
65cdf0e10cSrcweir 
66cdf0e10cSrcweir #include "sdundogr.hxx"
67cdf0e10cSrcweir #include "undopage.hxx"
68cdf0e10cSrcweir #include "glob.hxx"
69cdf0e10cSrcweir #include "app.hxx"
70cdf0e10cSrcweir #include "fupoor.hxx"
71cdf0e10cSrcweir #include "slideshow.hxx"
72cdf0e10cSrcweir #ifndef SD_FRAME_VIEW
73cdf0e10cSrcweir #include "FrameView.hxx"
74cdf0e10cSrcweir #endif
75cdf0e10cSrcweir #include "sdpage.hxx"
76cdf0e10cSrcweir #include "Window.hxx"
77cdf0e10cSrcweir #include "sdresid.hxx"
78cdf0e10cSrcweir #include "drawview.hxx"
79cdf0e10cSrcweir #include "drawdoc.hxx"
80cdf0e10cSrcweir #include "DrawViewShell.hxx"
81cdf0e10cSrcweir #include "Ruler.hxx"
82cdf0e10cSrcweir #include "DrawDocShell.hxx"
83cdf0e10cSrcweir #include "headerfooterdlg.hxx"
84cdf0e10cSrcweir #include "masterlayoutdlg.hxx"
85cdf0e10cSrcweir #include "Ruler.hxx"
86cdf0e10cSrcweir #include "DrawDocShell.hxx"
87cdf0e10cSrcweir #include "sdabstdlg.hxx"
88cdf0e10cSrcweir #include <sfx2/ipclient.hxx>
89cdf0e10cSrcweir #include <tools/diagnose_ex.h>
90cdf0e10cSrcweir #include "ViewShellBase.hxx"
91cdf0e10cSrcweir #include "FormShellManager.hxx"
92cdf0e10cSrcweir #include "LayerTabBar.hxx"
93cdf0e10cSrcweir #include "sdabstdlg.hxx"
94cdf0e10cSrcweir #include "sdpage.hxx"
95cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XControllerManager.hpp>
96cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
97cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XConfiguration.hpp>
98cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp>
99cdf0e10cSrcweir 
100cdf0e10cSrcweir using namespace ::com::sun::star::uno;
101cdf0e10cSrcweir using namespace ::com::sun::star::drawing::framework;
102cdf0e10cSrcweir using ::com::sun::star::frame::XFrame;
103cdf0e10cSrcweir using ::com::sun::star::frame::XController;
104cdf0e10cSrcweir 
105cdf0e10cSrcweir namespace sd {
106cdf0e10cSrcweir 
107cdf0e10cSrcweir #ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED
108cdf0e10cSrcweir #define SO2_DECL_SVINPLACEOBJECT_DEFINED
109cdf0e10cSrcweir SO2_DECL_REF(SvInPlaceObject)
110cdf0e10cSrcweir #endif
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 
114cdf0e10cSrcweir /*************************************************************************
115cdf0e10cSrcweir |*
116cdf0e10cSrcweir |* SfxRequests fuer Controller bearbeiten
117cdf0e10cSrcweir |*
118cdf0e10cSrcweir \************************************************************************/
119cdf0e10cSrcweir 
120cdf0e10cSrcweir void  DrawViewShell::ExecCtrl(SfxRequest& rReq)
121cdf0e10cSrcweir {
122cdf0e10cSrcweir 	// waehrend einer Diashow wird nichts ausser dem Seitenwechsel und dem
123cdf0e10cSrcweir 	// Sprung zur Bookmark ausgefuehrt!
124cdf0e10cSrcweir 	if( HasCurrentFunction(SID_PRESENTATION) &&
125cdf0e10cSrcweir 		rReq.GetSlot() != SID_SWITCHPAGE &&
126cdf0e10cSrcweir 		rReq.GetSlot() != SID_JUMPTOMARK)
127cdf0e10cSrcweir 		return;
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 	CheckLineTo (rReq);
130cdf0e10cSrcweir 
131cdf0e10cSrcweir     // End text edit mode for some requests.
132cdf0e10cSrcweir 	sal_uInt16 nSlot = rReq.GetSlot();
133cdf0e10cSrcweir     switch (nSlot)
134cdf0e10cSrcweir     {
135cdf0e10cSrcweir 		case SID_OUTPUT_QUALITY_COLOR:
136cdf0e10cSrcweir 		case SID_OUTPUT_QUALITY_GRAYSCALE:
137cdf0e10cSrcweir 		case SID_OUTPUT_QUALITY_BLACKWHITE:
138cdf0e10cSrcweir 		case SID_OUTPUT_QUALITY_CONTRAST:
139cdf0e10cSrcweir             // Do nothing.
140cdf0e10cSrcweir             break;
141cdf0e10cSrcweir         default:
142cdf0e10cSrcweir             if ( mpDrawView->IsTextEdit() )
143cdf0e10cSrcweir             {
144cdf0e10cSrcweir                 mpDrawView->SdrEndTextEdit();
145cdf0e10cSrcweir             }
146cdf0e10cSrcweir     }
147cdf0e10cSrcweir 
148cdf0e10cSrcweir     //	sal_uInt16 nSlot = rReq.GetSlot();
149cdf0e10cSrcweir 	switch (nSlot)
150cdf0e10cSrcweir 	{
151cdf0e10cSrcweir 		case SID_SWITCHPAGE:  // BASIC
152cdf0e10cSrcweir 		{
153cdf0e10cSrcweir 			sal_Bool bWasBasic = sal_False;
154cdf0e10cSrcweir 
155cdf0e10cSrcweir 			// switch page in running slide show
156cdf0e10cSrcweir 			if(SlideShow::IsRunning(GetViewShellBase()) && rReq.GetArgs())
157cdf0e10cSrcweir 			{
158cdf0e10cSrcweir 				SFX_REQUEST_ARG(rReq, pWhatPage, SfxUInt32Item, ID_VAL_WHATPAGE, sal_False);
159cdf0e10cSrcweir 				SlideShow::GetSlideShow(GetViewShellBase())->jumpToPageNumber((sal_Int32)((pWhatPage->GetValue()-1)>>1));
160cdf0e10cSrcweir 			}
161cdf0e10cSrcweir 			else
162cdf0e10cSrcweir 			{
163cdf0e10cSrcweir 				const SfxItemSet *pArgs = rReq.GetArgs ();
164cdf0e10cSrcweir 				sal_uInt16 nSelectedPage = 0;
165cdf0e10cSrcweir 
166cdf0e10cSrcweir 				if (! pArgs)
167cdf0e10cSrcweir 				{
168cdf0e10cSrcweir 					nSelectedPage = maTabControl.GetCurPageId() - 1;
169cdf0e10cSrcweir 				}
170cdf0e10cSrcweir 				else if (pArgs->Count () == 2)
171cdf0e10cSrcweir 				{
172cdf0e10cSrcweir 					SFX_REQUEST_ARG (rReq, pWhatPage, SfxUInt32Item, ID_VAL_WHATPAGE, sal_False);
173cdf0e10cSrcweir 					SFX_REQUEST_ARG (rReq, pWhatKind, SfxUInt32Item, ID_VAL_WHATKIND, sal_False);
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 					sal_Int32 nWhatPage = (sal_Int32)pWhatPage->GetValue ();
176cdf0e10cSrcweir 					sal_Int32 nWhatKind = (sal_Int32)pWhatKind->GetValue ();
177cdf0e10cSrcweir 					if (! CHECK_RANGE (PK_STANDARD, nWhatKind, PK_HANDOUT))
178cdf0e10cSrcweir 					{
179cdf0e10cSrcweir 						StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
180cdf0e10cSrcweir 						rReq.Ignore ();
181cdf0e10cSrcweir 						break;
182cdf0e10cSrcweir 					}
183cdf0e10cSrcweir 					else if (meEditMode != EM_MASTERPAGE)
184cdf0e10cSrcweir 					{
185cdf0e10cSrcweir 						if (! CHECK_RANGE (0, nWhatPage, GetDoc()->GetSdPageCount((PageKind)nWhatKind)))
186cdf0e10cSrcweir 						{
187cdf0e10cSrcweir 							StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
188cdf0e10cSrcweir 							rReq.Ignore ();
189cdf0e10cSrcweir 							break;
190cdf0e10cSrcweir 						}
191cdf0e10cSrcweir 
192cdf0e10cSrcweir 						nSelectedPage = (short) nWhatPage;
193cdf0e10cSrcweir 						mePageKind	  = (PageKind) nWhatKind;
194cdf0e10cSrcweir 						bWasBasic	  = sal_True;
195cdf0e10cSrcweir 					}
196cdf0e10cSrcweir 				}
197cdf0e10cSrcweir 				else
198cdf0e10cSrcweir 				{
199cdf0e10cSrcweir 					StarBASIC::FatalError (SbERR_WRONG_ARGS);
200cdf0e10cSrcweir 					rReq.Ignore ();
201cdf0e10cSrcweir 					break;
202cdf0e10cSrcweir 				}
203cdf0e10cSrcweir 
204cdf0e10cSrcweir 
205cdf0e10cSrcweir 				if( GetDocSh() && (GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED))
206cdf0e10cSrcweir 					GetDocSh()->SetModified();
207cdf0e10cSrcweir 
208cdf0e10cSrcweir 				SwitchPage(nSelectedPage);
209cdf0e10cSrcweir 
210cdf0e10cSrcweir 				if(HasCurrentFunction(SID_BEZIER_EDIT))
211cdf0e10cSrcweir 					GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
212cdf0e10cSrcweir 
213cdf0e10cSrcweir 				Invalidate();
214cdf0e10cSrcweir 				InvalidateWindows();
215cdf0e10cSrcweir 				rReq.Done ();
216cdf0e10cSrcweir 			}
217cdf0e10cSrcweir 			break;
218cdf0e10cSrcweir 		}
219cdf0e10cSrcweir 
220cdf0e10cSrcweir 		case SID_SWITCHLAYER:  // BASIC
221cdf0e10cSrcweir 		{
222cdf0e10cSrcweir 			const SfxItemSet *pArgs = rReq.GetArgs ();
223cdf0e10cSrcweir 			sal_uInt16 nCurPage = GetLayerTabControl()->GetCurPageId ();
224cdf0e10cSrcweir 
225cdf0e10cSrcweir 			if( pArgs && pArgs->Count () == 1)
226cdf0e10cSrcweir 			{
227cdf0e10cSrcweir 				SFX_REQUEST_ARG (rReq, pWhatLayer, SfxUInt32Item, ID_VAL_WHATLAYER, sal_False);
228cdf0e10cSrcweir 				if( pWhatLayer )
229cdf0e10cSrcweir 					nCurPage = (short) pWhatLayer->GetValue ();
230cdf0e10cSrcweir 			}
231cdf0e10cSrcweir 
232cdf0e10cSrcweir 			mpDrawView->SetActiveLayer( GetLayerTabControl()->GetPageText(nCurPage) );
233cdf0e10cSrcweir 			Invalidate();
234cdf0e10cSrcweir 			rReq.Done ();
235cdf0e10cSrcweir 
236cdf0e10cSrcweir 			break;
237cdf0e10cSrcweir 		}
238cdf0e10cSrcweir 
239cdf0e10cSrcweir 		case SID_PAGEMODE:	// BASIC
240cdf0e10cSrcweir 		{
241cdf0e10cSrcweir 
242cdf0e10cSrcweir 			const SfxItemSet *pArgs = rReq.GetArgs ();
243cdf0e10cSrcweir 
244cdf0e10cSrcweir 			if ( pArgs && pArgs->Count () == 2)
245cdf0e10cSrcweir 			{
246cdf0e10cSrcweir 				SFX_REQUEST_ARG (rReq, pIsActive, SfxBoolItem, ID_VAL_ISACTIVE, sal_False);
247cdf0e10cSrcweir 				SFX_REQUEST_ARG (rReq, pWhatKind, SfxUInt32Item, ID_VAL_WHATKIND, sal_False);
248cdf0e10cSrcweir 
249cdf0e10cSrcweir 				sal_Int32 nWhatKind = (sal_Int32)pWhatKind->GetValue ();
250cdf0e10cSrcweir 				if (CHECK_RANGE (PK_STANDARD, nWhatKind, PK_HANDOUT))
251cdf0e10cSrcweir 				{
252cdf0e10cSrcweir 					mbIsLayerModeActive = pIsActive->GetValue ();
253cdf0e10cSrcweir 					mePageKind = (PageKind) nWhatKind;
254cdf0e10cSrcweir 				}
255cdf0e10cSrcweir 			}
256cdf0e10cSrcweir 
257cdf0e10cSrcweir 			// Default-Layer der Page einschalten
258cdf0e10cSrcweir 			mpDrawView->SetActiveLayer( String( SdResId(STR_LAYER_LAYOUT) ) );
259cdf0e10cSrcweir 
260cdf0e10cSrcweir 			ChangeEditMode(EM_PAGE, mbIsLayerModeActive);
261cdf0e10cSrcweir 
262cdf0e10cSrcweir 			Invalidate();
263cdf0e10cSrcweir 			rReq.Done ();
264cdf0e10cSrcweir 
265cdf0e10cSrcweir 			break;
266cdf0e10cSrcweir 		}
267cdf0e10cSrcweir 
268cdf0e10cSrcweir 		case SID_LAYERMODE:  // BASIC
269cdf0e10cSrcweir 		{
270cdf0e10cSrcweir 			const SfxItemSet *pArgs = rReq.GetArgs ();
271cdf0e10cSrcweir 
272cdf0e10cSrcweir 			if ( pArgs && pArgs->Count () == 2)
273cdf0e10cSrcweir 			{
274cdf0e10cSrcweir 				SFX_REQUEST_ARG (rReq, pWhatLayerMode, SfxBoolItem, ID_VAL_ISACTIVE, sal_False);
275cdf0e10cSrcweir 				SFX_REQUEST_ARG (rReq, pWhatLayer, SfxUInt32Item, ID_VAL_WHATLAYER, sal_False);
276cdf0e10cSrcweir 
277cdf0e10cSrcweir 				sal_Int32 nWhatLayer = (sal_Int32)pWhatLayer->GetValue ();
278cdf0e10cSrcweir 				if (CHECK_RANGE (EM_PAGE, nWhatLayer, EM_MASTERPAGE))
279cdf0e10cSrcweir 				{
280cdf0e10cSrcweir 					mbIsLayerModeActive = pWhatLayerMode->GetValue ();
281cdf0e10cSrcweir 					meEditMode = (EditMode) nWhatLayer;
282cdf0e10cSrcweir 				}
283cdf0e10cSrcweir 			}
284cdf0e10cSrcweir 
285cdf0e10cSrcweir 			ChangeEditMode(meEditMode, !mbIsLayerModeActive);
286cdf0e10cSrcweir 
287cdf0e10cSrcweir 			Invalidate();
288cdf0e10cSrcweir 			rReq.Done ();
289cdf0e10cSrcweir 
290cdf0e10cSrcweir 			break;
291cdf0e10cSrcweir 		}
292cdf0e10cSrcweir 
293cdf0e10cSrcweir 		case SID_HEADER_AND_FOOTER:
294cdf0e10cSrcweir 		case SID_INSERT_PAGE_NUMBER:
295cdf0e10cSrcweir 		case SID_INSERT_DATE_TIME:
296cdf0e10cSrcweir 		{
297cdf0e10cSrcweir 			SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
298cdf0e10cSrcweir 			AbstractHeaderFooterDialog* pDlg = pFact ? pFact->CreateHeaderFooterDialog( (::ViewShell*)this, GetActiveWindow(), GetDoc(), mpActualPage ) : 0;
299cdf0e10cSrcweir 			if( pDlg )
300cdf0e10cSrcweir 			{
301cdf0e10cSrcweir 				pDlg->Execute();
302cdf0e10cSrcweir 				delete pDlg;
303cdf0e10cSrcweir 
304cdf0e10cSrcweir 				GetActiveWindow()->Invalidate();
305cdf0e10cSrcweir 				UpdatePreview( mpActualPage );
306cdf0e10cSrcweir 			}
307cdf0e10cSrcweir 
308cdf0e10cSrcweir 			Invalidate();
309cdf0e10cSrcweir 			rReq.Done ();
310cdf0e10cSrcweir 
311cdf0e10cSrcweir 			break;
312cdf0e10cSrcweir 		}
313cdf0e10cSrcweir 
314cdf0e10cSrcweir 		case SID_MASTER_LAYOUTS:
315cdf0e10cSrcweir 		{
316cdf0e10cSrcweir 			SdPage* pPage = GetActualPage();
317cdf0e10cSrcweir             if (meEditMode == EM_MASTERPAGE)
318cdf0e10cSrcweir                 // Use the master page of the current page.
319cdf0e10cSrcweir                 pPage = static_cast<SdPage*>(&pPage->TRG_GetMasterPage());
320cdf0e10cSrcweir 
321cdf0e10cSrcweir 			SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
322cdf0e10cSrcweir 			VclAbstractDialog* pDlg = pFact ? pFact->CreateMasterLayoutDialog( GetActiveWindow(), GetDoc(), pPage ) : 0;
323cdf0e10cSrcweir 			if( pDlg )
324cdf0e10cSrcweir 			{
325cdf0e10cSrcweir 				pDlg->Execute();
326cdf0e10cSrcweir 				delete pDlg;
327cdf0e10cSrcweir 				Invalidate();
328cdf0e10cSrcweir 			}
329cdf0e10cSrcweir 			rReq.Done ();
330cdf0e10cSrcweir 			break;
331cdf0e10cSrcweir 		}
332cdf0e10cSrcweir 		case SID_OBJECTRESIZE:
333cdf0e10cSrcweir 		{
334cdf0e10cSrcweir 			/******************************************************************
335cdf0e10cSrcweir 			* Der Server moechte die Clientgrosse verandern
336cdf0e10cSrcweir 			******************************************************************/
337cdf0e10cSrcweir             OSL_ASSERT (GetViewShell()!=NULL);
338cdf0e10cSrcweir             SfxInPlaceClient* pIPClient = GetViewShell()->GetIPClient();
339cdf0e10cSrcweir 
340cdf0e10cSrcweir             if ( pIPClient && pIPClient->IsObjectInPlaceActive() )
341cdf0e10cSrcweir 			{
342cdf0e10cSrcweir 				const SfxRectangleItem& rRect =
343cdf0e10cSrcweir 					(SfxRectangleItem&)rReq.GetArgs()->Get(SID_OBJECTRESIZE);
344cdf0e10cSrcweir 				Rectangle aRect( GetActiveWindow()->PixelToLogic( rRect.GetValue() ) );
345cdf0e10cSrcweir 
346cdf0e10cSrcweir 				if ( mpDrawView->AreObjectsMarked() )
347cdf0e10cSrcweir 				{
348cdf0e10cSrcweir 					const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
349cdf0e10cSrcweir 
350cdf0e10cSrcweir 					if (rMarkList.GetMarkCount() == 1)
351cdf0e10cSrcweir 					{
352cdf0e10cSrcweir 						SdrMark* pMark = rMarkList.GetMark(0);
353cdf0e10cSrcweir 						SdrObject* pObj = pMark->GetMarkedSdrObj();
354cdf0e10cSrcweir 
355cdf0e10cSrcweir 						SdrOle2Obj* pOle2Obj = dynamic_cast< SdrOle2Obj* >( pObj );
356cdf0e10cSrcweir 						if(pOle2Obj)
357cdf0e10cSrcweir                         {
358cdf0e10cSrcweir                             if( pOle2Obj->GetObjRef().is() )
359cdf0e10cSrcweir                             {
360cdf0e10cSrcweir                                 pOle2Obj->SetLogicRect(aRect);
361cdf0e10cSrcweir                             }
362cdf0e10cSrcweir 						}
363cdf0e10cSrcweir 					}
364cdf0e10cSrcweir 				}
365cdf0e10cSrcweir             }
366cdf0e10cSrcweir 			rReq.Ignore ();
367cdf0e10cSrcweir 			break;
368cdf0e10cSrcweir 		}
369cdf0e10cSrcweir 
370cdf0e10cSrcweir 		case SID_RELOAD:
371cdf0e10cSrcweir 		{
372cdf0e10cSrcweir 			// #83951#
373cdf0e10cSrcweir 			sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
374cdf0e10cSrcweir             SfxViewFrame* pFrame = GetViewFrame();
375cdf0e10cSrcweir 
376cdf0e10cSrcweir             try
377cdf0e10cSrcweir             {
378cdf0e10cSrcweir                 Reference< XFrame > xFrame( pFrame->GetFrame().GetFrameInterface(), UNO_SET_THROW );
379cdf0e10cSrcweir 
380cdf0e10cSrcweir                 // Save the current configuration of panes and views.
381cdf0e10cSrcweir                 Reference<XControllerManager> xControllerManager (
382cdf0e10cSrcweir                     GetViewShellBase().GetController(), UNO_QUERY_THROW);
383cdf0e10cSrcweir                 Reference<XConfigurationController> xConfigurationController (
384cdf0e10cSrcweir                     xControllerManager->getConfigurationController(), UNO_QUERY_THROW );
385cdf0e10cSrcweir                 Reference<XConfiguration> xConfiguration (
386cdf0e10cSrcweir                     xConfigurationController->getRequestedConfiguration(), UNO_SET_THROW );
387cdf0e10cSrcweir 
388cdf0e10cSrcweir                 SfxChildWindow* pWindow = pFrame->GetChildWindow(nId);
389cdf0e10cSrcweir                 if(pWindow)
390cdf0e10cSrcweir                 {
391cdf0e10cSrcweir                     Svx3DWin* p3DWin = (Svx3DWin*)(pWindow->GetWindow());
392cdf0e10cSrcweir                     if(p3DWin)
393cdf0e10cSrcweir                         p3DWin->DocumentReload();
394cdf0e10cSrcweir                 }
395cdf0e10cSrcweir 
396cdf0e10cSrcweir                 // Normale Weiterleitung an ViewFrame zur Ausfuehrung
397cdf0e10cSrcweir                 GetViewFrame()->ExecuteSlot(rReq);
398cdf0e10cSrcweir 
399cdf0e10cSrcweir                 // From here on we must cope with this object and the frame already being
400cdf0e10cSrcweir                 // deleted.  Do not call any methods or use data members.
401cdf0e10cSrcweir                 Reference<XController> xController( xFrame->getController(), UNO_SET_THROW );
402cdf0e10cSrcweir 
403cdf0e10cSrcweir                 // Restore the configuration.
404cdf0e10cSrcweir                 xControllerManager = Reference<XControllerManager>( xController, UNO_QUERY_THROW);
405cdf0e10cSrcweir                 xConfigurationController = Reference<XConfigurationController>(
406cdf0e10cSrcweir                     xControllerManager->getConfigurationController());
407cdf0e10cSrcweir                 if ( ! xConfigurationController.is())
408cdf0e10cSrcweir                     throw RuntimeException();
409cdf0e10cSrcweir                 xConfigurationController->restoreConfiguration(xConfiguration);
410cdf0e10cSrcweir             }
411cdf0e10cSrcweir             catch (RuntimeException&)
412cdf0e10cSrcweir             {
413cdf0e10cSrcweir                 DBG_UNHANDLED_EXCEPTION();
414cdf0e10cSrcweir             }
415cdf0e10cSrcweir 
416cdf0e10cSrcweir 			// We have to return immediately to avoid accessing this object.
417cdf0e10cSrcweir 			return;
418cdf0e10cSrcweir 		}
419cdf0e10cSrcweir 
420cdf0e10cSrcweir 		case SID_JUMPTOMARK:
421cdf0e10cSrcweir 		{
422cdf0e10cSrcweir 			if( rReq.GetArgs() )
423cdf0e10cSrcweir 			{
424cdf0e10cSrcweir 				SFX_REQUEST_ARG(rReq, pBookmark, SfxStringItem, SID_JUMPTOMARK, sal_False);
425cdf0e10cSrcweir 
426cdf0e10cSrcweir 				if (pBookmark)
427cdf0e10cSrcweir 				{
428cdf0e10cSrcweir 					UniString sBookmark( INetURLObject::decode( pBookmark->GetValue(), '%', INetURLObject::DECODE_WITH_CHARSET ) );
429cdf0e10cSrcweir 
430cdf0e10cSrcweir 					rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
431cdf0e10cSrcweir 					if(xSlideshow.is() && xSlideshow->isRunning())
432cdf0e10cSrcweir 					{
433cdf0e10cSrcweir 						xSlideshow->jumpToBookmark(sBookmark);
434cdf0e10cSrcweir 					}
435cdf0e10cSrcweir 					else
436cdf0e10cSrcweir 					{
437cdf0e10cSrcweir 						GotoBookmark( sBookmark );
438cdf0e10cSrcweir 					}
439cdf0e10cSrcweir 				}
440cdf0e10cSrcweir 			}
441cdf0e10cSrcweir 			rReq.Done();
442cdf0e10cSrcweir 			break;
443cdf0e10cSrcweir 		}
444cdf0e10cSrcweir 
445cdf0e10cSrcweir 		case SID_OUTPUT_QUALITY_COLOR:
446cdf0e10cSrcweir 		case SID_OUTPUT_QUALITY_GRAYSCALE:
447cdf0e10cSrcweir 		case SID_OUTPUT_QUALITY_BLACKWHITE:
448cdf0e10cSrcweir 		case SID_OUTPUT_QUALITY_CONTRAST:
449cdf0e10cSrcweir 		{
450cdf0e10cSrcweir             ExecReq( rReq );
451cdf0e10cSrcweir 			break;
452cdf0e10cSrcweir 		}
453cdf0e10cSrcweir 
454cdf0e10cSrcweir 		case SID_MAIL_SCROLLBODY_PAGEDOWN:
455cdf0e10cSrcweir 		{
456cdf0e10cSrcweir             ExecReq( rReq );
457cdf0e10cSrcweir 			break;
458cdf0e10cSrcweir 		}
459cdf0e10cSrcweir 
460cdf0e10cSrcweir 		case SID_ATTR_YEAR2000:
461cdf0e10cSrcweir 		{
462cdf0e10cSrcweir             FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
463cdf0e10cSrcweir             if (pFormShell != NULL)
464cdf0e10cSrcweir             {
465cdf0e10cSrcweir                 const SfxPoolItem* pItem;
466cdf0e10cSrcweir                 if (rReq.GetArgs()->GetItemState(
467cdf0e10cSrcweir                     SID_ATTR_YEAR2000, sal_True, &pItem) == SFX_ITEM_SET)
468cdf0e10cSrcweir 					pFormShell->SetY2KState (
469cdf0e10cSrcweir                         static_cast<const SfxUInt16Item*>(pItem)->GetValue());
470cdf0e10cSrcweir             }
471cdf0e10cSrcweir 
472cdf0e10cSrcweir 			rReq.Done();
473cdf0e10cSrcweir 		}
474cdf0e10cSrcweir 		break;
475cdf0e10cSrcweir 
476cdf0e10cSrcweir 		case SID_OPT_LOCALE_CHANGED:
477cdf0e10cSrcweir 		{
478cdf0e10cSrcweir 			GetActiveWindow()->Invalidate();
479cdf0e10cSrcweir 			UpdatePreview( mpActualPage );
480cdf0e10cSrcweir 			rReq.Done();
481cdf0e10cSrcweir 		}
482cdf0e10cSrcweir 
483cdf0e10cSrcweir 		default:
484cdf0e10cSrcweir 		break;
485cdf0e10cSrcweir 	}
486cdf0e10cSrcweir }
487cdf0e10cSrcweir 
488cdf0e10cSrcweir /*************************************************************************
489cdf0e10cSrcweir |*
490cdf0e10cSrcweir |* SfxRequests fuer Lineale bearbeiten
491cdf0e10cSrcweir |*
492cdf0e10cSrcweir \************************************************************************/
493cdf0e10cSrcweir 
494cdf0e10cSrcweir void  DrawViewShell::ExecRuler(SfxRequest& rReq)
495cdf0e10cSrcweir {
496cdf0e10cSrcweir 	// waehrend einer Diashow wird nichts ausgefuehrt!
497cdf0e10cSrcweir 	if(HasCurrentFunction(SID_PRESENTATION))
498cdf0e10cSrcweir 		return;
499cdf0e10cSrcweir 
500cdf0e10cSrcweir 	CheckLineTo (rReq);
501cdf0e10cSrcweir 
502cdf0e10cSrcweir 	const SfxItemSet* pArgs = rReq.GetArgs();
503cdf0e10cSrcweir 	const Point aPagePos( GetActiveWindow()->GetViewOrigin() );
504cdf0e10cSrcweir 	Size aPageSize = mpActualPage->GetSize();
505cdf0e10cSrcweir 	Size aViewSize = GetActiveWindow()->GetViewSize();
506cdf0e10cSrcweir 	SdUndoGroup* pUndoGroup = NULL;
507cdf0e10cSrcweir 
508cdf0e10cSrcweir 	if ( rReq.GetSlot() == SID_ATTR_LONG_LRSPACE ||
509cdf0e10cSrcweir 		 rReq.GetSlot() == SID_ATTR_LONG_ULSPACE )
510cdf0e10cSrcweir 	{
511cdf0e10cSrcweir 		pUndoGroup = new SdUndoGroup(GetDoc());
512cdf0e10cSrcweir 		String aString(SdResId(STR_UNDO_CHANGE_PAGEBORDER));
513cdf0e10cSrcweir 		pUndoGroup->SetComment(aString);
514cdf0e10cSrcweir 	}
515cdf0e10cSrcweir 
516cdf0e10cSrcweir 	switch ( rReq.GetSlot() )
517cdf0e10cSrcweir 	{
518cdf0e10cSrcweir 		case SID_ATTR_LONG_LRSPACE:
519cdf0e10cSrcweir 		{
520cdf0e10cSrcweir 			const SvxLongLRSpaceItem& rLRSpace = (const SvxLongLRSpaceItem&)
521cdf0e10cSrcweir 					pArgs->Get(GetPool().GetWhich(SID_ATTR_LONG_LRSPACE));
522cdf0e10cSrcweir 
523cdf0e10cSrcweir 			if( mpDrawView->IsTextEdit() )
524cdf0e10cSrcweir 			{
525cdf0e10cSrcweir 				Rectangle aRect = maMarkRect;
526cdf0e10cSrcweir 				aRect.SetPos(aRect.TopLeft() + aPagePos);
527cdf0e10cSrcweir 				aRect.Left()  = rLRSpace.GetLeft();
528cdf0e10cSrcweir 				aRect.Right() = aViewSize.Width() - rLRSpace.GetRight();
529cdf0e10cSrcweir 				aRect.SetPos(aRect.TopLeft() - aPagePos);
530cdf0e10cSrcweir 				if ( aRect != maMarkRect)
531cdf0e10cSrcweir 				{
532cdf0e10cSrcweir 					mpDrawView->SetAllMarkedRect(aRect);
533cdf0e10cSrcweir 					maMarkRect = mpDrawView->GetAllMarkedRect();
534cdf0e10cSrcweir 					Invalidate( SID_RULER_OBJECT );
535cdf0e10cSrcweir 				}
536cdf0e10cSrcweir 			}
537cdf0e10cSrcweir 			else
538cdf0e10cSrcweir 			{
539cdf0e10cSrcweir 				long nLeft = Max(0L, rLRSpace.GetLeft() - aPagePos.X());
540cdf0e10cSrcweir 				long nRight = Max(0L, rLRSpace.GetRight() + aPagePos.X() +
541cdf0e10cSrcweir 								  	aPageSize.Width() - aViewSize.Width());
542cdf0e10cSrcweir 
543cdf0e10cSrcweir 				sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind);
544cdf0e10cSrcweir 				sal_uInt16 i;
545cdf0e10cSrcweir 				for ( i = 0; i < nPageCnt; i++)
546cdf0e10cSrcweir 				{
547cdf0e10cSrcweir 					SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
548cdf0e10cSrcweir 					SdUndoAction* pUndo = new SdPageLRUndoAction(GetDoc(),
549cdf0e10cSrcweir 											pPage,
550cdf0e10cSrcweir 											pPage->GetLftBorder(),
551cdf0e10cSrcweir 											pPage->GetRgtBorder(),
552cdf0e10cSrcweir 											nLeft, nRight);
553cdf0e10cSrcweir 					pUndoGroup->AddAction(pUndo);
554cdf0e10cSrcweir 					pPage->SetLftBorder(nLeft);
555cdf0e10cSrcweir 					pPage->SetRgtBorder(nRight);
556cdf0e10cSrcweir 				}
557cdf0e10cSrcweir 				nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
558cdf0e10cSrcweir 
559cdf0e10cSrcweir 				for (i = 0; i < nPageCnt; i++)
560cdf0e10cSrcweir 				{
561cdf0e10cSrcweir 					SdPage* pPage = GetDoc()->GetMasterSdPage(i, mePageKind);
562cdf0e10cSrcweir 					SdUndoAction* pUndo = new SdPageLRUndoAction(GetDoc(),
563cdf0e10cSrcweir 											pPage,
564cdf0e10cSrcweir 											pPage->GetLftBorder(),
565cdf0e10cSrcweir 											pPage->GetRgtBorder(),
566cdf0e10cSrcweir 											nLeft, nRight);
567cdf0e10cSrcweir 					pUndoGroup->AddAction(pUndo);
568cdf0e10cSrcweir 					pPage->SetLftBorder(nLeft);
569cdf0e10cSrcweir 					pPage->SetRgtBorder(nRight);
570cdf0e10cSrcweir 				}
571cdf0e10cSrcweir 				InvalidateWindows();
572cdf0e10cSrcweir 			}
573cdf0e10cSrcweir 			break;
574cdf0e10cSrcweir 		}
575cdf0e10cSrcweir 		case SID_ATTR_LONG_ULSPACE:
576cdf0e10cSrcweir 		{
577cdf0e10cSrcweir             const SvxLongULSpaceItem& rULSpace = (const SvxLongULSpaceItem&)
578cdf0e10cSrcweir                     pArgs->Get(GetPool().GetWhich(SID_ATTR_LONG_ULSPACE));
579cdf0e10cSrcweir 
580cdf0e10cSrcweir 			if( mpDrawView->IsTextEdit() )
581cdf0e10cSrcweir 			{
582cdf0e10cSrcweir 				Rectangle aRect = maMarkRect;
583cdf0e10cSrcweir 				aRect.SetPos(aRect.TopLeft() + aPagePos);
584cdf0e10cSrcweir                 aRect.Top()  = rULSpace.GetUpper();
585cdf0e10cSrcweir                 aRect.Bottom() = aViewSize.Height() - rULSpace.GetLower();
586cdf0e10cSrcweir 				aRect.SetPos(aRect.TopLeft() - aPagePos);
587cdf0e10cSrcweir 
588cdf0e10cSrcweir                 if ( aRect != maMarkRect)
589cdf0e10cSrcweir 				{
590cdf0e10cSrcweir 					mpDrawView->SetAllMarkedRect(aRect);
591cdf0e10cSrcweir 					maMarkRect = mpDrawView->GetAllMarkedRect();
592cdf0e10cSrcweir 					Invalidate( SID_RULER_OBJECT );
593cdf0e10cSrcweir 				}
594cdf0e10cSrcweir 			}
595cdf0e10cSrcweir 			else
596cdf0e10cSrcweir 			{
597cdf0e10cSrcweir                 long nUpper = Max(0L, rULSpace.GetUpper() - aPagePos.Y());
598cdf0e10cSrcweir                 long nLower = Max(0L, rULSpace.GetLower() + aPagePos.Y() +
599cdf0e10cSrcweir                                       aPageSize.Height() - aViewSize.Height());
600cdf0e10cSrcweir 
601cdf0e10cSrcweir                 sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind);
602cdf0e10cSrcweir                 sal_uInt16 i;
603cdf0e10cSrcweir                 for ( i = 0; i < nPageCnt; i++)
604cdf0e10cSrcweir                 {
605cdf0e10cSrcweir                     SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
606cdf0e10cSrcweir                     SdUndoAction* pUndo = new SdPageULUndoAction(GetDoc(),
607cdf0e10cSrcweir                                             pPage,
608cdf0e10cSrcweir                                             pPage->GetUppBorder(),
609cdf0e10cSrcweir                                             pPage->GetLwrBorder(),
610cdf0e10cSrcweir                                             nUpper, nLower);
611cdf0e10cSrcweir                     pUndoGroup->AddAction(pUndo);
612cdf0e10cSrcweir                     pPage->SetUppBorder(nUpper);
613cdf0e10cSrcweir                     pPage->SetLwrBorder(nLower);
614cdf0e10cSrcweir                 }
615cdf0e10cSrcweir                 nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
616cdf0e10cSrcweir 
617cdf0e10cSrcweir                 for (i = 0; i < nPageCnt; i++)
618cdf0e10cSrcweir                 {
619cdf0e10cSrcweir                     SdPage* pPage = GetDoc()->GetMasterSdPage(i, mePageKind);
620cdf0e10cSrcweir                     SdUndoAction* pUndo = new SdPageULUndoAction(GetDoc(),
621cdf0e10cSrcweir                                             pPage,
622cdf0e10cSrcweir                                             pPage->GetUppBorder(),
623cdf0e10cSrcweir                                             pPage->GetLwrBorder(),
624cdf0e10cSrcweir                                             nUpper, nLower);
625cdf0e10cSrcweir                     pUndoGroup->AddAction(pUndo);
626cdf0e10cSrcweir                     pPage->SetUppBorder(nUpper);
627cdf0e10cSrcweir                     pPage->SetLwrBorder(nLower);
628cdf0e10cSrcweir                 }
629cdf0e10cSrcweir                 InvalidateWindows();
630cdf0e10cSrcweir             }
631cdf0e10cSrcweir 			break;
632cdf0e10cSrcweir 		}
633cdf0e10cSrcweir 
634cdf0e10cSrcweir 		case SID_RULER_OBJECT:
635cdf0e10cSrcweir 		{
636cdf0e10cSrcweir 			Rectangle aRect = maMarkRect;
637cdf0e10cSrcweir 			aRect.SetPos(aRect.TopLeft() + aPagePos);
638cdf0e10cSrcweir 
639cdf0e10cSrcweir 			const SvxObjectItem& rOI = (const SvxObjectItem&)
640cdf0e10cSrcweir 					pArgs->Get(GetPool().GetWhich(SID_RULER_OBJECT));
641cdf0e10cSrcweir 
642cdf0e10cSrcweir 			if ( rOI.GetStartX() != rOI.GetEndX() )
643cdf0e10cSrcweir 			{
644cdf0e10cSrcweir 				aRect.Left()  = rOI.GetStartX();
645cdf0e10cSrcweir 				aRect.Right() = rOI.GetEndX();
646cdf0e10cSrcweir 			}
647cdf0e10cSrcweir 			if ( rOI.GetStartY() != rOI.GetEndY() )
648cdf0e10cSrcweir 			{
649cdf0e10cSrcweir 				aRect.Top()    = rOI.GetStartY();
650cdf0e10cSrcweir 				aRect.Bottom() = rOI.GetEndY();
651cdf0e10cSrcweir 			}
652cdf0e10cSrcweir 			aRect.SetPos(aRect.TopLeft() - aPagePos);
653cdf0e10cSrcweir 			if ( aRect != maMarkRect)
654cdf0e10cSrcweir 			{
655cdf0e10cSrcweir 				mpDrawView->SetAllMarkedRect(aRect);
656cdf0e10cSrcweir 				maMarkRect = mpDrawView->GetAllMarkedRect();
657cdf0e10cSrcweir 				Invalidate( SID_RULER_OBJECT );
658cdf0e10cSrcweir 			}
659cdf0e10cSrcweir 			break;
660cdf0e10cSrcweir 		}
661cdf0e10cSrcweir 
662cdf0e10cSrcweir 		case SID_ATTR_TABSTOP:
663cdf0e10cSrcweir 		{
664cdf0e10cSrcweir 			if( mpDrawView->IsTextEdit() )
665cdf0e10cSrcweir 			{
666cdf0e10cSrcweir 				const SvxTabStopItem& rItem = (const SvxTabStopItem&)
667cdf0e10cSrcweir                             pArgs->Get( EE_PARA_TABS );
668cdf0e10cSrcweir 
669cdf0e10cSrcweir                 SfxItemSet aEditAttr( GetPool(), EE_PARA_TABS, EE_PARA_TABS );
670cdf0e10cSrcweir 
671cdf0e10cSrcweir 				aEditAttr.Put( rItem );
672cdf0e10cSrcweir 				mpDrawView->SetAttributes( aEditAttr );
673cdf0e10cSrcweir 
674cdf0e10cSrcweir 				// #91081# Invalidate is missing here
675cdf0e10cSrcweir 				Invalidate(SID_ATTR_TABSTOP);
676cdf0e10cSrcweir 			}
677cdf0e10cSrcweir 			break;
678cdf0e10cSrcweir 		}
679cdf0e10cSrcweir 
680cdf0e10cSrcweir 		case SID_ATTR_PARA_LRSPACE:
681cdf0e10cSrcweir 		{
682cdf0e10cSrcweir 			if( mpDrawView->IsTextEdit() )
683cdf0e10cSrcweir 			{
684cdf0e10cSrcweir 				sal_uInt16 nId = SID_ATTR_PARA_LRSPACE;
685cdf0e10cSrcweir 				const SvxLRSpaceItem& rItem = (const SvxLRSpaceItem&)
686cdf0e10cSrcweir 							pArgs->Get( nId );
687cdf0e10cSrcweir 
688cdf0e10cSrcweir                 SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE );
689cdf0e10cSrcweir 
690cdf0e10cSrcweir                 nId = EE_PARA_LRSPACE;
691cdf0e10cSrcweir 				SvxLRSpaceItem aLRSpaceItem( rItem.GetLeft(),
692cdf0e10cSrcweir 						rItem.GetRight(), rItem.GetTxtLeft(),
693cdf0e10cSrcweir 						rItem.GetTxtFirstLineOfst(), nId );
694cdf0e10cSrcweir 				aEditAttr.Put( aLRSpaceItem );
695cdf0e10cSrcweir 				mpDrawView->SetAttributes( aEditAttr );
696cdf0e10cSrcweir 
697cdf0e10cSrcweir 				// #92557# Invalidate is missing here
698cdf0e10cSrcweir 				Invalidate(SID_ATTR_PARA_LRSPACE);
699cdf0e10cSrcweir 			}
700cdf0e10cSrcweir 			break;
701cdf0e10cSrcweir 		}
702cdf0e10cSrcweir 	}
703cdf0e10cSrcweir 	if ( pUndoGroup )
704cdf0e10cSrcweir 		// Undo Gruppe dem Undo Manager uebergeben
705cdf0e10cSrcweir 		GetViewFrame()->GetObjectShell()->GetUndoManager()->
706cdf0e10cSrcweir 											AddUndoAction(pUndoGroup);
707cdf0e10cSrcweir }
708cdf0e10cSrcweir 
709cdf0e10cSrcweir /*************************************************************************
710cdf0e10cSrcweir |*
711cdf0e10cSrcweir |* Statuswerte der Lineale bestimmen
712cdf0e10cSrcweir |*
713cdf0e10cSrcweir \************************************************************************/
714cdf0e10cSrcweir void  DrawViewShell::GetRulerState(SfxItemSet& rSet)
715cdf0e10cSrcweir {
716cdf0e10cSrcweir 	Point aOrigin;
717cdf0e10cSrcweir 
718cdf0e10cSrcweir 	if (mpDrawView->GetSdrPageView())
719cdf0e10cSrcweir 	{
720cdf0e10cSrcweir 		aOrigin = mpDrawView->GetSdrPageView()->GetPageOrigin();
721cdf0e10cSrcweir 	}
722cdf0e10cSrcweir 
723cdf0e10cSrcweir 	Size aViewSize = GetActiveWindow()->GetViewSize();
724cdf0e10cSrcweir 
725cdf0e10cSrcweir 	const Point aPagePos( GetActiveWindow()->GetViewOrigin() );
726cdf0e10cSrcweir 	Size aPageSize = mpActualPage->GetSize();
727cdf0e10cSrcweir 
728cdf0e10cSrcweir 	Rectangle aRect(aPagePos, Point( aViewSize.Width() - (aPagePos.X() + aPageSize.Width()),
729cdf0e10cSrcweir 	        	                     aViewSize.Height() - (aPagePos.Y() + aPageSize.Height())));
730cdf0e10cSrcweir 
731cdf0e10cSrcweir 	if( mpDrawView->IsTextEdit() )
732cdf0e10cSrcweir 	{
733cdf0e10cSrcweir 		Point aPnt1 = GetActiveWindow()->GetWinViewPos();
734cdf0e10cSrcweir 		Point aPnt2 = GetActiveWindow()->GetViewOrigin();
735cdf0e10cSrcweir 		Rectangle aMinMaxRect = Rectangle( aPnt1, Size(ULONG_MAX, ULONG_MAX) );
736cdf0e10cSrcweir 		rSet.Put( SfxRectangleItem(SID_RULER_LR_MIN_MAX, aMinMaxRect) );
737cdf0e10cSrcweir 	}
738cdf0e10cSrcweir 	else
739cdf0e10cSrcweir 	{
740cdf0e10cSrcweir 		rSet.Put( SfxRectangleItem(SID_RULER_LR_MIN_MAX, aRect) );
741cdf0e10cSrcweir 	}
742cdf0e10cSrcweir 
743cdf0e10cSrcweir     SvxLongLRSpaceItem aLRSpace(aPagePos.X() + mpActualPage->GetLftBorder(),
744cdf0e10cSrcweir 								aRect.Right() + mpActualPage->GetRgtBorder(),
745cdf0e10cSrcweir 								GetPool().GetWhich(SID_ATTR_LONG_LRSPACE));
746cdf0e10cSrcweir 	SvxLongULSpaceItem aULSpace(aPagePos.Y() + mpActualPage->GetUppBorder(),
747cdf0e10cSrcweir 								aRect.Bottom() + mpActualPage->GetLwrBorder(),
748cdf0e10cSrcweir 								GetPool().GetWhich(SID_ATTR_LONG_ULSPACE));
749cdf0e10cSrcweir 	rSet.Put(SvxPagePosSizeItem(Point(0,0) - aPagePos, aViewSize.Width(),
750cdf0e10cSrcweir 													   aViewSize.Height()));
751cdf0e10cSrcweir 	SfxPointItem aPointItem( SID_RULER_NULL_OFFSET, aPagePos + aOrigin );
752cdf0e10cSrcweir 
753cdf0e10cSrcweir 	SvxProtectItem aProtect( SID_RULER_PROTECT );
754cdf0e10cSrcweir 
755cdf0e10cSrcweir 	maMarkRect = mpDrawView->GetAllMarkedRect();
756cdf0e10cSrcweir 
757cdf0e10cSrcweir 	const sal_Bool bRTL = GetDoc() && GetDoc()->GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB;
758cdf0e10cSrcweir 	rSet.Put(SfxBoolItem(SID_RULER_TEXT_RIGHT_TO_LEFT, bRTL));
759cdf0e10cSrcweir 
760cdf0e10cSrcweir 	if( mpDrawView->AreObjectsMarked() )
761cdf0e10cSrcweir 	{
762cdf0e10cSrcweir 		if( mpDrawView->IsTextEdit() )
763cdf0e10cSrcweir 		{
764cdf0e10cSrcweir 			SdrObject* pObj = mpDrawView->GetMarkedObjectList().GetMark( 0 )->GetMarkedSdrObj();
765cdf0e10cSrcweir 			if( pObj->GetObjInventor() == SdrInventor)
766cdf0e10cSrcweir 			{
767cdf0e10cSrcweir 				SfxItemSet aEditAttr( GetDoc()->GetPool() );
768cdf0e10cSrcweir 				mpDrawView->GetAttributes( aEditAttr );
769cdf0e10cSrcweir                 if( aEditAttr.GetItemState( EE_PARA_TABS ) >= SFX_ITEM_AVAILABLE )
770cdf0e10cSrcweir 				{
771cdf0e10cSrcweir                     const SvxTabStopItem& rItem = (const SvxTabStopItem&) aEditAttr.Get( EE_PARA_TABS );
772cdf0e10cSrcweir 					rSet.Put( rItem );
773cdf0e10cSrcweir 
774cdf0e10cSrcweir 					//Rectangle aRect = maMarkRect;
775cdf0e10cSrcweir 
776cdf0e10cSrcweir                     const SvxLRSpaceItem& rLRSpaceItem = (const SvxLRSpaceItem&) aEditAttr.Get( EE_PARA_LRSPACE );
777cdf0e10cSrcweir 					sal_uInt16 nId = SID_ATTR_PARA_LRSPACE;
778cdf0e10cSrcweir 					SvxLRSpaceItem aLRSpaceItem( rLRSpaceItem.GetLeft(),
779cdf0e10cSrcweir 							rLRSpaceItem.GetRight(), rLRSpaceItem.GetTxtLeft(),
780cdf0e10cSrcweir 							rLRSpaceItem.GetTxtFirstLineOfst(), nId );
781cdf0e10cSrcweir 					rSet.Put( aLRSpaceItem );
782cdf0e10cSrcweir 
783cdf0e10cSrcweir 					Point aPos( aPagePos + maMarkRect.TopLeft() );
784cdf0e10cSrcweir 
785cdf0e10cSrcweir 					if ( aEditAttr.GetItemState( SDRATTR_TEXT_LEFTDIST ) == SFX_ITEM_ON )
786cdf0e10cSrcweir 					{
787cdf0e10cSrcweir 						const SdrTextLeftDistItem& rTLDItem = (const SdrTextLeftDistItem&)
788cdf0e10cSrcweir 															  aEditAttr.Get( SDRATTR_TEXT_LEFTDIST );
789cdf0e10cSrcweir 						long nLD = rTLDItem.GetValue();
790cdf0e10cSrcweir 						aPos.X() += nLD;
791cdf0e10cSrcweir 					}
792cdf0e10cSrcweir 
793cdf0e10cSrcweir 					aPointItem.SetValue( aPos );
794cdf0e10cSrcweir 
795cdf0e10cSrcweir 					aLRSpace.SetLeft( aPagePos.X() + maMarkRect.Left() );
796cdf0e10cSrcweir 
797cdf0e10cSrcweir 					if ( aEditAttr.GetItemState( SDRATTR_TEXT_LEFTDIST ) == SFX_ITEM_ON )
798cdf0e10cSrcweir 					{
799cdf0e10cSrcweir 						const SdrTextLeftDistItem& rTLDItem = (const SdrTextLeftDistItem&)
800cdf0e10cSrcweir 															  aEditAttr.Get( SDRATTR_TEXT_LEFTDIST );
801cdf0e10cSrcweir 						long nLD = rTLDItem.GetValue();
802cdf0e10cSrcweir 						aLRSpace.SetLeft( aLRSpace.GetLeft() + nLD );
803cdf0e10cSrcweir 					}
804cdf0e10cSrcweir 
805cdf0e10cSrcweir 					aLRSpace.SetRight( aRect.Right() + aPageSize.Width() - maMarkRect.Right() );
806cdf0e10cSrcweir 					aULSpace.SetUpper( aPagePos.Y() + maMarkRect.Top() );
807cdf0e10cSrcweir 					aULSpace.SetLower( aRect.Bottom() + aPageSize.Height() - maMarkRect.Bottom() );
808cdf0e10cSrcweir 
809cdf0e10cSrcweir 					rSet.DisableItem( SID_RULER_OBJECT );
810cdf0e10cSrcweir 
811cdf0e10cSrcweir 					// Seitenraender werden gelocked
812cdf0e10cSrcweir 					aProtect.SetSizeProtect( sal_True );
813cdf0e10cSrcweir 					aProtect.SetPosProtect( sal_True );
814cdf0e10cSrcweir 				}
815cdf0e10cSrcweir 
816cdf0e10cSrcweir 				if( aEditAttr.GetItemState( EE_PARA_WRITINGDIR ) >= SFX_ITEM_AVAILABLE )
817cdf0e10cSrcweir 				{
818cdf0e10cSrcweir 					const SvxFrameDirectionItem& rItem = (const SvxFrameDirectionItem&) aEditAttr.Get( EE_PARA_WRITINGDIR );
819cdf0e10cSrcweir 					rSet.Put(SfxBoolItem(SID_RULER_TEXT_RIGHT_TO_LEFT, rItem.GetValue() == ::com::sun::star::text::WritingMode_RL_TB));
820cdf0e10cSrcweir 				}
821cdf0e10cSrcweir 			}
822cdf0e10cSrcweir 		}
823cdf0e10cSrcweir 		else
824cdf0e10cSrcweir 		{
825cdf0e10cSrcweir             rSet.DisableItem( EE_PARA_TABS );
826cdf0e10cSrcweir 			rSet.DisableItem( SID_RULER_TEXT_RIGHT_TO_LEFT );
827cdf0e10cSrcweir 
828cdf0e10cSrcweir 			if( mpDrawView->IsResizeAllowed(sal_True) )
829cdf0e10cSrcweir 			{
830cdf0e10cSrcweir 				Rectangle aResizeRect( maMarkRect );
831cdf0e10cSrcweir 
832cdf0e10cSrcweir 				aResizeRect.SetPos(aResizeRect.TopLeft() + aPagePos);
833cdf0e10cSrcweir 				SvxObjectItem aObjItem(aResizeRect.Left(), aResizeRect.Right(),
834cdf0e10cSrcweir 									   aResizeRect.Top(), aResizeRect.Bottom());
835cdf0e10cSrcweir 				rSet.Put(aObjItem);
836cdf0e10cSrcweir                 rSet.DisableItem( EE_PARA_TABS );
837cdf0e10cSrcweir 			}
838cdf0e10cSrcweir 			else
839cdf0e10cSrcweir 			{
840cdf0e10cSrcweir 				rSet.DisableItem( SID_RULER_OBJECT );
841cdf0e10cSrcweir 			}
842cdf0e10cSrcweir 		}
843cdf0e10cSrcweir 	}
844cdf0e10cSrcweir 	else
845cdf0e10cSrcweir 	{
846cdf0e10cSrcweir 		rSet.DisableItem( SID_RULER_OBJECT );
847cdf0e10cSrcweir         rSet.DisableItem( EE_PARA_TABS );
848cdf0e10cSrcweir //		rSet.DisableItem( SID_RULER_TEXT_RIGHT_TO_LEFT );
849cdf0e10cSrcweir 	}
850cdf0e10cSrcweir 
851cdf0e10cSrcweir 	rSet.Put( aLRSpace );
852cdf0e10cSrcweir 	rSet.Put( aULSpace );
853cdf0e10cSrcweir 
854cdf0e10cSrcweir 	rSet.Put( aPointItem );
855cdf0e10cSrcweir 	rSet.Put( aProtect );
856cdf0e10cSrcweir }
857cdf0e10cSrcweir 
858cdf0e10cSrcweir /*************************************************************************
859cdf0e10cSrcweir |*
860cdf0e10cSrcweir |* SfxRequests fuer StatusBar bearbeiten
861cdf0e10cSrcweir |*
862cdf0e10cSrcweir \************************************************************************/
863cdf0e10cSrcweir 
864cdf0e10cSrcweir void  DrawViewShell::ExecStatusBar(SfxRequest& rReq)
865cdf0e10cSrcweir {
866cdf0e10cSrcweir 	// waehrend einer Diashow wird nichts ausgefuehrt!
867cdf0e10cSrcweir 	if(HasCurrentFunction(SID_PRESENTATION))
868cdf0e10cSrcweir 		return;
869cdf0e10cSrcweir 
870cdf0e10cSrcweir 	CheckLineTo (rReq);
871cdf0e10cSrcweir 
872cdf0e10cSrcweir 	switch ( rReq.GetSlot() )
873cdf0e10cSrcweir 	{
874cdf0e10cSrcweir 		case SID_ATTR_SIZE:
875cdf0e10cSrcweir 		{
876cdf0e10cSrcweir 			GetViewFrame()->GetDispatcher()->Execute( SID_ATTR_TRANSFORM, SFX_CALLMODE_ASYNCHRON );
877cdf0e10cSrcweir 		}
878cdf0e10cSrcweir 		break;
879cdf0e10cSrcweir 
880cdf0e10cSrcweir 		case SID_STATUS_LAYOUT:
881cdf0e10cSrcweir 		{
882cdf0e10cSrcweir 			GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION_LAYOUT, SFX_CALLMODE_ASYNCHRON );
883cdf0e10cSrcweir 		}
884cdf0e10cSrcweir 		break;
885cdf0e10cSrcweir 	}
886cdf0e10cSrcweir }
887cdf0e10cSrcweir 
888cdf0e10cSrcweir /*************************************************************************
889cdf0e10cSrcweir |*
890cdf0e10cSrcweir |* Status der Snap-Objekt-Eintraege im Popup setzen
891cdf0e10cSrcweir |*
892cdf0e10cSrcweir \************************************************************************/
893cdf0e10cSrcweir 
894cdf0e10cSrcweir void  DrawViewShell::GetSnapItemState( SfxItemSet &rSet )
895cdf0e10cSrcweir {
896cdf0e10cSrcweir 	SdrPageView* pPV;
897cdf0e10cSrcweir 	Point	aMPos = GetActiveWindow()->PixelToLogic(maMousePos);
898cdf0e10cSrcweir 	sal_uInt16	nHitLog = (sal_uInt16) GetActiveWindow()->PixelToLogic(
899cdf0e10cSrcweir         Size(FuPoor::HITPIX,0)).Width();
900cdf0e10cSrcweir 	sal_uInt16	nHelpLine;
901cdf0e10cSrcweir 
902cdf0e10cSrcweir 	if ( mpDrawView->PickHelpLine(aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) )
903cdf0e10cSrcweir 	{
904cdf0e10cSrcweir 		const SdrHelpLine& rHelpLine = (pPV->GetHelpLines())[nHelpLine];
905cdf0e10cSrcweir 
906cdf0e10cSrcweir 		if ( rHelpLine.GetKind() == SDRHELPLINE_POINT )
907cdf0e10cSrcweir 		{
908cdf0e10cSrcweir 			rSet.Put( SfxStringItem( SID_SET_SNAPITEM,
909cdf0e10cSrcweir 								String( SdResId( STR_POPUP_EDIT_SNAPPOINT))) );
910cdf0e10cSrcweir 			rSet.Put( SfxStringItem( SID_DELETE_SNAPITEM,
911cdf0e10cSrcweir 								String( SdResId( STR_POPUP_DELETE_SNAPPOINT))) );
912cdf0e10cSrcweir 		}
913cdf0e10cSrcweir 		else
914cdf0e10cSrcweir 		{
915cdf0e10cSrcweir 			rSet.Put( SfxStringItem( SID_SET_SNAPITEM,
916cdf0e10cSrcweir 								String( SdResId( STR_POPUP_EDIT_SNAPLINE))) );
917cdf0e10cSrcweir 			rSet.Put( SfxStringItem( SID_DELETE_SNAPITEM,
918cdf0e10cSrcweir 								String( SdResId( STR_POPUP_DELETE_SNAPLINE))) );
919cdf0e10cSrcweir 		}
920cdf0e10cSrcweir 	}
921cdf0e10cSrcweir }
922cdf0e10cSrcweir 
923cdf0e10cSrcweir 
924cdf0e10cSrcweir /*************************************************************************
925cdf0e10cSrcweir |*
926cdf0e10cSrcweir |*
927cdf0e10cSrcweir |*
928cdf0e10cSrcweir \************************************************************************/
929cdf0e10cSrcweir 
930cdf0e10cSrcweir void DrawViewShell::AddWindow (::sd::Window* pWin)
931cdf0e10cSrcweir {
932cdf0e10cSrcweir 	mpDrawView->AddWindowToPaintView(pWin);
933cdf0e10cSrcweir }
934cdf0e10cSrcweir 
935cdf0e10cSrcweir /*************************************************************************
936cdf0e10cSrcweir |*
937cdf0e10cSrcweir |*
938cdf0e10cSrcweir |*
939cdf0e10cSrcweir \************************************************************************/
940cdf0e10cSrcweir 
941cdf0e10cSrcweir void DrawViewShell::RemoveWindow(::sd::Window* pWin)
942cdf0e10cSrcweir {
943cdf0e10cSrcweir 	mpDrawView->DeleteWindowFromPaintView(pWin);
944cdf0e10cSrcweir }
945cdf0e10cSrcweir 
946cdf0e10cSrcweir } // end of namespace sd
947