Bump version to 4.3-4
[LibreOffice.git] / basctl / source / dlged / dlged.cxx
blobebf8ba0b5cc1ea0cbb715874576ebf0a2ecdb64f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include "basidesh.hxx"
22 #include "dlged.hxx"
23 #include "dlgedclip.hxx"
24 #include "dlgeddef.hxx"
25 #include "dlgedfac.hxx"
26 #include "dlgedfunc.hxx"
27 #include "dlgedmod.hxx"
28 #include "dlgedobj.hxx"
29 #include "dlgedpage.hxx"
30 #include "dlgedview.hxx"
31 #include "iderdll.hxx"
32 #include "localizationmgr.hxx"
33 #include "baside3.hxx"
35 #include <com/sun/star/awt/Toolkit.hpp>
36 #include <com/sun/star/awt/UnoControlDialog.hpp>
37 #include <com/sun/star/awt/XDialog.hpp>
38 #include <com/sun/star/resource/StringResource.hpp>
39 #include <com/sun/star/util/XCloneable.hpp>
40 #include <com/sun/star/util/NumberFormatsSupplier.hpp>
41 #include <comphelper/types.hxx>
42 #include <sfx2/viewfrm.hxx>
43 #include <svl/itempool.hxx>
44 #include <svx/sdrpaintwindow.hxx>
45 #include <svx/svxids.hrc>
46 #include <toolkit/helper/vclunohelper.hxx>
47 #include <vcl/svapp.hxx>
48 #include <xmlscript/xml_helper.hxx>
49 #include <xmlscript/xmldlg_imexp.hxx>
51 namespace basctl
54 using namespace comphelper;
55 using namespace ::com::sun::star;
56 using namespace ::com::sun::star::uno;
57 using namespace ::com::sun::star::beans;
58 using namespace ::com::sun::star::io;
60 static OUString aResourceResolverPropName( "ResourceResolver" );
61 static OUString aDecorationPropName( "Decoration" );
62 static OUString aTitlePropName( "Title" );
66 // DlgEdHint
69 TYPEINIT1( DlgEdHint, SfxHint );
71 DlgEdHint::DlgEdHint(Kind eHint)
72 : eKind(eHint)
73 , pDlgEdObj(0)
77 DlgEdHint::DlgEdHint(Kind eHint, DlgEdObj* pObj)
78 : eKind(eHint)
79 , pDlgEdObj(pObj)
83 DlgEdHint::~DlgEdHint()
88 // DlgEditor
91 void DlgEditor::ShowDialog()
93 uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext();
95 // create a dialog
96 uno::Reference< awt::XUnoControlDialog > xDlg = awt::UnoControlDialog::create( xContext );
98 // clone the dialog model
99 uno::Reference< util::XCloneable > xC( m_xUnoControlDialogModel, uno::UNO_QUERY );
100 uno::Reference< util::XCloneable > xNew = xC->createClone();
101 uno::Reference< awt::XControlModel > xDlgMod( xNew, uno::UNO_QUERY );
103 uno::Reference< beans::XPropertySet > xSrcDlgModPropSet( m_xUnoControlDialogModel, uno::UNO_QUERY );
104 uno::Reference< beans::XPropertySet > xNewDlgModPropSet( xDlgMod, uno::UNO_QUERY );
105 if( xNewDlgModPropSet.is() )
107 if( xSrcDlgModPropSet.is() )
111 Any aResourceResolver = xSrcDlgModPropSet->getPropertyValue( aResourceResolverPropName );
112 xNewDlgModPropSet->setPropertyValue( aResourceResolverPropName, aResourceResolver );
114 catch(const UnknownPropertyException& )
116 OSL_FAIL( "DlgEditor::ShowDialog(): No ResourceResolver property" );
120 // Disable decoration
121 bool bDecoration = true;
124 Any aDecorationAny = xSrcDlgModPropSet->getPropertyValue( aDecorationPropName );
125 aDecorationAny >>= bDecoration;
126 if( !bDecoration )
128 xNewDlgModPropSet->setPropertyValue( aDecorationPropName, makeAny( true ) );
129 xNewDlgModPropSet->setPropertyValue( aTitlePropName, makeAny( OUString() ) );
132 catch(const UnknownPropertyException& )
136 // set the model
137 xDlg->setModel( xDlgMod );
139 // create a peer
140 uno::Reference< awt::XToolkit> xToolkit = awt::Toolkit::create( xContext );
141 xDlg->createPeer( xToolkit, rWindow.GetComponentInterface() );
143 xDlg->execute();
145 // need to cast because of multiple inheritance
146 Reference<awt::XControl>(xDlg)->dispose();
150 bool DlgEditor::UnmarkDialog()
152 SdrObject* pDlgObj = pDlgEdModel->GetPage(0)->GetObj(0);
153 SdrPageView* pPgView = pDlgEdView->GetSdrPageView();
155 bool bWasMarked = pDlgEdView->IsObjMarked( pDlgObj );
157 if( bWasMarked )
158 pDlgEdView->MarkObj( pDlgObj, pPgView, true );
160 return bWasMarked;
164 bool DlgEditor::RemarkDialog()
166 SdrObject* pDlgObj = pDlgEdModel->GetPage(0)->GetObj(0);
167 SdrPageView* pPgView = pDlgEdView->GetSdrPageView();
169 bool bWasMarked = pDlgEdView->IsObjMarked( pDlgObj );
171 if( !bWasMarked )
172 pDlgEdView->MarkObj( pDlgObj, pPgView, false );
174 return bWasMarked;
178 DlgEditor::DlgEditor (
179 Window& rWindow_, DialogWindowLayout& rLayout_,
180 com::sun::star::uno::Reference<com::sun::star::frame::XModel> const& xModel,
181 com::sun::star::uno::Reference<com::sun::star::container::XNameContainer> xDialogModel
183 :pHScroll(NULL)
184 ,pVScroll(NULL)
185 ,pDlgEdModel(new DlgEdModel())
186 ,pDlgEdPage(new DlgEdPage(*pDlgEdModel))
187 ,pDlgEdView(new DlgEdView(*pDlgEdModel, rWindow_, *this))
188 ,m_ClipboardDataFlavors(1)
189 ,m_ClipboardDataFlavorsResource(2)
190 ,pObjFac(new DlgEdFactory(xModel))
191 ,rWindow(rWindow_)
192 ,pFunc(new DlgEdFuncSelect(*this))
193 ,rLayout(rLayout_)
194 ,eMode( DlgEditor::SELECT )
195 ,eActObj( OBJ_DLG_PUSHBUTTON )
196 ,bFirstDraw(false)
197 ,aGridSize( 100, 100 ) // 100TH_MM
198 ,bGridVisible(false)
199 ,bGridSnap(true)
200 ,bCreateOK(true)
201 ,bDialogModelChanged(false)
202 ,mnPaintGuard(0)
203 ,m_xDocument( xModel )
205 pDlgEdModel->GetItemPool().FreezeIdRanges();
206 pDlgEdModel->SetScaleUnit( MAP_100TH_MM );
208 SdrLayerAdmin& rAdmin = pDlgEdModel->GetLayerAdmin();
209 rAdmin.NewLayer( rAdmin.GetControlLayerName() );
210 rAdmin.NewLayer( OUString( "HiddenLayer" ) );
212 pDlgEdModel->InsertPage(pDlgEdPage);
214 // set clipboard data flavors
215 m_ClipboardDataFlavors[0].MimeType = "application/vnd.sun.xml.dialog" ;
216 m_ClipboardDataFlavors[0].HumanPresentableName = "Dialog 6.0" ;
217 m_ClipboardDataFlavors[0].DataType = ::getCppuType( (const Sequence< sal_Int8 >*) 0 );
219 m_ClipboardDataFlavorsResource[0] = m_ClipboardDataFlavors[0];
220 m_ClipboardDataFlavorsResource[1].MimeType = "application/vnd.sun.xml.dialogwithresource" ;
221 m_ClipboardDataFlavorsResource[1].HumanPresentableName = "Dialog 8.0" ;
222 m_ClipboardDataFlavorsResource[1].DataType = ::getCppuType( (const Sequence< sal_Int8 >*) 0 );
224 aPaintTimer.SetTimeout( 1 );
225 aPaintTimer.SetTimeoutHdl( LINK( this, DlgEditor, PaintTimeout ) );
227 aMarkTimer.SetTimeout( 100 );
228 aMarkTimer.SetTimeoutHdl( LINK( this, DlgEditor, MarkTimeout ) );
230 rWindow.SetMapMode( MapMode( MAP_100TH_MM ) );
231 pDlgEdPage->SetSize( rWindow.PixelToLogic( Size(DLGED_PAGE_WIDTH_MIN, DLGED_PAGE_HEIGHT_MIN) ) );
233 pDlgEdView->ShowSdrPage(pDlgEdView->GetModel()->GetPage(0));
234 pDlgEdView->SetLayerVisible( OUString( "HiddenLayer" ), false );
235 pDlgEdView->SetMoveSnapOnlyTopLeft(true);
236 pDlgEdView->SetWorkArea( Rectangle( Point( 0, 0 ), pDlgEdPage->GetSize() ) );
238 pDlgEdView->SetGridCoarse( aGridSize );
239 pDlgEdView->SetSnapGridWidth(Fraction(aGridSize.Width(), 1), Fraction(aGridSize.Height(), 1));
240 pDlgEdView->SetGridSnap( bGridSnap );
241 pDlgEdView->SetGridVisible( bGridVisible );
242 pDlgEdView->SetDragStripes(false);
244 pDlgEdView->SetDesignMode(true);
246 ::comphelper::disposeComponent( m_xControlContainer );
248 SetDialog(xDialogModel);
252 DlgEditor::~DlgEditor()
254 aPaintTimer.Stop();
255 aMarkTimer.Stop();
257 ::comphelper::disposeComponent( m_xControlContainer );
261 Reference< awt::XControlContainer > DlgEditor::GetWindowControlContainer()
263 if (!m_xControlContainer.is())
264 m_xControlContainer = VCLUnoHelper::CreateControlContainer(&rWindow);
265 return m_xControlContainer;
269 void DlgEditor::SetScrollBars( ScrollBar* pHS, ScrollBar* pVS )
271 pHScroll = pHS;
272 pVScroll = pVS;
274 InitScrollBars();
278 void DlgEditor::InitScrollBars()
280 DBG_ASSERT( pHScroll, "DlgEditor::InitScrollBars: no horizontal scroll bar!" );
281 DBG_ASSERT( pVScroll, "DlgEditor::InitScrollBars: no vertical scroll bar!" );
282 if ( !pHScroll || !pVScroll )
283 return;
285 Size aOutSize = rWindow.GetOutputSize();
286 Size aPgSize = pDlgEdPage->GetSize();
288 pHScroll->SetRange( Range( 0, aPgSize.Width() ));
289 pVScroll->SetRange( Range( 0, aPgSize.Height() ));
290 pHScroll->SetVisibleSize( (sal_uLong)aOutSize.Width() );
291 pVScroll->SetVisibleSize( (sal_uLong)aOutSize.Height() );
293 pHScroll->SetLineSize( aOutSize.Width() / 10 );
294 pVScroll->SetLineSize( aOutSize.Height() / 10 );
295 pHScroll->SetPageSize( aOutSize.Width() / 2 );
296 pVScroll->SetPageSize( aOutSize.Height() / 2 );
298 DoScroll( pHScroll );
299 DoScroll( pVScroll );
303 void DlgEditor::DoScroll( ScrollBar* )
305 if( !pHScroll || !pVScroll )
306 return;
308 MapMode aMap = rWindow.GetMapMode();
309 Point aOrg = aMap.GetOrigin();
311 Size aScrollPos( pHScroll->GetThumbPos(), pVScroll->GetThumbPos() );
312 aScrollPos = rWindow.LogicToPixel( aScrollPos );
313 aScrollPos = rWindow.PixelToLogic( aScrollPos );
315 long nX = aScrollPos.Width() + aOrg.X();
316 long nY = aScrollPos.Height() + aOrg.Y();
318 if( !nX && !nY )
319 return;
321 rWindow.Update();
323 // #i31562#
324 // When scrolling, someone was rescuing the Wallpaper and forced the window scroll to
325 // be done without background refresh. I do not know why, but that causes the repaint
326 // problems. Taking that out.
327 // Wallpaper aOldBackground = rWindow.GetBackground();
328 // rWindow.SetBackground();
330 // #i74769# children should be scrolled
331 rWindow.Scroll( -nX, -nY, SCROLL_CHILDREN);
332 aMap.SetOrigin( Point( -aScrollPos.Width(), -aScrollPos.Height() ) );
333 rWindow.SetMapMode( aMap );
334 rWindow.Update();
336 DlgEdHint aHint( DlgEdHint::WINDOWSCROLLED );
337 Broadcast( aHint );
341 void DlgEditor::UpdateScrollBars()
343 MapMode aMap = rWindow.GetMapMode();
344 Point aOrg = aMap.GetOrigin();
346 if ( pHScroll )
347 pHScroll->SetThumbPos( -aOrg.X() );
349 if ( pVScroll )
350 pVScroll->SetThumbPos( -aOrg.Y() );
354 void DlgEditor::SetDialog( uno::Reference< container::XNameContainer > xUnoControlDialogModel )
356 // set dialog model
357 m_xUnoControlDialogModel = xUnoControlDialogModel;
359 // create dialog form
360 pDlgEdForm = new DlgEdForm(*this);
361 uno::Reference< awt::XControlModel > xDlgMod( m_xUnoControlDialogModel , uno::UNO_QUERY );
362 pDlgEdForm->SetUnoControlModel(xDlgMod);
363 ((DlgEdPage*)pDlgEdModel->GetPage(0))->SetDlgEdForm( pDlgEdForm );
364 pDlgEdModel->GetPage(0)->InsertObject( pDlgEdForm );
365 AdjustPageSize();
366 pDlgEdForm->SetRectFromProps();
367 pDlgEdForm->UpdateTabIndices(); // for backward compatibility
368 pDlgEdForm->StartListening();
370 // create controls
371 Reference< ::com::sun::star::container::XNameAccess > xNameAcc( m_xUnoControlDialogModel, UNO_QUERY );
372 if ( xNameAcc.is() )
374 // get sequence of control names
375 Sequence< OUString > aNames = xNameAcc->getElementNames();
376 const OUString* pNames = aNames.getConstArray();
377 sal_Int32 nCtrls = aNames.getLength();
379 // create a map of tab indices and control names, sorted by tab index
380 IndexToNameMap aIndexToNameMap;
381 for ( sal_Int32 i = 0; i < nCtrls; ++i )
383 // get name
384 OUString aName( pNames[i] );
386 // get tab index
387 sal_Int16 nTabIndex = -1;
388 Any aCtrl = xNameAcc->getByName( aName );
389 Reference< ::com::sun::star::beans::XPropertySet > xPSet;
390 aCtrl >>= xPSet;
391 if ( xPSet.is() )
392 xPSet->getPropertyValue( DLGED_PROP_TABINDEX ) >>= nTabIndex;
394 // insert into map
395 aIndexToNameMap.insert( IndexToNameMap::value_type( nTabIndex, aName ) );
398 // create controls and insert them into drawing page
399 for ( IndexToNameMap::iterator aIt = aIndexToNameMap.begin(); aIt != aIndexToNameMap.end(); ++aIt )
401 Any aCtrl = xNameAcc->getByName( aIt->second );
402 Reference< ::com::sun::star::awt::XControlModel > xCtrlModel;
403 aCtrl >>= xCtrlModel;
404 DlgEdObj* pCtrlObj = new DlgEdObj();
405 pCtrlObj->SetUnoControlModel( xCtrlModel );
406 pCtrlObj->SetDlgEdForm( pDlgEdForm );
407 pDlgEdForm->AddChild( pCtrlObj );
408 pDlgEdModel->GetPage(0)->InsertObject( pCtrlObj );
409 pCtrlObj->SetRectFromProps();
410 pCtrlObj->UpdateStep();
411 pCtrlObj->StartListening();
415 bFirstDraw = true;
417 pDlgEdModel->SetChanged(false);
420 void DlgEditor::ResetDialog ()
422 DlgEdForm* pOldDlgEdForm = pDlgEdForm;
423 DlgEdPage* pPage = (DlgEdPage*)pDlgEdModel->GetPage(0);
424 SdrPageView* pPgView = pDlgEdView->GetSdrPageView();
425 bool bWasMarked = pDlgEdView->IsObjMarked( pOldDlgEdForm );
426 pDlgEdView->UnmarkAll();
427 pPage->Clear();
428 pPage->SetDlgEdForm( NULL );
429 SetDialog( m_xUnoControlDialogModel );
430 if( bWasMarked )
431 pDlgEdView->MarkObj( pDlgEdForm, pPgView, false );
435 Reference< util::XNumberFormatsSupplier > const & DlgEditor::GetNumberFormatsSupplier()
437 if ( !m_xSupplier.is() )
439 Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
440 Reference< util::XNumberFormatsSupplier > xSupplier( util::NumberFormatsSupplier::createWithDefaultLocale(xContext) );
442 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
443 if ( !m_xSupplier.is() )
445 m_xSupplier = xSupplier;
448 return m_xSupplier;
452 void DlgEditor::MouseButtonDown( const MouseEvent& rMEvt )
454 rWindow.GrabFocus();
455 pFunc->MouseButtonDown( rMEvt );
459 void DlgEditor::MouseButtonUp( const MouseEvent& rMEvt )
461 bool bRet = pFunc->MouseButtonUp( rMEvt );
463 if( eMode == DlgEditor::INSERT )
464 bCreateOK = bRet;
468 void DlgEditor::MouseMove( const MouseEvent& rMEvt )
470 pFunc->MouseMove( rMEvt );
474 bool DlgEditor::KeyInput( const KeyEvent& rKEvt )
476 return pFunc->KeyInput( rKEvt );
480 void DlgEditor::Paint( const Rectangle& rRect )
482 aPaintRect = rRect;
483 PaintTimeout( &aPaintTimer );
487 IMPL_LINK_NOARG(DlgEditor, PaintTimeout)
489 mnPaintGuard++;
491 Size aMacSize;
492 if( bFirstDraw &&
493 rWindow.IsVisible() &&
494 (rWindow.GetOutputSize() != aMacSize) )
496 bFirstDraw = false;
498 // get property set
499 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPSet(pDlgEdForm->GetUnoControlModel(), ::com::sun::star::uno::UNO_QUERY);
501 if ( xPSet.is() )
503 // get dialog size from properties
504 sal_Int32 nWidth = 0, nHeight = 0;
505 xPSet->getPropertyValue( DLGED_PROP_WIDTH ) >>= nWidth;
506 xPSet->getPropertyValue( DLGED_PROP_HEIGHT ) >>= nHeight;
508 if ( nWidth == 0 && nHeight == 0 )
510 Size aSize = rWindow.PixelToLogic( Size( 400, 300 ) );
512 // align with grid
513 Size aGridSize_(long(pDlgEdView->GetSnapGridWidthX()), long(pDlgEdView->GetSnapGridWidthY()));
514 aSize.Width() -= aSize.Width() % aGridSize_.Width();
515 aSize.Height() -= aSize.Height() % aGridSize_.Height();
517 Point aPos;
518 Size aOutSize = rWindow.GetOutputSize();
519 aPos.X() = (aOutSize.Width()>>1) - (aSize.Width()>>1);
520 aPos.Y() = (aOutSize.Height()>>1) - (aSize.Height()>>1);
522 // align with grid
523 aPos.X() -= aPos.X() % aGridSize_.Width();
524 aPos.Y() -= aPos.Y() % aGridSize_.Height();
526 // don't put in the corner
527 Point aMinPos = rWindow.PixelToLogic( Point( 30, 20 ) );
528 if( (aPos.X() < aMinPos.X()) || (aPos.Y() < aMinPos.Y()) )
530 aPos = aMinPos;
531 aPos.X() -= aPos.X() % aGridSize_.Width();
532 aPos.Y() -= aPos.Y() % aGridSize_.Height();
535 // set dialog position and size
536 pDlgEdForm->SetSnapRect( Rectangle( aPos, aSize ) );
537 pDlgEdForm->EndListening(false);
538 pDlgEdForm->SetPropsFromRect();
539 pDlgEdForm->GetDlgEditor().SetDialogModelChanged(true);
540 pDlgEdForm->StartListening();
542 // set position and size of controls
543 if (sal_uLong nObjCount = pDlgEdPage->GetObjCount())
545 for ( sal_uLong i = 0 ; i < nObjCount ; i++ )
546 if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pDlgEdPage->GetObj(i)))
547 if (!dynamic_cast<DlgEdForm*>(pDlgEdObj))
548 pDlgEdObj->SetRectFromProps();
554 // repaint, get PageView and prepare Region
555 SdrPageView* pPgView = pDlgEdView->GetSdrPageView();
556 const Region aPaintRectRegion(aPaintRect);
559 // #i74769#
560 SdrPaintWindow* pTargetPaintWindow = 0;
562 // mark repaint start
563 if(pPgView)
565 pTargetPaintWindow = pPgView->GetView().BeginDrawLayers(&rWindow, aPaintRectRegion);
566 OSL_ENSURE(pTargetPaintWindow, "BeginDrawLayers: Got no SdrPaintWindow (!)");
569 // draw background self using wallpaper
570 // #i79128# ...and use correct OutDev for that
571 if(pTargetPaintWindow)
573 OutputDevice& rTargetOutDev = pTargetPaintWindow->GetTargetOutputDevice();
574 rTargetOutDev.DrawWallpaper(aPaintRect, Wallpaper(Color(COL_WHITE)));
577 // do paint (unbuffered) and mark repaint end
578 if(pPgView)
580 // paint of control layer is done in EndDrawLayers anyway...
581 pPgView->GetView().EndDrawLayers(*pTargetPaintWindow, true);
584 mnPaintGuard--;
586 return 0;
590 IMPL_LINK_NOARG(DlgEditor, MarkTimeout)
592 rLayout.UpdatePropertyBrowser();
593 return 1;
597 void DlgEditor::SetMode (Mode eNewMode )
599 if ( eNewMode != eMode )
601 if ( eNewMode == INSERT )
602 pFunc.reset(new DlgEdFuncInsert(*this));
603 else
604 pFunc.reset(new DlgEdFuncSelect(*this));
606 if ( eNewMode == READONLY )
607 pDlgEdModel->SetReadOnly( true );
608 else
609 pDlgEdModel->SetReadOnly( false );
612 if ( eNewMode == TEST )
613 ShowDialog();
615 eMode = eNewMode;
619 void DlgEditor::SetInsertObj( sal_uInt16 eObj )
621 eActObj = eObj;
623 pDlgEdView->SetCurrentObj( eActObj, DlgInventor );
627 sal_uInt16 DlgEditor::GetInsertObj() const
629 return eActObj;
633 void DlgEditor::CreateDefaultObject()
635 // create object by factory
636 SdrObject* pObj = SdrObjFactory::MakeNewObject( pDlgEdView->GetCurrentObjInventor(), pDlgEdView->GetCurrentObjIdentifier(), pDlgEdPage );
638 if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pObj))
640 // set position and size
641 Size aSize = rWindow.PixelToLogic( Size( 96, 24 ) );
642 Point aPoint = (pDlgEdForm->GetSnapRect()).Center();
643 aPoint.X() -= aSize.Width() / 2;
644 aPoint.Y() -= aSize.Height() / 2;
645 pDlgEdObj->SetSnapRect( Rectangle( aPoint, aSize ) );
647 // set default property values
648 pDlgEdObj->SetDefaults();
650 // insert object into drawing page
651 SdrPageView* pPageView = pDlgEdView->GetSdrPageView();
652 pDlgEdView->InsertObjectAtView( pDlgEdObj, *pPageView);
654 // start listening
655 pDlgEdObj->StartListening();
660 void DlgEditor::Cut()
662 Copy();
663 Delete();
667 void implCopyStreamToByteSequence( Reference< XInputStream > xStream,
668 Sequence< sal_Int8 >& bytes )
670 sal_Int32 nRead = xStream->readBytes( bytes, xStream->available() );
671 for (;;)
673 Sequence< sal_Int8 > readBytes;
674 nRead = xStream->readBytes( readBytes, 1024 );
675 if (! nRead)
676 break;
678 sal_Int32 nPos = bytes.getLength();
679 bytes.realloc( nPos + nRead );
680 memcpy( bytes.getArray() + nPos, readBytes.getConstArray(), (sal_uInt32)nRead );
684 void DlgEditor::Copy()
686 if( !pDlgEdView->AreObjectsMarked() )
687 return;
689 // stop all drawing actions
690 pDlgEdView->BrkAction();
692 // create an empty clipboard dialog model
693 Reference< util::XCloneable > xClone( m_xUnoControlDialogModel, UNO_QUERY );
694 Reference< util::XCloneable > xNewClone = xClone->createClone();
695 Reference< container::XNameContainer > xClipDialogModel( xNewClone, UNO_QUERY );
697 Reference< container::XNameAccess > xNAcc( xClipDialogModel, UNO_QUERY );
698 if ( xNAcc.is() )
700 Sequence< OUString > aNames = xNAcc->getElementNames();
701 const OUString* pNames = aNames.getConstArray();
702 sal_uInt32 nCtrls = aNames.getLength();
704 for ( sal_uInt32 n = 0; n < nCtrls; n++ )
706 xClipDialogModel->removeByName( pNames[n] );
710 // insert control models of marked objects into clipboard dialog model
711 sal_uLong nMark = pDlgEdView->GetMarkedObjectList().GetMarkCount();
712 for( sal_uLong i = 0; i < nMark; i++ )
714 SdrObject* pObj = pDlgEdView->GetMarkedObjectList().GetMark(i)->GetMarkedSdrObj();
715 DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pObj);
717 if (pDlgEdObj && !dynamic_cast<DlgEdForm*>(pDlgEdObj))
719 OUString aName;
720 Reference< beans::XPropertySet > xMarkPSet(pDlgEdObj->GetUnoControlModel(), uno::UNO_QUERY);
721 if (xMarkPSet.is())
723 xMarkPSet->getPropertyValue( DLGED_PROP_NAME ) >>= aName;
726 Reference< container::XNameAccess > xNameAcc(m_xUnoControlDialogModel, UNO_QUERY );
727 if ( xNameAcc.is() && xNameAcc->hasByName(aName) )
729 Any aCtrl = xNameAcc->getByName( aName );
731 // clone control model
732 Reference< util::XCloneable > xCtrl;
733 aCtrl >>= xCtrl;
734 Reference< util::XCloneable > xNewCtrl = xCtrl->createClone();
735 Any aNewCtrl;
736 aNewCtrl <<= xNewCtrl;
738 if (xClipDialogModel.is())
739 xClipDialogModel->insertByName( aName , aNewCtrl );
744 // export clipboard dialog model to xml
745 Reference< XComponentContext > xContext(
746 comphelper::getProcessComponentContext() );
747 Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xClipDialogModel, xContext, m_xDocument );
748 Reference< XInputStream > xStream( xISP->createInputStream() );
749 Sequence< sal_Int8 > DialogModelBytes;
750 implCopyStreamToByteSequence( xStream, DialogModelBytes );
751 xStream->closeInput();
753 // set clipboard content
754 Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow().GetClipboard();
755 if ( xClipboard.is() )
757 // With resource?
758 uno::Reference< beans::XPropertySet > xDialogModelPropSet( m_xUnoControlDialogModel, uno::UNO_QUERY );
759 uno::Reference< resource::XStringResourcePersistence > xStringResourcePersistence;
760 if( xDialogModelPropSet.is() )
764 Any aResourceResolver = xDialogModelPropSet->getPropertyValue( aResourceResolverPropName );
765 aResourceResolver >>= xStringResourcePersistence;
767 catch(const UnknownPropertyException& )
771 DlgEdTransferableImpl* pTrans = NULL;
772 if( xStringResourcePersistence.is() )
774 // With resource, support old and new format
776 // Export xClipDialogModel another time with ids replaced by current language string
777 uno::Reference< resource::XStringResourceManager >
778 xStringResourceManager( xStringResourcePersistence, uno::UNO_QUERY );
779 LocalizationMgr::resetResourceForDialog( xClipDialogModel, xStringResourceManager );
780 Reference< XInputStreamProvider > xISP2 = ::xmlscript::exportDialogModel( xClipDialogModel, xContext, m_xDocument );
781 Reference< XInputStream > xStream2( xISP2->createInputStream() );
782 Sequence< sal_Int8 > NoResourceDialogModelBytes;
783 implCopyStreamToByteSequence( xStream2, NoResourceDialogModelBytes );
784 xStream2->closeInput();
786 // Old format contains dialog with replaced ids
787 Sequence< Any > aSeqData(2);
788 Any aNoResourceDialogModelBytesAny;
789 aNoResourceDialogModelBytesAny <<= NoResourceDialogModelBytes;
790 aSeqData[0] = aNoResourceDialogModelBytesAny;
792 // New format contains dialog and resource
793 Sequence< sal_Int8 > aResData = xStringResourcePersistence->exportBinary();
795 // Create sequence for combined dialog and resource
796 sal_Int32 nDialogDataLen = DialogModelBytes.getLength();
797 sal_Int32 nResDataLen = aResData.getLength();
799 // Combined data = 4 Bytes 32Bit Offset to begin of resource data, lowest byte first
800 // + nDialogDataLen bytes dialog data + nResDataLen resource data
801 sal_Int32 nTotalLen = 4 + nDialogDataLen + nResDataLen;
802 sal_Int32 nResOffset = 4 + nDialogDataLen;
803 Sequence< sal_Int8 > aCombinedData( nTotalLen );
804 sal_Int8* pCombinedData = aCombinedData.getArray();
806 // Write offset
807 sal_Int32 n = nResOffset;
808 for( sal_Int16 i = 0 ; i < 4 ; i++ )
810 pCombinedData[i] = sal_Int8( n & 0xff );
811 n >>= 8;
813 memcpy( pCombinedData + 4, DialogModelBytes.getConstArray(), nDialogDataLen );
814 memcpy( pCombinedData + nResOffset, aResData.getConstArray(), nResDataLen );
816 Any aCombinedDataAny;
817 aCombinedDataAny <<= aCombinedData;
818 aSeqData[1] = aCombinedDataAny;
820 pTrans = new DlgEdTransferableImpl( m_ClipboardDataFlavorsResource, aSeqData );
822 else
824 // No resource, support only old format
825 Sequence< Any > aSeqData(1);
826 Any aDialogModelBytesAny;
827 aDialogModelBytesAny <<= DialogModelBytes;
828 aSeqData[0] = aDialogModelBytesAny;
829 pTrans = new DlgEdTransferableImpl( m_ClipboardDataFlavors , aSeqData );
831 const sal_uInt32 nRef = Application::ReleaseSolarMutex();
832 xClipboard->setContents( pTrans , pTrans );
833 Application::AcquireSolarMutex( nRef );
838 void DlgEditor::Paste()
840 // stop all drawing actions
841 pDlgEdView->BrkAction();
843 // unmark all objects
844 pDlgEdView->UnmarkAll();
846 // get clipboard
847 Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow().GetClipboard();
848 if ( xClipboard.is() )
850 // get clipboard content
851 const sal_uInt32 nRef = Application::ReleaseSolarMutex();
852 Reference< datatransfer::XTransferable > xTransf = xClipboard->getContents();
853 Application::AcquireSolarMutex( nRef );
854 if ( xTransf.is() )
856 // Is target dialog (library) localized?
857 uno::Reference< beans::XPropertySet > xDialogModelPropSet( m_xUnoControlDialogModel, uno::UNO_QUERY );
858 uno::Reference< resource::XStringResourceManager > xStringResourceManager;
859 if( xDialogModelPropSet.is() )
863 Any aResourceResolver = xDialogModelPropSet->getPropertyValue( aResourceResolverPropName );
864 aResourceResolver >>= xStringResourceManager;
866 catch(const UnknownPropertyException& )
869 bool bLocalized = false;
870 if( xStringResourceManager.is() )
871 bLocalized = ( xStringResourceManager->getLocales().getLength() > 0 );
873 if ( xTransf->isDataFlavorSupported( m_ClipboardDataFlavors[0] ) )
875 // create clipboard dialog model from xml
876 Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
877 Reference< container::XNameContainer > xClipDialogModel( xContext->getServiceManager()->createInstanceWithContext(
878 "com.sun.star.awt.UnoControlDialogModel", xContext ), uno::UNO_QUERY );
880 bool bSourceIsLocalized = false;
881 Sequence< sal_Int8 > DialogModelBytes;
882 Sequence< sal_Int8 > aResData;
883 if( bLocalized && xTransf->isDataFlavorSupported( m_ClipboardDataFlavorsResource[1] ) )
885 bSourceIsLocalized = true;
887 Any aCombinedDataAny = xTransf->getTransferData( m_ClipboardDataFlavorsResource[1] );
888 Sequence< sal_Int8 > aCombinedData;
889 aCombinedDataAny >>= aCombinedData;
890 const sal_Int8* pCombinedData = aCombinedData.getConstArray();
892 sal_Int32 nTotalLen = aCombinedData.getLength();
894 // Reading offset
895 sal_Int32 nResOffset = 0;
896 sal_Int32 nFactor = 1;
897 for( sal_Int16 i = 0; i < 4; i++ )
899 nResOffset += nFactor * sal_uInt8( pCombinedData[i] );
900 nFactor *= 256;
903 sal_Int32 nResDataLen = nTotalLen - nResOffset;
904 sal_Int32 nDialogDataLen = nTotalLen - nResDataLen - 4;
906 DialogModelBytes.realloc( nDialogDataLen );
907 memcpy( DialogModelBytes.getArray(), pCombinedData + 4, nDialogDataLen );
909 aResData.realloc( nResDataLen );
910 memcpy( aResData.getArray(), pCombinedData + nResOffset, nResDataLen );
912 else
914 Any aAny = xTransf->getTransferData( m_ClipboardDataFlavors[0] );
915 aAny >>= DialogModelBytes;
918 if ( xClipDialogModel.is() )
920 ::xmlscript::importDialogModel( ::xmlscript::createInputStream( rtl::ByteSequence(DialogModelBytes.getArray(), DialogModelBytes.getLength()) ) , xClipDialogModel, xContext, m_xDocument );
923 // get control models from clipboard dialog model
924 Reference< ::com::sun::star::container::XNameAccess > xNameAcc( xClipDialogModel, UNO_QUERY );
925 if ( xNameAcc.is() )
927 Sequence< OUString > aNames = xNameAcc->getElementNames();
928 const OUString* pNames = aNames.getConstArray();
929 sal_uInt32 nCtrls = aNames.getLength();
931 Reference< resource::XStringResourcePersistence > xStringResourcePersistence;
932 if( nCtrls > 0 && bSourceIsLocalized )
934 xStringResourcePersistence = css::resource::StringResource::create( getProcessComponentContext() );
935 xStringResourcePersistence->importBinary( aResData );
937 for( sal_uInt32 n = 0; n < nCtrls; n++ )
939 Any aA = xNameAcc->getByName( pNames[n] );
940 Reference< ::com::sun::star::awt::XControlModel > xCM;
941 aA >>= xCM;
943 // clone the control model
944 Reference< util::XCloneable > xClone( xCM, uno::UNO_QUERY );
945 Reference< awt::XControlModel > xCtrlModel( xClone->createClone(), uno::UNO_QUERY );
947 DlgEdObj* pCtrlObj = new DlgEdObj();
948 pCtrlObj->SetDlgEdForm(pDlgEdForm); // set parent form
949 pDlgEdForm->AddChild(pCtrlObj); // add child to parent form
950 pCtrlObj->SetUnoControlModel( xCtrlModel ); // set control model
952 // set new name
953 OUString aOUniqueName( pCtrlObj->GetUniqueName() );
954 Reference< beans::XPropertySet > xPSet( xCtrlModel , UNO_QUERY );
955 Any aUniqueName;
956 aUniqueName <<= aOUniqueName;
957 xPSet->setPropertyValue( DLGED_PROP_NAME, aUniqueName );
959 // set tabindex
960 Reference< container::XNameAccess > xNA( m_xUnoControlDialogModel , UNO_QUERY );
961 Sequence< OUString > aNames_ = xNA->getElementNames();
962 Any aTabIndex;
963 aTabIndex <<= (sal_Int16) aNames_.getLength();
964 xPSet->setPropertyValue( DLGED_PROP_TABINDEX, aTabIndex );
966 if( bLocalized )
968 Any aControlAny;
969 aControlAny <<= xCtrlModel;
970 if( bSourceIsLocalized && xStringResourcePersistence.is() )
972 Reference< resource::XStringResourceResolver >
973 xSourceStringResolver( xStringResourcePersistence, UNO_QUERY );
974 LocalizationMgr::copyResourcesForPastedEditorObject( this,
975 aControlAny, aOUniqueName, xSourceStringResolver );
977 else
979 LocalizationMgr::setControlResourceIDsForNewEditorObject
980 ( this, aControlAny, aOUniqueName );
984 // insert control model in editor dialog model
985 Any aCtrlModel;
986 aCtrlModel <<= xCtrlModel;
987 m_xUnoControlDialogModel->insertByName( aOUniqueName , aCtrlModel );
989 // insert object into drawing page
990 pDlgEdModel->GetPage(0)->InsertObject( pCtrlObj );
991 pCtrlObj->SetRectFromProps();
992 pCtrlObj->UpdateStep();
993 pDlgEdForm->UpdateTabOrderAndGroups();
994 pCtrlObj->StartListening(); // start listening
996 // mark object
997 SdrPageView* pPgView = pDlgEdView->GetSdrPageView();
998 pDlgEdView->MarkObj( pCtrlObj, pPgView, false, true);
1001 // center marked objects in dialog editor form
1002 Point aMarkCenter = (pDlgEdView->GetMarkedObjRect()).Center();
1003 Point aFormCenter = (pDlgEdForm->GetSnapRect()).Center();
1004 Point aPoint = aFormCenter - aMarkCenter;
1005 Size aSize( aPoint.X() , aPoint.Y() );
1006 pDlgEdView->MoveMarkedObj( aSize ); // update of control model properties (position + size) in NbcMove
1007 pDlgEdView->MarkListHasChanged();
1009 // dialog model changed
1010 SetDialogModelChanged(true);
1018 void DlgEditor::Delete()
1020 if( !pDlgEdView->AreObjectsMarked() )
1021 return;
1023 // remove control models of marked objects from dialog model
1024 sal_uLong nMark = pDlgEdView->GetMarkedObjectList().GetMarkCount();
1026 for( sal_uLong i = 0; i < nMark; i++ )
1028 SdrObject* pObj = pDlgEdView->GetMarkedObjectList().GetMark(i)->GetMarkedSdrObj();
1029 DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pObj);
1031 if ( pDlgEdObj && !dynamic_cast<DlgEdForm*>(pDlgEdObj) )
1033 // get name from property
1034 OUString aName;
1035 uno::Reference< beans::XPropertySet > xPSet(pDlgEdObj->GetUnoControlModel(), uno::UNO_QUERY);
1036 if (xPSet.is())
1038 xPSet->getPropertyValue( DLGED_PROP_NAME ) >>= aName;
1041 // remove control from dialog model
1042 Reference< ::com::sun::star::container::XNameAccess > xNameAcc(pDlgEdObj->GetDlgEdForm()->GetUnoControlModel(), UNO_QUERY );
1043 if ( xNameAcc.is() && xNameAcc->hasByName(aName) )
1045 Reference< ::com::sun::star::container::XNameContainer > xCont(xNameAcc, UNO_QUERY );
1046 if ( xCont.is() )
1048 if( xCont->hasByName( aName ) )
1050 Any aAny = xCont->getByName( aName );
1051 LocalizationMgr::deleteControlResourceIDsForDeletedEditorObject( this, aAny, aName );
1053 xCont->removeByName( aName );
1057 // remove child from parent form
1058 pDlgEdForm->RemoveChild( pDlgEdObj );
1062 // update tab indices
1063 pDlgEdForm->UpdateTabIndices();
1065 pDlgEdView->BrkAction();
1067 bool const bDlgMarked = UnmarkDialog();
1068 pDlgEdView->DeleteMarked();
1069 if( bDlgMarked )
1070 RemarkDialog();
1074 bool DlgEditor::IsPasteAllowed()
1076 // get clipboard
1077 Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow().GetClipboard();
1078 if ( xClipboard.is() )
1080 // get clipboard content
1081 const sal_uInt32 nRef = Application::ReleaseSolarMutex();
1082 Reference< datatransfer::XTransferable > xTransf = xClipboard->getContents();
1083 Application::AcquireSolarMutex( nRef );
1084 return xTransf.is() && xTransf->isDataFlavorSupported( m_ClipboardDataFlavors[0] );
1086 return false;
1090 void DlgEditor::ShowProperties()
1092 rLayout.ShowPropertyBrowser();
1096 void DlgEditor::UpdatePropertyBrowserDelayed()
1098 aMarkTimer.Start();
1102 bool DlgEditor::IsModified() const
1104 return pDlgEdModel->IsChanged() || bDialogModelChanged;
1108 void DlgEditor::ClearModifyFlag()
1110 pDlgEdModel->SetChanged(false);
1111 bDialogModelChanged = false;
1115 namespace Print
1117 long const nLeftMargin = 1700;
1118 long const nRightMargin = 900;
1119 long const nTopMargin = 2000;
1120 long const nBottomMargin = 1000;
1121 long const nBorder = 300;
1124 void lcl_PrintHeader( Printer* pPrinter, const OUString& rTitle ) // not working yet
1127 pPrinter->Push();
1129 Size const aSz = pPrinter->GetOutputSize();
1131 pPrinter->SetLineColor( COL_BLACK );
1132 pPrinter->SetFillColor();
1134 Font aFont( pPrinter->GetFont() );
1135 aFont.SetWeight( WEIGHT_BOLD );
1136 aFont.SetAlign( ALIGN_BOTTOM );
1137 pPrinter->SetFont( aFont );
1139 long const nFontHeight = pPrinter->GetTextHeight();
1141 // 1st border => line, 2+3 border = free space
1142 long const nYTop = Print::nTopMargin - 3*Print::nBorder - nFontHeight;
1144 long const nXLeft = Print::nLeftMargin - Print::nBorder;
1145 long const nXRight = aSz.Width() - Print::nRightMargin + Print::nBorder;
1147 pPrinter->DrawRect(Rectangle(
1148 Point(nXLeft, nYTop),
1149 Size(nXRight - nXLeft, aSz.Height() - nYTop - Print::nBottomMargin + Print::nBorder)
1152 long nY = Print::nTopMargin - 2*Print::nBorder;
1153 Point aPos(Print::nLeftMargin, nY);
1154 pPrinter->DrawText( aPos, rTitle );
1156 nY = Print::nTopMargin - Print::nBorder;
1157 pPrinter->DrawLine( Point( nXLeft, nY ), Point( nXRight, nY ) );
1159 pPrinter->Pop();
1163 sal_Int32 DlgEditor::countPages( Printer* )
1165 return 1;
1168 void DlgEditor::printPage( sal_Int32 nPage, Printer* pPrinter, const OUString& rTitle )
1170 if( nPage == 0 )
1171 Print( pPrinter, rTitle );
1175 void DlgEditor::Print( Printer* pPrinter, const OUString& rTitle ) // not working yet
1178 MapMode aOldMap( pPrinter->GetMapMode());
1179 Font aOldFont( pPrinter->GetFont() );
1181 MapMode aMap( MAP_100TH_MM );
1182 pPrinter->SetMapMode( aMap );
1183 Font aFont;
1184 aFont.SetAlign( ALIGN_BOTTOM );
1185 aFont.SetSize( Size( 0, 360 ));
1186 pPrinter->SetFont( aFont );
1188 Size aPaperSz = pPrinter->GetOutputSize();
1189 aPaperSz.Width() -= (Print::nLeftMargin + Print::nRightMargin);
1190 aPaperSz.Height() -= (Print::nTopMargin + Print::nBottomMargin);
1192 lcl_PrintHeader( pPrinter, rTitle );
1194 Bitmap aDlg;
1195 Size aBmpSz( pPrinter->PixelToLogic( aDlg.GetSizePixel() ) );
1196 double nPaperSzWidth = aPaperSz.Width();
1197 double nPaperSzHeight = aPaperSz.Height();
1198 double nBmpSzWidth = aBmpSz.Width();
1199 double nBmpSzHeight = aBmpSz.Height();
1200 double nScaleX = (nPaperSzWidth / nBmpSzWidth );
1201 double nScaleY = (nPaperSzHeight / nBmpSzHeight );
1203 Size aOutputSz;
1204 if( nBmpSzHeight * nScaleX <= nPaperSzHeight )
1206 aOutputSz.Width() = (long)(((double)nBmpSzWidth) * nScaleX);
1207 aOutputSz.Height() = (long)(((double)nBmpSzHeight) * nScaleX);
1209 else
1211 aOutputSz.Width() = (long)(((double)nBmpSzWidth) * nScaleY);
1212 aOutputSz.Height() = (long)(((double)nBmpSzHeight) * nScaleY);
1215 Point aPosOffs(
1216 (aPaperSz.Width() / 2) - (aOutputSz.Width() / 2),
1217 (aPaperSz.Height()/ 2) - (aOutputSz.Height() / 2));
1219 aPosOffs.X() += Print::nLeftMargin;
1220 aPosOffs.Y() += Print::nTopMargin;
1222 pPrinter->DrawBitmap( aPosOffs, aOutputSz, aDlg );
1224 pPrinter->SetMapMode( aOldMap );
1225 pPrinter->SetFont( aOldFont );
1230 bool DlgEditor::AdjustPageSize()
1232 bool bAdjustedPageSize = false;
1233 Reference< beans::XPropertySet > xPSet( m_xUnoControlDialogModel, UNO_QUERY );
1234 if ( xPSet.is() )
1236 sal_Int32 nFormXIn = 0, nFormYIn = 0, nFormWidthIn = 0, nFormHeightIn = 0;
1237 xPSet->getPropertyValue( DLGED_PROP_POSITIONX ) >>= nFormXIn;
1238 xPSet->getPropertyValue( DLGED_PROP_POSITIONY ) >>= nFormYIn;
1239 xPSet->getPropertyValue( DLGED_PROP_WIDTH ) >>= nFormWidthIn;
1240 xPSet->getPropertyValue( DLGED_PROP_HEIGHT ) >>= nFormHeightIn;
1242 sal_Int32 nFormX, nFormY, nFormWidth, nFormHeight;
1243 if ( pDlgEdForm && pDlgEdForm->TransformFormToSdrCoordinates( nFormXIn, nFormYIn, nFormWidthIn, nFormHeightIn, nFormX, nFormY, nFormWidth, nFormHeight ) )
1245 Size aPageSizeDelta( 400, 300 );
1246 aPageSizeDelta = rWindow.PixelToLogic( aPageSizeDelta, MapMode( MAP_100TH_MM ) );
1248 sal_Int32 nNewPageWidth = nFormX + nFormWidth + aPageSizeDelta.Width();
1249 sal_Int32 nNewPageHeight = nFormY + nFormHeight + aPageSizeDelta.Height();
1251 Size aPageSizeMin( DLGED_PAGE_WIDTH_MIN, DLGED_PAGE_HEIGHT_MIN );
1252 aPageSizeMin = rWindow.PixelToLogic( aPageSizeMin, MapMode( MAP_100TH_MM ) );
1253 sal_Int32 nPageWidthMin = aPageSizeMin.Width();
1254 sal_Int32 nPageHeightMin = aPageSizeMin.Height();
1256 if ( nNewPageWidth < nPageWidthMin )
1257 nNewPageWidth = nPageWidthMin;
1259 if ( nNewPageHeight < nPageHeightMin )
1260 nNewPageHeight = nPageHeightMin;
1262 if ( pDlgEdPage )
1264 Size aPageSize = pDlgEdPage->GetSize();
1265 if ( nNewPageWidth != aPageSize.Width() || nNewPageHeight != aPageSize.Height() )
1267 Size aNewPageSize( nNewPageWidth, nNewPageHeight );
1268 pDlgEdPage->SetSize( aNewPageSize );
1269 pDlgEdView->SetWorkArea( Rectangle( Point( 0, 0 ), aNewPageSize ) );
1270 bAdjustedPageSize = true;
1276 return bAdjustedPageSize;
1280 } // namespace basctl
1282 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */