xref: /trunk/main/sd/source/ui/view/drviews3.cxx (revision 1ff378ef29d061c5ebed689ca488bcdadd10692f)
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
10cdf0e10cSrcweir  *
115b190011SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
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.
19cdf0e10cSrcweir  *
205b190011SAndrew Rist  *************************************************************/
215b190011SAndrew Rist 
225b190011SAndrew 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>
99766ce4d0SZheng Fan #include <editeng/lspcitem.hxx>
100766ce4d0SZheng Fan #include <editeng/ulspitem.hxx>
101cdf0e10cSrcweir using namespace ::com::sun::star::uno;
102cdf0e10cSrcweir using namespace ::com::sun::star::drawing::framework;
103cdf0e10cSrcweir using ::com::sun::star::frame::XFrame;
104cdf0e10cSrcweir using ::com::sun::star::frame::XController;
105cdf0e10cSrcweir 
106cdf0e10cSrcweir namespace sd {
107cdf0e10cSrcweir 
108cdf0e10cSrcweir #ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED
109cdf0e10cSrcweir #define SO2_DECL_SVINPLACEOBJECT_DEFINED
110cdf0e10cSrcweir SO2_DECL_REF(SvInPlaceObject)
111cdf0e10cSrcweir #endif
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 
114cdf0e10cSrcweir 
115cdf0e10cSrcweir /*************************************************************************
116cdf0e10cSrcweir |*
117cdf0e10cSrcweir |* SfxRequests fuer Controller bearbeiten
118cdf0e10cSrcweir |*
119cdf0e10cSrcweir \************************************************************************/
120cdf0e10cSrcweir 
121cdf0e10cSrcweir void  DrawViewShell::ExecCtrl(SfxRequest& rReq)
122cdf0e10cSrcweir {
123cdf0e10cSrcweir     // waehrend einer Diashow wird nichts ausser dem Seitenwechsel und dem
124cdf0e10cSrcweir     // Sprung zur Bookmark ausgefuehrt!
125cdf0e10cSrcweir     if( HasCurrentFunction(SID_PRESENTATION) &&
126cdf0e10cSrcweir         rReq.GetSlot() != SID_SWITCHPAGE &&
127cdf0e10cSrcweir         rReq.GetSlot() != SID_JUMPTOMARK)
128cdf0e10cSrcweir         return;
129cdf0e10cSrcweir 
130cdf0e10cSrcweir     CheckLineTo (rReq);
131cdf0e10cSrcweir 
132cdf0e10cSrcweir     // End text edit mode for some requests.
133cdf0e10cSrcweir     sal_uInt16 nSlot = rReq.GetSlot();
134cdf0e10cSrcweir     switch (nSlot)
135cdf0e10cSrcweir     {
136cdf0e10cSrcweir         case SID_OUTPUT_QUALITY_COLOR:
137cdf0e10cSrcweir         case SID_OUTPUT_QUALITY_GRAYSCALE:
138cdf0e10cSrcweir         case SID_OUTPUT_QUALITY_BLACKWHITE:
139cdf0e10cSrcweir         case SID_OUTPUT_QUALITY_CONTRAST:
140cdf0e10cSrcweir             // Do nothing.
141cdf0e10cSrcweir             break;
142cdf0e10cSrcweir         default:
143cdf0e10cSrcweir             if ( mpDrawView->IsTextEdit() )
144cdf0e10cSrcweir             {
145cdf0e10cSrcweir                 mpDrawView->SdrEndTextEdit();
146cdf0e10cSrcweir             }
147cdf0e10cSrcweir     }
148cdf0e10cSrcweir 
149cdf0e10cSrcweir     //  sal_uInt16 nSlot = rReq.GetSlot();
150cdf0e10cSrcweir     switch (nSlot)
151cdf0e10cSrcweir     {
152cdf0e10cSrcweir         case SID_SWITCHPAGE:  // BASIC
153cdf0e10cSrcweir         {
154cdf0e10cSrcweir             sal_Bool bWasBasic = sal_False;
155cdf0e10cSrcweir 
156cdf0e10cSrcweir             // switch page in running slide show
157cdf0e10cSrcweir             if(SlideShow::IsRunning(GetViewShellBase()) && rReq.GetArgs())
158cdf0e10cSrcweir             {
159cdf0e10cSrcweir                 SFX_REQUEST_ARG(rReq, pWhatPage, SfxUInt32Item, ID_VAL_WHATPAGE, sal_False);
160cdf0e10cSrcweir                 SlideShow::GetSlideShow(GetViewShellBase())->jumpToPageNumber((sal_Int32)((pWhatPage->GetValue()-1)>>1));
161cdf0e10cSrcweir             }
162cdf0e10cSrcweir             else
163cdf0e10cSrcweir             {
164cdf0e10cSrcweir                 const SfxItemSet *pArgs = rReq.GetArgs ();
165cdf0e10cSrcweir                 sal_uInt16 nSelectedPage = 0;
166cdf0e10cSrcweir 
167cdf0e10cSrcweir                 if (! pArgs)
168cdf0e10cSrcweir                 {
169cdf0e10cSrcweir                     nSelectedPage = maTabControl.GetCurPageId() - 1;
170cdf0e10cSrcweir                 }
171cdf0e10cSrcweir                 else if (pArgs->Count () == 2)
172cdf0e10cSrcweir                 {
173cdf0e10cSrcweir                     SFX_REQUEST_ARG (rReq, pWhatPage, SfxUInt32Item, ID_VAL_WHATPAGE, sal_False);
174cdf0e10cSrcweir                     SFX_REQUEST_ARG (rReq, pWhatKind, SfxUInt32Item, ID_VAL_WHATKIND, sal_False);
175cdf0e10cSrcweir 
176cdf0e10cSrcweir                     sal_Int32 nWhatPage = (sal_Int32)pWhatPage->GetValue ();
177cdf0e10cSrcweir                     sal_Int32 nWhatKind = (sal_Int32)pWhatKind->GetValue ();
178cdf0e10cSrcweir                     if (! CHECK_RANGE (PK_STANDARD, nWhatKind, PK_HANDOUT))
179cdf0e10cSrcweir                     {
180cdf0e10cSrcweir                         StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
181cdf0e10cSrcweir                         rReq.Ignore ();
182cdf0e10cSrcweir                         break;
183cdf0e10cSrcweir                     }
184cdf0e10cSrcweir                     else if (meEditMode != EM_MASTERPAGE)
185cdf0e10cSrcweir                     {
186cdf0e10cSrcweir                         if (! CHECK_RANGE (0, nWhatPage, GetDoc()->GetSdPageCount((PageKind)nWhatKind)))
187cdf0e10cSrcweir                         {
188cdf0e10cSrcweir                             StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
189cdf0e10cSrcweir                             rReq.Ignore ();
190cdf0e10cSrcweir                             break;
191cdf0e10cSrcweir                         }
192cdf0e10cSrcweir 
193cdf0e10cSrcweir                         nSelectedPage = (short) nWhatPage;
194cdf0e10cSrcweir                         mePageKind    = (PageKind) nWhatKind;
195cdf0e10cSrcweir                         bWasBasic     = sal_True;
196cdf0e10cSrcweir                     }
197cdf0e10cSrcweir                 }
198cdf0e10cSrcweir                 else
199cdf0e10cSrcweir                 {
200cdf0e10cSrcweir                     StarBASIC::FatalError (SbERR_WRONG_ARGS);
201cdf0e10cSrcweir                     rReq.Ignore ();
202cdf0e10cSrcweir                     break;
203cdf0e10cSrcweir                 }
204cdf0e10cSrcweir 
205cdf0e10cSrcweir 
206cdf0e10cSrcweir                 if( GetDocSh() && (GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED))
207cdf0e10cSrcweir                     GetDocSh()->SetModified();
208cdf0e10cSrcweir 
209cdf0e10cSrcweir                 SwitchPage(nSelectedPage);
210cdf0e10cSrcweir 
211cdf0e10cSrcweir                 if(HasCurrentFunction(SID_BEZIER_EDIT))
212cdf0e10cSrcweir                     GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
213cdf0e10cSrcweir 
214cdf0e10cSrcweir                 Invalidate();
215cdf0e10cSrcweir                 InvalidateWindows();
216cdf0e10cSrcweir                 rReq.Done ();
217cdf0e10cSrcweir             }
218cdf0e10cSrcweir             break;
219cdf0e10cSrcweir         }
220cdf0e10cSrcweir 
221cdf0e10cSrcweir         case SID_SWITCHLAYER:  // BASIC
222cdf0e10cSrcweir         {
223cdf0e10cSrcweir             const SfxItemSet *pArgs = rReq.GetArgs ();
224cdf0e10cSrcweir             sal_uInt16 nCurPage = GetLayerTabControl()->GetCurPageId ();
225cdf0e10cSrcweir 
226cdf0e10cSrcweir             if( pArgs && pArgs->Count () == 1)
227cdf0e10cSrcweir             {
228cdf0e10cSrcweir                 SFX_REQUEST_ARG (rReq, pWhatLayer, SfxUInt32Item, ID_VAL_WHATLAYER, sal_False);
229cdf0e10cSrcweir                 if( pWhatLayer )
230cdf0e10cSrcweir                     nCurPage = (short) pWhatLayer->GetValue ();
231cdf0e10cSrcweir             }
232cdf0e10cSrcweir 
233cdf0e10cSrcweir             mpDrawView->SetActiveLayer( GetLayerTabControl()->GetPageText(nCurPage) );
234cdf0e10cSrcweir             Invalidate();
235cdf0e10cSrcweir             rReq.Done ();
236cdf0e10cSrcweir 
237cdf0e10cSrcweir             break;
238cdf0e10cSrcweir         }
239cdf0e10cSrcweir 
240cdf0e10cSrcweir         case SID_PAGEMODE:  // BASIC
241cdf0e10cSrcweir         {
242cdf0e10cSrcweir 
243cdf0e10cSrcweir             const SfxItemSet *pArgs = rReq.GetArgs ();
244cdf0e10cSrcweir 
245cdf0e10cSrcweir             if ( pArgs && pArgs->Count () == 2)
246cdf0e10cSrcweir             {
247cdf0e10cSrcweir                 SFX_REQUEST_ARG (rReq, pIsActive, SfxBoolItem, ID_VAL_ISACTIVE, sal_False);
248cdf0e10cSrcweir                 SFX_REQUEST_ARG (rReq, pWhatKind, SfxUInt32Item, ID_VAL_WHATKIND, sal_False);
249cdf0e10cSrcweir 
250cdf0e10cSrcweir                 sal_Int32 nWhatKind = (sal_Int32)pWhatKind->GetValue ();
251cdf0e10cSrcweir                 if (CHECK_RANGE (PK_STANDARD, nWhatKind, PK_HANDOUT))
252cdf0e10cSrcweir                 {
253cdf0e10cSrcweir                     mbIsLayerModeActive = pIsActive->GetValue ();
254cdf0e10cSrcweir                     mePageKind = (PageKind) nWhatKind;
255cdf0e10cSrcweir                 }
256cdf0e10cSrcweir             }
257cdf0e10cSrcweir 
258cdf0e10cSrcweir             // Default-Layer der Page einschalten
259cdf0e10cSrcweir             mpDrawView->SetActiveLayer( String( SdResId(STR_LAYER_LAYOUT) ) );
260cdf0e10cSrcweir 
261cdf0e10cSrcweir             ChangeEditMode(EM_PAGE, mbIsLayerModeActive);
262cdf0e10cSrcweir 
263cdf0e10cSrcweir             Invalidate();
264cdf0e10cSrcweir             rReq.Done ();
265cdf0e10cSrcweir 
266cdf0e10cSrcweir             break;
267cdf0e10cSrcweir         }
268cdf0e10cSrcweir 
269cdf0e10cSrcweir         case SID_LAYERMODE:  // BASIC
270cdf0e10cSrcweir         {
271cdf0e10cSrcweir             const SfxItemSet *pArgs = rReq.GetArgs ();
272cdf0e10cSrcweir 
273cdf0e10cSrcweir             if ( pArgs && pArgs->Count () == 2)
274cdf0e10cSrcweir             {
275cdf0e10cSrcweir                 SFX_REQUEST_ARG (rReq, pWhatLayerMode, SfxBoolItem, ID_VAL_ISACTIVE, sal_False);
276cdf0e10cSrcweir                 SFX_REQUEST_ARG (rReq, pWhatLayer, SfxUInt32Item, ID_VAL_WHATLAYER, sal_False);
277cdf0e10cSrcweir 
278cdf0e10cSrcweir                 sal_Int32 nWhatLayer = (sal_Int32)pWhatLayer->GetValue ();
279cdf0e10cSrcweir                 if (CHECK_RANGE (EM_PAGE, nWhatLayer, EM_MASTERPAGE))
280cdf0e10cSrcweir                 {
281cdf0e10cSrcweir                     mbIsLayerModeActive = pWhatLayerMode->GetValue ();
282cdf0e10cSrcweir                     meEditMode = (EditMode) nWhatLayer;
283cdf0e10cSrcweir                 }
284cdf0e10cSrcweir             }
285cdf0e10cSrcweir 
286cdf0e10cSrcweir             ChangeEditMode(meEditMode, !mbIsLayerModeActive);
287cdf0e10cSrcweir 
288cdf0e10cSrcweir             Invalidate();
289cdf0e10cSrcweir             rReq.Done ();
290cdf0e10cSrcweir 
291cdf0e10cSrcweir             break;
292cdf0e10cSrcweir         }
293cdf0e10cSrcweir 
294cdf0e10cSrcweir         case SID_HEADER_AND_FOOTER:
295cdf0e10cSrcweir         case SID_INSERT_PAGE_NUMBER:
296cdf0e10cSrcweir         case SID_INSERT_DATE_TIME:
297cdf0e10cSrcweir         {
298cdf0e10cSrcweir             SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
299cdf0e10cSrcweir             AbstractHeaderFooterDialog* pDlg = pFact ? pFact->CreateHeaderFooterDialog( (::ViewShell*)this, GetActiveWindow(), GetDoc(), mpActualPage ) : 0;
300cdf0e10cSrcweir             if( pDlg )
301cdf0e10cSrcweir             {
302cdf0e10cSrcweir                 pDlg->Execute();
303cdf0e10cSrcweir                 delete pDlg;
304cdf0e10cSrcweir 
305cdf0e10cSrcweir                 GetActiveWindow()->Invalidate();
306cdf0e10cSrcweir                 UpdatePreview( mpActualPage );
307cdf0e10cSrcweir             }
308cdf0e10cSrcweir 
309cdf0e10cSrcweir             Invalidate();
310cdf0e10cSrcweir             rReq.Done ();
311cdf0e10cSrcweir 
312cdf0e10cSrcweir             break;
313cdf0e10cSrcweir         }
314cdf0e10cSrcweir 
315cdf0e10cSrcweir         case SID_MASTER_LAYOUTS:
316cdf0e10cSrcweir         {
317cdf0e10cSrcweir             SdPage* pPage = GetActualPage();
318cdf0e10cSrcweir             if (meEditMode == EM_MASTERPAGE)
319cdf0e10cSrcweir                 // Use the master page of the current page.
320cdf0e10cSrcweir                 pPage = static_cast<SdPage*>(&pPage->TRG_GetMasterPage());
321cdf0e10cSrcweir 
322cdf0e10cSrcweir             SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
323cdf0e10cSrcweir             VclAbstractDialog* pDlg = pFact ? pFact->CreateMasterLayoutDialog( GetActiveWindow(), GetDoc(), pPage ) : 0;
324cdf0e10cSrcweir             if( pDlg )
325cdf0e10cSrcweir             {
326cdf0e10cSrcweir                 pDlg->Execute();
327cdf0e10cSrcweir                 delete pDlg;
328cdf0e10cSrcweir                 Invalidate();
329cdf0e10cSrcweir             }
330cdf0e10cSrcweir             rReq.Done ();
331cdf0e10cSrcweir             break;
332cdf0e10cSrcweir         }
333cdf0e10cSrcweir         case SID_OBJECTRESIZE:
334cdf0e10cSrcweir         {
335cdf0e10cSrcweir             /******************************************************************
336cdf0e10cSrcweir             * Der Server moechte die Clientgrosse verandern
337cdf0e10cSrcweir             ******************************************************************/
338cdf0e10cSrcweir             OSL_ASSERT (GetViewShell()!=NULL);
339cdf0e10cSrcweir             SfxInPlaceClient* pIPClient = GetViewShell()->GetIPClient();
340cdf0e10cSrcweir 
341cdf0e10cSrcweir             if ( pIPClient && pIPClient->IsObjectInPlaceActive() )
342cdf0e10cSrcweir             {
343cdf0e10cSrcweir                 const SfxRectangleItem& rRect =
344cdf0e10cSrcweir                     (SfxRectangleItem&)rReq.GetArgs()->Get(SID_OBJECTRESIZE);
345cdf0e10cSrcweir                 Rectangle aRect( GetActiveWindow()->PixelToLogic( rRect.GetValue() ) );
346cdf0e10cSrcweir 
347cdf0e10cSrcweir                 if ( mpDrawView->AreObjectsMarked() )
348cdf0e10cSrcweir                 {
349cdf0e10cSrcweir                     const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
350cdf0e10cSrcweir 
351cdf0e10cSrcweir                     if (rMarkList.GetMarkCount() == 1)
352cdf0e10cSrcweir                     {
353cdf0e10cSrcweir                         SdrMark* pMark = rMarkList.GetMark(0);
354cdf0e10cSrcweir                         SdrObject* pObj = pMark->GetMarkedSdrObj();
355cdf0e10cSrcweir 
356cdf0e10cSrcweir                         SdrOle2Obj* pOle2Obj = dynamic_cast< SdrOle2Obj* >( pObj );
357cdf0e10cSrcweir                         if(pOle2Obj)
358cdf0e10cSrcweir                         {
359cdf0e10cSrcweir                             if( pOle2Obj->GetObjRef().is() )
360cdf0e10cSrcweir                             {
361cdf0e10cSrcweir                                 pOle2Obj->SetLogicRect(aRect);
362cdf0e10cSrcweir                             }
363cdf0e10cSrcweir                         }
364cdf0e10cSrcweir                     }
365cdf0e10cSrcweir                 }
366cdf0e10cSrcweir             }
367cdf0e10cSrcweir             rReq.Ignore ();
368cdf0e10cSrcweir             break;
369cdf0e10cSrcweir         }
370cdf0e10cSrcweir 
371cdf0e10cSrcweir         case SID_RELOAD:
372cdf0e10cSrcweir         {
373cdf0e10cSrcweir             // #83951#
374cdf0e10cSrcweir             sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
375cdf0e10cSrcweir             SfxViewFrame* pFrame = GetViewFrame();
376cdf0e10cSrcweir 
377cdf0e10cSrcweir             try
378cdf0e10cSrcweir             {
379cdf0e10cSrcweir                 Reference< XFrame > xFrame( pFrame->GetFrame().GetFrameInterface(), UNO_SET_THROW );
380cdf0e10cSrcweir 
381cdf0e10cSrcweir                 // Save the current configuration of panes and views.
382cdf0e10cSrcweir                 Reference<XControllerManager> xControllerManager (
383cdf0e10cSrcweir                     GetViewShellBase().GetController(), UNO_QUERY_THROW);
384cdf0e10cSrcweir                 Reference<XConfigurationController> xConfigurationController (
385cdf0e10cSrcweir                     xControllerManager->getConfigurationController(), UNO_QUERY_THROW );
386cdf0e10cSrcweir                 Reference<XConfiguration> xConfiguration (
387cdf0e10cSrcweir                     xConfigurationController->getRequestedConfiguration(), UNO_SET_THROW );
388cdf0e10cSrcweir 
389cdf0e10cSrcweir                 SfxChildWindow* pWindow = pFrame->GetChildWindow(nId);
390cdf0e10cSrcweir                 if(pWindow)
391cdf0e10cSrcweir                 {
392cdf0e10cSrcweir                     Svx3DWin* p3DWin = (Svx3DWin*)(pWindow->GetWindow());
393cdf0e10cSrcweir                     if(p3DWin)
394cdf0e10cSrcweir                         p3DWin->DocumentReload();
395cdf0e10cSrcweir                 }
396cdf0e10cSrcweir 
397cdf0e10cSrcweir                 // Normale Weiterleitung an ViewFrame zur Ausfuehrung
398cdf0e10cSrcweir                 GetViewFrame()->ExecuteSlot(rReq);
399cdf0e10cSrcweir 
400cdf0e10cSrcweir                 // From here on we must cope with this object and the frame already being
401cdf0e10cSrcweir                 // deleted.  Do not call any methods or use data members.
402cdf0e10cSrcweir                 Reference<XController> xController( xFrame->getController(), UNO_SET_THROW );
403cdf0e10cSrcweir 
404cdf0e10cSrcweir                 // Restore the configuration.
405cdf0e10cSrcweir                 xControllerManager = Reference<XControllerManager>( xController, UNO_QUERY_THROW);
406cdf0e10cSrcweir                 xConfigurationController = Reference<XConfigurationController>(
407cdf0e10cSrcweir                     xControllerManager->getConfigurationController());
408cdf0e10cSrcweir                 if ( ! xConfigurationController.is())
409cdf0e10cSrcweir                     throw RuntimeException();
410cdf0e10cSrcweir                 xConfigurationController->restoreConfiguration(xConfiguration);
411cdf0e10cSrcweir             }
412cdf0e10cSrcweir             catch (RuntimeException&)
413cdf0e10cSrcweir             {
414cdf0e10cSrcweir                 DBG_UNHANDLED_EXCEPTION();
415cdf0e10cSrcweir             }
416cdf0e10cSrcweir 
417cdf0e10cSrcweir             // We have to return immediately to avoid accessing this object.
418cdf0e10cSrcweir             return;
419cdf0e10cSrcweir         }
420cdf0e10cSrcweir 
421cdf0e10cSrcweir         case SID_JUMPTOMARK:
422cdf0e10cSrcweir         {
423cdf0e10cSrcweir             if( rReq.GetArgs() )
424cdf0e10cSrcweir             {
425cdf0e10cSrcweir                 SFX_REQUEST_ARG(rReq, pBookmark, SfxStringItem, SID_JUMPTOMARK, sal_False);
426cdf0e10cSrcweir 
427cdf0e10cSrcweir                 if (pBookmark)
428cdf0e10cSrcweir                 {
429cdf0e10cSrcweir                     UniString sBookmark( INetURLObject::decode( pBookmark->GetValue(), '%', INetURLObject::DECODE_WITH_CHARSET ) );
430cdf0e10cSrcweir 
431cdf0e10cSrcweir                     rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
432cdf0e10cSrcweir                     if(xSlideshow.is() && xSlideshow->isRunning())
433cdf0e10cSrcweir                     {
434cdf0e10cSrcweir                         xSlideshow->jumpToBookmark(sBookmark);
435cdf0e10cSrcweir                     }
436cdf0e10cSrcweir                     else
437cdf0e10cSrcweir                     {
438cdf0e10cSrcweir                         GotoBookmark( sBookmark );
439cdf0e10cSrcweir                     }
440cdf0e10cSrcweir                 }
441cdf0e10cSrcweir             }
442cdf0e10cSrcweir             rReq.Done();
443cdf0e10cSrcweir             break;
444cdf0e10cSrcweir         }
445cdf0e10cSrcweir 
446cdf0e10cSrcweir         case SID_OUTPUT_QUALITY_COLOR:
447cdf0e10cSrcweir         case SID_OUTPUT_QUALITY_GRAYSCALE:
448cdf0e10cSrcweir         case SID_OUTPUT_QUALITY_BLACKWHITE:
449cdf0e10cSrcweir         case SID_OUTPUT_QUALITY_CONTRAST:
450cdf0e10cSrcweir         {
451cdf0e10cSrcweir             ExecReq( rReq );
452cdf0e10cSrcweir             break;
453cdf0e10cSrcweir         }
454cdf0e10cSrcweir 
455cdf0e10cSrcweir         case SID_MAIL_SCROLLBODY_PAGEDOWN:
456cdf0e10cSrcweir         {
457cdf0e10cSrcweir             ExecReq( rReq );
458cdf0e10cSrcweir             break;
459cdf0e10cSrcweir         }
460cdf0e10cSrcweir 
461cdf0e10cSrcweir         case SID_ATTR_YEAR2000:
462cdf0e10cSrcweir         {
463cdf0e10cSrcweir             FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
464cdf0e10cSrcweir             if (pFormShell != NULL)
465cdf0e10cSrcweir             {
466cdf0e10cSrcweir                 const SfxPoolItem* pItem;
467cdf0e10cSrcweir                 if (rReq.GetArgs()->GetItemState(
468cdf0e10cSrcweir                     SID_ATTR_YEAR2000, sal_True, &pItem) == SFX_ITEM_SET)
469cdf0e10cSrcweir                     pFormShell->SetY2KState (
470cdf0e10cSrcweir                         static_cast<const SfxUInt16Item*>(pItem)->GetValue());
471cdf0e10cSrcweir             }
472cdf0e10cSrcweir 
473cdf0e10cSrcweir             rReq.Done();
474cdf0e10cSrcweir         }
475cdf0e10cSrcweir         break;
476cdf0e10cSrcweir 
477cdf0e10cSrcweir         case SID_OPT_LOCALE_CHANGED:
478cdf0e10cSrcweir         {
479cdf0e10cSrcweir             GetActiveWindow()->Invalidate();
480cdf0e10cSrcweir             UpdatePreview( mpActualPage );
481cdf0e10cSrcweir             rReq.Done();
482cdf0e10cSrcweir         }
483cdf0e10cSrcweir 
484cdf0e10cSrcweir         default:
485cdf0e10cSrcweir         break;
486cdf0e10cSrcweir     }
487cdf0e10cSrcweir }
488cdf0e10cSrcweir 
489cdf0e10cSrcweir /*************************************************************************
490cdf0e10cSrcweir |*
491cdf0e10cSrcweir |* SfxRequests fuer Lineale bearbeiten
492cdf0e10cSrcweir |*
493cdf0e10cSrcweir \************************************************************************/
494cdf0e10cSrcweir 
495cdf0e10cSrcweir void  DrawViewShell::ExecRuler(SfxRequest& rReq)
496cdf0e10cSrcweir {
497cdf0e10cSrcweir     // waehrend einer Diashow wird nichts ausgefuehrt!
498cdf0e10cSrcweir     if(HasCurrentFunction(SID_PRESENTATION))
499cdf0e10cSrcweir         return;
500cdf0e10cSrcweir 
501cdf0e10cSrcweir     CheckLineTo (rReq);
502cdf0e10cSrcweir 
503cdf0e10cSrcweir     const SfxItemSet* pArgs = rReq.GetArgs();
504cdf0e10cSrcweir     const Point aPagePos( GetActiveWindow()->GetViewOrigin() );
505cdf0e10cSrcweir     Size aPageSize = mpActualPage->GetSize();
506cdf0e10cSrcweir     Size aViewSize = GetActiveWindow()->GetViewSize();
507cdf0e10cSrcweir     SdUndoGroup* pUndoGroup = NULL;
508cdf0e10cSrcweir 
509cdf0e10cSrcweir     if ( rReq.GetSlot() == SID_ATTR_LONG_LRSPACE ||
510cdf0e10cSrcweir          rReq.GetSlot() == SID_ATTR_LONG_ULSPACE )
511cdf0e10cSrcweir     {
512cdf0e10cSrcweir         pUndoGroup = new SdUndoGroup(GetDoc());
513cdf0e10cSrcweir         String aString(SdResId(STR_UNDO_CHANGE_PAGEBORDER));
514cdf0e10cSrcweir         pUndoGroup->SetComment(aString);
515cdf0e10cSrcweir     }
516cdf0e10cSrcweir 
517cdf0e10cSrcweir     switch ( rReq.GetSlot() )
518cdf0e10cSrcweir     {
519cdf0e10cSrcweir         case SID_ATTR_LONG_LRSPACE:
520cdf0e10cSrcweir         {
521cdf0e10cSrcweir             const SvxLongLRSpaceItem& rLRSpace = (const SvxLongLRSpaceItem&)
522cdf0e10cSrcweir                     pArgs->Get(GetPool().GetWhich(SID_ATTR_LONG_LRSPACE));
523cdf0e10cSrcweir 
524cdf0e10cSrcweir             if( mpDrawView->IsTextEdit() )
525cdf0e10cSrcweir             {
526cdf0e10cSrcweir                 Rectangle aRect = maMarkRect;
527cdf0e10cSrcweir                 aRect.SetPos(aRect.TopLeft() + aPagePos);
528cdf0e10cSrcweir                 aRect.Left()  = rLRSpace.GetLeft();
529cdf0e10cSrcweir                 aRect.Right() = aViewSize.Width() - rLRSpace.GetRight();
530cdf0e10cSrcweir                 aRect.SetPos(aRect.TopLeft() - aPagePos);
531cdf0e10cSrcweir                 if ( aRect != maMarkRect)
532cdf0e10cSrcweir                 {
533cdf0e10cSrcweir                     mpDrawView->SetAllMarkedRect(aRect);
534cdf0e10cSrcweir                     maMarkRect = mpDrawView->GetAllMarkedRect();
535cdf0e10cSrcweir                     Invalidate( SID_RULER_OBJECT );
536cdf0e10cSrcweir                 }
537cdf0e10cSrcweir             }
538cdf0e10cSrcweir             else
539cdf0e10cSrcweir             {
540cdf0e10cSrcweir                 long nLeft = Max(0L, rLRSpace.GetLeft() - aPagePos.X());
541cdf0e10cSrcweir                 long nRight = Max(0L, rLRSpace.GetRight() + aPagePos.X() +
542cdf0e10cSrcweir                                     aPageSize.Width() - aViewSize.Width());
543cdf0e10cSrcweir 
544cdf0e10cSrcweir                 sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind);
545cdf0e10cSrcweir                 sal_uInt16 i;
546cdf0e10cSrcweir                 for ( i = 0; i < nPageCnt; i++)
547cdf0e10cSrcweir                 {
548cdf0e10cSrcweir                     SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
549cdf0e10cSrcweir                     SdUndoAction* pUndo = new SdPageLRUndoAction(GetDoc(),
550cdf0e10cSrcweir                                             pPage,
551cdf0e10cSrcweir                                             pPage->GetLftBorder(),
552cdf0e10cSrcweir                                             pPage->GetRgtBorder(),
553cdf0e10cSrcweir                                             nLeft, nRight);
554cdf0e10cSrcweir                     pUndoGroup->AddAction(pUndo);
555cdf0e10cSrcweir                     pPage->SetLftBorder(nLeft);
556cdf0e10cSrcweir                     pPage->SetRgtBorder(nRight);
557cdf0e10cSrcweir                 }
558cdf0e10cSrcweir                 nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
559cdf0e10cSrcweir 
560cdf0e10cSrcweir                 for (i = 0; i < nPageCnt; i++)
561cdf0e10cSrcweir                 {
562cdf0e10cSrcweir                     SdPage* pPage = GetDoc()->GetMasterSdPage(i, mePageKind);
563cdf0e10cSrcweir                     SdUndoAction* pUndo = new SdPageLRUndoAction(GetDoc(),
564cdf0e10cSrcweir                                             pPage,
565cdf0e10cSrcweir                                             pPage->GetLftBorder(),
566cdf0e10cSrcweir                                             pPage->GetRgtBorder(),
567cdf0e10cSrcweir                                             nLeft, nRight);
568cdf0e10cSrcweir                     pUndoGroup->AddAction(pUndo);
569cdf0e10cSrcweir                     pPage->SetLftBorder(nLeft);
570cdf0e10cSrcweir                     pPage->SetRgtBorder(nRight);
571cdf0e10cSrcweir                 }
572cdf0e10cSrcweir                 InvalidateWindows();
573cdf0e10cSrcweir             }
574cdf0e10cSrcweir             break;
575cdf0e10cSrcweir         }
576cdf0e10cSrcweir         case SID_ATTR_LONG_ULSPACE:
577cdf0e10cSrcweir         {
578cdf0e10cSrcweir             const SvxLongULSpaceItem& rULSpace = (const SvxLongULSpaceItem&)
579cdf0e10cSrcweir                     pArgs->Get(GetPool().GetWhich(SID_ATTR_LONG_ULSPACE));
580cdf0e10cSrcweir 
581cdf0e10cSrcweir             if( mpDrawView->IsTextEdit() )
582cdf0e10cSrcweir             {
583cdf0e10cSrcweir                 Rectangle aRect = maMarkRect;
584cdf0e10cSrcweir                 aRect.SetPos(aRect.TopLeft() + aPagePos);
585cdf0e10cSrcweir                 aRect.Top()  = rULSpace.GetUpper();
586cdf0e10cSrcweir                 aRect.Bottom() = aViewSize.Height() - rULSpace.GetLower();
587cdf0e10cSrcweir                 aRect.SetPos(aRect.TopLeft() - aPagePos);
588cdf0e10cSrcweir 
589cdf0e10cSrcweir                 if ( aRect != maMarkRect)
590cdf0e10cSrcweir                 {
591cdf0e10cSrcweir                     mpDrawView->SetAllMarkedRect(aRect);
592cdf0e10cSrcweir                     maMarkRect = mpDrawView->GetAllMarkedRect();
593cdf0e10cSrcweir                     Invalidate( SID_RULER_OBJECT );
594cdf0e10cSrcweir                 }
595cdf0e10cSrcweir             }
596cdf0e10cSrcweir             else
597cdf0e10cSrcweir             {
598cdf0e10cSrcweir                 long nUpper = Max(0L, rULSpace.GetUpper() - aPagePos.Y());
599cdf0e10cSrcweir                 long nLower = Max(0L, rULSpace.GetLower() + aPagePos.Y() +
600cdf0e10cSrcweir                                       aPageSize.Height() - aViewSize.Height());
601cdf0e10cSrcweir 
602cdf0e10cSrcweir                 sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind);
603cdf0e10cSrcweir                 sal_uInt16 i;
604cdf0e10cSrcweir                 for ( i = 0; i < nPageCnt; i++)
605cdf0e10cSrcweir                 {
606cdf0e10cSrcweir                     SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
607cdf0e10cSrcweir                     SdUndoAction* pUndo = new SdPageULUndoAction(GetDoc(),
608cdf0e10cSrcweir                                             pPage,
609cdf0e10cSrcweir                                             pPage->GetUppBorder(),
610cdf0e10cSrcweir                                             pPage->GetLwrBorder(),
611cdf0e10cSrcweir                                             nUpper, nLower);
612cdf0e10cSrcweir                     pUndoGroup->AddAction(pUndo);
613cdf0e10cSrcweir                     pPage->SetUppBorder(nUpper);
614cdf0e10cSrcweir                     pPage->SetLwrBorder(nLower);
615cdf0e10cSrcweir                 }
616cdf0e10cSrcweir                 nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
617cdf0e10cSrcweir 
618cdf0e10cSrcweir                 for (i = 0; i < nPageCnt; i++)
619cdf0e10cSrcweir                 {
620cdf0e10cSrcweir                     SdPage* pPage = GetDoc()->GetMasterSdPage(i, mePageKind);
621cdf0e10cSrcweir                     SdUndoAction* pUndo = new SdPageULUndoAction(GetDoc(),
622cdf0e10cSrcweir                                             pPage,
623cdf0e10cSrcweir                                             pPage->GetUppBorder(),
624cdf0e10cSrcweir                                             pPage->GetLwrBorder(),
625cdf0e10cSrcweir                                             nUpper, nLower);
626cdf0e10cSrcweir                     pUndoGroup->AddAction(pUndo);
627cdf0e10cSrcweir                     pPage->SetUppBorder(nUpper);
628cdf0e10cSrcweir                     pPage->SetLwrBorder(nLower);
629cdf0e10cSrcweir                 }
630cdf0e10cSrcweir                 InvalidateWindows();
631cdf0e10cSrcweir             }
632cdf0e10cSrcweir             break;
633cdf0e10cSrcweir         }
634cdf0e10cSrcweir 
635cdf0e10cSrcweir         case SID_RULER_OBJECT:
636cdf0e10cSrcweir         {
637cdf0e10cSrcweir             Rectangle aRect = maMarkRect;
638cdf0e10cSrcweir             aRect.SetPos(aRect.TopLeft() + aPagePos);
639cdf0e10cSrcweir 
640cdf0e10cSrcweir             const SvxObjectItem& rOI = (const SvxObjectItem&)
641cdf0e10cSrcweir                     pArgs->Get(GetPool().GetWhich(SID_RULER_OBJECT));
642cdf0e10cSrcweir 
643cdf0e10cSrcweir             if ( rOI.GetStartX() != rOI.GetEndX() )
644cdf0e10cSrcweir             {
645cdf0e10cSrcweir                 aRect.Left()  = rOI.GetStartX();
646cdf0e10cSrcweir                 aRect.Right() = rOI.GetEndX();
647cdf0e10cSrcweir             }
648cdf0e10cSrcweir             if ( rOI.GetStartY() != rOI.GetEndY() )
649cdf0e10cSrcweir             {
650cdf0e10cSrcweir                 aRect.Top()    = rOI.GetStartY();
651cdf0e10cSrcweir                 aRect.Bottom() = rOI.GetEndY();
652cdf0e10cSrcweir             }
653cdf0e10cSrcweir             aRect.SetPos(aRect.TopLeft() - aPagePos);
654cdf0e10cSrcweir             if ( aRect != maMarkRect)
655cdf0e10cSrcweir             {
656cdf0e10cSrcweir                 mpDrawView->SetAllMarkedRect(aRect);
657cdf0e10cSrcweir                 maMarkRect = mpDrawView->GetAllMarkedRect();
658cdf0e10cSrcweir                 Invalidate( SID_RULER_OBJECT );
659cdf0e10cSrcweir             }
660cdf0e10cSrcweir             break;
661cdf0e10cSrcweir         }
662cdf0e10cSrcweir 
663cdf0e10cSrcweir         case SID_ATTR_TABSTOP:
664cdf0e10cSrcweir         {
665cdf0e10cSrcweir             if( mpDrawView->IsTextEdit() )
666cdf0e10cSrcweir             {
667cdf0e10cSrcweir                 const SvxTabStopItem& rItem = (const SvxTabStopItem&)
668cdf0e10cSrcweir                             pArgs->Get( EE_PARA_TABS );
669cdf0e10cSrcweir 
670cdf0e10cSrcweir                 SfxItemSet aEditAttr( GetPool(), EE_PARA_TABS, EE_PARA_TABS );
671cdf0e10cSrcweir 
672cdf0e10cSrcweir                 aEditAttr.Put( rItem );
673cdf0e10cSrcweir                 mpDrawView->SetAttributes( aEditAttr );
674cdf0e10cSrcweir 
675cdf0e10cSrcweir                 // #91081# Invalidate is missing here
676cdf0e10cSrcweir                 Invalidate(SID_ATTR_TABSTOP);
677cdf0e10cSrcweir             }
678cdf0e10cSrcweir             break;
679cdf0e10cSrcweir         }
680cdf0e10cSrcweir 
681766ce4d0SZheng Fan         case SID_ATTR_PARA_LINESPACE:
682766ce4d0SZheng Fan         {
683766ce4d0SZheng Fan             sal_uInt16 nSlot = SID_ATTR_PARA_LINESPACE;
684766ce4d0SZheng Fan             SvxLineSpacingItem aParaLineSP = (const SvxLineSpacingItem&)pArgs->Get(
685766ce4d0SZheng Fan                 GetPool().GetWhich(nSlot));
686766ce4d0SZheng Fan 
687766ce4d0SZheng Fan             SfxItemSet aEditAttr( GetPool(), EE_PARA_SBL, EE_PARA_SBL );
688766ce4d0SZheng Fan             aParaLineSP.SetWhich( EE_PARA_SBL );
689766ce4d0SZheng Fan 
690766ce4d0SZheng Fan             aEditAttr.Put( aParaLineSP );
691766ce4d0SZheng Fan             mpDrawView->SetAttributes( aEditAttr );
692766ce4d0SZheng Fan 
693766ce4d0SZheng Fan             Invalidate(SID_ATTR_PARA_LINESPACE);
694766ce4d0SZheng Fan         }
695766ce4d0SZheng Fan         break;
696766ce4d0SZheng Fan             //xuxu for UL
697766ce4d0SZheng Fan         case SID_ATTR_PARA_ULSPACE:
698766ce4d0SZheng Fan         {
699766ce4d0SZheng Fan             sal_uInt16 nSlot = SID_ATTR_PARA_ULSPACE;
700766ce4d0SZheng Fan             SvxULSpaceItem aULSP = (const SvxULSpaceItem&)pArgs->Get(
701766ce4d0SZheng Fan                 GetPool().GetWhich(nSlot));
702766ce4d0SZheng Fan             SfxItemSet aEditAttr( GetPool(), EE_PARA_ULSPACE, EE_PARA_ULSPACE );
703766ce4d0SZheng Fan             aULSP.SetWhich( EE_PARA_ULSPACE );
704766ce4d0SZheng Fan 
705766ce4d0SZheng Fan             aEditAttr.Put( aULSP );
706766ce4d0SZheng Fan             mpDrawView->SetAttributes( aEditAttr );
707766ce4d0SZheng Fan 
708766ce4d0SZheng Fan             Invalidate(SID_ATTR_PARA_ULSPACE);
709766ce4d0SZheng Fan         }
710766ce4d0SZheng Fan         break;
711766ce4d0SZheng Fan 
712cdf0e10cSrcweir         case SID_ATTR_PARA_LRSPACE:
713cdf0e10cSrcweir         {
714*1ff378efSZheng Fan             sal_uInt16 nSlot = SID_ATTR_PARA_LRSPACE;
715*1ff378efSZheng Fan             SvxLRSpaceItem aLRSpace = (const SvxLRSpaceItem&)pArgs->Get(
716*1ff378efSZheng Fan                 GetPool().GetWhich(nSlot));
717cdf0e10cSrcweir 
718cdf0e10cSrcweir             SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE );
719*1ff378efSZheng Fan             aLRSpace.SetWhich( EE_PARA_LRSPACE );
720cdf0e10cSrcweir 
721*1ff378efSZheng Fan             aEditAttr.Put( aLRSpace );
722cdf0e10cSrcweir             mpDrawView->SetAttributes( aEditAttr );
723cdf0e10cSrcweir 
724cdf0e10cSrcweir             Invalidate(SID_ATTR_PARA_LRSPACE);
725cdf0e10cSrcweir             break;
726cdf0e10cSrcweir         }
727766ce4d0SZheng Fan         case SID_ATTR_LRSPACE:
728766ce4d0SZheng Fan         {
729766ce4d0SZheng Fan             if( mpDrawView->IsTextEdit() )
730766ce4d0SZheng Fan             {
731766ce4d0SZheng Fan                 sal_uInt16 nId = SID_ATTR_PARA_LRSPACE;
732766ce4d0SZheng Fan                 const SvxLRSpaceItem& rItem = (const SvxLRSpaceItem&)
733766ce4d0SZheng Fan                             pArgs->Get( nId );
734766ce4d0SZheng Fan 
735766ce4d0SZheng Fan                         SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE );
736766ce4d0SZheng Fan 
737766ce4d0SZheng Fan                         nId = EE_PARA_LRSPACE;
738766ce4d0SZheng Fan                 SvxLRSpaceItem aLRSpaceItem( rItem.GetLeft(),
739766ce4d0SZheng Fan                         rItem.GetRight(), rItem.GetTxtLeft(),
740766ce4d0SZheng Fan                         rItem.GetTxtFirstLineOfst(), nId );
741766ce4d0SZheng Fan                 aEditAttr.Put( aLRSpaceItem );
742766ce4d0SZheng Fan                 mpDrawView->SetAttributes( aEditAttr );
743766ce4d0SZheng Fan 
744766ce4d0SZheng Fan                 // #92557# Invalidate is missing here
745766ce4d0SZheng Fan                 Invalidate(SID_ATTR_PARA_LRSPACE);
746766ce4d0SZheng Fan             }
747766ce4d0SZheng Fan             break;
748766ce4d0SZheng Fan         }
749cdf0e10cSrcweir     }
750cdf0e10cSrcweir     if ( pUndoGroup )
751cdf0e10cSrcweir         // Undo Gruppe dem Undo Manager uebergeben
752cdf0e10cSrcweir         GetViewFrame()->GetObjectShell()->GetUndoManager()->
753cdf0e10cSrcweir                                             AddUndoAction(pUndoGroup);
754cdf0e10cSrcweir }
755cdf0e10cSrcweir 
756cdf0e10cSrcweir /*************************************************************************
757cdf0e10cSrcweir |*
758cdf0e10cSrcweir |* Statuswerte der Lineale bestimmen
759cdf0e10cSrcweir |*
760cdf0e10cSrcweir \************************************************************************/
761cdf0e10cSrcweir void  DrawViewShell::GetRulerState(SfxItemSet& rSet)
762cdf0e10cSrcweir {
763cdf0e10cSrcweir     Point aOrigin;
764cdf0e10cSrcweir 
765cdf0e10cSrcweir     if (mpDrawView->GetSdrPageView())
766cdf0e10cSrcweir     {
767cdf0e10cSrcweir         aOrigin = mpDrawView->GetSdrPageView()->GetPageOrigin();
768cdf0e10cSrcweir     }
769cdf0e10cSrcweir 
770cdf0e10cSrcweir     Size aViewSize = GetActiveWindow()->GetViewSize();
771cdf0e10cSrcweir 
772cdf0e10cSrcweir     const Point aPagePos( GetActiveWindow()->GetViewOrigin() );
773cdf0e10cSrcweir     Size aPageSize = mpActualPage->GetSize();
774cdf0e10cSrcweir 
775cdf0e10cSrcweir     Rectangle aRect(aPagePos, Point( aViewSize.Width() - (aPagePos.X() + aPageSize.Width()),
776cdf0e10cSrcweir                                      aViewSize.Height() - (aPagePos.Y() + aPageSize.Height())));
777cdf0e10cSrcweir 
778cdf0e10cSrcweir     if( mpDrawView->IsTextEdit() )
779cdf0e10cSrcweir     {
780cdf0e10cSrcweir         Point aPnt1 = GetActiveWindow()->GetWinViewPos();
781cdf0e10cSrcweir         Point aPnt2 = GetActiveWindow()->GetViewOrigin();
782cdf0e10cSrcweir         Rectangle aMinMaxRect = Rectangle( aPnt1, Size(ULONG_MAX, ULONG_MAX) );
783cdf0e10cSrcweir         rSet.Put( SfxRectangleItem(SID_RULER_LR_MIN_MAX, aMinMaxRect) );
784cdf0e10cSrcweir     }
785cdf0e10cSrcweir     else
786cdf0e10cSrcweir     {
787cdf0e10cSrcweir         rSet.Put( SfxRectangleItem(SID_RULER_LR_MIN_MAX, aRect) );
788cdf0e10cSrcweir     }
789cdf0e10cSrcweir 
790cdf0e10cSrcweir     SvxLongLRSpaceItem aLRSpace(aPagePos.X() + mpActualPage->GetLftBorder(),
791cdf0e10cSrcweir                                 aRect.Right() + mpActualPage->GetRgtBorder(),
792cdf0e10cSrcweir                                 GetPool().GetWhich(SID_ATTR_LONG_LRSPACE));
793cdf0e10cSrcweir     SvxLongULSpaceItem aULSpace(aPagePos.Y() + mpActualPage->GetUppBorder(),
794cdf0e10cSrcweir                                 aRect.Bottom() + mpActualPage->GetLwrBorder(),
795cdf0e10cSrcweir                                 GetPool().GetWhich(SID_ATTR_LONG_ULSPACE));
796cdf0e10cSrcweir     rSet.Put(SvxPagePosSizeItem(Point(0,0) - aPagePos, aViewSize.Width(),
797cdf0e10cSrcweir                                                        aViewSize.Height()));
798cdf0e10cSrcweir     SfxPointItem aPointItem( SID_RULER_NULL_OFFSET, aPagePos + aOrigin );
799cdf0e10cSrcweir 
800cdf0e10cSrcweir     SvxProtectItem aProtect( SID_RULER_PROTECT );
801cdf0e10cSrcweir 
802cdf0e10cSrcweir     maMarkRect = mpDrawView->GetAllMarkedRect();
803cdf0e10cSrcweir 
804cdf0e10cSrcweir     const sal_Bool bRTL = GetDoc() && GetDoc()->GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB;
805cdf0e10cSrcweir     rSet.Put(SfxBoolItem(SID_RULER_TEXT_RIGHT_TO_LEFT, bRTL));
806cdf0e10cSrcweir 
807cdf0e10cSrcweir     if( mpDrawView->AreObjectsMarked() )
808cdf0e10cSrcweir     {
809cdf0e10cSrcweir         if( mpDrawView->IsTextEdit() )
810cdf0e10cSrcweir         {
811cdf0e10cSrcweir             SdrObject* pObj = mpDrawView->GetMarkedObjectList().GetMark( 0 )->GetMarkedSdrObj();
812cdf0e10cSrcweir             if( pObj->GetObjInventor() == SdrInventor)
813cdf0e10cSrcweir             {
814cdf0e10cSrcweir                 SfxItemSet aEditAttr( GetDoc()->GetPool() );
815cdf0e10cSrcweir                 mpDrawView->GetAttributes( aEditAttr );
816cdf0e10cSrcweir                 if( aEditAttr.GetItemState( EE_PARA_TABS ) >= SFX_ITEM_AVAILABLE )
817cdf0e10cSrcweir                 {
818cdf0e10cSrcweir                     const SvxTabStopItem& rItem = (const SvxTabStopItem&) aEditAttr.Get( EE_PARA_TABS );
819cdf0e10cSrcweir                     rSet.Put( rItem );
820cdf0e10cSrcweir 
821cdf0e10cSrcweir                     //Rectangle aRect = maMarkRect;
822cdf0e10cSrcweir 
823cdf0e10cSrcweir                     const SvxLRSpaceItem& rLRSpaceItem = (const SvxLRSpaceItem&) aEditAttr.Get( EE_PARA_LRSPACE );
824cdf0e10cSrcweir                     sal_uInt16 nId = SID_ATTR_PARA_LRSPACE;
825cdf0e10cSrcweir                     SvxLRSpaceItem aLRSpaceItem( rLRSpaceItem.GetLeft(),
826cdf0e10cSrcweir                             rLRSpaceItem.GetRight(), rLRSpaceItem.GetTxtLeft(),
827cdf0e10cSrcweir                             rLRSpaceItem.GetTxtFirstLineOfst(), nId );
828cdf0e10cSrcweir                     rSet.Put( aLRSpaceItem );
829cdf0e10cSrcweir 
830cdf0e10cSrcweir                     Point aPos( aPagePos + maMarkRect.TopLeft() );
831cdf0e10cSrcweir 
832cdf0e10cSrcweir                     if ( aEditAttr.GetItemState( SDRATTR_TEXT_LEFTDIST ) == SFX_ITEM_ON )
833cdf0e10cSrcweir                     {
834cdf0e10cSrcweir                         const SdrTextLeftDistItem& rTLDItem = (const SdrTextLeftDistItem&)
835cdf0e10cSrcweir                                                               aEditAttr.Get( SDRATTR_TEXT_LEFTDIST );
836cdf0e10cSrcweir                         long nLD = rTLDItem.GetValue();
837cdf0e10cSrcweir                         aPos.X() += nLD;
838cdf0e10cSrcweir                     }
839cdf0e10cSrcweir 
840cdf0e10cSrcweir                     aPointItem.SetValue( aPos );
841cdf0e10cSrcweir 
842cdf0e10cSrcweir                     aLRSpace.SetLeft( aPagePos.X() + maMarkRect.Left() );
843cdf0e10cSrcweir 
844cdf0e10cSrcweir                     if ( aEditAttr.GetItemState( SDRATTR_TEXT_LEFTDIST ) == SFX_ITEM_ON )
845cdf0e10cSrcweir                     {
846cdf0e10cSrcweir                         const SdrTextLeftDistItem& rTLDItem = (const SdrTextLeftDistItem&)
847cdf0e10cSrcweir                                                               aEditAttr.Get( SDRATTR_TEXT_LEFTDIST );
848cdf0e10cSrcweir                         long nLD = rTLDItem.GetValue();
849cdf0e10cSrcweir                         aLRSpace.SetLeft( aLRSpace.GetLeft() + nLD );
850cdf0e10cSrcweir                     }
851cdf0e10cSrcweir 
852cdf0e10cSrcweir                     aLRSpace.SetRight( aRect.Right() + aPageSize.Width() - maMarkRect.Right() );
853cdf0e10cSrcweir                     aULSpace.SetUpper( aPagePos.Y() + maMarkRect.Top() );
854cdf0e10cSrcweir                     aULSpace.SetLower( aRect.Bottom() + aPageSize.Height() - maMarkRect.Bottom() );
855cdf0e10cSrcweir 
856cdf0e10cSrcweir                     rSet.DisableItem( SID_RULER_OBJECT );
857cdf0e10cSrcweir 
858cdf0e10cSrcweir                     // Seitenraender werden gelocked
859cdf0e10cSrcweir                     aProtect.SetSizeProtect( sal_True );
860cdf0e10cSrcweir                     aProtect.SetPosProtect( sal_True );
861cdf0e10cSrcweir                 }
862cdf0e10cSrcweir 
863cdf0e10cSrcweir                 if( aEditAttr.GetItemState( EE_PARA_WRITINGDIR ) >= SFX_ITEM_AVAILABLE )
864cdf0e10cSrcweir                 {
865cdf0e10cSrcweir                     const SvxFrameDirectionItem& rItem = (const SvxFrameDirectionItem&) aEditAttr.Get( EE_PARA_WRITINGDIR );
866cdf0e10cSrcweir                     rSet.Put(SfxBoolItem(SID_RULER_TEXT_RIGHT_TO_LEFT, rItem.GetValue() == ::com::sun::star::text::WritingMode_RL_TB));
867cdf0e10cSrcweir                 }
868cdf0e10cSrcweir             }
869cdf0e10cSrcweir         }
870cdf0e10cSrcweir         else
871cdf0e10cSrcweir         {
872cdf0e10cSrcweir             rSet.DisableItem( EE_PARA_TABS );
873cdf0e10cSrcweir             rSet.DisableItem( SID_RULER_TEXT_RIGHT_TO_LEFT );
874cdf0e10cSrcweir 
875cdf0e10cSrcweir             if( mpDrawView->IsResizeAllowed(sal_True) )
876cdf0e10cSrcweir             {
877cdf0e10cSrcweir                 Rectangle aResizeRect( maMarkRect );
878cdf0e10cSrcweir 
879cdf0e10cSrcweir                 aResizeRect.SetPos(aResizeRect.TopLeft() + aPagePos);
880cdf0e10cSrcweir                 SvxObjectItem aObjItem(aResizeRect.Left(), aResizeRect.Right(),
881cdf0e10cSrcweir                                        aResizeRect.Top(), aResizeRect.Bottom());
882cdf0e10cSrcweir                 rSet.Put(aObjItem);
883cdf0e10cSrcweir                 rSet.DisableItem( EE_PARA_TABS );
884cdf0e10cSrcweir             }
885cdf0e10cSrcweir             else
886cdf0e10cSrcweir             {
887cdf0e10cSrcweir                 rSet.DisableItem( SID_RULER_OBJECT );
888cdf0e10cSrcweir             }
889cdf0e10cSrcweir         }
890cdf0e10cSrcweir     }
891cdf0e10cSrcweir     else
892cdf0e10cSrcweir     {
893cdf0e10cSrcweir         rSet.DisableItem( SID_RULER_OBJECT );
894cdf0e10cSrcweir         rSet.DisableItem( EE_PARA_TABS );
895cdf0e10cSrcweir //      rSet.DisableItem( SID_RULER_TEXT_RIGHT_TO_LEFT );
896cdf0e10cSrcweir     }
897cdf0e10cSrcweir 
898cdf0e10cSrcweir     rSet.Put( aLRSpace );
899cdf0e10cSrcweir     rSet.Put( aULSpace );
900cdf0e10cSrcweir 
901cdf0e10cSrcweir     rSet.Put( aPointItem );
902cdf0e10cSrcweir     rSet.Put( aProtect );
903cdf0e10cSrcweir }
904cdf0e10cSrcweir 
905cdf0e10cSrcweir /*************************************************************************
906cdf0e10cSrcweir |*
907cdf0e10cSrcweir |* SfxRequests fuer StatusBar bearbeiten
908cdf0e10cSrcweir |*
909cdf0e10cSrcweir \************************************************************************/
910cdf0e10cSrcweir 
911cdf0e10cSrcweir void  DrawViewShell::ExecStatusBar(SfxRequest& rReq)
912cdf0e10cSrcweir {
913cdf0e10cSrcweir     // waehrend einer Diashow wird nichts ausgefuehrt!
914cdf0e10cSrcweir     if(HasCurrentFunction(SID_PRESENTATION))
915cdf0e10cSrcweir         return;
916cdf0e10cSrcweir 
917cdf0e10cSrcweir     CheckLineTo (rReq);
918cdf0e10cSrcweir 
919cdf0e10cSrcweir     switch ( rReq.GetSlot() )
920cdf0e10cSrcweir     {
921cdf0e10cSrcweir         case SID_ATTR_SIZE:
922cdf0e10cSrcweir         {
923cdf0e10cSrcweir             GetViewFrame()->GetDispatcher()->Execute( SID_ATTR_TRANSFORM, SFX_CALLMODE_ASYNCHRON );
924cdf0e10cSrcweir         }
925cdf0e10cSrcweir         break;
926cdf0e10cSrcweir 
927cdf0e10cSrcweir         case SID_STATUS_LAYOUT:
928cdf0e10cSrcweir         {
929cdf0e10cSrcweir             GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION_LAYOUT, SFX_CALLMODE_ASYNCHRON );
930cdf0e10cSrcweir         }
931cdf0e10cSrcweir         break;
932cdf0e10cSrcweir     }
933cdf0e10cSrcweir }
934cdf0e10cSrcweir 
935cdf0e10cSrcweir /*************************************************************************
936cdf0e10cSrcweir |*
937cdf0e10cSrcweir |* Status der Snap-Objekt-Eintraege im Popup setzen
938cdf0e10cSrcweir |*
939cdf0e10cSrcweir \************************************************************************/
940cdf0e10cSrcweir 
941cdf0e10cSrcweir void  DrawViewShell::GetSnapItemState( SfxItemSet &rSet )
942cdf0e10cSrcweir {
943cdf0e10cSrcweir     SdrPageView* pPV;
944cdf0e10cSrcweir     Point   aMPos = GetActiveWindow()->PixelToLogic(maMousePos);
945cdf0e10cSrcweir     sal_uInt16  nHitLog = (sal_uInt16) GetActiveWindow()->PixelToLogic(
946cdf0e10cSrcweir         Size(FuPoor::HITPIX,0)).Width();
947cdf0e10cSrcweir     sal_uInt16  nHelpLine;
948cdf0e10cSrcweir 
949cdf0e10cSrcweir     if ( mpDrawView->PickHelpLine(aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) )
950cdf0e10cSrcweir     {
951cdf0e10cSrcweir         const SdrHelpLine& rHelpLine = (pPV->GetHelpLines())[nHelpLine];
952cdf0e10cSrcweir 
953cdf0e10cSrcweir         if ( rHelpLine.GetKind() == SDRHELPLINE_POINT )
954cdf0e10cSrcweir         {
955cdf0e10cSrcweir             rSet.Put( SfxStringItem( SID_SET_SNAPITEM,
956cdf0e10cSrcweir                                 String( SdResId( STR_POPUP_EDIT_SNAPPOINT))) );
957cdf0e10cSrcweir             rSet.Put( SfxStringItem( SID_DELETE_SNAPITEM,
958cdf0e10cSrcweir                                 String( SdResId( STR_POPUP_DELETE_SNAPPOINT))) );
959cdf0e10cSrcweir         }
960cdf0e10cSrcweir         else
961cdf0e10cSrcweir         {
962cdf0e10cSrcweir             rSet.Put( SfxStringItem( SID_SET_SNAPITEM,
963cdf0e10cSrcweir                                 String( SdResId( STR_POPUP_EDIT_SNAPLINE))) );
964cdf0e10cSrcweir             rSet.Put( SfxStringItem( SID_DELETE_SNAPITEM,
965cdf0e10cSrcweir                                 String( SdResId( STR_POPUP_DELETE_SNAPLINE))) );
966cdf0e10cSrcweir         }
967cdf0e10cSrcweir     }
968cdf0e10cSrcweir }
969cdf0e10cSrcweir 
970cdf0e10cSrcweir 
971cdf0e10cSrcweir /*************************************************************************
972cdf0e10cSrcweir |*
973cdf0e10cSrcweir |*
974cdf0e10cSrcweir |*
975cdf0e10cSrcweir \************************************************************************/
976cdf0e10cSrcweir 
977cdf0e10cSrcweir void DrawViewShell::AddWindow (::sd::Window* pWin)
978cdf0e10cSrcweir {
979cdf0e10cSrcweir     mpDrawView->AddWindowToPaintView(pWin);
980cdf0e10cSrcweir }
981cdf0e10cSrcweir 
982cdf0e10cSrcweir /*************************************************************************
983cdf0e10cSrcweir |*
984cdf0e10cSrcweir |*
985cdf0e10cSrcweir |*
986cdf0e10cSrcweir \************************************************************************/
987cdf0e10cSrcweir 
988cdf0e10cSrcweir void DrawViewShell::RemoveWindow(::sd::Window* pWin)
989cdf0e10cSrcweir {
990cdf0e10cSrcweir     mpDrawView->DeleteWindowFromPaintView(pWin);
991cdf0e10cSrcweir }
992cdf0e10cSrcweir 
993cdf0e10cSrcweir } // end of namespace sd
994