xref: /aoo41x/main/sw/source/ui/utlui/unotools.cxx (revision 205b6fc7)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sw.hxx"
26 
27 #include <swtypes.hxx>
28 #include <globals.hrc>
29 #include <misc.hrc>
30 
31 #include <utlui.hrc>
32 #include <unotools.hrc>
33 #include <unotools.hxx>
34 #include <unoprnms.hxx>
35 #include <tools/debug.hxx>
36 #include <vcl/msgbox.hxx>
37 #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
38 #include <com/sun/star/view/XScreenCursor.hpp>
39 #include <com/sun/star/view/DocumentZoomType.hpp>
40 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
41 #include <com/sun/star/style/XStyle.hpp>
42 #include <com/sun/star/text/XTextDocument.hpp>
43 #include <com/sun/star/awt/PosSize.hpp>
44 #include <com/sun/star/view/XViewSettingsSupplier.hpp>
45 #include <com/sun/star/container/XNameContainer.hpp>
46 #include <com/sun/star/frame/XLayoutManager.hpp>
47 #include <comphelper/processfactory.hxx>
48 #include <sfx2/dispatch.hxx>
49 #include <svl/stritem.hxx>
50 #include <shellio.hxx>
51 #include <docsh.hxx>
52 #include <view.hxx>
53 #include <wrtsh.hxx>
54 #include <swmodule.hxx>
55 #include <TextCursorHelper.hxx>
56 #include <unocrsr.hxx>
57 #include <doc.hxx>
58 
59 #include <unomid.h>
60 
61 
62 using namespace ::com::sun::star;
63 using ::rtl::OUString;
64 
65 const sal_Char cFrameControl[] = "com.sun.star.frame.FrameControl";
66 const sal_Char cFactory[] = "private:factory/swriter";
67 /************************************************************************
68 
69 ************************************************************************/
70 
71 sal_Bool SwOneExampleFrame::bShowServiceNotAvailableMessage = sal_True;
72 
73 /* -----------------27.07.99 15:26-------------------
74 
75  --------------------------------------------------*/
SwOneExampleFrame(Window & rWin,sal_uInt32 nFlags,const Link * pInitializedLink,String * pURL)76 SwOneExampleFrame::SwOneExampleFrame( Window& rWin,
77 										sal_uInt32 nFlags,
78 										const Link* pInitializedLink,
79 										String* pURL ) :
80 	aTopWindow( rWin.GetParent(), 0, this ),
81     rWindow(rWin),
82     aMenuRes(SW_RES(RES_FRMEX_MENU)),
83 
84     pModuleView(SW_MOD()->GetView()),
85 
86     nStyleFlags(nFlags),
87 	bIsInitialized(sal_False),
88 	bServiceAvailable(sal_False)
89 {
90 	if(pURL && pURL->Len())
91 		sArgumentURL = *pURL;
92 
93 	aTopWindow.SetPaintTransparent(sal_True);
94 	aTopWindow.SetPosSizePixel(rWin.GetPosPixel(), rWin.GetSizePixel());
95 	aTopWindow.SetZOrder( &rWin, WINDOW_ZORDER_FIRST );
96 
97 	if( pInitializedLink )
98 		aInitializedLink = *pInitializedLink;
99 
100 	// the controller is asynchronously set
101 	aLoadedTimer.SetTimeoutHdl(LINK(this, SwOneExampleFrame, TimeoutHdl));
102 // 		aLoadedTimer.SetTimeout(500);
103 	aLoadedTimer.SetTimeout(200);
104 
105 	rWin.Enable(sal_False);
106 	CreateControl();
107 
108 	aTopWindow.Show();
109 }
110 
111 /* -----------------------------08.12.99 13:44--------------------------------
112 
113  ---------------------------------------------------------------------------*/
CreateErrorMessage(Window * pParent)114 void SwOneExampleFrame::CreateErrorMessage(Window* pParent)
115 {
116 	if(SwOneExampleFrame::bShowServiceNotAvailableMessage)
117 	{
118 		String sInfo(SW_RES(STR_SERVICE_UNAVAILABLE));
119 		sInfo += C2S(cFrameControl);
120 		InfoBox(pParent, sInfo).Execute();
121 		SwOneExampleFrame::bShowServiceNotAvailableMessage = sal_False;
122 	}
123 }
124 /* -----------------27.07.99 15:26-------------------
125 
126  --------------------------------------------------*/
~SwOneExampleFrame()127 SwOneExampleFrame::~SwOneExampleFrame()
128 {
129 	DisposeControl();
130 }
131 /* -----------------------------21.12.00 10:16--------------------------------
132 
133  ---------------------------------------------------------------------------*/
CreateControl()134 void	SwOneExampleFrame::CreateControl()
135 {
136 	if(_xControl.is())
137 		return ;
138 	uno::Reference< lang::XMultiServiceFactory >
139 									xMgr = comphelper::getProcessServiceFactory();
140 	uno::Reference< uno::XInterface >  xInst = xMgr->createInstance( C2U("com.sun.star.frame.FrameControl") );
141 	_xControl = uno::Reference< awt::XControl >(xInst, uno::UNO_QUERY);
142 	if(_xControl.is())
143 	{
144 		uno::Reference< awt::XWindowPeer >  xParent( rWindow.GetComponentInterface() );
145 
146 		uno::Reference< awt::XToolkit >  xToolkit( xMgr->createInstance( C2U("com.sun.star.awt.Toolkit") ), uno::UNO_QUERY );
147 		if(xToolkit.is())
148 		{
149 			_xControl->createPeer( xToolkit, xParent );
150 
151             uno::Reference< awt::XWindow >  xWin( _xControl, uno::UNO_QUERY );
152 			xWin->setVisible( sal_False );
153 			Size aWinSize(rWindow.GetOutputSizePixel());
154 			xWin->setPosSize( 0, 0, aWinSize.Width(), aWinSize.Height(), awt::PosSize::SIZE );
155 
156             uno::Reference< beans::XPropertySet >  xPrSet(xInst, uno::UNO_QUERY);
157 			uno::Any aURL;
158 			//
159 			// create new doc
160 			String sTempURL = C2S(cFactory);
161 			if(sArgumentURL.Len())
162 				sTempURL = sArgumentURL;
163 			aURL <<= OUString(sTempURL);
164 
165 			uno::Sequence<beans::PropertyValue> aSeq(3);
166 			beans::PropertyValue* pValues = aSeq.getArray();
167 			pValues[0].Name = C2U("ReadOnly");
168 			sal_Bool bTrue = sal_True;
169 			pValues[0].Value.setValue(&bTrue, ::getBooleanCppuType());
170 			pValues[1].Name = C2U("OpenFlags");
171 			pValues[1].Value <<= C2U("-RB");
172 			pValues[2].Name = C2U("Referer");
173 			pValues[2].Value <<= C2U("private:user");
174 			uno::Any aArgs;
175 			aArgs.setValue(&aSeq, ::getCppuType((uno::Sequence<beans::PropertyValue>*)0));
176 
177 			xPrSet->setPropertyValue( C2U("LoaderArguments"), aArgs );
178 			//save and set readonly???
179 
180 			xPrSet->setPropertyValue(C2U("ComponentURL"), aURL);
181 
182 			aLoadedTimer.Start();
183 			bServiceAvailable = sal_True;
184 		}
185 	}
186 }
187 
188 
189 /* -----------------------------21.12.00 10:16--------------------------------
190 
191  ---------------------------------------------------------------------------*/
DisposeControl()192 void	SwOneExampleFrame::DisposeControl()
193 {
194 	_xCursor = 0;
195 	if(_xControl.is())
196 		_xControl->dispose();
197 	_xControl = 0;
198 	_xModel = 0;
199 	_xController = 0;
200 }
201 /* -----------------27.07.99 15:26-------------------
202 
203  --------------------------------------------------*/
IMPL_LINK(SwOneExampleFrame,TimeoutHdl,Timer *,pTimer)204 IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer )
205 {
206 	if(!_xControl.is())
207 		return 0;
208 
209 	// now get the model
210 	uno::Reference< beans::XPropertySet >  xPrSet(_xControl, uno::UNO_QUERY);
211 	uno::Any aFrame = xPrSet->getPropertyValue(C2U("Frame"));
212     uno::Reference< frame::XFrame >  xFrm;
213     aFrame >>= xFrm;
214 
215     uno::Reference< beans::XPropertySet > xPropSet( xFrm, uno::UNO_QUERY );
216     if ( xPropSet.is() )
217     {
218         try
219         {
220             uno::Reference< frame::XLayoutManager > xLayoutManager;
221             uno::Any aValue = xPropSet->getPropertyValue(C2U("LayoutManager"));
222 	        aValue >>= xLayoutManager;
223             if ( xLayoutManager.is() )
224                 xLayoutManager->setVisible( sal_False );
225         }
226         catch ( uno::Exception& )
227         {
228         }
229     }
230 
231     _xController = xFrm->getController();
232 	if(_xController.is())
233 	{
234 		_xModel = _xController->getModel();
235 		//now the ViewOptions should be set properly
236 		uno::Reference< view::XViewSettingsSupplier >  xSettings(_xController, uno::UNO_QUERY);
237 		uno::Reference< beans::XPropertySet >  xViewProps = xSettings->getViewSettings();
238 
239 		sal_Bool bTrue = sal_True;
240 		sal_Bool bFalse = sal_False;
241 		uno::Any aTrueSet( &bTrue, ::getBooleanCppuType() );
242 		uno::Any aFalseSet( &bFalse, ::getBooleanCppuType() );
243 
244 		if( !bIsInitialized )
245 		{
246 			xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_BREAKS			   	)), aFalseSet);
247 			xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_DRAWINGS             )), aTrueSet);
248 			xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_FIELD_COMMANDS       )), aFalseSet);
249 			xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_GRAPHICS             )), aTrueSet);
250 			xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_HIDDEN_PARAGRAPHS    )), aFalseSet);
251 			xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_HIDDEN_TEXT          )), aFalseSet);
252 			xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_HORI_RULER	  		)), aFalseSet);
253 			xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_PARA_BREAKS          )), aFalseSet);
254 			xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_PROTECTED_SPACES     )), aFalseSet);
255 			xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_SOFT_HYPHENS         )), aFalseSet);
256 			xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_SPACES               )), aFalseSet);
257 			xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_TABLES               )), aTrueSet);
258 			xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_TABSTOPS             )), aFalseSet);
259 			xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_VERT_RULER     		)), aFalseSet);
260 
261 			if(0 ==(nStyleFlags&EX_SHOW_ONLINE_LAYOUT))
262 			{
263                 uno::Any aZoom;
264                 aZoom <<= (sal_Int16)view::DocumentZoomType::PAGE_WIDTH_EXACT;
265                 xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_ZOOM_TYPE)), aZoom);
266 			}
267 			else
268 			{
269 				uno::Any aZoom;
270 				aZoom <<= (sal_Int16)view::DocumentZoomType::BY_VALUE;
271 				xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_ZOOM_TYPE)), aZoom);
272 
273 				sal_Int16 nZoomValue = 50;
274 				if(EX_SHOW_BUSINESS_CARDS == nStyleFlags)
275 				{
276 					nZoomValue = 80;
277 				}
278 				aZoom <<= nZoomValue;
279 				xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_ZOOM_VALUE)), aZoom);
280 			}
281 			// set onlinelayout property behind setting the zoom
282 			xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_ONLINE_LAYOUT)),
283 					(nStyleFlags&EX_SHOW_ONLINE_LAYOUT) ? aTrueSet : aFalseSet );
284 			bIsInitialized = sal_True;
285 		}
286 
287 		uno::Reference< text::XTextDocument >  xDoc(_xModel, uno::UNO_QUERY);
288 		uno::Reference< text::XText >  xText = xDoc->getText();
289 		_xCursor = xText->createTextCursor();
290 		uno::Reference< beans::XPropertySet >  xCrsrProp(_xCursor, uno::UNO_QUERY);
291 		uno::Any aPageStyle = xCrsrProp->getPropertyValue(
292 											C2U(SW_PROP_NAME_STR(UNO_NAME_PAGE_STYLE_NAME)));
293 		OUString sPageStyle;
294 		aPageStyle >>= sPageStyle;
295 
296 		uno::Reference< style::XStyleFamiliesSupplier >  xSSupp( xDoc, uno::UNO_QUERY);
297 		uno::Reference< container::XNameAccess >  xStyles = xSSupp->getStyleFamilies();
298 		uno::Any aPFamily = xStyles->getByName( C2U("PageStyles" ) );
299         uno::Reference< container::XNameContainer >  xPFamily;
300 
301         if( 0 == (EX_SHOW_DEFAULT_PAGE == nStyleFlags)
302                 && (aPFamily >>= xPFamily) && sPageStyle.getLength() )
303 		{
304 			uno::Any aPStyle = xPFamily->getByName( sPageStyle );
305             uno::Reference< style::XStyle >  xPStyle;
306             aPStyle >>= xPStyle;
307 			uno::Reference< beans::XPropertySet >  xPProp(xPStyle, uno::UNO_QUERY);
308 			uno::Any aSize = xPProp->getPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SIZE)));
309             awt::Size aPSize;
310             aSize >>= aPSize;
311 			//TODO: set page width to card width
312 			aPSize.Width = 10000;
313 			aSize.setValue(&aPSize, ::getCppuType((awt::Size*)0));
314 			xPProp->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SIZE)), aSize);
315 
316             uno::Any aZero; aZero <<= (sal_Int32)0;
317             xPProp->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_LEFT_MARGIN)), aZero);
318             xPProp->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_RIGHT_MARGIN)), aZero);
319 		}
320 
321 		// can only be done here - the SFX changes the ScrollBar values
322 		xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_HORI_SCROLL_BAR )), aFalseSet);
323 		xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_VERT_SCROLL_BAR )), aFalseSet);
324 
325 		if( aInitializedLink.IsSet() )
326 		{
327 			rWindow.Enable(sal_False, sal_True);
328 			//rWindow.Enable(sal_True, sal_False);
329    			aInitializedLink.Call(this);
330 		}
331 
332         uno::Reference< text::XTextViewCursorSupplier >  xCrsrSupp(_xController, uno::UNO_QUERY);
333 		uno::Reference< view::XScreenCursor >  xScrCrsr(xCrsrSupp->getViewCursor(), uno::UNO_QUERY);
334         if(xScrCrsr.is())
335             xScrCrsr->screenUp();
336 
337         uno::Reference< awt::XWindow >  xWin( _xControl, uno::UNO_QUERY );
338 		xWin->setVisible( sal_True );
339 		rWindow.Show();
340 
341 		uno::Reference< lang::XUnoTunnel> xTunnel( _xCursor, uno::UNO_QUERY);
342 		if( xTunnel.is() )
343 		{
344             OTextCursorHelper* pCrsr = reinterpret_cast<OTextCursorHelper*>( xTunnel->getSomething(
345                                         OTextCursorHelper::getUnoTunnelId() ));
346 			if( pCrsr )
347 			{
348 				SwEditShell* pSh = pCrsr->GetDoc()->GetEditShell();
349 				if( pSh->ActionCount() )
350 				{
351 					pSh->EndAllAction();
352 					pSh->UnlockPaint();
353 				}
354 			}
355 		}
356 
357 		SW_MOD()->SetView(pModuleView);
358 	}
359 	else
360 		pTimer->Start();
361 	return 0;
362 }
363 /* -----------------------------27.12.99 09:59--------------------------------
364 
365  ---------------------------------------------------------------------------*/
ClearDocument(sal_Bool bStartUpdateTimer)366 void SwOneExampleFrame::ClearDocument( sal_Bool bStartUpdateTimer )
367 {
368 	uno::Reference< lang::XUnoTunnel> xTunnel( _xCursor, uno::UNO_QUERY);
369 	if( xTunnel.is() )
370 	{
371         OTextCursorHelper* pCrsr = reinterpret_cast<OTextCursorHelper*>(xTunnel->getSomething(
372                                         OTextCursorHelper::getUnoTunnelId()) );
373 		if( pCrsr )
374 		{
375 			SwDoc* pDoc = pCrsr->GetDoc();
376 			SwEditShell* pSh = pDoc->GetEditShell();
377 			pSh->LockPaint();
378 			pSh->StartAllAction();
379 			pDoc->ClearDoc();
380 
381 			if( aLoadedTimer.IsActive() || !bStartUpdateTimer )
382 			{
383 				pSh->EndAllAction();
384 				pSh->UnlockPaint();
385 			}
386 			if( bStartUpdateTimer )
387 				aLoadedTimer.Start();
388 		}
389 		else
390 		{
391 			_xCursor->gotoStart(sal_False);
392 			_xCursor->gotoEnd(sal_True);
393 			_xCursor->setString(OUString());
394 		}
395 	}
396 }
397 /* -----------------------------15.12.99 11:09--------------------------------
398 
399  ---------------------------------------------------------------------------*/
400 static const sal_Int16 nZoomValues[] =
401 {
402 	20,
403 	40,
404 	50,
405 	75,
406 	100
407 };
408 //---------------------------------------------------------------------------
409 #define ITEM_UP		100
410 #define ITEM_DOWN	200
411 #define ITEM_ZOOM   300
412 
CreatePopup(const Point & rPt)413 void SwOneExampleFrame::CreatePopup(const Point& rPt)
414 {
415 	PopupMenu aPop;
416 	PopupMenu aSubPop1;
417 	ResStringArray& rArr = aMenuRes.GetMenuArray();
418 
419 	aPop.InsertItem(ITEM_UP,   rArr.GetString(rArr.FindIndex(ST_MENU_UP )));
420 	aPop.InsertItem(ITEM_DOWN, rArr.GetString(rArr.FindIndex(ST_MENU_DOWN )));
421 
422 	Link aSelLk = LINK(this, SwOneExampleFrame, PopupHdl );
423 	aPop.SetSelectHdl(aSelLk);
424 	if(EX_SHOW_ONLINE_LAYOUT == nStyleFlags)
425 	{
426 		aPop.InsertItem(ITEM_ZOOM, rArr.GetString(rArr.FindIndex(ST_MENU_ZOOM   )));
427 
428 		uno::Reference< view::XViewSettingsSupplier >  xSettings(_xController, uno::UNO_QUERY);
429 		uno::Reference< beans::XPropertySet >  xViewProps = xSettings->getViewSettings();
430 
431 		uno::Any aZoom = xViewProps->getPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_ZOOM_VALUE)));
432 		sal_Int16 nZoom = 0;
433 		aZoom >>= nZoom;
434 
435         for (sal_uInt16 i = 0;
436                 i < (sizeof(nZoomValues)/sizeof(nZoomValues[0])); ++i)
437 		{
438 			String sTemp;
439 			sTemp = String::CreateFromInt32(nZoomValues[i]);
440 			sTemp += String::CreateFromAscii(" %");
441 			aSubPop1.InsertItem( ITEM_ZOOM + i + 1, sTemp);
442 			if(nZoom == nZoomValues[i])
443 				aSubPop1.CheckItem(ITEM_ZOOM + i + 1);
444 		}
445 		aPop.SetPopupMenu( ITEM_ZOOM, &aSubPop1 );
446 		aSubPop1.SetSelectHdl(aSelLk);
447 	}
448 	aPop.Execute( &aTopWindow, rPt );
449 
450 }
451 /* -----------------------------15.12.99 11:09--------------------------------
452 
453  ---------------------------------------------------------------------------*/
IMPL_LINK(SwOneExampleFrame,PopupHdl,Menu *,pMenu)454 IMPL_LINK(SwOneExampleFrame, PopupHdl, Menu*, pMenu )
455 {
456 	sal_uInt16 nId = pMenu->GetCurItemId();
457     if ((nId > ITEM_ZOOM) &&
458         (nId <= (ITEM_ZOOM + (sizeof(nZoomValues)/sizeof(nZoomValues[0])))))
459 	{
460 		sal_Int16 nZoom = nZoomValues[nId - ITEM_ZOOM - 1];
461 		uno::Reference< view::XViewSettingsSupplier >  xSettings(_xController, uno::UNO_QUERY);
462 		uno::Reference< beans::XPropertySet >  xViewProps = xSettings->getViewSettings();
463 
464 		uno::Any aZoom;
465 		aZoom <<= nZoom;
466 		xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_ZOOM_VALUE)), aZoom);
467         aZoom <<= (sal_Int16)view::DocumentZoomType::BY_VALUE;
468 		xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_ZOOM_TYPE)), aZoom);
469 	}
470 	else if(ITEM_UP == nId || ITEM_DOWN == nId)
471 	{
472 		uno::Reference< text::XTextViewCursorSupplier >  xCrsrSupp(_xController, uno::UNO_QUERY);
473 		uno::Reference< view::XScreenCursor >  xScrCrsr(xCrsrSupp->getViewCursor(), uno::UNO_QUERY);
474 		if(ITEM_UP == nId)
475 			xScrCrsr->screenUp();
476 		else
477 			xScrCrsr->screenDown();
478 	}
479 	return 0;
480 };
481 /* -----------------------------15.12.99 10:37--------------------------------
482 
483  ---------------------------------------------------------------------------*/
SwFrmCtrlWindow(Window * pParent,WinBits nBits,SwOneExampleFrame * pFrame)484 SwFrmCtrlWindow::SwFrmCtrlWindow(Window* pParent, WinBits nBits,
485 								SwOneExampleFrame* 	pFrame) :
486 	Window(pParent, nBits),
487 	pExampleFrame(pFrame)
488 {
489 }
490 /* -----------------------------15.12.99 09:57--------------------------------
491 
492  ---------------------------------------------------------------------------*/
Command(const CommandEvent & rCEvt)493 void SwFrmCtrlWindow::Command( const CommandEvent& rCEvt )
494 {
495 	switch ( rCEvt.GetCommand() )
496 	{
497 		case COMMAND_CONTEXTMENU:
498 		{
499 			//#125881# quickly clicking crashes because the control is not fully initialized
500             if(pExampleFrame->GetController().is())
501                 pExampleFrame->CreatePopup(rCEvt.GetMousePosPixel());
502 		}
503 		break;
504 		case COMMAND_WHEEL:
505 		case COMMAND_STARTAUTOSCROLL:
506 		case COMMAND_AUTOSCROLL:
507 		break;
508 		default:;
509 	}
510 }
511 /* -----------------------------15.12.99 12:57--------------------------------
512 
513  ---------------------------------------------------------------------------*/
MenuResource(const ResId & rResId)514 MenuResource::MenuResource(const ResId& rResId) :
515 	Resource(rResId),
516 	aMenuArray(ResId(1,*rResId.GetResMgr()))
517 {
518 	FreeResource();
519 }
520 
521