xref: /trunk/main/sd/source/ui/view/sdview.cxx (revision 766ce4d0f35a6d5b4b7c65174e638ff2dfbd4ec1)
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 #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
27cdf0e10cSrcweir #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include "View.hxx"
30cdf0e10cSrcweir #include <editeng/unolingu.hxx>
31cdf0e10cSrcweir #include <sfx2/request.hxx>
32cdf0e10cSrcweir #include <svx/obj3d.hxx>
33cdf0e10cSrcweir #include <svx/fmview.hxx>
34cdf0e10cSrcweir #include <editeng/outliner.hxx>
35cdf0e10cSrcweir #ifndef _SVX_SVXIDS_HRC
36cdf0e10cSrcweir #include <svx/svxids.hrc>
37cdf0e10cSrcweir #endif
38cdf0e10cSrcweir #include <svx/svdograf.hxx>
39cdf0e10cSrcweir #include <svx/svdoole2.hxx>
40cdf0e10cSrcweir #include <svx/svdundo.hxx>
41cdf0e10cSrcweir #include <vcl/msgbox.hxx>
42cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
43cdf0e10cSrcweir #include <sfx2/app.hxx>
44cdf0e10cSrcweir #include <svx/svdpagv.hxx>
45cdf0e10cSrcweir #include <sfx2/docfile.hxx>
46cdf0e10cSrcweir #include <svx/svdoutl.hxx>
47cdf0e10cSrcweir #include <svx/sdr/contact/displayinfo.hxx>
48cdf0e10cSrcweir 
49cdf0e10cSrcweir #include <svx/svdetc.hxx>
50cdf0e10cSrcweir #include <editeng/editstat.hxx>
51cdf0e10cSrcweir 
52cdf0e10cSrcweir #include <svx/dialogs.hrc>
53cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
54f120fe41SAndre Fischer #include <sfx2/sidebar/EnumContext.hxx>
55cdf0e10cSrcweir #include <svx/svdopage.hxx>
56cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx>
57cdf0e10cSrcweir #include <svx/xlndsit.hxx>
58cdf0e10cSrcweir #include <svx/xlineit0.hxx>
59cdf0e10cSrcweir #include <svx/xlnclit.hxx>
6095a18594SAndre Fischer #include <svx/sidebar/ContextChangeEventMultiplexer.hxx>
61cdf0e10cSrcweir #include <vcl/virdev.hxx>
62cdf0e10cSrcweir 
63cdf0e10cSrcweir #include "app.hrc"
64cdf0e10cSrcweir #include "strings.hrc"
65cdf0e10cSrcweir #include "Window.hxx"
66cdf0e10cSrcweir #include "Client.hxx"
67cdf0e10cSrcweir #include "drawdoc.hxx"
68cdf0e10cSrcweir #include "DrawDocShell.hxx"
69cdf0e10cSrcweir #include "app.hxx"
70cdf0e10cSrcweir #include "sdpage.hxx"
71cdf0e10cSrcweir #include "glob.hrc"
72cdf0e10cSrcweir #include "sdresid.hxx"
73cdf0e10cSrcweir #include "DrawViewShell.hxx"
74cdf0e10cSrcweir #include "futext.hxx"
75cdf0e10cSrcweir #include "fuinsfil.hxx"
76cdf0e10cSrcweir #include "slideshow.hxx"
77cdf0e10cSrcweir #include "stlpool.hxx"
78cdf0e10cSrcweir #include "FrameView.hxx"
79cdf0e10cSrcweir #include "ViewClipboard.hxx"
80cdf0e10cSrcweir #include "undo/undomanager.hxx"
81cdf0e10cSrcweir #include <svx/sdr/contact/viewobjectcontact.hxx>
82cdf0e10cSrcweir #include <svx/sdr/contact/viewcontact.hxx>
83cdf0e10cSrcweir #include <svx/sdr/contact/displayinfo.hxx>
84*766ce4d0SZheng Fan #include <svx/svdotable.hxx>
85cdf0e10cSrcweir #include "EventMultiplexer.hxx"
86cdf0e10cSrcweir #include "ViewShellBase.hxx"
87cdf0e10cSrcweir #include "ViewShellManager.hxx"
88cdf0e10cSrcweir 
89cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygontools.hxx>
90cdf0e10cSrcweir #include <basegfx/color/bcolor.hxx>
91cdf0e10cSrcweir #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
92cdf0e10cSrcweir #include <drawinglayer/primitive2d/textlayoutdevice.hxx>
93cdf0e10cSrcweir #include <drawinglayer/primitive2d/groupprimitive2d.hxx>
94cdf0e10cSrcweir #include <svx/sdr/contact/objectcontact.hxx>
95*766ce4d0SZheng Fan #include <svx/sdr/table/tablecontroller.hxx>
96cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
97cdf0e10cSrcweir #include <drawinglayer/primitive2d/textprimitive2d.hxx>
98cdf0e10cSrcweir #include <svx/unoapi.hxx>
99cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrixtools.hxx>
100cdf0e10cSrcweir 
101cdf0e10cSrcweir #include <numeric>
102cdf0e10cSrcweir 
103cdf0e10cSrcweir using namespace com::sun::star;
104cdf0e10cSrcweir using namespace com::sun::star::uno;
105*766ce4d0SZheng Fan using namespace sdr::table;
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 TYPEINIT1(View, FmFormView);
114cdf0e10cSrcweir 
115cdf0e10cSrcweir /*************************************************************************
116cdf0e10cSrcweir |*
117cdf0e10cSrcweir |* Ctor
118cdf0e10cSrcweir |*
119cdf0e10cSrcweir \************************************************************************/
120cdf0e10cSrcweir 
121cdf0e10cSrcweir View::View(SdDrawDocument* pDrawDoc, OutputDevice* pOutDev,
122cdf0e10cSrcweir                ViewShell* pViewShell)
123cdf0e10cSrcweir   : FmFormView(pDrawDoc, pOutDev),
124cdf0e10cSrcweir     mpDoc(pDrawDoc),
125cdf0e10cSrcweir     mpDocSh( pDrawDoc->GetDocSh() ),
126cdf0e10cSrcweir     mpViewSh(pViewShell),
127cdf0e10cSrcweir     mpDragSrcMarkList(NULL),
128cdf0e10cSrcweir     mpDropMarkerObj(NULL),
129cdf0e10cSrcweir     mpDropMarker(NULL),
130cdf0e10cSrcweir     mnDragSrcPgNum(SDRPAGE_NOTFOUND),
131cdf0e10cSrcweir     mnAction(DND_ACTION_NONE),
132cdf0e10cSrcweir     mnLockRedrawSmph(0),
133cdf0e10cSrcweir     mpLockedRedraws(NULL),
134cdf0e10cSrcweir     mbIsDropAllowed(sal_True),
135cdf0e10cSrcweir     maSmartTags(*this),
136cdf0e10cSrcweir     mpClipboard (new ViewClipboard (*this))
137cdf0e10cSrcweir {
138cdf0e10cSrcweir     // #i73602# Use default from the configuration
139cdf0e10cSrcweir     SetBufferedOverlayAllowed(getOptionsDrawinglayer().IsOverlayBuffer_DrawImpress());
140cdf0e10cSrcweir 
141cdf0e10cSrcweir     // #i74769#, #i75172# Use default from the configuration
142cdf0e10cSrcweir     SetBufferedOutputAllowed(getOptionsDrawinglayer().IsPaintBuffer_DrawImpress());
143cdf0e10cSrcweir 
144cdf0e10cSrcweir     EnableExtendedKeyInputDispatcher(sal_False);
145cdf0e10cSrcweir     EnableExtendedMouseEventDispatcher(sal_False);
146cdf0e10cSrcweir     EnableExtendedCommandEventDispatcher(sal_False);
147cdf0e10cSrcweir 
148cdf0e10cSrcweir     SetUseIncompatiblePathCreateInterface(sal_False);
149cdf0e10cSrcweir     SetMarkHdlWhenTextEdit(sal_True);
150cdf0e10cSrcweir     EnableTextEditOnObjectsWithoutTextIfTextTool(sal_True);
151cdf0e10cSrcweir 
152cdf0e10cSrcweir     SetMinMoveDistancePixel(2);
153cdf0e10cSrcweir     SetHitTolerancePixel(2);
154cdf0e10cSrcweir     SetMeasureLayer(String(SdResId(STR_LAYER_MEASURELINES)));
155cdf0e10cSrcweir 
156cdf0e10cSrcweir     // Timer fuer verzoegertes Drop (muss fuer MAC sein)
157cdf0e10cSrcweir     maDropErrorTimer.SetTimeoutHdl( LINK(this, View, DropErrorHdl) );
158cdf0e10cSrcweir     maDropErrorTimer.SetTimeout(50);
159cdf0e10cSrcweir     maDropInsertFileTimer.SetTimeoutHdl( LINK(this, View, DropInsertFileHdl) );
160cdf0e10cSrcweir     maDropInsertFileTimer.SetTimeout(50);
161cdf0e10cSrcweir }
162cdf0e10cSrcweir 
163cdf0e10cSrcweir void View::ImplClearDrawDropMarker()
164cdf0e10cSrcweir {
165cdf0e10cSrcweir     if(mpDropMarker)
166cdf0e10cSrcweir     {
167cdf0e10cSrcweir         delete mpDropMarker;
168cdf0e10cSrcweir         mpDropMarker = 0L;
169cdf0e10cSrcweir     }
170cdf0e10cSrcweir }
171cdf0e10cSrcweir 
172cdf0e10cSrcweir /*************************************************************************
173cdf0e10cSrcweir |*
174cdf0e10cSrcweir |* Dtor
175cdf0e10cSrcweir |*
176cdf0e10cSrcweir \************************************************************************/
177cdf0e10cSrcweir 
178cdf0e10cSrcweir View::~View()
179cdf0e10cSrcweir {
180cdf0e10cSrcweir     maSmartTags.Dispose();
181cdf0e10cSrcweir 
182cdf0e10cSrcweir     // release content of selection clipboard, if we own the content
183cdf0e10cSrcweir     UpdateSelectionClipboard( sal_True );
184cdf0e10cSrcweir 
185cdf0e10cSrcweir     maDropErrorTimer.Stop();
186cdf0e10cSrcweir     maDropInsertFileTimer.Stop();
187cdf0e10cSrcweir 
188cdf0e10cSrcweir     ImplClearDrawDropMarker();
189cdf0e10cSrcweir 
190cdf0e10cSrcweir     while(PaintWindowCount())
191cdf0e10cSrcweir     {
192cdf0e10cSrcweir         // Alle angemeldeten OutDevs entfernen
193cdf0e10cSrcweir         DeleteWindowFromPaintView(GetFirstOutputDevice() /*GetWin(0)*/);
194cdf0e10cSrcweir     }
195cdf0e10cSrcweir 
196cdf0e10cSrcweir     // gespeicherte Redraws loeschen
197cdf0e10cSrcweir     if (mpLockedRedraws)
198cdf0e10cSrcweir     {
199cdf0e10cSrcweir         SdViewRedrawRec* pRec = (SdViewRedrawRec*)mpLockedRedraws->First();
200cdf0e10cSrcweir         while (pRec)
201cdf0e10cSrcweir         {
202cdf0e10cSrcweir             delete pRec;
203cdf0e10cSrcweir             pRec = (SdViewRedrawRec*)mpLockedRedraws->Next();
204cdf0e10cSrcweir         }
205cdf0e10cSrcweir         delete mpLockedRedraws;
206cdf0e10cSrcweir     }
207cdf0e10cSrcweir }
208cdf0e10cSrcweir 
209cdf0e10cSrcweir 
210cdf0e10cSrcweir class ViewRedirector : public ::sdr::contact::ViewObjectContactRedirector
211cdf0e10cSrcweir {
212cdf0e10cSrcweir public:
213cdf0e10cSrcweir     ViewRedirector();
214cdf0e10cSrcweir     virtual ~ViewRedirector();
215cdf0e10cSrcweir 
216cdf0e10cSrcweir     // all default implementations just call the same methods at the original. To do something
217cdf0e10cSrcweir     // different, overload the method and at least do what the method does.
218cdf0e10cSrcweir     virtual drawinglayer::primitive2d::Primitive2DSequence createRedirectedPrimitive2DSequence(
219cdf0e10cSrcweir         const sdr::contact::ViewObjectContact& rOriginal,
220cdf0e10cSrcweir         const sdr::contact::DisplayInfo& rDisplayInfo);
221cdf0e10cSrcweir };
222cdf0e10cSrcweir 
223cdf0e10cSrcweir ViewRedirector::ViewRedirector()
224cdf0e10cSrcweir {
225cdf0e10cSrcweir }
226cdf0e10cSrcweir 
227cdf0e10cSrcweir ViewRedirector::~ViewRedirector()
228cdf0e10cSrcweir {
229cdf0e10cSrcweir }
230cdf0e10cSrcweir 
231cdf0e10cSrcweir drawinglayer::primitive2d::Primitive2DSequence ViewRedirector::createRedirectedPrimitive2DSequence(
232cdf0e10cSrcweir     const sdr::contact::ViewObjectContact& rOriginal,
233cdf0e10cSrcweir     const sdr::contact::DisplayInfo& rDisplayInfo)
234cdf0e10cSrcweir {
235cdf0e10cSrcweir     SdrObject* pObject = rOriginal.GetViewContact().TryToGetSdrObject();
236cdf0e10cSrcweir     drawinglayer::primitive2d::Primitive2DSequence xRetval;
237cdf0e10cSrcweir 
238cdf0e10cSrcweir     if(pObject && pObject->GetPage())
239cdf0e10cSrcweir     {
240cdf0e10cSrcweir         const bool bDoCreateGeometry(pObject->GetPage()->checkVisibility( rOriginal, rDisplayInfo, true ));
241cdf0e10cSrcweir 
242cdf0e10cSrcweir         if(!bDoCreateGeometry && !(( pObject->GetObjInventor() == SdrInventor ) && ( pObject->GetObjIdentifier() == OBJ_PAGE )) )
243cdf0e10cSrcweir             return xRetval;
244cdf0e10cSrcweir 
245cdf0e10cSrcweir         PresObjKind eKind(PRESOBJ_NONE);
246cdf0e10cSrcweir         const bool bSubContentProcessing(rDisplayInfo.GetSubContentActive());
247cdf0e10cSrcweir         const bool bIsMasterPageObject(pObject->GetPage()->IsMasterPage());
248cdf0e10cSrcweir         const bool bIsPrinting(rOriginal.GetObjectContact().isOutputToPrinter());
249cdf0e10cSrcweir         const SdrPageView* pPageView = rOriginal.GetObjectContact().TryToGetSdrPageView();
250cdf0e10cSrcweir         const SdrPage* pVisualizedPage = GetSdrPageFromXDrawPage(rOriginal.GetObjectContact().getViewInformation2D().getVisualizedPage());
251cdf0e10cSrcweir         const SdPage* pObjectsSdPage = dynamic_cast< SdPage* >(pObject->GetPage());
252cdf0e10cSrcweir         const bool bIsInsidePageObj(pPageView && pPageView->GetPage() != pVisualizedPage);
253cdf0e10cSrcweir 
254cdf0e10cSrcweir         // check if we need to draw a placeholder border. Never do it for
255cdf0e10cSrcweir         // objects inside a SdrPageObj and never when printing
256cdf0e10cSrcweir         if(!bIsInsidePageObj && !bIsPrinting)
257cdf0e10cSrcweir         {
258cdf0e10cSrcweir             bool bCreateOutline(false);
259cdf0e10cSrcweir 
260cdf0e10cSrcweir             if( pObject->IsEmptyPresObj() && pObject->ISA(SdrTextObj) )
261cdf0e10cSrcweir             {
262cdf0e10cSrcweir                 if( !bSubContentProcessing || !pObject->IsNotVisibleAsMaster() )
263cdf0e10cSrcweir                 {
264cdf0e10cSrcweir                     eKind = pObjectsSdPage ? pObjectsSdPage->GetPresObjKind(pObject) : PRESOBJ_NONE;
265cdf0e10cSrcweir                     bCreateOutline = true;
266cdf0e10cSrcweir                 }
267cdf0e10cSrcweir             }
268cdf0e10cSrcweir             else if( ( pObject->GetObjInventor() == SdrInventor ) && ( pObject->GetObjIdentifier() == OBJ_TEXT ) )
269cdf0e10cSrcweir             {
270cdf0e10cSrcweir                 if( pObjectsSdPage )
271cdf0e10cSrcweir                 {
272cdf0e10cSrcweir                     eKind = pObjectsSdPage->GetPresObjKind(pObject);
273cdf0e10cSrcweir 
274cdf0e10cSrcweir                     if((eKind == PRESOBJ_FOOTER) || (eKind == PRESOBJ_HEADER) || (eKind == PRESOBJ_DATETIME) || (eKind == PRESOBJ_SLIDENUMBER) )
275cdf0e10cSrcweir                     {
276cdf0e10cSrcweir                         if( !bSubContentProcessing )
277cdf0e10cSrcweir                         {
278cdf0e10cSrcweir                             // only draw a boundary for header&footer objects on the masterpage itself
279cdf0e10cSrcweir                             bCreateOutline = true;
280cdf0e10cSrcweir                         }
281cdf0e10cSrcweir                     }
282cdf0e10cSrcweir                 }
283cdf0e10cSrcweir             }
284cdf0e10cSrcweir             else if( ( pObject->GetObjInventor() == SdrInventor ) && ( pObject->GetObjIdentifier() == OBJ_PAGE ) )
285cdf0e10cSrcweir             {
286cdf0e10cSrcweir                 // only for handout page, else this frame will be created for each
287cdf0e10cSrcweir                 // page preview object in SlideSorter and PagePane
288cdf0e10cSrcweir                 if(pObjectsSdPage && PK_HANDOUT == pObjectsSdPage->GetPageKind())
289cdf0e10cSrcweir                 {
290cdf0e10cSrcweir                     bCreateOutline = true;
291cdf0e10cSrcweir                 }
292cdf0e10cSrcweir             }
293cdf0e10cSrcweir 
294cdf0e10cSrcweir             if(bCreateOutline)
295cdf0e10cSrcweir             {
296cdf0e10cSrcweir                 // empty presentation objects get a gray frame
297cdf0e10cSrcweir                 const svtools::ColorConfig aColorConfig;
298cdf0e10cSrcweir                 const svtools::ColorConfigValue aColor( aColorConfig.GetColorValue( svtools::OBJECTBOUNDARIES ) );
299cdf0e10cSrcweir 
300cdf0e10cSrcweir                 if( aColor.bIsVisible )
301cdf0e10cSrcweir                 {
302cdf0e10cSrcweir                     // get basic object transformation
303cdf0e10cSrcweir                     const basegfx::BColor aRGBColor(Color(aColor.nColor).getBColor());
304cdf0e10cSrcweir                     basegfx::B2DHomMatrix aObjectMatrix;
305cdf0e10cSrcweir                     basegfx::B2DPolyPolygon aObjectPolyPolygon;
306cdf0e10cSrcweir                     pObject->TRGetBaseGeometry(aObjectMatrix, aObjectPolyPolygon);
307cdf0e10cSrcweir 
308cdf0e10cSrcweir                     // create dashed border
309cdf0e10cSrcweir                     {
310cdf0e10cSrcweir                         // create object polygon
311cdf0e10cSrcweir                         basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon());
312cdf0e10cSrcweir                         aPolygon.transform(aObjectMatrix);
313cdf0e10cSrcweir 
314cdf0e10cSrcweir                         // create line and stroke attribute
315cdf0e10cSrcweir                         ::std::vector< double > aDotDashArray;
316cdf0e10cSrcweir 
317cdf0e10cSrcweir                         aDotDashArray.push_back(160.0);
318cdf0e10cSrcweir                         aDotDashArray.push_back(80.0);
319cdf0e10cSrcweir 
320cdf0e10cSrcweir                         const double fFullDotDashLen(::std::accumulate(aDotDashArray.begin(), aDotDashArray.end(), 0.0));
321cdf0e10cSrcweir                         const drawinglayer::attribute::LineAttribute aLine(aRGBColor);
322cdf0e10cSrcweir                         const drawinglayer::attribute::StrokeAttribute aStroke(aDotDashArray, fFullDotDashLen);
323cdf0e10cSrcweir 
324cdf0e10cSrcweir                         // create primitive and add
325cdf0e10cSrcweir                         const drawinglayer::primitive2d::Primitive2DReference xRef(new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
326cdf0e10cSrcweir                             aPolygon,
327cdf0e10cSrcweir                             aLine,
328cdf0e10cSrcweir                             aStroke));
329cdf0e10cSrcweir                         drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xRef);
330cdf0e10cSrcweir                     }
331cdf0e10cSrcweir 
332cdf0e10cSrcweir                     // now paint the placeholder description, but only when masterpage
333cdf0e10cSrcweir                     // is displayed as page directly (MasterPage view)
334cdf0e10cSrcweir                     if(!bSubContentProcessing && bIsMasterPageObject)
335cdf0e10cSrcweir                     {
336cdf0e10cSrcweir                         String aObjectString;
337cdf0e10cSrcweir 
338cdf0e10cSrcweir                         switch( eKind )
339cdf0e10cSrcweir                         {
340cdf0e10cSrcweir                             case PRESOBJ_TITLE:
341cdf0e10cSrcweir                             {
342cdf0e10cSrcweir                                 if(pObjectsSdPage && pObjectsSdPage->GetPageKind() == PK_STANDARD)
343cdf0e10cSrcweir                                 {
344cdf0e10cSrcweir                                     static String aTitleAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_TITLE ) );
345cdf0e10cSrcweir                                     aObjectString = aTitleAreaStr;
346cdf0e10cSrcweir                                 }
347cdf0e10cSrcweir 
348cdf0e10cSrcweir                                 break;
349cdf0e10cSrcweir                             }
350cdf0e10cSrcweir                             case PRESOBJ_OUTLINE:
351cdf0e10cSrcweir                             {
352cdf0e10cSrcweir                                 static String aOutlineAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_OUTLINE ) );
353cdf0e10cSrcweir                                 aObjectString = aOutlineAreaStr;
354cdf0e10cSrcweir                                 break;
355cdf0e10cSrcweir                             }
356cdf0e10cSrcweir                             case PRESOBJ_FOOTER:
357cdf0e10cSrcweir                             {
358cdf0e10cSrcweir                                 static String aFooterAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_FOOTER ) );
359cdf0e10cSrcweir                                 aObjectString = aFooterAreaStr;
360cdf0e10cSrcweir                                 break;
361cdf0e10cSrcweir                             }
362cdf0e10cSrcweir                             case PRESOBJ_HEADER:
363cdf0e10cSrcweir                             {
364cdf0e10cSrcweir                                 static String aHeaderAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_HEADER ) );
365cdf0e10cSrcweir                                 aObjectString = aHeaderAreaStr;
366cdf0e10cSrcweir                                 break;
367cdf0e10cSrcweir                             }
368cdf0e10cSrcweir                             case PRESOBJ_DATETIME:
369cdf0e10cSrcweir                             {
370cdf0e10cSrcweir                                 static String aDateTimeStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_DATETIME ) );
371cdf0e10cSrcweir                                 aObjectString = aDateTimeStr;
372cdf0e10cSrcweir                                 break;
373cdf0e10cSrcweir                             }
374cdf0e10cSrcweir                             case PRESOBJ_NOTES:
375cdf0e10cSrcweir                             {
376cdf0e10cSrcweir                                 static String aDateTimeStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_NOTES ) );
377cdf0e10cSrcweir                                 aObjectString = aDateTimeStr;
378cdf0e10cSrcweir                                 break;
379cdf0e10cSrcweir                             }
380cdf0e10cSrcweir                             case PRESOBJ_SLIDENUMBER:
381cdf0e10cSrcweir                             {
382cdf0e10cSrcweir                                 if(pObjectsSdPage && pObjectsSdPage->GetPageKind() == PK_STANDARD)
383cdf0e10cSrcweir                                 {
384cdf0e10cSrcweir                                     static String aSlideAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_SLIDE ) );
385cdf0e10cSrcweir                                     aObjectString = aSlideAreaStr;
386cdf0e10cSrcweir                                 }
387cdf0e10cSrcweir                                 else
388cdf0e10cSrcweir                                 {
389cdf0e10cSrcweir                                     static String aNumberAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_NUMBER ) );
390cdf0e10cSrcweir                                     aObjectString = aNumberAreaStr;
391cdf0e10cSrcweir                                 }
392cdf0e10cSrcweir                                 break;
393cdf0e10cSrcweir                             }
394cdf0e10cSrcweir                             default:
395cdf0e10cSrcweir                             {
396cdf0e10cSrcweir                                 break;
397cdf0e10cSrcweir                             }
398cdf0e10cSrcweir                         }
399cdf0e10cSrcweir 
400cdf0e10cSrcweir                         if( aObjectString.Len() )
401cdf0e10cSrcweir                         {
402cdf0e10cSrcweir                             // decompose object matrix to be able to place text correctly
403cdf0e10cSrcweir                             basegfx::B2DTuple aScale;
404cdf0e10cSrcweir                             basegfx::B2DTuple aTranslate;
405cdf0e10cSrcweir                             double fRotate, fShearX;
406cdf0e10cSrcweir                             aObjectMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
407cdf0e10cSrcweir 
408cdf0e10cSrcweir                             // create font
409cdf0e10cSrcweir                             SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObject );
410cdf0e10cSrcweir                             const SdrTextVertAdjust eTVA(pTextObj ? pTextObj->GetTextVerticalAdjust() : SDRTEXTVERTADJUST_CENTER);
411cdf0e10cSrcweir                             Font aScaledVclFont;
412cdf0e10cSrcweir 
413cdf0e10cSrcweir                             // use a text size factor to get more reliable text sizes from the text layouter
414cdf0e10cSrcweir                             // (and from vcl), tipp from HDU
415cdf0e10cSrcweir                             static sal_uInt32 nTextSizeFactor(100);
416cdf0e10cSrcweir 
417cdf0e10cSrcweir                             // use a factor to get more linear text size calculations
418cdf0e10cSrcweir                             aScaledVclFont.SetHeight( 500 * nTextSizeFactor );
419cdf0e10cSrcweir 
420cdf0e10cSrcweir                             // get basic geometry and get text size
421cdf0e10cSrcweir                             drawinglayer::primitive2d::TextLayouterDevice aTextLayouter;
422cdf0e10cSrcweir                             aTextLayouter.setFont(aScaledVclFont);
423cdf0e10cSrcweir                             const xub_StrLen nTextLength(aObjectString.Len());
424cdf0e10cSrcweir 
425cdf0e10cSrcweir                             // do not forget to use the factor again to get the width for the 500
426cdf0e10cSrcweir                             const double fTextWidth(aTextLayouter.getTextWidth(aObjectString, 0, nTextLength) * (1.0 / nTextSizeFactor));
427cdf0e10cSrcweir                             const double fTextHeight(aTextLayouter.getTextHeight() * (1.0 / nTextSizeFactor));
428cdf0e10cSrcweir 
429cdf0e10cSrcweir                             // calculate text primitive position. If text is at bottom, use top for
430cdf0e10cSrcweir                             // the extra text and vice versa
431cdf0e10cSrcweir                             const double fHorDist(125);
432cdf0e10cSrcweir                             const double fVerDist(125);
433cdf0e10cSrcweir                             const double fPosX((aTranslate.getX() + aScale.getX()) - fTextWidth - fHorDist);
434cdf0e10cSrcweir                             const double fPosY((SDRTEXTVERTADJUST_BOTTOM == eTVA)
435cdf0e10cSrcweir                                 ? aTranslate.getY() - fVerDist + fTextHeight
436cdf0e10cSrcweir                                 : (aTranslate.getY() + aScale.getY()) - fVerDist);
437cdf0e10cSrcweir 
438cdf0e10cSrcweir                             // get font attributes; use normally scaled font
439cdf0e10cSrcweir                             const basegfx::BColor aFontColor(aRGBColor);
440cdf0e10cSrcweir                             Font aVclFont;
441cdf0e10cSrcweir                             basegfx::B2DVector aTextSizeAttribute;
442cdf0e10cSrcweir 
443cdf0e10cSrcweir                             aVclFont.SetHeight( 500 );
444cdf0e10cSrcweir 
445cdf0e10cSrcweir                             const drawinglayer::attribute::FontAttribute aFontAttribute(
446cdf0e10cSrcweir                                 drawinglayer::primitive2d::getFontAttributeFromVclFont(
447cdf0e10cSrcweir                                     aTextSizeAttribute,
448cdf0e10cSrcweir                                     aVclFont,
449cdf0e10cSrcweir                                     false,
450cdf0e10cSrcweir                                     false));
451cdf0e10cSrcweir 
452cdf0e10cSrcweir                             // fill text matrix
453cdf0e10cSrcweir                             const basegfx::B2DHomMatrix aTextMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
454cdf0e10cSrcweir                                 aTextSizeAttribute.getX(), aTextSizeAttribute.getY(),
455cdf0e10cSrcweir                                 fShearX,
456cdf0e10cSrcweir                                 fRotate,
457cdf0e10cSrcweir                                 fPosX, fPosY));
458cdf0e10cSrcweir 
459cdf0e10cSrcweir                             // create DXTextArray (can be empty one)
460cdf0e10cSrcweir                             const ::std::vector< double > aDXArray;
461cdf0e10cSrcweir 
462cdf0e10cSrcweir                             // create locale; this may need some more information in the future
463cdf0e10cSrcweir                             const ::com::sun::star::lang::Locale aLocale;
464cdf0e10cSrcweir 
465cdf0e10cSrcweir                             // create primitive and add
466cdf0e10cSrcweir                             const drawinglayer::primitive2d::Primitive2DReference xRef(
467cdf0e10cSrcweir                                 new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
468cdf0e10cSrcweir                                     aTextMatrix,
469cdf0e10cSrcweir                                     aObjectString,
470cdf0e10cSrcweir                                     0,
471cdf0e10cSrcweir                                     nTextLength,
472cdf0e10cSrcweir                                     aDXArray,
473cdf0e10cSrcweir                                     aFontAttribute,
474cdf0e10cSrcweir                                     aLocale,
475cdf0e10cSrcweir                                     aFontColor));
476cdf0e10cSrcweir                             drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xRef);
477cdf0e10cSrcweir                         }
478cdf0e10cSrcweir                     }
479cdf0e10cSrcweir                 }
480cdf0e10cSrcweir             }
481cdf0e10cSrcweir         }
482cdf0e10cSrcweir 
483cdf0e10cSrcweir         if(bDoCreateGeometry)
484cdf0e10cSrcweir         {
485cdf0e10cSrcweir             drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(
486cdf0e10cSrcweir                 xRetval,
487cdf0e10cSrcweir                 sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(
488cdf0e10cSrcweir                     rOriginal,
489cdf0e10cSrcweir                     rDisplayInfo));
490cdf0e10cSrcweir         }
491cdf0e10cSrcweir     }
492cdf0e10cSrcweir     else
493cdf0e10cSrcweir     {
494cdf0e10cSrcweir         // not a SdrObject visualisation (maybe e.g. page) or no page
495cdf0e10cSrcweir         xRetval = sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo);
496cdf0e10cSrcweir     }
497cdf0e10cSrcweir 
498cdf0e10cSrcweir     return xRetval;
499cdf0e10cSrcweir }
500cdf0e10cSrcweir 
501cdf0e10cSrcweir /*************************************************************************
502cdf0e10cSrcweir |*
503cdf0e10cSrcweir |* Paint-Methode: das Ereignis wird an die View weitergeleitet
504cdf0e10cSrcweir |*
505cdf0e10cSrcweir \************************************************************************/
506cdf0e10cSrcweir 
507cdf0e10cSrcweir void View::CompleteRedraw(OutputDevice* pOutDev, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector /*=0L*/)
508cdf0e10cSrcweir {
509cdf0e10cSrcweir     // ausfuehren ??
510cdf0e10cSrcweir     if (mnLockRedrawSmph == 0)
511cdf0e10cSrcweir     {
512cdf0e10cSrcweir         SdrPageView* pPgView = GetSdrPageView();
513cdf0e10cSrcweir 
514cdf0e10cSrcweir         if (pPgView)
515cdf0e10cSrcweir         {
516cdf0e10cSrcweir             SdPage* pPage = (SdPage*) pPgView->GetPage();
517cdf0e10cSrcweir             if( pPage )
518cdf0e10cSrcweir             {
519cdf0e10cSrcweir                 SdrOutliner& rOutl=mpDoc->GetDrawOutliner(NULL);
520cdf0e10cSrcweir                 bool bScreenDisplay(true);
521cdf0e10cSrcweir 
522cdf0e10cSrcweir                 if(bScreenDisplay && pOutDev && OUTDEV_PRINTER == pOutDev->GetOutDevType())
523cdf0e10cSrcweir                 {
524cdf0e10cSrcweir                     // #i75566# printing; suppress AutoColor BackgroundColor generation
525cdf0e10cSrcweir                     // for visibility reasons by giving GetPageBackgroundColor()
526cdf0e10cSrcweir                     // the needed hint
527cdf0e10cSrcweir                     bScreenDisplay = false;
528cdf0e10cSrcweir                 }
529cdf0e10cSrcweir 
530cdf0e10cSrcweir                 if(bScreenDisplay && pOutDev && pOutDev->GetPDFWriter())
531cdf0e10cSrcweir                 {
532cdf0e10cSrcweir                     // #i75566# PDF export; suppress AutoColor BackgroundColor generation (see above)
533cdf0e10cSrcweir                     bScreenDisplay = false;
534cdf0e10cSrcweir                 }
535cdf0e10cSrcweir 
536cdf0e10cSrcweir                 // #i75566# Name change GetBackgroundColor -> GetPageBackgroundColor and
537cdf0e10cSrcweir                 // hint value if screen display. Only then the AutoColor mechanisms shall be applied
538cdf0e10cSrcweir                 rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor(pPgView, bScreenDisplay) );
539cdf0e10cSrcweir             }
540cdf0e10cSrcweir         }
541cdf0e10cSrcweir 
542cdf0e10cSrcweir         ViewRedirector aViewRedirector;
543cdf0e10cSrcweir         FmFormView::CompleteRedraw(pOutDev, rReg, pRedirector ? pRedirector : &aViewRedirector);
544cdf0e10cSrcweir     }
545cdf0e10cSrcweir     // oder speichern?
546cdf0e10cSrcweir     else
547cdf0e10cSrcweir     {
548cdf0e10cSrcweir         if (!mpLockedRedraws)
549cdf0e10cSrcweir             mpLockedRedraws = new List;
550cdf0e10cSrcweir 
551cdf0e10cSrcweir         SdViewRedrawRec* pRec = new SdViewRedrawRec;
552cdf0e10cSrcweir         pRec->mpOut = pOutDev;
553cdf0e10cSrcweir         pRec->aRect = rReg.GetBoundRect();
554cdf0e10cSrcweir         mpLockedRedraws->Insert(pRec, LIST_APPEND);
555cdf0e10cSrcweir     }
556cdf0e10cSrcweir }
557cdf0e10cSrcweir 
558cdf0e10cSrcweir 
559cdf0e10cSrcweir /*************************************************************************
560cdf0e10cSrcweir |*
561cdf0e10cSrcweir |* Selektion hat sich geaendert
562cdf0e10cSrcweir |*
563cdf0e10cSrcweir \************************************************************************/
564cdf0e10cSrcweir 
565cdf0e10cSrcweir void View::MarkListHasChanged()
566cdf0e10cSrcweir {
567cdf0e10cSrcweir     FmFormView::MarkListHasChanged();
568cdf0e10cSrcweir 
569cdf0e10cSrcweir     if( GetMarkedObjectCount() > 0 )
570cdf0e10cSrcweir         maSmartTags.deselect();
571cdf0e10cSrcweir }
572cdf0e10cSrcweir 
573cdf0e10cSrcweir 
574cdf0e10cSrcweir /*************************************************************************
575cdf0e10cSrcweir |*
576cdf0e10cSrcweir |* Attribute setzen
577cdf0e10cSrcweir |*
578cdf0e10cSrcweir \************************************************************************/
579cdf0e10cSrcweir 
580cdf0e10cSrcweir sal_Bool View::SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll)
581cdf0e10cSrcweir {
582cdf0e10cSrcweir     sal_Bool bOk = FmFormView::SetAttributes(rSet, bReplaceAll);
583cdf0e10cSrcweir     return (bOk);
584cdf0e10cSrcweir }
585cdf0e10cSrcweir 
586cdf0e10cSrcweir 
587cdf0e10cSrcweir /*************************************************************************
588cdf0e10cSrcweir |*
589cdf0e10cSrcweir |* Attribute holen
590cdf0e10cSrcweir |*
591cdf0e10cSrcweir \************************************************************************/
592cdf0e10cSrcweir 
593cdf0e10cSrcweir sal_Bool View::GetAttributes( SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr ) const
594cdf0e10cSrcweir {
595cdf0e10cSrcweir     return( FmFormView::GetAttributes( rTargetSet, bOnlyHardAttr ) );
596cdf0e10cSrcweir }
597cdf0e10cSrcweir 
598cdf0e10cSrcweir 
599cdf0e10cSrcweir /*************************************************************************
600cdf0e10cSrcweir |*
601cdf0e10cSrcweir |* Ist ein Praesentationsobjekt selektiert?
602cdf0e10cSrcweir |*
603cdf0e10cSrcweir \************************************************************************/
604cdf0e10cSrcweir 
605cdf0e10cSrcweir sal_Bool View::IsPresObjSelected(sal_Bool bOnPage, sal_Bool bOnMasterPage, sal_Bool bCheckPresObjListOnly, sal_Bool bCheckLayoutOnly) const
606cdf0e10cSrcweir {
607cdf0e10cSrcweir     /**************************************************************************
608cdf0e10cSrcweir     * Ist ein Presentationsobjekt selektiert?
609cdf0e10cSrcweir     **************************************************************************/
610cdf0e10cSrcweir     SdrMarkList* pMarkList;
611cdf0e10cSrcweir 
612cdf0e10cSrcweir     if (mnDragSrcPgNum != SDRPAGE_NOTFOUND &&
613cdf0e10cSrcweir         mnDragSrcPgNum != GetSdrPageView()->GetPage()->GetPageNum())
614cdf0e10cSrcweir     {
615cdf0e10cSrcweir         // Es laeuft gerade Drag&Drop
616cdf0e10cSrcweir         // Source- und Destination-Page unterschiedlich:
617cdf0e10cSrcweir         // es wird die gemerkte MarkList verwendet
618cdf0e10cSrcweir         pMarkList = mpDragSrcMarkList;
619cdf0e10cSrcweir     }
620cdf0e10cSrcweir     else
621cdf0e10cSrcweir     {
622cdf0e10cSrcweir         // Es wird die aktuelle MarkList verwendet
623cdf0e10cSrcweir         pMarkList = new SdrMarkList(GetMarkedObjectList());
624cdf0e10cSrcweir     }
625cdf0e10cSrcweir 
626cdf0e10cSrcweir     SdrMark* pMark;
627cdf0e10cSrcweir     SdPage* pPage;
628cdf0e10cSrcweir     SdrObject* pObj;
629cdf0e10cSrcweir 
630cdf0e10cSrcweir     sal_Bool bSelected = sal_False;
631cdf0e10cSrcweir     sal_Bool bMasterPage = sal_False;
632cdf0e10cSrcweir     long nMark;
633cdf0e10cSrcweir     long nMarkMax = long(pMarkList->GetMarkCount()) - 1;
634cdf0e10cSrcweir 
635cdf0e10cSrcweir     for (nMark = nMarkMax; (nMark >= 0) && !bSelected; nMark--)
636cdf0e10cSrcweir     {
637cdf0e10cSrcweir         // Rueckwaerts durch die Marklist
638cdf0e10cSrcweir         pMark = pMarkList->GetMark(nMark);
639cdf0e10cSrcweir         pObj = pMark->GetMarkedSdrObj();
640cdf0e10cSrcweir 
641cdf0e10cSrcweir         if ( pObj && ( bCheckPresObjListOnly || pObj->IsEmptyPresObj() || pObj->GetUserCall() ) )
642cdf0e10cSrcweir         {
643cdf0e10cSrcweir             pPage = (SdPage*) pObj->GetPage();
644cdf0e10cSrcweir             bMasterPage = pPage->IsMasterPage();
645cdf0e10cSrcweir 
646cdf0e10cSrcweir             if ( (bMasterPage && bOnMasterPage) || (!bMasterPage && bOnPage) )
647cdf0e10cSrcweir             {
648cdf0e10cSrcweir                 if ( pPage && pPage->IsPresObj(pObj) )
649cdf0e10cSrcweir                 {
650cdf0e10cSrcweir                     if( bCheckLayoutOnly )
651cdf0e10cSrcweir                     {
652cdf0e10cSrcweir                         PresObjKind eKind = pPage->GetPresObjKind(pObj);
653cdf0e10cSrcweir 
654cdf0e10cSrcweir                         if((eKind != PRESOBJ_FOOTER) && (eKind != PRESOBJ_HEADER) && (eKind != PRESOBJ_DATETIME) && (eKind != PRESOBJ_SLIDENUMBER) )
655cdf0e10cSrcweir                             bSelected = sal_True;
656cdf0e10cSrcweir                     }
657cdf0e10cSrcweir                     else
658cdf0e10cSrcweir                     {
659cdf0e10cSrcweir                         bSelected = sal_True;
660cdf0e10cSrcweir                     }
661cdf0e10cSrcweir                 }
662cdf0e10cSrcweir             }
663cdf0e10cSrcweir         }
664cdf0e10cSrcweir     }
665cdf0e10cSrcweir 
666cdf0e10cSrcweir     if (pMarkList != mpDragSrcMarkList)
667cdf0e10cSrcweir     {
668cdf0e10cSrcweir        delete pMarkList;
669cdf0e10cSrcweir     }
670cdf0e10cSrcweir 
671cdf0e10cSrcweir     return (bSelected);
672cdf0e10cSrcweir }
673cdf0e10cSrcweir 
674cdf0e10cSrcweir /*************************************************************************
675cdf0e10cSrcweir |*
676cdf0e10cSrcweir |* Alles selektieren
677cdf0e10cSrcweir |*
678cdf0e10cSrcweir \************************************************************************/
679cdf0e10cSrcweir 
680cdf0e10cSrcweir void View::SelectAll()
681cdf0e10cSrcweir {
682cdf0e10cSrcweir     if ( IsTextEdit() )
683cdf0e10cSrcweir     {
684cdf0e10cSrcweir         OutlinerView* pOLV = GetTextEditOutlinerView();
685cdf0e10cSrcweir         const ::Outliner* pOutliner = GetTextEditOutliner();
686cdf0e10cSrcweir         pOLV->SelectRange( 0, (sal_uInt16) pOutliner->GetParagraphCount() );
687cdf0e10cSrcweir     }
688cdf0e10cSrcweir     else
689cdf0e10cSrcweir     {
690cdf0e10cSrcweir         MarkAll();
691cdf0e10cSrcweir     }
692cdf0e10cSrcweir }
693cdf0e10cSrcweir 
694cdf0e10cSrcweir 
695cdf0e10cSrcweir /*************************************************************************
696cdf0e10cSrcweir |*
697cdf0e10cSrcweir |* Dokument hat sich geaendert
698cdf0e10cSrcweir |*
699cdf0e10cSrcweir \************************************************************************/
700cdf0e10cSrcweir 
701cdf0e10cSrcweir void View::ModelHasChanged()
702cdf0e10cSrcweir {
703cdf0e10cSrcweir     // Erst SdrView benachrichtigen
704cdf0e10cSrcweir     FmFormView::ModelHasChanged();
705cdf0e10cSrcweir }
706cdf0e10cSrcweir 
707cdf0e10cSrcweir /*************************************************************************
708cdf0e10cSrcweir |*
709cdf0e10cSrcweir |* StyleSheet setzen
710cdf0e10cSrcweir |*
711cdf0e10cSrcweir \************************************************************************/
712cdf0e10cSrcweir 
713cdf0e10cSrcweir sal_Bool View::SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
714cdf0e10cSrcweir {
715cdf0e10cSrcweir     // weiter an SdrView
716cdf0e10cSrcweir     return FmFormView::SetStyleSheet(pStyleSheet, bDontRemoveHardAttr);
717cdf0e10cSrcweir }
718cdf0e10cSrcweir 
719cdf0e10cSrcweir 
720cdf0e10cSrcweir /*************************************************************************
721cdf0e10cSrcweir |*
722cdf0e10cSrcweir |* Texteingabe beginnen
723cdf0e10cSrcweir |*
724cdf0e10cSrcweir \************************************************************************/
725cdf0e10cSrcweir 
726cdf0e10cSrcweir static void SetSpellOptions( SdDrawDocument* pDoc, sal_uLong& rCntrl )
727cdf0e10cSrcweir {
728cdf0e10cSrcweir     sal_Bool bOnlineSpell = pDoc->GetOnlineSpell();
729cdf0e10cSrcweir 
730cdf0e10cSrcweir     if( bOnlineSpell )
731cdf0e10cSrcweir         rCntrl |= EE_CNTRL_ONLINESPELLING;
732cdf0e10cSrcweir     else
733cdf0e10cSrcweir         rCntrl &= ~EE_CNTRL_ONLINESPELLING;
734cdf0e10cSrcweir }
735cdf0e10cSrcweir 
736cdf0e10cSrcweir sal_Bool View::SdrBeginTextEdit(
737cdf0e10cSrcweir     SdrObject* pObj, SdrPageView* pPV, ::Window* pWin,
738cdf0e10cSrcweir     sal_Bool bIsNewObj,
739cdf0e10cSrcweir     SdrOutliner* pOutl, OutlinerView* pGivenOutlinerView,
740cdf0e10cSrcweir     sal_Bool bDontDeleteOutliner, sal_Bool bOnlyOneView, sal_Bool bGrabFocus )
741cdf0e10cSrcweir {
742cdf0e10cSrcweir     GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent(
743cdf0e10cSrcweir         sd::tools::EventMultiplexerEvent::EID_BEGIN_TEXT_EDIT, (void*)pObj );
744cdf0e10cSrcweir 
745cdf0e10cSrcweir     if( pOutl==NULL && pObj )
746cdf0e10cSrcweir         pOutl = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, pObj->GetModel() );
747cdf0e10cSrcweir 
748cdf0e10cSrcweir     // make draw&impress specific initialisations
749cdf0e10cSrcweir     if( pOutl )
750cdf0e10cSrcweir     {
751cdf0e10cSrcweir         pOutl->SetStyleSheetPool((SfxStyleSheetPool*) mpDoc->GetStyleSheetPool());
752cdf0e10cSrcweir         pOutl->SetCalcFieldValueHdl(LINK(SD_MOD(), SdModule, CalcFieldValueHdl));
753cdf0e10cSrcweir         sal_uLong nCntrl = pOutl->GetControlWord();
754cdf0e10cSrcweir         nCntrl |= EE_CNTRL_ALLOWBIGOBJS;
755cdf0e10cSrcweir         nCntrl |= EE_CNTRL_URLSFXEXECUTE;
756cdf0e10cSrcweir         nCntrl |= EE_CNTRL_MARKFIELDS;
757cdf0e10cSrcweir         nCntrl |= EE_CNTRL_AUTOCORRECT;
758cdf0e10cSrcweir 
759cdf0e10cSrcweir         nCntrl &= ~EE_CNTRL_ULSPACESUMMATION;
760cdf0e10cSrcweir         if ( mpDoc->IsSummationOfParagraphs() )
761cdf0e10cSrcweir             nCntrl |= EE_CNTRL_ULSPACESUMMATION;
762cdf0e10cSrcweir 
763cdf0e10cSrcweir         SetSpellOptions( mpDoc, nCntrl );
764cdf0e10cSrcweir 
765cdf0e10cSrcweir         pOutl->SetControlWord(nCntrl);
766cdf0e10cSrcweir 
767cdf0e10cSrcweir         Reference< linguistic2::XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
768cdf0e10cSrcweir         if ( xSpellChecker.is() )
769cdf0e10cSrcweir             pOutl->SetSpeller( xSpellChecker );
770cdf0e10cSrcweir 
771cdf0e10cSrcweir         Reference< linguistic2::XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
772cdf0e10cSrcweir         if( xHyphenator.is() )
773cdf0e10cSrcweir             pOutl->SetHyphenator( xHyphenator );
774cdf0e10cSrcweir 
775cdf0e10cSrcweir         pOutl->SetDefaultLanguage( Application::GetSettings().GetLanguage() );
776cdf0e10cSrcweir     }
777cdf0e10cSrcweir 
778cdf0e10cSrcweir     sal_Bool bReturn = FmFormView::SdrBeginTextEdit(
779cdf0e10cSrcweir         pObj, pPV, pWin, bIsNewObj, pOutl,
780cdf0e10cSrcweir         pGivenOutlinerView, bDontDeleteOutliner,
781cdf0e10cSrcweir         bOnlyOneView, bGrabFocus);
782cdf0e10cSrcweir 
78395a18594SAndre Fischer     ContextChangeEventMultiplexer::NotifyContextChange(
784f120fe41SAndre Fischer         &GetViewShell()->GetViewShellBase(),
785f120fe41SAndre Fischer         ::sfx2::sidebar::EnumContext::Context_DrawText);
78695a18594SAndre Fischer 
787cdf0e10cSrcweir     if (bReturn)
788cdf0e10cSrcweir     {
789cdf0e10cSrcweir         ::Outliner* pOL = GetTextEditOutliner();
790cdf0e10cSrcweir 
791cdf0e10cSrcweir         if( pObj && pObj->GetPage() )
792cdf0e10cSrcweir         {
793cdf0e10cSrcweir             Color aBackground;
794cdf0e10cSrcweir             if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_TABLE )
795cdf0e10cSrcweir             {
796cdf0e10cSrcweir                 aBackground = GetTextEditBackgroundColor(*this);
797cdf0e10cSrcweir             }
798cdf0e10cSrcweir             else
799cdf0e10cSrcweir             {
800cdf0e10cSrcweir                 aBackground = pObj->GetPage()->GetPageBackgroundColor(pPV);
801cdf0e10cSrcweir             }
80202c50d82SAndre Fischer             if (pOL != NULL)
803cdf0e10cSrcweir                 pOL->SetBackgroundColor( aBackground  );
804cdf0e10cSrcweir         }
805cdf0e10cSrcweir 
80602c50d82SAndre Fischer         if (pOL != NULL)
80702c50d82SAndre Fischer         {
808cdf0e10cSrcweir             pOL->SetParaInsertedHdl(LINK(this, View, OnParagraphInsertedHdl));
809cdf0e10cSrcweir             pOL->SetParaRemovingHdl(LINK(this, View, OnParagraphRemovingHdl));
810cdf0e10cSrcweir         }
81102c50d82SAndre Fischer     }
812cdf0e10cSrcweir 
813cdf0e10cSrcweir     return(bReturn);
814cdf0e10cSrcweir }
815cdf0e10cSrcweir 
816cdf0e10cSrcweir /** ends current text editing */
817cdf0e10cSrcweir SdrEndTextEditKind View::SdrEndTextEdit(sal_Bool bDontDeleteReally )
818cdf0e10cSrcweir {
819cdf0e10cSrcweir     SdrObjectWeakRef xObj( GetTextEditObject() );
820cdf0e10cSrcweir 
821cdf0e10cSrcweir     sal_Bool bDefaultTextRestored = RestoreDefaultText( dynamic_cast< SdrTextObj* >( GetTextEditObject() ) );
822cdf0e10cSrcweir 
823cdf0e10cSrcweir     SdrEndTextEditKind eKind = FmFormView::SdrEndTextEdit(bDontDeleteReally);
824cdf0e10cSrcweir 
825cdf0e10cSrcweir     if( bDefaultTextRestored )
826cdf0e10cSrcweir     {
827cdf0e10cSrcweir         if( xObj.is() && !xObj->IsEmptyPresObj() )
828cdf0e10cSrcweir         {
829cdf0e10cSrcweir             xObj->SetEmptyPresObj( sal_True );
830cdf0e10cSrcweir         }
831cdf0e10cSrcweir         else
832cdf0e10cSrcweir         {
833cdf0e10cSrcweir             eKind = SDRENDTEXTEDIT_UNCHANGED;
834cdf0e10cSrcweir         }
835cdf0e10cSrcweir     }
836cdf0e10cSrcweir     else if( xObj.is() && xObj->IsEmptyPresObj() )
837cdf0e10cSrcweir     {
838cdf0e10cSrcweir         SdrTextObj* pObj = dynamic_cast< SdrTextObj* >( xObj.get() );
839cdf0e10cSrcweir         if( pObj && pObj->HasText() )
840cdf0e10cSrcweir         {
841cdf0e10cSrcweir             SdrPage* pPage = pObj->GetPage();
842cdf0e10cSrcweir             if( !pPage || !pPage->IsMasterPage() )
843cdf0e10cSrcweir                 pObj->SetEmptyPresObj( sal_False );
844cdf0e10cSrcweir         }
845cdf0e10cSrcweir     }
846cdf0e10cSrcweir 
84795a18594SAndre Fischer     GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent(
84895a18594SAndre Fischer         sd::tools::EventMultiplexerEvent::EID_END_TEXT_EDIT,
84995a18594SAndre Fischer         (void*)xObj.get() );
850cdf0e10cSrcweir 
851cdf0e10cSrcweir     if( xObj.is() )
852cdf0e10cSrcweir     {
853f120fe41SAndre Fischer         ContextChangeEventMultiplexer::NotifyContextChange(
854f120fe41SAndre Fischer             &GetViewShell()->GetViewShellBase(),
855f120fe41SAndre Fischer             ::sfx2::sidebar::EnumContext::Context_Default);
856f120fe41SAndre Fischer 
857cdf0e10cSrcweir         SdPage* pPage = dynamic_cast< SdPage* >( xObj->GetPage() );
858cdf0e10cSrcweir         if( pPage )
859cdf0e10cSrcweir             pPage->onEndTextEdit( xObj.get() );
860cdf0e10cSrcweir     }
861cdf0e10cSrcweir 
862cdf0e10cSrcweir     return(eKind);
863cdf0e10cSrcweir }
864cdf0e10cSrcweir 
865cdf0e10cSrcweir // --------------------------------------------------------------------
866cdf0e10cSrcweir 
867cdf0e10cSrcweir /** restores the default text if the given text object is currently in edit mode and
868cdf0e10cSrcweir     no text has been entered already. Is only usefull just before text edit ends. */
869cdf0e10cSrcweir bool View::RestoreDefaultText( SdrTextObj* pTextObj )
870cdf0e10cSrcweir {
871cdf0e10cSrcweir     bool bRestored = false;
872cdf0e10cSrcweir 
873cdf0e10cSrcweir     if( pTextObj && (pTextObj == GetTextEditObject()) )
874cdf0e10cSrcweir     {
875cdf0e10cSrcweir         if( !pTextObj->HasText() )
876cdf0e10cSrcweir         {
877cdf0e10cSrcweir             SdPage* pPage = dynamic_cast< SdPage* >( pTextObj->GetPage() );
878cdf0e10cSrcweir 
879cdf0e10cSrcweir             if(pPage)
880cdf0e10cSrcweir             {
881cdf0e10cSrcweir                 bRestored = pPage->RestoreDefaultText( pTextObj );
882cdf0e10cSrcweir                 if( bRestored )
883cdf0e10cSrcweir                 {
884cdf0e10cSrcweir                     SdrOutliner* pOutliner = GetTextEditOutliner();
885cdf0e10cSrcweir                     pTextObj->SetTextEditOutliner( pOutliner );
886cdf0e10cSrcweir                     OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject();
887cdf0e10cSrcweir                     if (pOutliner)
888cdf0e10cSrcweir                         pOutliner->SetText(*pParaObj);
889cdf0e10cSrcweir                 }
890cdf0e10cSrcweir             }
891cdf0e10cSrcweir         }
892cdf0e10cSrcweir     }
893cdf0e10cSrcweir 
894cdf0e10cSrcweir     return bRestored;
895cdf0e10cSrcweir }
896cdf0e10cSrcweir 
897cdf0e10cSrcweir /*************************************************************************
898cdf0e10cSrcweir |*
899cdf0e10cSrcweir |* Originalgroesse der markierten Objekte setzen
900cdf0e10cSrcweir |*
901cdf0e10cSrcweir \************************************************************************/
902cdf0e10cSrcweir 
903cdf0e10cSrcweir void View::SetMarkedOriginalSize()
904cdf0e10cSrcweir {
905cdf0e10cSrcweir     SdrUndoGroup*   pUndoGroup = new SdrUndoGroup(*mpDoc);
906cdf0e10cSrcweir     sal_uLong           nCount = GetMarkedObjectCount();
907cdf0e10cSrcweir     sal_Bool            bOK = sal_False;
908cdf0e10cSrcweir 
909cdf0e10cSrcweir     for( sal_uInt32 i = 0; i < nCount; i++ )
910cdf0e10cSrcweir     {
911cdf0e10cSrcweir         SdrObject* pObj = GetMarkedObjectByIndex(i);
912cdf0e10cSrcweir 
913cdf0e10cSrcweir         if( pObj->GetObjInventor() == SdrInventor )
914cdf0e10cSrcweir         {
915cdf0e10cSrcweir             if( pObj->GetObjIdentifier() == OBJ_OLE2 )
916cdf0e10cSrcweir             {
917cdf0e10cSrcweir                 uno::Reference < embed::XEmbeddedObject > xObj = ((SdrOle2Obj*)pObj)->GetObjRef();
918cdf0e10cSrcweir                 if( xObj.is() )
919cdf0e10cSrcweir                 {
920cdf0e10cSrcweir                     // TODO/LEAN: working with VisualArea can switch object to running state
921cdf0e10cSrcweir 
922cdf0e10cSrcweir                     sal_Int64 nAspect = ((SdrOle2Obj*)pObj)->GetAspect();
923cdf0e10cSrcweir                     Size aOleSize;
924cdf0e10cSrcweir 
925cdf0e10cSrcweir                     if ( nAspect == embed::Aspects::MSOLE_ICON )
926cdf0e10cSrcweir                     {
927cdf0e10cSrcweir                         MapMode aMap100( MAP_100TH_MM );
928cdf0e10cSrcweir                         aOleSize = ((SdrOle2Obj*)pObj)->GetOrigObjSize( &aMap100 );
929cdf0e10cSrcweir                         bOK = sal_True;
930cdf0e10cSrcweir                     }
931cdf0e10cSrcweir                     else
932cdf0e10cSrcweir                     {
933cdf0e10cSrcweir                         MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
934cdf0e10cSrcweir                         try
935cdf0e10cSrcweir                         {
936cdf0e10cSrcweir                             awt::Size aSz = xObj->getVisualAreaSize( nAspect );
937cdf0e10cSrcweir                             aOleSize = OutputDevice::LogicToLogic( Size( aSz.Width, aSz.Height ), aUnit, MAP_100TH_MM );
938cdf0e10cSrcweir                             bOK = sal_True;
939cdf0e10cSrcweir                         }
940cdf0e10cSrcweir                         catch( embed::NoVisualAreaSizeException& )
941cdf0e10cSrcweir                         {}
942cdf0e10cSrcweir                     }
943cdf0e10cSrcweir 
944cdf0e10cSrcweir                     if ( bOK )
945cdf0e10cSrcweir                     {
946cdf0e10cSrcweir                         Rectangle   aDrawRect( pObj->GetLogicRect() );
947cdf0e10cSrcweir 
948cdf0e10cSrcweir                         pUndoGroup->AddAction( mpDoc->GetSdrUndoFactory().CreateUndoGeoObject( *pObj ) );
949cdf0e10cSrcweir                         pObj->Resize( aDrawRect.TopLeft(), Fraction( aOleSize.Width(), aDrawRect.GetWidth() ),
950cdf0e10cSrcweir                                                         Fraction( aOleSize.Height(), aDrawRect.GetHeight() ) );
951cdf0e10cSrcweir                     }
952cdf0e10cSrcweir                 }
953cdf0e10cSrcweir             }
954cdf0e10cSrcweir             else if( pObj->GetObjIdentifier() == OBJ_GRAF )
955cdf0e10cSrcweir             {
956cdf0e10cSrcweir                 const MapMode   aMap100( MAP_100TH_MM );
957cdf0e10cSrcweir                 Size            aSize;
958cdf0e10cSrcweir 
959cdf0e10cSrcweir                 if ( static_cast< SdrGrafObj* >( pObj )->GetGrafPrefMapMode().GetMapUnit() == MAP_PIXEL )
960cdf0e10cSrcweir                     aSize = Application::GetDefaultDevice()->PixelToLogic( static_cast< SdrGrafObj* >( pObj )->GetGrafPrefSize(), aMap100 );
961cdf0e10cSrcweir                 else
962cdf0e10cSrcweir                 {
963cdf0e10cSrcweir                     aSize = OutputDevice::LogicToLogic( static_cast< SdrGrafObj* >( pObj )->GetGrafPrefSize(),
964cdf0e10cSrcweir                                                         static_cast< SdrGrafObj* >( pObj )->GetGrafPrefMapMode(),
965cdf0e10cSrcweir                                                         aMap100 );
966cdf0e10cSrcweir                 }
967cdf0e10cSrcweir 
968cdf0e10cSrcweir                 pUndoGroup->AddAction( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj ) );
969cdf0e10cSrcweir                 Rectangle aRect( pObj->GetLogicRect() );
970cdf0e10cSrcweir                 aRect.SetSize( aSize );
971cdf0e10cSrcweir                 pObj->SetLogicRect( aRect );
972cdf0e10cSrcweir 
973cdf0e10cSrcweir                 bOK = sal_True;
974cdf0e10cSrcweir             }
975cdf0e10cSrcweir         }
976cdf0e10cSrcweir     }
977cdf0e10cSrcweir 
978cdf0e10cSrcweir     if( bOK )
979cdf0e10cSrcweir     {
980cdf0e10cSrcweir         pUndoGroup->SetComment( String(SdResId(STR_UNDO_ORIGINALSIZE)) );
981cdf0e10cSrcweir         mpDocSh->GetUndoManager()->AddUndoAction(pUndoGroup);
982cdf0e10cSrcweir     }
983cdf0e10cSrcweir     else
984cdf0e10cSrcweir         delete pUndoGroup;
985cdf0e10cSrcweir }
986cdf0e10cSrcweir 
987cdf0e10cSrcweir /*************************************************************************
988cdf0e10cSrcweir |*
989cdf0e10cSrcweir |* OLE-Obj am Client connecten
990cdf0e10cSrcweir |*
991cdf0e10cSrcweir \************************************************************************/
992cdf0e10cSrcweir 
993cdf0e10cSrcweir void View::DoConnect(SdrOle2Obj* pObj)
994cdf0e10cSrcweir {
995cdf0e10cSrcweir     if (mpViewSh)
996cdf0e10cSrcweir     {
997cdf0e10cSrcweir         uno::Reference < embed::XEmbeddedObject > xObj( pObj->GetObjRef() );
998cdf0e10cSrcweir         if( xObj.is() )
999cdf0e10cSrcweir         {
1000cdf0e10cSrcweir             ::sd::Window* pWindow = mpViewSh->GetActiveWindow();
1001cdf0e10cSrcweir             SfxInPlaceClient* pSdClient = mpViewSh-> GetViewShellBase().FindIPClient( xObj, pWindow );
1002cdf0e10cSrcweir             if ( !pSdClient )
1003cdf0e10cSrcweir             {
1004cdf0e10cSrcweir                 pSdClient = new Client(pObj, mpViewSh, pWindow);
1005cdf0e10cSrcweir                 Rectangle aRect = pObj->GetLogicRect();
1006cdf0e10cSrcweir                 {
1007cdf0e10cSrcweir                     // TODO/LEAN: working with visual area can switch object to running state
1008cdf0e10cSrcweir                     Size aDrawSize = aRect.GetSize();
1009cdf0e10cSrcweir                     awt::Size aSz;
1010cdf0e10cSrcweir 
1011cdf0e10cSrcweir                     MapMode aMapMode( mpDoc->GetScaleUnit() );
1012cdf0e10cSrcweir                     Size aObjAreaSize = pObj->GetOrigObjSize( &aMapMode );
1013cdf0e10cSrcweir 
1014cdf0e10cSrcweir                     Fraction aScaleWidth (aDrawSize.Width(),  aObjAreaSize.Width() );
1015cdf0e10cSrcweir                     Fraction aScaleHeight(aDrawSize.Height(), aObjAreaSize.Height() );
1016cdf0e10cSrcweir                     aScaleWidth.ReduceInaccurate(10);       // kompatibel zum SdrOle2Obj
1017cdf0e10cSrcweir                     aScaleHeight.ReduceInaccurate(10);
1018cdf0e10cSrcweir                     pSdClient->SetSizeScale(aScaleWidth, aScaleHeight);
1019cdf0e10cSrcweir 
1020cdf0e10cSrcweir                     // sichtbarer Ausschnitt wird nur inplace veraendert!
1021cdf0e10cSrcweir                     // the object area must be set after the scaling, since it triggers resize
1022cdf0e10cSrcweir                     aRect.SetSize(aObjAreaSize);
1023cdf0e10cSrcweir                     pSdClient->SetObjArea(aRect);
1024cdf0e10cSrcweir                 }
1025cdf0e10cSrcweir             }
1026cdf0e10cSrcweir         }
1027cdf0e10cSrcweir     }
1028cdf0e10cSrcweir }
1029cdf0e10cSrcweir 
1030cdf0e10cSrcweir /*************************************************************************
1031cdf0e10cSrcweir |*
1032cdf0e10cSrcweir |*
1033cdf0e10cSrcweir |*
1034cdf0e10cSrcweir \************************************************************************/
1035cdf0e10cSrcweir 
1036cdf0e10cSrcweir sal_Bool View::IsMorphingAllowed() const
1037cdf0e10cSrcweir {
1038cdf0e10cSrcweir     const SdrMarkList&  rMarkList = GetMarkedObjectList();
1039cdf0e10cSrcweir     sal_Bool                bRet = sal_False;
1040cdf0e10cSrcweir 
1041cdf0e10cSrcweir     if ( rMarkList.GetMarkCount() == 2 )
1042cdf0e10cSrcweir     {
1043cdf0e10cSrcweir         const SdrObject*    pObj1 = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
1044cdf0e10cSrcweir         const SdrObject*    pObj2 = rMarkList.GetMark( 1 )->GetMarkedSdrObj();
1045cdf0e10cSrcweir         const sal_uInt16        nKind1 = pObj1->GetObjIdentifier();
1046cdf0e10cSrcweir         const sal_uInt16        nKind2 = pObj2->GetObjIdentifier();
1047cdf0e10cSrcweir 
1048cdf0e10cSrcweir         if ( ( nKind1 != OBJ_TEXT && nKind2 != OBJ_TEXT ) &&
1049cdf0e10cSrcweir              ( nKind1 != OBJ_TITLETEXT && nKind2 != OBJ_TITLETEXT ) &&
1050cdf0e10cSrcweir              ( nKind1 != OBJ_OUTLINETEXT && nKind2 != OBJ_OUTLINETEXT ) &&
1051cdf0e10cSrcweir              ( nKind1 != OBJ_GRUP && nKind2 != OBJ_GRUP ) &&
1052cdf0e10cSrcweir              ( nKind1 != OBJ_LINE && nKind2 != OBJ_LINE ) &&
1053cdf0e10cSrcweir              ( nKind1 != OBJ_PLIN && nKind2 != OBJ_PLIN ) &&
1054cdf0e10cSrcweir              ( nKind1 != OBJ_PATHLINE && nKind2 != OBJ_PATHLINE ) &&
1055cdf0e10cSrcweir              ( nKind1 != OBJ_FREELINE && nKind2 != OBJ_FREELINE ) &&
1056cdf0e10cSrcweir              ( nKind1 != OBJ_PATHPLIN && nKind2 != OBJ_PATHPLIN ) &&
1057cdf0e10cSrcweir              ( nKind1 != OBJ_MEASURE && nKind2 != OBJ_MEASURE ) &&
1058cdf0e10cSrcweir              ( nKind1 != OBJ_EDGE && nKind2 != OBJ_EDGE ) &&
1059cdf0e10cSrcweir              ( nKind1 != OBJ_GRAF && nKind2 != OBJ_GRAF ) &&
1060cdf0e10cSrcweir              ( nKind1 != OBJ_OLE2 && nKind2 != OBJ_OLE2 ) &&
1061cdf0e10cSrcweir              ( nKind1 != OBJ_CAPTION && nKind2 !=  OBJ_CAPTION ) &&
1062cdf0e10cSrcweir              !pObj1->ISA( E3dObject) && !pObj2->ISA( E3dObject) )
1063cdf0e10cSrcweir         {
1064cdf0e10cSrcweir             SfxItemSet      aSet1( mpDoc->GetPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE );
1065cdf0e10cSrcweir             SfxItemSet      aSet2( mpDoc->GetPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE );
1066cdf0e10cSrcweir 
1067cdf0e10cSrcweir             aSet1.Put(pObj1->GetMergedItemSet());
1068cdf0e10cSrcweir             aSet2.Put(pObj2->GetMergedItemSet());
1069cdf0e10cSrcweir 
1070cdf0e10cSrcweir             const XFillStyle    eFillStyle1 = ( (const XFillStyleItem&) aSet1.Get( XATTR_FILLSTYLE ) ).GetValue();
1071cdf0e10cSrcweir             const XFillStyle    eFillStyle2 = ( (const XFillStyleItem&) aSet2.Get( XATTR_FILLSTYLE ) ).GetValue();
1072cdf0e10cSrcweir 
1073cdf0e10cSrcweir             if( ( eFillStyle1 == XFILL_NONE || eFillStyle1 == XFILL_SOLID ) &&
1074cdf0e10cSrcweir                 ( eFillStyle2 == XFILL_NONE || eFillStyle2 == XFILL_SOLID ) )
1075cdf0e10cSrcweir                 bRet = sal_True;
1076cdf0e10cSrcweir         }
1077cdf0e10cSrcweir     }
1078cdf0e10cSrcweir 
1079cdf0e10cSrcweir     return bRet;
1080cdf0e10cSrcweir }
1081cdf0e10cSrcweir 
1082cdf0e10cSrcweir /*************************************************************************
1083cdf0e10cSrcweir |*
1084cdf0e10cSrcweir |*
1085cdf0e10cSrcweir |*
1086cdf0e10cSrcweir \************************************************************************/
1087cdf0e10cSrcweir 
1088cdf0e10cSrcweir sal_Bool View::IsVectorizeAllowed() const
1089cdf0e10cSrcweir {
1090cdf0e10cSrcweir     const SdrMarkList&  rMarkList = GetMarkedObjectList();
1091cdf0e10cSrcweir     sal_Bool                bRet = sal_False;
1092cdf0e10cSrcweir 
1093cdf0e10cSrcweir     if( rMarkList.GetMarkCount() == 1 )
1094cdf0e10cSrcweir     {
1095ddde725dSArmin Le Grand         const SdrGrafObj* pObj = dynamic_cast< const SdrGrafObj* >(rMarkList.GetMark( 0 )->GetMarkedSdrObj());
1096cdf0e10cSrcweir 
1097ddde725dSArmin Le Grand         if(pObj)
1098ddde725dSArmin Le Grand         {
1099ddde725dSArmin Le Grand             if(GRAPHIC_BITMAP == pObj->GetGraphicType() && !pObj->isEmbeddedSvg())
1100ddde725dSArmin Le Grand             {
1101cdf0e10cSrcweir                 bRet = sal_True;
1102cdf0e10cSrcweir             }
1103ddde725dSArmin Le Grand         }
1104ddde725dSArmin Le Grand     }
1105cdf0e10cSrcweir 
1106cdf0e10cSrcweir     return bRet;
1107cdf0e10cSrcweir }
1108cdf0e10cSrcweir 
1109cdf0e10cSrcweir void View::onAccessibilityOptionsChanged()
1110cdf0e10cSrcweir {
1111cdf0e10cSrcweir     if( mpViewSh )
1112cdf0e10cSrcweir     {
1113cdf0e10cSrcweir         ::sd::Window* pWindow = mpViewSh->GetActiveWindow();
1114cdf0e10cSrcweir         if( pWindow )
1115cdf0e10cSrcweir         {
1116cdf0e10cSrcweir             const StyleSettings& rStyleSettings = pWindow->GetSettings().GetStyleSettings();
1117cdf0e10cSrcweir 
1118cdf0e10cSrcweir             sal_uInt16 nOutputSlot, nPreviewSlot;
1119cdf0e10cSrcweir 
1120cdf0e10cSrcweir             SvtAccessibilityOptions& aAccOptions = getAccessibilityOptions();
1121cdf0e10cSrcweir 
1122cdf0e10cSrcweir             if( mpViewSh->GetViewFrame() && mpViewSh->GetViewFrame()->GetDispatcher() )
1123cdf0e10cSrcweir             {
1124cdf0e10cSrcweir                 if( rStyleSettings.GetHighContrastMode() )
1125cdf0e10cSrcweir                 {
1126cdf0e10cSrcweir                     nOutputSlot = SID_OUTPUT_QUALITY_CONTRAST;
1127cdf0e10cSrcweir                 }
1128cdf0e10cSrcweir                 else
1129cdf0e10cSrcweir                 {
1130cdf0e10cSrcweir                     nOutputSlot = SID_OUTPUT_QUALITY_COLOR;
1131cdf0e10cSrcweir                 }
1132cdf0e10cSrcweir 
1133cdf0e10cSrcweir                 if( rStyleSettings.GetHighContrastMode() && aAccOptions.GetIsForPagePreviews() )
1134cdf0e10cSrcweir                 {
1135cdf0e10cSrcweir                     nPreviewSlot = SID_PREVIEW_QUALITY_CONTRAST;
1136cdf0e10cSrcweir                 }
1137cdf0e10cSrcweir                 else
1138cdf0e10cSrcweir                 {
1139cdf0e10cSrcweir                     nPreviewSlot = SID_PREVIEW_QUALITY_COLOR;
1140cdf0e10cSrcweir                 }
1141cdf0e10cSrcweir 
1142cdf0e10cSrcweir                 mpViewSh->GetViewFrame()->GetDispatcher()->Execute( nOutputSlot, SFX_CALLMODE_ASYNCHRON );
1143cdf0e10cSrcweir                 mpViewSh->GetViewFrame()->GetDispatcher()->Execute( nPreviewSlot, SFX_CALLMODE_ASYNCHRON );
1144cdf0e10cSrcweir             }
1145cdf0e10cSrcweir 
1146cdf0e10cSrcweir             mpViewSh->Invalidate();
1147cdf0e10cSrcweir         }
1148cdf0e10cSrcweir     }
1149cdf0e10cSrcweir }
1150cdf0e10cSrcweir 
1151cdf0e10cSrcweir IMPL_LINK( View, OnParagraphInsertedHdl, ::Outliner *, pOutliner )
1152cdf0e10cSrcweir {
1153cdf0e10cSrcweir     Paragraph* pPara = pOutliner->GetHdlParagraph();
1154cdf0e10cSrcweir     SdrObject* pObj = GetTextEditObject();
1155cdf0e10cSrcweir 
1156cdf0e10cSrcweir     if( pPara && pObj )
1157cdf0e10cSrcweir     {
1158cdf0e10cSrcweir         SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() );
1159cdf0e10cSrcweir         if( pPage )
1160cdf0e10cSrcweir             pPage->onParagraphInserted( pOutliner, pPara, pObj );
1161cdf0e10cSrcweir     }
1162cdf0e10cSrcweir     return 0;
1163cdf0e10cSrcweir }
1164cdf0e10cSrcweir 
1165cdf0e10cSrcweir /*************************************************************************
1166cdf0e10cSrcweir |*
1167cdf0e10cSrcweir |* Handler fuer das Loeschen von Seiten (Absaetzen)
1168cdf0e10cSrcweir |*
1169cdf0e10cSrcweir \************************************************************************/
1170cdf0e10cSrcweir 
1171cdf0e10cSrcweir IMPL_LINK( View, OnParagraphRemovingHdl, ::Outliner *, pOutliner )
1172cdf0e10cSrcweir {
1173cdf0e10cSrcweir     Paragraph* pPara = pOutliner->GetHdlParagraph();
1174cdf0e10cSrcweir     SdrObject* pObj = GetTextEditObject();
1175cdf0e10cSrcweir 
1176cdf0e10cSrcweir     if( pPara && pObj )
1177cdf0e10cSrcweir     {
1178cdf0e10cSrcweir         SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() );
1179cdf0e10cSrcweir         if( pPage )
1180cdf0e10cSrcweir             pPage->onParagraphRemoving( pOutliner, pPara, pObj );
1181cdf0e10cSrcweir     }
1182cdf0e10cSrcweir     return 0;
1183cdf0e10cSrcweir }
1184cdf0e10cSrcweir 
1185cdf0e10cSrcweir bool View::isRecordingUndo() const
1186cdf0e10cSrcweir {
1187cdf0e10cSrcweir     if( mpDoc && mpDoc->IsUndoEnabled() )
1188cdf0e10cSrcweir     {
1189cdf0e10cSrcweir         sd::UndoManager* pUndoManager = mpDoc ? mpDoc->GetUndoManager() : 0;
1190cdf0e10cSrcweir         return pUndoManager && pUndoManager->IsInListAction();
1191cdf0e10cSrcweir     }
1192cdf0e10cSrcweir     else
1193cdf0e10cSrcweir     {
1194cdf0e10cSrcweir         return false;
1195cdf0e10cSrcweir     }
1196cdf0e10cSrcweir }
1197cdf0e10cSrcweir 
1198cdf0e10cSrcweir void View::AddCustomHdl()
1199cdf0e10cSrcweir {
1200cdf0e10cSrcweir     maSmartTags.addCustomHandles( aHdl );
1201cdf0e10cSrcweir }
1202cdf0e10cSrcweir 
1203cdf0e10cSrcweir void View::updateHandles()
1204cdf0e10cSrcweir {
1205cdf0e10cSrcweir     AdjustMarkHdl();
1206cdf0e10cSrcweir }
1207cdf0e10cSrcweir 
1208cdf0e10cSrcweir SdrViewContext View::GetContext() const
1209cdf0e10cSrcweir {
1210cdf0e10cSrcweir     SdrViewContext eContext = SDRCONTEXT_STANDARD;
1211cdf0e10cSrcweir     if( maSmartTags.getContext( eContext ) )
1212cdf0e10cSrcweir         return eContext;
1213cdf0e10cSrcweir     else
1214cdf0e10cSrcweir         return FmFormView::GetContext();
1215cdf0e10cSrcweir }
1216cdf0e10cSrcweir 
1217cdf0e10cSrcweir sal_Bool View::HasMarkablePoints() const
1218cdf0e10cSrcweir {
1219cdf0e10cSrcweir     if( maSmartTags.HasMarkablePoints() )
1220cdf0e10cSrcweir         return true;
1221cdf0e10cSrcweir     else
1222cdf0e10cSrcweir         return FmFormView::HasMarkablePoints();
1223cdf0e10cSrcweir }
1224cdf0e10cSrcweir 
1225cdf0e10cSrcweir sal_uLong View::GetMarkablePointCount() const
1226cdf0e10cSrcweir {
1227cdf0e10cSrcweir     sal_uLong nCount = FmFormView::GetMarkablePointCount();
1228cdf0e10cSrcweir     nCount += maSmartTags.GetMarkablePointCount();
1229cdf0e10cSrcweir     return nCount;
1230cdf0e10cSrcweir }
1231cdf0e10cSrcweir 
1232cdf0e10cSrcweir sal_Bool View::HasMarkedPoints() const
1233cdf0e10cSrcweir {
1234cdf0e10cSrcweir     if( maSmartTags.HasMarkedPoints() )
1235cdf0e10cSrcweir         return true;
1236cdf0e10cSrcweir     else
1237cdf0e10cSrcweir         return FmFormView::HasMarkedPoints();
1238cdf0e10cSrcweir }
1239cdf0e10cSrcweir 
1240cdf0e10cSrcweir sal_uLong View::GetMarkedPointCount() const
1241cdf0e10cSrcweir {
1242cdf0e10cSrcweir     sal_uLong nCount = FmFormView::GetMarkedPointCount();
1243cdf0e10cSrcweir     nCount += maSmartTags.GetMarkedPointCount();
1244cdf0e10cSrcweir     return nCount;
1245cdf0e10cSrcweir }
1246cdf0e10cSrcweir 
1247cdf0e10cSrcweir sal_Bool View::IsPointMarkable(const SdrHdl& rHdl) const
1248cdf0e10cSrcweir {
1249cdf0e10cSrcweir     if( maSmartTags.IsPointMarkable( rHdl ) )
1250cdf0e10cSrcweir         return true;
1251cdf0e10cSrcweir     else
1252cdf0e10cSrcweir         return FmFormView::IsPointMarkable( rHdl );
1253cdf0e10cSrcweir }
1254cdf0e10cSrcweir 
1255cdf0e10cSrcweir sal_Bool View::MarkPoint(SdrHdl& rHdl, sal_Bool bUnmark )
1256cdf0e10cSrcweir {
1257cdf0e10cSrcweir     if( maSmartTags.MarkPoint( rHdl, bUnmark ) )
1258cdf0e10cSrcweir         return true;
1259cdf0e10cSrcweir     else
1260cdf0e10cSrcweir         return FmFormView::MarkPoint( rHdl, bUnmark );
1261cdf0e10cSrcweir }
1262cdf0e10cSrcweir 
1263cdf0e10cSrcweir sal_Bool View::MarkPoints(const Rectangle* pRect, sal_Bool bUnmark)
1264cdf0e10cSrcweir {
1265cdf0e10cSrcweir     if( maSmartTags.MarkPoints( pRect, bUnmark ) )
1266cdf0e10cSrcweir         return true;
1267cdf0e10cSrcweir     else
1268cdf0e10cSrcweir         return FmFormView::MarkPoints( pRect, bUnmark );
1269cdf0e10cSrcweir }
1270cdf0e10cSrcweir 
1271cdf0e10cSrcweir void View::CheckPossibilities()
1272cdf0e10cSrcweir {
1273cdf0e10cSrcweir     FmFormView::CheckPossibilities();
1274cdf0e10cSrcweir     maSmartTags.CheckPossibilities();
1275cdf0e10cSrcweir }
1276cdf0e10cSrcweir 
1277cdf0e10cSrcweir void View::OnBeginPasteOrDrop( PasteOrDropInfos* /*pInfos*/ )
1278cdf0e10cSrcweir {
1279cdf0e10cSrcweir }
1280cdf0e10cSrcweir 
1281cdf0e10cSrcweir /** this is called after a paste or drop operation, make sure that the newly inserted paragraphs
1282cdf0e10cSrcweir     get the correct style sheet. */
1283cdf0e10cSrcweir void View::OnEndPasteOrDrop( PasteOrDropInfos* pInfos )
1284cdf0e10cSrcweir {
1285cdf0e10cSrcweir     SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( GetTextEditObject() );
1286cdf0e10cSrcweir     SdrOutliner* pOutliner = GetTextEditOutliner();
1287cdf0e10cSrcweir     if( pOutliner && pTextObj && pTextObj->GetPage() )
1288cdf0e10cSrcweir     {
1289cdf0e10cSrcweir         SdPage* pPage = static_cast< SdPage* >( pTextObj->GetPage() );
1290cdf0e10cSrcweir 
1291cdf0e10cSrcweir         SfxStyleSheet* pStyleSheet = 0;
1292cdf0e10cSrcweir 
1293cdf0e10cSrcweir         const PresObjKind eKind = pPage->GetPresObjKind(pTextObj);
1294cdf0e10cSrcweir         if( eKind != PRESOBJ_NONE )
1295cdf0e10cSrcweir             pStyleSheet = pPage->GetStyleSheetForPresObj(eKind);
1296cdf0e10cSrcweir         else
1297cdf0e10cSrcweir             pStyleSheet = pTextObj->GetStyleSheet();
1298cdf0e10cSrcweir 
1299cdf0e10cSrcweir         if( eKind == PRESOBJ_OUTLINE )
1300cdf0e10cSrcweir         {
1301cdf0e10cSrcweir             // for outline shapes, set the correct outline style sheet for each
1302cdf0e10cSrcweir             // new paragraph, depending on the paragraph depth
1303cdf0e10cSrcweir             SfxStyleSheetBasePool* pStylePool = GetDoc()->GetStyleSheetPool();
1304cdf0e10cSrcweir 
1305cdf0e10cSrcweir             for ( sal_uInt16 nPara = pInfos->nStartPara; nPara <= pInfos->nEndPara; nPara++ )
1306cdf0e10cSrcweir             {
1307cdf0e10cSrcweir                 sal_Int16 nDepth = pOutliner->GetDepth( nPara );
1308cdf0e10cSrcweir 
1309cdf0e10cSrcweir                 SfxStyleSheet* pStyle = 0;
1310cdf0e10cSrcweir                 if( nDepth > 0 )
1311cdf0e10cSrcweir                 {
1312cdf0e10cSrcweir                     String aStyleSheetName( pStyleSheet->GetName() );
1313cdf0e10cSrcweir                     aStyleSheetName.Erase( aStyleSheetName.Len() - 1, 1 );
1314cdf0e10cSrcweir                     aStyleSheetName += String::CreateFromInt32( nDepth );
1315cdf0e10cSrcweir                     pStyle = static_cast<SfxStyleSheet*>( pStylePool->Find( aStyleSheetName, pStyleSheet->GetFamily() ) );
1316cdf0e10cSrcweir                     DBG_ASSERT( pStyle, "sd::View::OnEndPasteOrDrop(), Style not found!" );
1317cdf0e10cSrcweir                 }
1318cdf0e10cSrcweir 
1319cdf0e10cSrcweir                 if( !pStyle )
1320cdf0e10cSrcweir                     pStyle = pStyleSheet;
1321cdf0e10cSrcweir 
1322cdf0e10cSrcweir                 pOutliner->SetStyleSheet( nPara, pStyle );
1323cdf0e10cSrcweir             }
1324cdf0e10cSrcweir         }
1325cdf0e10cSrcweir         else
1326cdf0e10cSrcweir         {
1327cdf0e10cSrcweir             // just put the object style on each new paragraph
1328cdf0e10cSrcweir             for ( sal_uInt16 nPara = pInfos->nStartPara; nPara <= pInfos->nEndPara; nPara++ )
1329cdf0e10cSrcweir             {
1330cdf0e10cSrcweir                 pOutliner->SetStyleSheet( nPara, pStyleSheet );
1331cdf0e10cSrcweir             }
1332cdf0e10cSrcweir         }
1333cdf0e10cSrcweir     }
1334cdf0e10cSrcweir }
1335cdf0e10cSrcweir 
1336*766ce4d0SZheng Fan sal_Bool View::ShouldToggleOn(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet)
1337*766ce4d0SZheng Fan {
1338*766ce4d0SZheng Fan     // If setting bullets/numbering by the dialog, always should toggle on.
1339*766ce4d0SZheng Fan     if (!bBulletOnOffMode)
1340*766ce4d0SZheng Fan         return sal_True;
1341*766ce4d0SZheng Fan     SdrModel* pSdrModel = GetModel();
1342*766ce4d0SZheng Fan     if (!pSdrModel)
1343*766ce4d0SZheng Fan         return sal_False;
1344*766ce4d0SZheng Fan 
1345*766ce4d0SZheng Fan     sal_Bool bToggleOn = sal_False;
1346*766ce4d0SZheng Fan     SdrOutliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrModel);
1347*766ce4d0SZheng Fan     sal_uInt32 nMarkCount = GetMarkedObjectCount();
1348*766ce4d0SZheng Fan     for (sal_uInt32 nIndex = 0; nIndex < nMarkCount && !bToggleOn; nIndex++)
1349*766ce4d0SZheng Fan     {
1350*766ce4d0SZheng Fan         SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(GetMarkedObjectByIndex(nIndex));
1351*766ce4d0SZheng Fan         if (!pTextObj || pTextObj->IsTextEditActive())
1352*766ce4d0SZheng Fan             continue;
1353*766ce4d0SZheng Fan         if (pTextObj->ISA(SdrTableObj))
1354*766ce4d0SZheng Fan         {
1355*766ce4d0SZheng Fan             SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >(pTextObj);
1356*766ce4d0SZheng Fan             if (!pTableObj)
1357*766ce4d0SZheng Fan                 continue;
1358*766ce4d0SZheng Fan             CellPos aStart, aEnd;
1359*766ce4d0SZheng Fan             SvxTableController* pTableController = dynamic_cast< SvxTableController* >(getSelectionController().get());
1360*766ce4d0SZheng Fan             if (pTableController)
1361*766ce4d0SZheng Fan             {
1362*766ce4d0SZheng Fan                 pTableController->getSelectedCells(aStart, aEnd);
1363*766ce4d0SZheng Fan             }
1364*766ce4d0SZheng Fan             else
1365*766ce4d0SZheng Fan             {
1366*766ce4d0SZheng Fan                 aStart = pTableObj->getFirstCell();
1367*766ce4d0SZheng Fan                 aEnd = pTableObj->getLastCell();
1368*766ce4d0SZheng Fan             }
1369*766ce4d0SZheng Fan             sal_Int32 nColCount = pTableObj->getColumnCount();
1370*766ce4d0SZheng Fan             for (sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow && !bToggleOn; nRow++)
1371*766ce4d0SZheng Fan             {
1372*766ce4d0SZheng Fan                 for (sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol && !bToggleOn; nCol++)
1373*766ce4d0SZheng Fan                 {
1374*766ce4d0SZheng Fan                     sal_Int32 nIndex = nRow * nColCount + nCol;
1375*766ce4d0SZheng Fan                     SdrText* pText = pTableObj->getText(nIndex);
1376*766ce4d0SZheng Fan                     if (!pText || !pText->GetOutlinerParaObject())
1377*766ce4d0SZheng Fan                         continue;
1378*766ce4d0SZheng Fan                     pOutliner->SetText(*(pText->GetOutlinerParaObject()));
1379*766ce4d0SZheng Fan                     sal_Int16 nStatus = pOutliner->GetBulletsNumberingStatus();
1380*766ce4d0SZheng Fan                     bToggleOn = ((bNormalBullet && nStatus != 0) || (!bNormalBullet && nStatus != 1)) ? sal_True : bToggleOn;
1381*766ce4d0SZheng Fan                     pOutliner->Clear();
1382*766ce4d0SZheng Fan                 }
1383*766ce4d0SZheng Fan             }
1384*766ce4d0SZheng Fan         }
1385*766ce4d0SZheng Fan         else
1386*766ce4d0SZheng Fan         {
1387*766ce4d0SZheng Fan             OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject();
1388*766ce4d0SZheng Fan             if (!pParaObj)
1389*766ce4d0SZheng Fan                 continue;
1390*766ce4d0SZheng Fan             pOutliner->SetText(*pParaObj);
1391*766ce4d0SZheng Fan             sal_Int16 nStatus = pOutliner->GetBulletsNumberingStatus();
1392*766ce4d0SZheng Fan             bToggleOn = ((bNormalBullet && nStatus != 0) || (!bNormalBullet && nStatus != 1)) ? sal_True : bToggleOn;
1393*766ce4d0SZheng Fan             pOutliner->Clear();
1394*766ce4d0SZheng Fan         }
1395*766ce4d0SZheng Fan     }
1396*766ce4d0SZheng Fan     delete pOutliner;
1397*766ce4d0SZheng Fan     return bToggleOn;
1398*766ce4d0SZheng Fan }
1399*766ce4d0SZheng Fan 
1400*766ce4d0SZheng Fan void View::ToggleMarkedObjectsBullets(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet, sal_Bool bMasterView, SvxNumRule* pNumRule, sal_Bool bForceBulletOnOff)
1401*766ce4d0SZheng Fan {
1402*766ce4d0SZheng Fan     SdrModel* pSdrModel = GetModel();
1403*766ce4d0SZheng Fan     Window* pWindow = dynamic_cast< Window* >(GetFirstOutputDevice());
1404*766ce4d0SZheng Fan     if (!pSdrModel || !pWindow)
1405*766ce4d0SZheng Fan         return;
1406*766ce4d0SZheng Fan 
1407*766ce4d0SZheng Fan     sal_Bool bUndoEnabled = pSdrModel->IsUndoEnabled();
1408*766ce4d0SZheng Fan     sal_Bool bToggleOn = ShouldToggleOn(bBulletOnOffMode, bNormalBullet);
1409*766ce4d0SZheng Fan     if ( bForceBulletOnOff ) {
1410*766ce4d0SZheng Fan         bToggleOn = bBulletOnOffMode;
1411*766ce4d0SZheng Fan     }
1412*766ce4d0SZheng Fan     SdrUndoGroup* pUndoGroup = new SdrUndoGroup(*pSdrModel);
1413*766ce4d0SZheng Fan     SdrOutliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrModel);
1414*766ce4d0SZheng Fan     OutlinerView* pOutlinerView = new OutlinerView(pOutliner, pWindow);
1415*766ce4d0SZheng Fan 
1416*766ce4d0SZheng Fan     sal_uInt32 nMarkCount = GetMarkedObjectCount();
1417*766ce4d0SZheng Fan     for (sal_uInt32 nIndex = 0; nIndex < nMarkCount; nIndex++)
1418*766ce4d0SZheng Fan     {
1419*766ce4d0SZheng Fan         SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(GetMarkedObjectByIndex(nIndex));
1420*766ce4d0SZheng Fan         if (!pTextObj || pTextObj->IsTextEditActive())
1421*766ce4d0SZheng Fan             continue;
1422*766ce4d0SZheng Fan         if (pTextObj->ISA(SdrTableObj))
1423*766ce4d0SZheng Fan         {
1424*766ce4d0SZheng Fan             SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >(pTextObj);
1425*766ce4d0SZheng Fan             if (!pTableObj)
1426*766ce4d0SZheng Fan                 continue;
1427*766ce4d0SZheng Fan             CellPos aStart, aEnd;
1428*766ce4d0SZheng Fan             SvxTableController* pTableController = dynamic_cast< SvxTableController* >(getSelectionController().get());
1429*766ce4d0SZheng Fan             if (pTableController)
1430*766ce4d0SZheng Fan             {
1431*766ce4d0SZheng Fan                 pTableController->getSelectedCells(aStart, aEnd);
1432*766ce4d0SZheng Fan             }
1433*766ce4d0SZheng Fan             else
1434*766ce4d0SZheng Fan             {
1435*766ce4d0SZheng Fan                 aStart = pTableObj->getFirstCell();
1436*766ce4d0SZheng Fan                 aEnd = pTableObj->getLastCell();
1437*766ce4d0SZheng Fan             }
1438*766ce4d0SZheng Fan             sal_Int32 nColCount = pTableObj->getColumnCount();
1439*766ce4d0SZheng Fan             for (sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++)
1440*766ce4d0SZheng Fan             {
1441*766ce4d0SZheng Fan                 for (sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++)
1442*766ce4d0SZheng Fan                 {
1443*766ce4d0SZheng Fan                     sal_Int32 nIndex = nRow * nColCount + nCol;
1444*766ce4d0SZheng Fan                     SdrText* pText = pTableObj->getText(nIndex);
1445*766ce4d0SZheng Fan                     if (!pText || !pText->GetOutlinerParaObject())
1446*766ce4d0SZheng Fan                         continue;
1447*766ce4d0SZheng Fan 
1448*766ce4d0SZheng Fan                     pOutliner->SetText(*(pText->GetOutlinerParaObject()));
1449*766ce4d0SZheng Fan                     if (bUndoEnabled)
1450*766ce4d0SZheng Fan                     {
1451*766ce4d0SZheng Fan                         SdrUndoObjSetText* pTxtUndo = dynamic_cast< SdrUndoObjSetText* >(pSdrModel->GetSdrUndoFactory().CreateUndoObjectSetText(*pTextObj, nIndex));
1452*766ce4d0SZheng Fan                         pUndoGroup->AddAction(pTxtUndo);
1453*766ce4d0SZheng Fan                     }
1454*766ce4d0SZheng Fan                     pOutlinerView->ToggleAllParagraphsBullets(bBulletOnOffMode, bNormalBullet, bToggleOn, bMasterView, pNumRule);
1455*766ce4d0SZheng Fan                     sal_uInt32 nParaCount = pOutliner->GetParagraphCount();
1456*766ce4d0SZheng Fan                     pText->SetOutlinerParaObject(pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount));
1457*766ce4d0SZheng Fan                     pOutliner->Clear();
1458*766ce4d0SZheng Fan                 }
1459*766ce4d0SZheng Fan             }
1460*766ce4d0SZheng Fan             // Broadcast the object change event.
1461*766ce4d0SZheng Fan             if (!pTextObj->AdjustTextFrameWidthAndHeight())
1462*766ce4d0SZheng Fan             {
1463*766ce4d0SZheng Fan                 pTextObj->SetChanged();
1464*766ce4d0SZheng Fan                 pTextObj->BroadcastObjectChange();
1465*766ce4d0SZheng Fan             }
1466*766ce4d0SZheng Fan         }
1467*766ce4d0SZheng Fan         else
1468*766ce4d0SZheng Fan         {
1469*766ce4d0SZheng Fan             OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject();
1470*766ce4d0SZheng Fan             if (!pParaObj)
1471*766ce4d0SZheng Fan                 continue;
1472*766ce4d0SZheng Fan             pOutliner->SetText(*pParaObj);
1473*766ce4d0SZheng Fan             if (bUndoEnabled)
1474*766ce4d0SZheng Fan             {
1475*766ce4d0SZheng Fan                 SdrUndoObjSetText* pTxtUndo = dynamic_cast< SdrUndoObjSetText* >(pSdrModel->GetSdrUndoFactory().CreateUndoObjectSetText(*pTextObj, 0));
1476*766ce4d0SZheng Fan                 pUndoGroup->AddAction(pTxtUndo);
1477*766ce4d0SZheng Fan             }
1478*766ce4d0SZheng Fan             pOutlinerView->ToggleAllParagraphsBullets(bBulletOnOffMode, bNormalBullet, bToggleOn, bMasterView, pNumRule);
1479*766ce4d0SZheng Fan             sal_uInt32 nParaCount = pOutliner->GetParagraphCount();
1480*766ce4d0SZheng Fan             pTextObj->SetOutlinerParaObject(pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount));
1481*766ce4d0SZheng Fan             pOutliner->Clear();
1482*766ce4d0SZheng Fan         }
1483*766ce4d0SZheng Fan     }
1484*766ce4d0SZheng Fan 
1485*766ce4d0SZheng Fan     if (pUndoGroup->GetActionCount() > 0 && bUndoEnabled)
1486*766ce4d0SZheng Fan     {
1487*766ce4d0SZheng Fan         pSdrModel->BegUndo();
1488*766ce4d0SZheng Fan         pSdrModel->AddUndo(pUndoGroup);
1489*766ce4d0SZheng Fan         pSdrModel->EndUndo();
1490*766ce4d0SZheng Fan     }
1491*766ce4d0SZheng Fan     else
1492*766ce4d0SZheng Fan     {
1493*766ce4d0SZheng Fan         delete pUndoGroup;
1494*766ce4d0SZheng Fan     }
1495*766ce4d0SZheng Fan     delete pOutliner;
1496*766ce4d0SZheng Fan     delete pOutlinerView;
1497*766ce4d0SZheng Fan }
1498*766ce4d0SZheng Fan 
1499cdf0e10cSrcweir } // end of namespace sd
1500