Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / basctl / source / basicide / baside3.cxx
blobf43d141bb55aab2fbb91f4ec2cbeeae917668854
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 .
20 #include <strings.hrc>
21 #include <helpids.h>
23 #include <accessibledialogwindow.hxx>
24 #include <baside3.hxx>
25 #include <basidesh.hxx>
26 #include <bastype2.hxx>
27 #include <dlged.hxx>
28 #include <dlgeddef.hxx>
29 #include <dlgedmod.hxx>
30 #include <dlgedview.hxx>
31 #include <iderdll.hxx>
32 #include <localizationmgr.hxx>
33 #include <managelang.hxx>
35 #include <basic/basmgr.hxx>
36 #include <com/sun/star/resource/StringResourceWithLocation.hpp>
37 #include <com/sun/star/ucb/SimpleFileAccess.hpp>
38 #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
39 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
40 #include <com/sun/star/ui/dialogs/FilePicker.hpp>
41 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
42 #include <comphelper/processfactory.hxx>
43 #include <sfx2/dispatch.hxx>
44 #include <sfx2/request.hxx>
45 #include <svl/aeitem.hxx>
46 #include <svl/visitem.hxx>
47 #include <svl/whiter.hxx>
48 #include <svx/svdundo.hxx>
49 #include <svx/svxids.hrc>
50 #include <tools/diagnose_ex.h>
51 #include <tools/urlobj.hxx>
52 #include <vcl/weld.hxx>
53 #include <vcl/settings.hxx>
54 #include <xmlscript/xmldlg_imexp.hxx>
56 namespace basctl
59 using namespace ::com::sun::star;
60 using namespace ::com::sun::star::uno;
61 using namespace ::com::sun::star::ucb;
62 using namespace ::com::sun::star::io;
63 using namespace ::com::sun::star::resource;
64 using namespace ::com::sun::star::ui::dialogs;
66 #ifdef _WIN32
67 char const FilterMask_All[] = "*.*";
68 #else
69 char const FilterMask_All[] = "*";
70 #endif
72 DialogWindow::DialogWindow(DialogWindowLayout* pParent, ScriptDocument const& rDocument,
73 const OUString& aLibName, const OUString& aName,
74 css::uno::Reference<css::container::XNameContainer> const& xDialogModel)
75 : BaseWindow(pParent, rDocument, aLibName, aName)
76 ,m_rLayout(*pParent)
77 ,m_pEditor(new DlgEditor(*this, m_rLayout, rDocument.isDocument()
78 ? rDocument.getDocument()
79 : Reference<frame::XModel>(), xDialogModel))
80 ,m_pUndoMgr(new SfxUndoManager)
81 ,m_nControlSlotId(SID_INSERT_SELECT)
83 InitSettings();
85 m_pEditor->GetModel().SetNotifyUndoActionHdl(
86 LINK(this, DialogWindow, NotifyUndoActionHdl)
89 SetHelpId( HID_BASICIDE_DIALOGWINDOW );
91 // set readonly mode for readonly libraries
92 Reference< script::XLibraryContainer2 > xDlgLibContainer( GetDocument().getLibraryContainer( E_DIALOGS ), UNO_QUERY );
93 if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) && xDlgLibContainer->isLibraryReadOnly( aLibName ) )
94 SetReadOnly(true);
96 if ( rDocument.isDocument() && rDocument.isReadOnly() )
97 SetReadOnly(true);
100 void DialogWindow::dispose()
102 m_pEditor.reset();
103 BaseWindow::dispose();
106 void DialogWindow::LoseFocus()
108 if ( IsModified() )
109 StoreData();
111 Window::LoseFocus();
114 void DialogWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
116 m_pEditor->Paint(rRenderContext, rRect);
119 void DialogWindow::Resize()
121 if (GetHScrollBar() && GetVScrollBar())
123 m_pEditor->SetScrollBars( GetHScrollBar(), GetVScrollBar() );
127 void DialogWindow::MouseButtonDown( const MouseEvent& rMEvt )
129 m_pEditor->MouseButtonDown( rMEvt );
131 if (SfxBindings* pBindings = GetBindingsPtr())
132 pBindings->Invalidate( SID_SHOW_PROPERTYBROWSER );
135 void DialogWindow::MouseButtonUp( const MouseEvent& rMEvt )
137 m_pEditor->MouseButtonUp( rMEvt );
138 if( (m_pEditor->GetMode() == DlgEditor::INSERT) && !m_pEditor->IsCreateOK() )
140 m_nControlSlotId = SID_INSERT_SELECT;
141 m_pEditor->SetMode( DlgEditor::SELECT );
142 Shell::InvalidateControlSlots();
144 if (SfxBindings* pBindings = GetBindingsPtr())
146 pBindings->Invalidate( SID_SHOW_PROPERTYBROWSER );
147 pBindings->Invalidate( SID_DOC_MODIFIED );
148 pBindings->Invalidate( SID_SAVEDOC );
149 pBindings->Invalidate( SID_COPY );
150 pBindings->Invalidate( SID_CUT );
154 void DialogWindow::MouseMove( const MouseEvent& rMEvt )
156 m_pEditor->MouseMove( rMEvt );
159 void DialogWindow::KeyInput( const KeyEvent& rKEvt )
161 SfxBindings* pBindings = GetBindingsPtr();
163 if( rKEvt.GetKeyCode() == KEY_BACKSPACE )
165 if (SfxDispatcher* pDispatcher = GetDispatcher())
166 pDispatcher->Execute( SID_BACKSPACE );
168 else
170 if( pBindings && rKEvt.GetKeyCode() == KEY_TAB )
171 pBindings->Invalidate( SID_SHOW_PROPERTYBROWSER );
173 if( !m_pEditor->KeyInput( rKEvt ) )
175 if( !SfxViewShell::Current()->KeyInput( rKEvt ) )
176 Window::KeyInput( rKEvt );
180 // may be KEY_TAB, KEY_BACKSPACE, KEY_ESCAPE
181 if( pBindings )
183 pBindings->Invalidate( SID_COPY );
184 pBindings->Invalidate( SID_CUT );
188 void DialogWindow::Command( const CommandEvent& rCEvt )
190 if ( ( rCEvt.GetCommand() == CommandEventId::Wheel ) ||
191 ( rCEvt.GetCommand() == CommandEventId::StartAutoScroll ) ||
192 ( rCEvt.GetCommand() == CommandEventId::AutoScroll ) )
194 HandleScrollCommand( rCEvt, GetHScrollBar(), GetVScrollBar() );
196 else if ( rCEvt.GetCommand() == CommandEventId::ContextMenu )
198 if (GetDispatcher())
200 SdrView& rView = GetView();
201 if( !rCEvt.IsMouseEvent() && rView.AreObjectsMarked() )
203 tools::Rectangle aMarkedRect( rView.GetMarkedRect() );
204 Point MarkedCenter( aMarkedRect.Center() );
205 Point PosPixel( LogicToPixel( MarkedCenter ) );
206 SfxDispatcher::ExecutePopup( this, &PosPixel );
208 else
210 SfxDispatcher::ExecutePopup();
215 else
216 BaseWindow::Command( rCEvt );
220 IMPL_STATIC_LINK(
221 DialogWindow, NotifyUndoActionHdl, SdrUndoAction *, pUndoAction, void )
223 // #i120515# pUndoAction needs to be deleted, this hand over is an ownership
224 // change. As long as it does not get added to the undo manager, it needs at
225 // least to be deleted.
226 delete pUndoAction;
229 void DialogWindow::DoInit()
231 GetHScrollBar()->Show();
232 GetVScrollBar()->Show();
233 m_pEditor->SetScrollBars( GetHScrollBar(), GetVScrollBar() );
236 void DialogWindow::DoScroll( ScrollBar* )
238 m_pEditor->DoScroll();
241 void DialogWindow::GetState( SfxItemSet& rSet )
243 SfxWhichIter aIter(rSet);
244 bool bIsCalc = false;
245 if ( GetDocument().isDocument() )
247 Reference< frame::XModel > xModel= GetDocument().getDocument();
248 if ( xModel.is() )
250 Reference< lang::XServiceInfo > xServiceInfo ( xModel, UNO_QUERY );
251 if ( xServiceInfo.is() && xServiceInfo->supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) )
252 bIsCalc = true;
256 for ( sal_uInt16 nWh = aIter.FirstWhich(); nWh != 0; nWh = aIter.NextWhich() )
258 switch ( nWh )
260 case SID_PASTE:
262 if ( !IsPasteAllowed() )
263 rSet.DisableItem( nWh );
265 if ( IsReadOnly() )
266 rSet.DisableItem( nWh );
268 break;
269 case SID_COPY:
271 // any object selected?
272 if ( !m_pEditor->GetView().AreObjectsMarked() )
273 rSet.DisableItem( nWh );
275 break;
276 case SID_CUT:
277 case SID_DELETE:
278 case SID_BACKSPACE:
280 // any object selected?
281 if ( !m_pEditor->GetView().AreObjectsMarked() )
282 rSet.DisableItem( nWh );
284 if ( IsReadOnly() )
285 rSet.DisableItem( nWh );
287 break;
288 case SID_REDO:
290 if ( !m_pUndoMgr->GetUndoActionCount() )
291 rSet.DisableItem( nWh );
293 break;
295 case SID_DIALOG_TESTMODE:
297 // is the IDE still active?
298 bool const bBool = GetShell()->GetFrame() &&
299 m_pEditor->GetMode() == DlgEditor::TEST;
300 rSet.Put(SfxBoolItem(SID_DIALOG_TESTMODE, bBool));
302 break;
304 case SID_CHOOSE_CONTROLS:
306 if ( IsReadOnly() )
307 rSet.DisableItem( nWh );
309 break;
311 case SID_SHOW_PROPERTYBROWSER:
313 Shell* pShell = GetShell();
314 SfxViewFrame* pViewFrame = pShell ? pShell->GetViewFrame() : nullptr;
315 if ( pViewFrame && !pViewFrame->HasChildWindow( SID_SHOW_PROPERTYBROWSER ) && !m_pEditor->GetView().AreObjectsMarked() )
316 rSet.DisableItem( nWh );
318 if ( IsReadOnly() )
319 rSet.DisableItem( nWh );
321 break;
322 case SID_INSERT_FORM_RADIO:
323 case SID_INSERT_FORM_CHECK:
324 case SID_INSERT_FORM_LIST:
325 case SID_INSERT_FORM_COMBO:
326 case SID_INSERT_FORM_VSCROLL:
327 case SID_INSERT_FORM_HSCROLL:
328 case SID_INSERT_FORM_SPIN:
330 if ( !bIsCalc || IsReadOnly() )
331 rSet.DisableItem( nWh );
332 else
333 rSet.Put( SfxBoolItem( nWh, m_nControlSlotId == nWh ) );
335 break;
337 case SID_INSERT_SELECT:
338 case SID_INSERT_PUSHBUTTON:
339 case SID_INSERT_RADIOBUTTON:
340 case SID_INSERT_CHECKBOX:
341 case SID_INSERT_LISTBOX:
342 case SID_INSERT_COMBOBOX:
343 case SID_INSERT_GROUPBOX:
344 case SID_INSERT_EDIT:
345 case SID_INSERT_FIXEDTEXT:
346 case SID_INSERT_IMAGECONTROL:
347 case SID_INSERT_PROGRESSBAR:
348 case SID_INSERT_HSCROLLBAR:
349 case SID_INSERT_VSCROLLBAR:
350 case SID_INSERT_HFIXEDLINE:
351 case SID_INSERT_VFIXEDLINE:
352 case SID_INSERT_DATEFIELD:
353 case SID_INSERT_TIMEFIELD:
354 case SID_INSERT_NUMERICFIELD:
355 case SID_INSERT_CURRENCYFIELD:
356 case SID_INSERT_FORMATTEDFIELD:
357 case SID_INSERT_PATTERNFIELD:
358 case SID_INSERT_FILECONTROL:
359 case SID_INSERT_SPINBUTTON:
360 case SID_INSERT_TREECONTROL:
362 if ( IsReadOnly() )
363 rSet.DisableItem( nWh );
364 else
365 rSet.Put( SfxBoolItem( nWh, m_nControlSlotId == nWh ) );
367 break;
368 case SID_SHOWLINES:
370 // if this is not a module window hide the
371 // setting, doesn't make sense for example if the
372 // dialog editor is open
373 rSet.DisableItem(nWh);
374 rSet.Put(SfxVisibilityItem(nWh, false));
375 break;
377 case SID_SELECTALL:
379 rSet.DisableItem( nWh );
381 break;
386 void DialogWindow::ExecuteCommand( SfxRequest& rReq )
388 const sal_uInt16 nSlotId(rReq.GetSlot());
389 sal_uInt16 nInsertObj(0);
391 switch ( nSlotId )
393 case SID_CUT:
394 if ( !IsReadOnly() )
396 GetEditor().Cut();
397 if (SfxBindings* pBindings = GetBindingsPtr())
398 pBindings->Invalidate( SID_DOC_MODIFIED );
400 break;
401 case SID_DELETE:
402 if ( !IsReadOnly() )
404 GetEditor().Delete();
405 if (SfxBindings* pBindings = GetBindingsPtr())
406 pBindings->Invalidate( SID_DOC_MODIFIED );
408 break;
409 case SID_COPY:
410 GetEditor().Copy();
411 break;
412 case SID_PASTE:
413 if ( !IsReadOnly() )
415 GetEditor().Paste();
416 if (SfxBindings* pBindings = GetBindingsPtr())
417 pBindings->Invalidate( SID_DOC_MODIFIED );
419 break;
421 case SID_INSERT_FORM_RADIO:
422 nInsertObj = OBJ_DLG_FORMRADIO;
423 break;
424 case SID_INSERT_FORM_CHECK:
425 nInsertObj = OBJ_DLG_FORMCHECK;
426 break;
427 case SID_INSERT_FORM_LIST:
428 nInsertObj = OBJ_DLG_FORMLIST;
429 break;
430 case SID_INSERT_FORM_COMBO:
431 nInsertObj = OBJ_DLG_FORMCOMBO;
432 break;
433 case SID_INSERT_FORM_SPIN:
434 nInsertObj = OBJ_DLG_FORMSPIN;
435 break;
436 case SID_INSERT_FORM_VSCROLL:
437 nInsertObj = OBJ_DLG_FORMVSCROLL;
438 break;
439 case SID_INSERT_FORM_HSCROLL:
440 nInsertObj = OBJ_DLG_FORMHSCROLL;
441 break;
442 case SID_INSERT_PUSHBUTTON:
443 nInsertObj = OBJ_DLG_PUSHBUTTON;
444 break;
445 case SID_INSERT_RADIOBUTTON:
446 nInsertObj = OBJ_DLG_RADIOBUTTON;
447 break;
448 case SID_INSERT_CHECKBOX:
449 nInsertObj = OBJ_DLG_CHECKBOX;
450 break;
451 case SID_INSERT_LISTBOX:
452 nInsertObj = OBJ_DLG_LISTBOX;
453 break;
454 case SID_INSERT_COMBOBOX:
455 nInsertObj = OBJ_DLG_COMBOBOX;
456 break;
457 case SID_INSERT_GROUPBOX:
458 nInsertObj = OBJ_DLG_GROUPBOX;
459 break;
460 case SID_INSERT_EDIT:
461 nInsertObj = OBJ_DLG_EDIT;
462 break;
463 case SID_INSERT_FIXEDTEXT:
464 nInsertObj = OBJ_DLG_FIXEDTEXT;
465 break;
466 case SID_INSERT_IMAGECONTROL:
467 nInsertObj = OBJ_DLG_IMAGECONTROL;
468 break;
469 case SID_INSERT_PROGRESSBAR:
470 nInsertObj = OBJ_DLG_PROGRESSBAR;
471 break;
472 case SID_INSERT_HSCROLLBAR:
473 nInsertObj = OBJ_DLG_HSCROLLBAR;
474 break;
475 case SID_INSERT_VSCROLLBAR:
476 nInsertObj = OBJ_DLG_VSCROLLBAR;
477 break;
478 case SID_INSERT_HFIXEDLINE:
479 nInsertObj = OBJ_DLG_HFIXEDLINE;
480 break;
481 case SID_INSERT_VFIXEDLINE:
482 nInsertObj = OBJ_DLG_VFIXEDLINE;
483 break;
484 case SID_INSERT_DATEFIELD:
485 nInsertObj = OBJ_DLG_DATEFIELD;
486 break;
487 case SID_INSERT_TIMEFIELD:
488 nInsertObj = OBJ_DLG_TIMEFIELD;
489 break;
490 case SID_INSERT_NUMERICFIELD:
491 nInsertObj = OBJ_DLG_NUMERICFIELD;
492 break;
493 case SID_INSERT_CURRENCYFIELD:
494 nInsertObj = OBJ_DLG_CURRENCYFIELD;
495 break;
496 case SID_INSERT_FORMATTEDFIELD:
497 nInsertObj = OBJ_DLG_FORMATTEDFIELD;
498 break;
499 case SID_INSERT_PATTERNFIELD:
500 nInsertObj = OBJ_DLG_PATTERNFIELD;
501 break;
502 case SID_INSERT_FILECONTROL:
503 nInsertObj = OBJ_DLG_FILECONTROL;
504 break;
505 case SID_INSERT_SPINBUTTON:
506 nInsertObj = OBJ_DLG_SPINBUTTON;
507 break;
508 case SID_INSERT_TREECONTROL:
509 nInsertObj = OBJ_DLG_TREECONTROL;
510 break;
511 case SID_INSERT_SELECT:
512 m_nControlSlotId = nSlotId;
513 GetEditor().SetMode( DlgEditor::SELECT );
514 Shell::InvalidateControlSlots();
515 break;
517 case SID_DIALOG_TESTMODE:
519 DlgEditor::Mode eOldMode = GetEditor().GetMode();
520 GetEditor().SetMode( DlgEditor::TEST );
521 GetEditor().SetMode( eOldMode );
522 rReq.Done();
523 if (SfxBindings* pBindings = GetBindingsPtr())
524 pBindings->Invalidate( SID_DIALOG_TESTMODE );
525 return;
527 case SID_EXPORT_DIALOG:
528 SaveDialog();
529 break;
531 case SID_IMPORT_DIALOG:
532 ImportDialog();
533 break;
535 case SID_BASICIDE_DELETECURRENT:
536 if (QueryDelDialog(m_aName, GetFrameWeld()))
538 if (RemoveDialog(m_aDocument, m_aLibName, m_aName))
540 MarkDocumentModified(m_aDocument);
541 GetShell()->RemoveWindow(this, true);
544 break;
547 if ( nInsertObj )
549 m_nControlSlotId = nSlotId;
550 GetEditor().SetMode( DlgEditor::INSERT );
551 GetEditor().SetInsertObj( nInsertObj );
553 if ( rReq.GetModifier() & KEY_MOD1 )
555 GetEditor().CreateDefaultObject();
556 if (SfxBindings* pBindings = GetBindingsPtr())
557 pBindings->Invalidate( SID_DOC_MODIFIED );
560 Shell::InvalidateControlSlots();
563 rReq.Done();
566 Reference< container::XNameContainer > const & DialogWindow::GetDialog() const
568 return m_pEditor->GetDialog();
571 bool DialogWindow::RenameDialog( const OUString& rNewName )
573 if (!basctl::RenameDialog(GetFrameWeld(), GetDocument(), GetLibName(), GetName(), rNewName))
574 return false;
576 if (SfxBindings* pBindings = GetBindingsPtr())
577 pBindings->Invalidate( SID_DOC_MODIFIED );
579 return true;
582 void DialogWindow::DisableBrowser()
584 m_rLayout.DisablePropertyBrowser();
587 void DialogWindow::UpdateBrowser()
589 m_rLayout.UpdatePropertyBrowser();
592 void DialogWindow::SaveDialog()
594 Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() );
595 Reference < XFilePicker3 > xFP = FilePicker::createWithMode(xContext, TemplateDescription::FILESAVE_AUTOEXTENSION_PASSWORD);
597 Reference< XFilePickerControlAccess > xFPControl(xFP, UNO_QUERY);
598 xFPControl->enableControl(ExtendedFilePickerElementIds::CHECKBOX_PASSWORD, false);
599 Any aValue;
600 aValue <<= true;
601 xFPControl->setValue(ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, 0, aValue);
603 if ( !m_sCurPath.isEmpty() )
604 xFP->setDisplayDirectory ( m_sCurPath );
606 xFP->setDefaultName( GetName() );
608 OUString aDialogStr(IDEResId(RID_STR_STDDIALOGNAME));
609 xFP->appendFilter( aDialogStr, "*.xdl" );
610 xFP->appendFilter( IDEResId(RID_STR_FILTER_ALLFILES), FilterMask_All );
611 xFP->setCurrentFilter( aDialogStr );
613 if( xFP->execute() == RET_OK )
615 Sequence< OUString > aPaths = xFP->getSelectedFiles();
616 m_sCurPath = aPaths[0];
618 // export dialog model to xml
619 Reference< container::XNameContainer > xDialogModel = GetDialog();
620 Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().isDocument() ? GetDocument().getDocument() : Reference< frame::XModel >() );
621 Reference< XInputStream > xInput( xISP->createInputStream() );
623 Reference< XSimpleFileAccess3 > xSFI( SimpleFileAccess::create(xContext) );
625 Reference< XOutputStream > xOutput;
628 if( xSFI->exists( m_sCurPath ) )
629 xSFI->kill( m_sCurPath );
630 xOutput = xSFI->openFileWrite( m_sCurPath );
632 catch(const Exception& )
635 if( xOutput.is() )
637 Sequence< sal_Int8 > bytes;
638 sal_Int32 nRead = xInput->readBytes( bytes, xInput->available() );
639 for (;;)
641 if( nRead )
642 xOutput->writeBytes( bytes );
644 nRead = xInput->readBytes( bytes, 1024 );
645 if (! nRead)
646 break;
649 // With resource?
650 Reference< beans::XPropertySet > xDialogModelPropSet( xDialogModel, UNO_QUERY );
651 Reference< resource::XStringResourceResolver > xStringResourceResolver;
652 if( xDialogModelPropSet.is() )
656 Any aResourceResolver = xDialogModelPropSet->getPropertyValue( "ResourceResolver" );
657 aResourceResolver >>= xStringResourceResolver;
659 catch(const beans::UnknownPropertyException& )
663 bool bResource = false;
664 if( xStringResourceResolver.is() )
666 Sequence< lang::Locale > aLocaleSeq = xStringResourceResolver->getLocales();
667 sal_Int32 nLocaleCount = aLocaleSeq.getLength();
668 if( nLocaleCount > 0 )
669 bResource = true;
672 if( bResource )
674 INetURLObject aURLObj( m_sCurPath );
675 aURLObj.removeExtension();
676 OUString aDialogName( aURLObj.getName() );
677 aURLObj.removeSegment();
678 OUString aURL( aURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
679 OUString aComment = "# " + aDialogName + " strings" ;
680 Reference< task::XInteractionHandler > xDummyHandler;
682 // Remove old properties files in case of overwriting Dialog files
683 if( xSFI->isFolder( aURL ) )
685 Sequence< OUString > aContentSeq = xSFI->getFolderContents( aURL, false );
687 OUString aDialogName_( aDialogName );
688 aDialogName_ += "_" ;
689 sal_Int32 nCount = aContentSeq.getLength();
690 const OUString* pFiles = aContentSeq.getConstArray();
691 for( int i = 0 ; i < nCount ; i++ )
693 OUString aCompleteName = pFiles[i];
694 OUString aPureName;
695 OUString aExtension;
696 sal_Int32 iDot = aCompleteName.lastIndexOf( '.' );
697 sal_Int32 iSlash = aCompleteName.lastIndexOf( '/' );
698 if( iDot != -1 )
700 sal_Int32 iCopyFrom = (iSlash != -1) ? iSlash + 1 : 0;
701 aPureName = aCompleteName.copy( iCopyFrom, iDot-iCopyFrom );
702 aExtension = aCompleteName.copy( iDot + 1 );
705 if( aExtension == "properties" || aExtension == "default" )
707 if( aPureName.startsWith( aDialogName_ ) )
711 xSFI->kill( aCompleteName );
713 catch(const uno::Exception& )
720 Reference< XStringResourceWithLocation > xStringResourceWithLocation =
721 StringResourceWithLocation::create( xContext, aURL, false/*bReadOnly*/,
722 xStringResourceResolver->getDefaultLocale(), aDialogName, aComment, xDummyHandler );
724 // Add locales
725 Sequence< lang::Locale > aLocaleSeq = xStringResourceResolver->getLocales();
726 const lang::Locale* pLocales = aLocaleSeq.getConstArray();
727 sal_Int32 nLocaleCount = aLocaleSeq.getLength();
728 for( sal_Int32 iLocale = 0 ; iLocale < nLocaleCount ; iLocale++ )
730 const lang::Locale& rLocale = pLocales[ iLocale ];
731 xStringResourceWithLocation->newLocale( rLocale );
734 LocalizationMgr::copyResourceForDialog( xDialogModel,
735 xStringResourceResolver, xStringResourceWithLocation );
737 xStringResourceWithLocation->store();
740 else
742 std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
743 VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_COULDNTWRITE)));
744 xBox->run();
749 std::vector< lang::Locale > implGetLanguagesOnlyContainedInFirstSeq
750 ( const Sequence< lang::Locale >& aFirstSeq, const Sequence< lang::Locale >& aSecondSeq )
752 std::vector< lang::Locale > avRet;
754 const lang::Locale* pFirst = aFirstSeq.getConstArray();
755 const lang::Locale* pSecond = aSecondSeq.getConstArray();
756 sal_Int32 nFirstCount = aFirstSeq.getLength();
757 sal_Int32 nSecondCount = aSecondSeq.getLength();
759 for( sal_Int32 iFirst = 0 ; iFirst < nFirstCount ; iFirst++ )
761 const lang::Locale& rFirstLocale = pFirst[ iFirst ];
763 bool bAlsoContainedInSecondSeq = false;
764 for( sal_Int32 iSecond = 0 ; iSecond < nSecondCount ; iSecond++ )
766 const lang::Locale& rSecondLocale = pSecond[ iSecond ];
768 bool bMatch = localesAreEqual( rFirstLocale, rSecondLocale );
769 if( bMatch )
771 bAlsoContainedInSecondSeq = true;
772 break;
776 if( !bAlsoContainedInSecondSeq )
777 avRet.push_back( rFirstLocale );
780 return avRet;
784 class NameClashQueryBox
786 private:
787 std::unique_ptr<weld::MessageDialog> m_xQueryBox;
788 public:
789 NameClashQueryBox(weld::Window* pParent, const OUString& rTitle, const OUString& rMessage)
790 : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question, VclButtonsType::NONE, rMessage))
792 if (!rTitle.isEmpty())
793 m_xQueryBox->set_title(rTitle);
794 m_xQueryBox->add_button(IDEResId(RID_STR_DLGIMP_CLASH_RENAME), RET_YES);
795 m_xQueryBox->add_button(IDEResId(RID_STR_DLGIMP_CLASH_REPLACE), RET_NO);
796 m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL);
797 m_xQueryBox->set_default_response(RET_YES);
799 short run() { return m_xQueryBox->run(); }
802 class LanguageMismatchQueryBox
804 private:
805 std::unique_ptr<weld::MessageDialog> m_xQueryBox;
806 public:
807 LanguageMismatchQueryBox(weld::Window* pParent, const OUString& rTitle, const OUString& rMessage)
808 : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question, VclButtonsType::NONE, rMessage))
810 if (!rTitle.isEmpty())
811 m_xQueryBox->set_title(rTitle);
812 m_xQueryBox->add_button(IDEResId(RID_STR_DLGIMP_MISMATCH_ADD), RET_YES);
813 m_xQueryBox->add_button(IDEResId(RID_STR_DLGIMP_MISMATCH_OMIT), RET_NO);
814 m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL);
815 m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Help), RET_HELP);
816 m_xQueryBox->set_default_response(RET_YES);
818 short run() { return m_xQueryBox->run(); }
821 bool implImportDialog(weld::Window* pWin, const OUString& rCurPath, const ScriptDocument& rDocument, const OUString& aLibName)
823 bool bDone = false;
825 Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() );
826 Reference < XFilePicker3 > xFP = FilePicker::createWithMode(xContext, TemplateDescription::FILEOPEN_SIMPLE);
828 Reference< XFilePickerControlAccess > xFPControl(xFP, UNO_QUERY);
829 xFPControl->enableControl(ExtendedFilePickerElementIds::CHECKBOX_PASSWORD, false);
830 Any aValue;
831 aValue <<= true;
832 xFPControl->setValue(ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, 0, aValue);
834 OUString aCurPath( rCurPath );
835 if ( !aCurPath.isEmpty() )
836 xFP->setDisplayDirectory ( aCurPath );
838 OUString aDialogStr(IDEResId(RID_STR_STDDIALOGNAME));
839 xFP->appendFilter( aDialogStr, "*.xdl" );
840 xFP->appendFilter( IDEResId(RID_STR_FILTER_ALLFILES), FilterMask_All );
841 xFP->setCurrentFilter( aDialogStr );
843 if( xFP->execute() == RET_OK )
845 Sequence< OUString > aPaths = xFP->getSelectedFiles();
846 aCurPath = aPaths[0];
848 OUString aBasePath;
849 OUString aOUCurPath( aCurPath );
850 sal_Int32 iSlash = aOUCurPath.lastIndexOf( '/' );
851 if( iSlash != -1 )
852 aBasePath = aOUCurPath.copy( 0, iSlash + 1 );
856 // create dialog model
857 Reference< container::XNameContainer > xDialogModel(
858 xContext->getServiceManager()->createInstanceWithContext("com.sun.star.awt.UnoControlDialogModel", xContext),
859 UNO_QUERY_THROW );
861 Reference< XSimpleFileAccess3 > xSFI( SimpleFileAccess::create(xContext) );
863 Reference< XInputStream > xInput;
864 if( xSFI->exists( aCurPath ) )
865 xInput = xSFI->openFileRead( aCurPath );
867 ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
869 OUString aXmlDlgName;
870 Reference< beans::XPropertySet > xDialogModelPropSet( xDialogModel, UNO_QUERY );
871 if( xDialogModelPropSet.is() )
875 Any aXmlDialogNameAny = xDialogModelPropSet->getPropertyValue( DLGED_PROP_NAME );
876 OUString aOUXmlDialogName;
877 aXmlDialogNameAny >>= aOUXmlDialogName;
878 aXmlDlgName = aOUXmlDialogName;
880 catch(const beans::UnknownPropertyException& )
883 bool bValidName = !aXmlDlgName.isEmpty();
884 OSL_ASSERT( bValidName );
885 if( !bValidName )
886 return bDone;
888 bool bDialogAlreadyExists = rDocument.hasDialog( aLibName, aXmlDlgName );
890 OUString aNewDlgName = aXmlDlgName;
891 enum NameClashMode
893 NO_CLASH,
894 CLASH_OVERWRITE_DIALOG,
895 CLASH_RENAME_DIALOG,
897 NameClashMode eNameClashMode = NO_CLASH;
898 if( bDialogAlreadyExists )
900 OUString aQueryBoxTitle(IDEResId(RID_STR_DLGIMP_CLASH_TITLE));
901 OUString aQueryBoxText(IDEResId(RID_STR_DLGIMP_CLASH_TEXT));
902 aQueryBoxText = aQueryBoxText.replaceAll("$(ARG1)", aXmlDlgName);
904 NameClashQueryBox aQueryBox(pWin, aQueryBoxTitle, aQueryBoxText);
905 sal_uInt16 nRet = aQueryBox.run();
906 if( nRet == RET_YES )
908 // RET_YES == Rename, see NameClashQueryBox::NameClashQueryBox
909 eNameClashMode = CLASH_RENAME_DIALOG;
911 aNewDlgName = rDocument.createObjectName( E_DIALOGS, aLibName );
913 else if( nRet == RET_NO )
915 // RET_NO == Replace, see NameClashQueryBox::NameClashQueryBox
916 eNameClashMode = CLASH_OVERWRITE_DIALOG;
918 else if( nRet == RET_CANCEL )
920 return bDone;
924 Shell* pShell = GetShell();
925 if (!pShell)
927 OSL_ASSERT(pShell);
928 return bDone;
931 // Resource?
932 css::lang::Locale aLocale = Application::GetSettings().GetUILanguageTag().getLocale();
933 Reference< task::XInteractionHandler > xDummyHandler;
934 Reference< XStringResourceWithLocation > xImportStringResource =
935 StringResourceWithLocation::create( xContext, aBasePath, true/*bReadOnly*/,
936 aLocale, aXmlDlgName, OUString(), xDummyHandler );
938 Sequence< lang::Locale > aImportLocaleSeq = xImportStringResource->getLocales();
939 sal_Int32 nImportLocaleCount = aImportLocaleSeq.getLength();
941 Reference< container::XNameContainer > xDialogLib( rDocument.getLibrary( E_DIALOGS, aLibName, true ) );
942 Reference< resource::XStringResourceManager > xLibStringResourceManager = LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib );
943 sal_Int32 nLibLocaleCount = 0;
944 Sequence< lang::Locale > aLibLocaleSeq;
945 if( xLibStringResourceManager.is() )
947 aLibLocaleSeq = xLibStringResourceManager->getLocales();
948 nLibLocaleCount = aLibLocaleSeq.getLength();
951 // Check language matches
952 std::vector< lang::Locale > aOnlyInImportLanguages =
953 implGetLanguagesOnlyContainedInFirstSeq( aImportLocaleSeq, aLibLocaleSeq );
954 int nOnlyInImportLanguageCount = aOnlyInImportLanguages.size();
956 // For now: Keep languages from lib
957 bool bLibLocalized = (nLibLocaleCount > 0);
958 bool bImportLocalized = (nImportLocaleCount > 0);
960 bool bAddDialogLanguagesToLib = false;
961 if( nOnlyInImportLanguageCount > 0 )
963 OUString aQueryBoxTitle(IDEResId(RID_STR_DLGIMP_MISMATCH_TITLE));
964 OUString aQueryBoxText(IDEResId(RID_STR_DLGIMP_MISMATCH_TEXT));
965 LanguageMismatchQueryBox aQueryBox(pWin, aQueryBoxTitle, aQueryBoxText);
966 sal_uInt16 nRet = aQueryBox.run();
967 if( nRet == RET_YES )
969 // RET_YES == Add, see LanguageMismatchQueryBox::LanguageMismatchQueryBox
970 bAddDialogLanguagesToLib = true;
972 // RET_NO == Omit, see LanguageMismatchQueryBox::LanguageMismatchQueryBox
973 // -> nothing to do here
974 //else if( RET_NO == nRet )
977 else if( nRet == RET_CANCEL )
979 return bDone;
983 if( bImportLocalized )
985 bool bCopyResourcesForDialog = true;
986 if( bAddDialogLanguagesToLib )
988 std::shared_ptr<LocalizationMgr> pCurMgr = pShell->GetCurLocalizationMgr();
990 lang::Locale aFirstLocale;
991 aFirstLocale = aOnlyInImportLanguages[0];
992 if( nOnlyInImportLanguageCount > 1 )
994 // Check if import default belongs to only import languages and use it then
995 lang::Locale aImportDefaultLocale = xImportStringResource->getDefaultLocale();
996 lang::Locale aTmpLocale;
997 for( int i = 0 ; i < nOnlyInImportLanguageCount ; ++i )
999 aTmpLocale = aOnlyInImportLanguages[i];
1000 if( localesAreEqual( aImportDefaultLocale, aTmpLocale ) )
1002 aFirstLocale = aImportDefaultLocale;
1003 break;
1008 Sequence< lang::Locale > aFirstLocaleSeq( 1 );
1009 aFirstLocaleSeq[0] = aFirstLocale;
1010 pCurMgr->handleAddLocales( aFirstLocaleSeq );
1012 if( nOnlyInImportLanguageCount > 1 )
1014 Sequence< lang::Locale > aRemainingLocaleSeq( nOnlyInImportLanguageCount - 1 );
1015 lang::Locale aTmpLocale;
1016 int iSeq = 0;
1017 for( int i = 0 ; i < nOnlyInImportLanguageCount ; ++i )
1019 aTmpLocale = aOnlyInImportLanguages[i];
1020 if( !localesAreEqual( aFirstLocale, aTmpLocale ) )
1021 aRemainingLocaleSeq[iSeq++] = aTmpLocale;
1023 pCurMgr->handleAddLocales( aRemainingLocaleSeq );
1026 else if( !bLibLocalized )
1028 Reference< resource::XStringResourceManager > xImportStringResourceManager( xImportStringResource, UNO_QUERY );
1029 LocalizationMgr::resetResourceForDialog( xDialogModel, xImportStringResourceManager );
1030 bCopyResourcesForDialog = false;
1033 if( bCopyResourcesForDialog )
1035 Reference< resource::XStringResourceResolver > xImportStringResourceResolver( xImportStringResource, UNO_QUERY );
1036 LocalizationMgr::copyResourceForDroppedDialog( xDialogModel, aXmlDlgName,
1037 xLibStringResourceManager, xImportStringResourceResolver );
1040 else if( bLibLocalized )
1042 LocalizationMgr::setResourceIDsForDialog( xDialogModel, xLibStringResourceManager );
1046 LocalizationMgr::setStringResourceAtDialog( rDocument, aLibName, aNewDlgName, xDialogModel );
1048 if( eNameClashMode == CLASH_OVERWRITE_DIALOG )
1050 if (basctl::RemoveDialog( rDocument, aLibName, aNewDlgName ) )
1052 BaseWindow* pDlgWin = pShell->FindDlgWin( rDocument, aLibName, aNewDlgName, false, true );
1053 if( pDlgWin != nullptr )
1054 pShell->RemoveWindow( pDlgWin, false );
1055 MarkDocumentModified( rDocument );
1057 else
1059 // TODO: Assertion?
1060 return bDone;
1064 if( eNameClashMode == CLASH_RENAME_DIALOG )
1066 bool bRenamed = false;
1067 if( xDialogModelPropSet.is() )
1071 xDialogModelPropSet->setPropertyValue( DLGED_PROP_NAME, Any(aNewDlgName) );
1072 bRenamed = true;
1074 catch(const beans::UnknownPropertyException& )
1079 if( bRenamed )
1081 LocalizationMgr::renameStringResourceIDs( rDocument, aLibName, aNewDlgName, xDialogModel );
1083 else
1085 // TODO: Assertion?
1086 return bDone;
1090 Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
1091 bool bSuccess = rDocument.insertDialog( aLibName, aNewDlgName, xISP );
1092 if( bSuccess )
1094 VclPtr<DialogWindow> pNewDlgWin = pShell->CreateDlgWin( rDocument, aLibName, aNewDlgName );
1095 pShell->SetCurWindow( pNewDlgWin, true );
1098 bDone = true;
1100 catch(const Exception& )
1104 return bDone;
1107 void DialogWindow::ImportDialog()
1109 const ScriptDocument& rDocument = GetDocument();
1110 OUString aLibName = GetLibName();
1111 implImportDialog(GetFrameWeld(), m_sCurPath, rDocument, aLibName);
1114 DlgEdModel& DialogWindow::GetModel() const
1116 return m_pEditor->GetModel();
1119 DlgEdPage& DialogWindow::GetPage() const
1121 return m_pEditor->GetPage();
1124 DlgEdView& DialogWindow::GetView() const
1126 return m_pEditor->GetView();
1129 bool DialogWindow::IsModified()
1131 return m_pEditor->IsModified();
1134 ::svl::IUndoManager* DialogWindow::GetUndoManager()
1136 return m_pUndoMgr.get();
1139 OUString DialogWindow::GetTitle()
1141 return GetName();
1144 EntryDescriptor DialogWindow::CreateEntryDescriptor()
1146 ScriptDocument aDocument( GetDocument() );
1147 OUString aLibName( GetLibName() );
1148 LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName );
1149 return EntryDescriptor( aDocument, eLocation, aLibName, OUString(), GetName(), OBJ_TYPE_DIALOG );
1152 void DialogWindow::SetReadOnly (bool bReadOnly)
1154 m_pEditor->SetMode(bReadOnly ? DlgEditor::READONLY : DlgEditor::SELECT);
1157 bool DialogWindow::IsReadOnly ()
1159 return m_pEditor->GetMode() == DlgEditor::READONLY;
1162 bool DialogWindow::IsPasteAllowed()
1164 return m_pEditor->IsPasteAllowed();
1167 void DialogWindow::StoreData()
1169 if ( IsModified() )
1173 Reference< container::XNameContainer > xLib = GetDocument().getLibrary( E_DIALOGS, GetLibName(), true );
1175 if( xLib.is() )
1177 Reference< container::XNameContainer > xDialogModel = m_pEditor->GetDialog();
1179 if( xDialogModel.is() )
1181 Reference< XComponentContext > xContext(
1182 comphelper::getProcessComponentContext() );
1183 Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().isDocument() ? GetDocument().getDocument() : Reference< frame::XModel >() );
1184 xLib->replaceByName( GetName(), Any( xISP ) );
1188 catch (const uno::Exception& )
1190 DBG_UNHANDLED_EXCEPTION("basctl.basicide");
1192 MarkDocumentModified( GetDocument() );
1193 m_pEditor->ClearModifyFlag();
1197 void DialogWindow::Activating ()
1199 UpdateBrowser();
1200 Show();
1203 void DialogWindow::Deactivating()
1205 Hide();
1206 if ( IsModified() )
1207 MarkDocumentModified( GetDocument() );
1208 DisableBrowser();
1211 sal_Int32 DialogWindow::countPages( Printer* )
1213 return 1;
1216 void DialogWindow::printPage( sal_Int32 nPage, Printer* pPrinter )
1218 DlgEditor::printPage( nPage, pPrinter, CreateQualifiedName() );
1221 void DialogWindow::DataChanged( const DataChangedEvent& rDCEvt )
1223 if( (rDCEvt.GetType()==DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
1225 InitSettings();
1226 Invalidate();
1228 else
1229 BaseWindow::DataChanged( rDCEvt );
1232 void DialogWindow::InitSettings()
1234 // FIXME RenderContext
1235 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
1236 vcl::Font aFont;
1237 aFont = rStyleSettings.GetFieldFont();
1238 SetPointFont(*this, aFont);
1240 SetTextColor( rStyleSettings.GetFieldTextColor() );
1241 SetTextFillColor();
1243 SetBackground( rStyleSettings.GetFieldColor() );
1246 css::uno::Reference< css::accessibility::XAccessible > DialogWindow::CreateAccessible()
1248 return static_cast<css::accessibility::XAccessible*>(new AccessibleDialogWindow( this ));
1251 char const* DialogWindow::GetHid () const
1253 return HID_BASICIDE_DIALOGWINDOW;
1255 ItemType DialogWindow::GetType () const
1257 return TYPE_DIALOG;
1261 // DialogWindowLayout
1264 DialogWindowLayout::DialogWindowLayout (vcl::Window* pParent, ObjectCatalog& rObjectCatalog_) :
1265 Layout(pParent),
1266 pChild(nullptr),
1267 rObjectCatalog(rObjectCatalog_),
1268 pPropertyBrowser(nullptr)
1270 ShowPropertyBrowser();
1273 DialogWindowLayout::~DialogWindowLayout()
1275 disposeOnce();
1278 void DialogWindowLayout::dispose()
1280 if (pPropertyBrowser)
1281 Remove(pPropertyBrowser);
1282 pPropertyBrowser.disposeAndClear();
1283 pChild.clear();
1284 Layout::dispose();
1287 // shows the property browser (and creates if necessary)
1288 void DialogWindowLayout::ShowPropertyBrowser ()
1290 // not exists?
1291 if (!pPropertyBrowser)
1293 // creating
1294 pPropertyBrowser = VclPtr<PropBrw>::Create(*this);
1295 pPropertyBrowser->Show();
1296 // after OnFirstSize():
1297 if (HasSize())
1298 AddPropertyBrowser();
1299 // updating if necessary
1300 UpdatePropertyBrowser();
1302 else
1303 pPropertyBrowser->Show();
1304 // refreshing the button state
1305 if (SfxBindings* pBindings = GetBindingsPtr())
1306 pBindings->Invalidate(SID_SHOW_PROPERTYBROWSER);
1309 // disables the property browser
1310 void DialogWindowLayout::DisablePropertyBrowser ()
1312 if (pPropertyBrowser)
1313 pPropertyBrowser->Update(nullptr);
1316 // updates the property browser
1317 void DialogWindowLayout::UpdatePropertyBrowser ()
1319 if (pPropertyBrowser)
1320 pPropertyBrowser->Update(GetShell());
1323 void DialogWindowLayout::Activating (BaseWindow& rChild)
1325 assert(dynamic_cast<DialogWindow*>(&rChild));
1326 pChild = &static_cast<DialogWindow&>(rChild);
1327 rObjectCatalog.SetLayoutWindow(this);
1328 rObjectCatalog.UpdateEntries();
1329 rObjectCatalog.Show();
1330 if (pPropertyBrowser)
1331 pPropertyBrowser->Show();
1332 Layout::Activating(rChild);
1335 void DialogWindowLayout::Deactivating ()
1337 Layout::Deactivating();
1338 rObjectCatalog.Hide();
1339 if (pPropertyBrowser)
1340 pPropertyBrowser->Hide();
1341 pChild = nullptr;
1344 void DialogWindowLayout::ExecuteGlobal (SfxRequest& rReq)
1346 switch (rReq.GetSlot())
1348 case SID_SHOW_PROPERTYBROWSER:
1349 // toggling property browser
1350 if (pPropertyBrowser && pPropertyBrowser->IsVisible())
1351 pPropertyBrowser->Hide();
1352 else
1353 ShowPropertyBrowser();
1354 ArrangeWindows();
1355 // refreshing the button state
1356 if (SfxBindings* pBindings = GetBindingsPtr())
1357 pBindings->Invalidate(SID_SHOW_PROPERTYBROWSER);
1358 break;
1362 void DialogWindowLayout::GetState (SfxItemSet& rSet, unsigned nWhich)
1364 switch (nWhich)
1366 case SID_SHOW_PROPERTYBROWSER:
1367 rSet.Put(SfxBoolItem(nWhich, pPropertyBrowser && pPropertyBrowser->IsVisible()));
1368 break;
1370 case SID_BASICIDE_CHOOSEMACRO:
1371 rSet.Put(SfxVisibilityItem(nWhich, false));
1372 break;
1376 void DialogWindowLayout::OnFirstSize (long const nWidth, long const nHeight)
1378 AddToLeft(&rObjectCatalog, Size(nWidth * 0.25, nHeight * 0.35));
1379 if (pPropertyBrowser)
1380 AddPropertyBrowser();
1383 void DialogWindowLayout::AddPropertyBrowser () {
1384 Size const aSize = GetOutputSizePixel();
1385 AddToLeft(pPropertyBrowser, Size(aSize.Width() * 0.25, aSize.Height() * 0.65));
1389 } // namespace basctl
1391 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */