LibreOffice Module basctl (master) 1
baside3.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <strings.hrc>
21#include <helpids.h>
22#include <iderid.hxx>
23
25#include <baside3.hxx>
26#include <basidesh.hxx>
27#include <bastype2.hxx>
28#include <basobj.hxx>
29#include <dlged.hxx>
30#include <dlgeddef.hxx>
31#include <dlgedmod.hxx>
32#include <dlgedview.hxx>
33#include <iderdll.hxx>
34#include <localizationmgr.hxx>
35#include <managelang.hxx>
36
37#include <com/sun/star/script/XLibraryContainer2.hpp>
38#include <com/sun/star/resource/StringResourceWithLocation.hpp>
39#include <com/sun/star/ucb/SimpleFileAccess.hpp>
40#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
41#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
42#include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
43#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
45#include <sfx2/dispatch.hxx>
47#include <sfx2/request.hxx>
48#include <sfx2/viewfrm.hxx>
49#include <svl/visitem.hxx>
50#include <svl/whiter.hxx>
51#include <svx/svdundo.hxx>
52#include <svx/svxids.hrc>
54#include <tools/urlobj.hxx>
55#include <vcl/commandevent.hxx>
56#include <vcl/weld.hxx>
57#include <vcl/settings.hxx>
58#include <vcl/stdtext.hxx>
59#include <vcl/svapp.hxx>
61
62namespace basctl
63{
64
65using namespace ::com::sun::star;
66using namespace ::com::sun::star::uno;
67using namespace ::com::sun::star::ucb;
68using namespace ::com::sun::star::io;
69using namespace ::com::sun::star::resource;
70using namespace ::com::sun::star::ui::dialogs;
71
72#ifdef _WIN32
73OUStringLiteral const FilterMask_All = u"*.*";
74#else
75constexpr OUStringLiteral FilterMask_All = u"*";
76#endif
77
79 const OUString& aLibName, const OUString& aName,
80 css::uno::Reference<css::container::XNameContainer> const& xDialogModel)
81 : BaseWindow(pParent, rDocument, aLibName, aName)
82 ,m_rLayout(*pParent)
83 ,m_pEditor(new DlgEditor(*this, m_rLayout, rDocument.isDocument()
84 ? rDocument.getDocument()
85 : Reference<frame::XModel>(), xDialogModel))
86 ,m_pUndoMgr(new SfxUndoManager)
87 ,m_nControlSlotId(SID_INSERT_SELECT)
88{
90
91 m_pEditor->GetModel().SetNotifyUndoActionHdl(
93 );
94
96
97 // set readonly mode for readonly libraries
98 Reference< script::XLibraryContainer2 > xDlgLibContainer( GetDocument().getLibraryContainer( E_DIALOGS ), UNO_QUERY );
99 if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) && xDlgLibContainer->isLibraryReadOnly( aLibName ) )
100 SetReadOnly(true);
101
102 if ( rDocument.isDocument() && rDocument.isReadOnly() )
103 SetReadOnly(true);
104}
105
107{
108 m_pEditor.reset();
110}
111
113{
114 if ( IsModified() )
115 StoreData();
116
117 Window::LoseFocus();
118}
119
120void DialogWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
121{
122 m_pEditor->Paint(rRenderContext, rRect);
123}
124
126{
127 if (GetHScrollBar() && GetVScrollBar())
128 {
129 m_pEditor->SetScrollBars( GetHScrollBar(), GetVScrollBar() );
130 }
131}
132
134{
135 m_pEditor->MouseButtonDown( rMEvt );
136
137 if (SfxBindings* pBindings = GetBindingsPtr())
138 pBindings->Invalidate( SID_SHOW_PROPERTYBROWSER );
139}
140
142{
143 m_pEditor->MouseButtonUp( rMEvt );
144 if( (m_pEditor->GetMode() == DlgEditor::INSERT) && !m_pEditor->IsCreateOK() )
145 {
146 m_nControlSlotId = SID_INSERT_SELECT;
147 m_pEditor->SetMode( DlgEditor::SELECT );
149 }
150 if (SfxBindings* pBindings = GetBindingsPtr())
151 {
152 pBindings->Invalidate( SID_SHOW_PROPERTYBROWSER );
153 pBindings->Invalidate( SID_DOC_MODIFIED );
154 pBindings->Invalidate( SID_SAVEDOC );
155 pBindings->Invalidate( SID_COPY );
156 pBindings->Invalidate( SID_CUT );
157 }
158}
159
161{
162 m_pEditor->MouseMove( rMEvt );
163}
164
166{
167 SfxBindings* pBindings = GetBindingsPtr();
168
169 if( rKEvt.GetKeyCode() == KEY_BACKSPACE )
170 {
171 if (SfxDispatcher* pDispatcher = GetDispatcher())
172 pDispatcher->Execute( SID_BACKSPACE );
173 }
174 else
175 {
176 if( pBindings && rKEvt.GetKeyCode() == KEY_TAB )
177 pBindings->Invalidate( SID_SHOW_PROPERTYBROWSER );
178
179 if( !m_pEditor->KeyInput( rKEvt ) )
180 {
181 if( !SfxViewShell::Current()->KeyInput( rKEvt ) )
182 Window::KeyInput( rKEvt );
183 }
184 }
185
186 // may be KEY_TAB, KEY_BACKSPACE, KEY_ESCAPE
187 if( pBindings )
188 {
189 pBindings->Invalidate( SID_COPY );
190 pBindings->Invalidate( SID_CUT );
191 }
192}
193
195{
196 if ( ( rCEvt.GetCommand() == CommandEventId::Wheel ) ||
197 ( rCEvt.GetCommand() == CommandEventId::StartAutoScroll ) ||
198 ( rCEvt.GetCommand() == CommandEventId::AutoScroll ) )
199 {
201 }
202 else if ( rCEvt.GetCommand() == CommandEventId::ContextMenu )
203 {
204 if (GetDispatcher())
205 {
206 SdrView& rView = GetView();
207 if( !rCEvt.IsMouseEvent() && rView.AreObjectsMarked() )
208 {
209 tools::Rectangle aMarkedRect( rView.GetMarkedRect() );
210 Point MarkedCenter( aMarkedRect.Center() );
211 Point PosPixel( LogicToPixel( MarkedCenter ) );
212 SfxDispatcher::ExecutePopup( this, &PosPixel );
213 }
214 else
215 {
217 }
218
219 }
220 }
221 else
222 BaseWindow::Command( rCEvt );
223}
224
225
226void DialogWindow::NotifyUndoActionHdl( std::unique_ptr<SdrUndoAction> )
227{
228 // #i120515# pUndoAction needs to be deleted, this hand over is an ownership
229 // change. As long as it does not get added to the undo manager, it needs at
230 // least to be deleted.
231}
232
234{
235 m_pEditor->SetScrollBars( GetHScrollBar(), GetVScrollBar() );
236}
237
239{
240 m_pEditor->DoScroll();
241}
242
244{
245 SfxWhichIter aIter(rSet);
246 bool bIsCalc = false;
247 if ( GetDocument().isDocument() )
248 {
250 if ( xModel.is() )
251 {
252 Reference< lang::XServiceInfo > xServiceInfo ( xModel, UNO_QUERY );
253 if ( xServiceInfo.is() && xServiceInfo->supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) )
254 bIsCalc = true;
255 }
256 }
257
258 for ( sal_uInt16 nWh = aIter.FirstWhich(); nWh != 0; nWh = aIter.NextWhich() )
259 {
260 switch ( nWh )
261 {
262 case SID_PASTE:
263 {
264 if ( !IsPasteAllowed() )
265 rSet.DisableItem( nWh );
266
267 if ( IsReadOnly() )
268 rSet.DisableItem( nWh );
269 }
270 break;
271 case SID_COPY:
272 {
273 // any object selected?
274 if ( !m_pEditor->GetView().AreObjectsMarked() )
275 rSet.DisableItem( nWh );
276 }
277 break;
278 case SID_CUT:
279 case SID_DELETE:
280 case SID_BACKSPACE:
281 {
282 // any object selected?
283 if ( !m_pEditor->GetView().AreObjectsMarked() )
284 rSet.DisableItem( nWh );
285
286 if ( IsReadOnly() )
287 rSet.DisableItem( nWh );
288 }
289 break;
290 case SID_REDO:
291 {
292 if ( !m_pUndoMgr->GetUndoActionCount() )
293 rSet.DisableItem( nWh );
294 }
295 break;
296
297 case SID_DIALOG_TESTMODE:
298 {
299 // is the IDE still active?
300 bool const bBool = GetShell()->GetFrame() &&
301 m_pEditor->GetMode() == DlgEditor::TEST;
302 rSet.Put(SfxBoolItem(SID_DIALOG_TESTMODE, bBool));
303 }
304 break;
305
306 case SID_CHOOSE_CONTROLS:
307 {
308 if ( IsReadOnly() )
309 rSet.DisableItem( nWh );
310 }
311 break;
312
313 case SID_SHOW_PROPERTYBROWSER:
314 {
315 Shell* pShell = GetShell();
316 SfxViewFrame* pViewFrame = pShell ? &pShell->GetViewFrame() : nullptr;
317 if ( pViewFrame && !pViewFrame->HasChildWindow( SID_SHOW_PROPERTYBROWSER ) && !m_pEditor->GetView().AreObjectsMarked() )
318 rSet.DisableItem( nWh );
319
320 if ( IsReadOnly() )
321 rSet.DisableItem( nWh );
322 }
323 break;
324 case SID_INSERT_FORM_RADIO:
325 case SID_INSERT_FORM_CHECK:
326 case SID_INSERT_FORM_LIST:
327 case SID_INSERT_FORM_COMBO:
328 case SID_INSERT_FORM_VSCROLL:
329 case SID_INSERT_FORM_HSCROLL:
330 case SID_INSERT_FORM_SPIN:
331 {
332 if ( !bIsCalc || IsReadOnly() )
333 rSet.DisableItem( nWh );
334 else
335 rSet.Put( SfxBoolItem( nWh, m_nControlSlotId == nWh ) );
336 }
337 break;
338
339 case SID_INSERT_SELECT:
340 case SID_INSERT_PUSHBUTTON:
341 case SID_INSERT_RADIOBUTTON:
342 case SID_INSERT_CHECKBOX:
343 case SID_INSERT_LISTBOX:
344 case SID_INSERT_COMBOBOX:
345 case SID_INSERT_GROUPBOX:
346 case SID_INSERT_EDIT:
347 case SID_INSERT_FIXEDTEXT:
348 case SID_INSERT_IMAGECONTROL:
349 case SID_INSERT_PROGRESSBAR:
350 case SID_INSERT_HSCROLLBAR:
351 case SID_INSERT_VSCROLLBAR:
352 case SID_INSERT_HFIXEDLINE:
353 case SID_INSERT_VFIXEDLINE:
354 case SID_INSERT_DATEFIELD:
355 case SID_INSERT_TIMEFIELD:
356 case SID_INSERT_NUMERICFIELD:
357 case SID_INSERT_CURRENCYFIELD:
358 case SID_INSERT_FORMATTEDFIELD:
359 case SID_INSERT_PATTERNFIELD:
360 case SID_INSERT_FILECONTROL:
361 case SID_INSERT_SPINBUTTON:
362 case SID_INSERT_GRIDCONTROL:
363 case SID_INSERT_HYPERLINKCONTROL:
364 case SID_INSERT_TREECONTROL:
365 {
366 if ( IsReadOnly() )
367 rSet.DisableItem( nWh );
368 else
369 rSet.Put( SfxBoolItem( nWh, m_nControlSlotId == nWh ) );
370 }
371 break;
372 case SID_SHOWLINES:
373 {
374 // if this is not a module window hide the
375 // setting, doesn't make sense for example if the
376 // dialog editor is open
377 rSet.DisableItem(nWh);
378 rSet.Put(SfxVisibilityItem(nWh, false));
379 break;
380 }
381 case SID_SELECTALL:
382 {
383 rSet.DisableItem( nWh );
384 }
385 break;
386 }
387 }
388}
389
391{
392 const sal_uInt16 nSlotId(rReq.GetSlot());
393 SdrObjKind nInsertObj(SdrObjKind::NONE);
394
395 switch ( nSlotId )
396 {
397 case SID_CUT:
398 if ( !IsReadOnly() )
399 {
400 GetEditor().Cut();
401 if (SfxBindings* pBindings = GetBindingsPtr())
402 pBindings->Invalidate( SID_DOC_MODIFIED );
403 }
404 break;
405 case SID_DELETE:
406 if ( !IsReadOnly() )
407 {
408 GetEditor().Delete();
409 if (SfxBindings* pBindings = GetBindingsPtr())
410 pBindings->Invalidate( SID_DOC_MODIFIED );
411 }
412 break;
413 case SID_COPY:
414 GetEditor().Copy();
415 break;
416 case SID_PASTE:
417 if ( !IsReadOnly() )
418 {
419 GetEditor().Paste();
420 if (SfxBindings* pBindings = GetBindingsPtr())
421 pBindings->Invalidate( SID_DOC_MODIFIED );
422 }
423 break;
424
425 case SID_INSERT_FORM_RADIO:
426 nInsertObj = SdrObjKind::BasicDialogFormRadio;
427 break;
428 case SID_INSERT_FORM_CHECK:
429 nInsertObj = SdrObjKind::BasicDialogFormCheck;
430 break;
431 case SID_INSERT_FORM_LIST:
432 nInsertObj = SdrObjKind::BasicDialogFormList;
433 break;
434 case SID_INSERT_FORM_COMBO:
435 nInsertObj = SdrObjKind::BasicDialogFormCombo;
436 break;
437 case SID_INSERT_FORM_SPIN:
438 nInsertObj = SdrObjKind::BasicDialogFormSpin;
439 break;
440 case SID_INSERT_FORM_VSCROLL:
441 nInsertObj = SdrObjKind::BasicDialogFormVerticalScroll;
442 break;
443 case SID_INSERT_FORM_HSCROLL:
444 nInsertObj = SdrObjKind::BasicDialogFormHorizontalScroll;
445 break;
446 case SID_INSERT_PUSHBUTTON:
447 nInsertObj = SdrObjKind::BasicDialogPushButton;
448 break;
449 case SID_INSERT_RADIOBUTTON:
450 nInsertObj = SdrObjKind::BasicDialogRadioButton;
451 break;
452 case SID_INSERT_CHECKBOX:
453 nInsertObj = SdrObjKind::BasicDialogCheckbox;
454 break;
455 case SID_INSERT_LISTBOX:
456 nInsertObj = SdrObjKind::BasicDialogListbox;
457 break;
458 case SID_INSERT_COMBOBOX:
459 nInsertObj = SdrObjKind::BasicDialogCombobox;
460 break;
461 case SID_INSERT_GROUPBOX:
462 nInsertObj = SdrObjKind::BasicDialogGroupBox;
463 break;
464 case SID_INSERT_EDIT:
465 nInsertObj = SdrObjKind::BasicDialogEdit;
466 break;
467 case SID_INSERT_FIXEDTEXT:
468 nInsertObj = SdrObjKind::BasicDialogFixedText;
469 break;
470 case SID_INSERT_IMAGECONTROL:
471 nInsertObj = SdrObjKind::BasicDialogImageControl;
472 break;
473 case SID_INSERT_PROGRESSBAR:
474 nInsertObj = SdrObjKind::BasicDialogProgressbar;
475 break;
476 case SID_INSERT_HSCROLLBAR:
477 nInsertObj = SdrObjKind::BasicDialogHorizontalScrollbar;
478 break;
479 case SID_INSERT_VSCROLLBAR:
480 nInsertObj = SdrObjKind::BasicDialogVerticalScrollbar;
481 break;
482 case SID_INSERT_HFIXEDLINE:
483 nInsertObj = SdrObjKind::BasicDialogHorizontalFixedLine;
484 break;
485 case SID_INSERT_VFIXEDLINE:
486 nInsertObj = SdrObjKind::BasicDialogVerticalFixedLine;
487 break;
488 case SID_INSERT_DATEFIELD:
489 nInsertObj = SdrObjKind::BasicDialogDateField;
490 break;
491 case SID_INSERT_TIMEFIELD:
492 nInsertObj = SdrObjKind::BasicDialogTimeField;
493 break;
494 case SID_INSERT_NUMERICFIELD:
495 nInsertObj = SdrObjKind::BasicDialogNumericField;
496 break;
497 case SID_INSERT_CURRENCYFIELD:
498 nInsertObj = SdrObjKind::BasicDialogCurencyField;
499 break;
500 case SID_INSERT_FORMATTEDFIELD:
501 nInsertObj = SdrObjKind::BasicDialogFormattedField;
502 break;
503 case SID_INSERT_PATTERNFIELD:
504 nInsertObj = SdrObjKind::BasicDialogPatternField;
505 break;
506 case SID_INSERT_FILECONTROL:
507 nInsertObj = SdrObjKind::BasicDialogFileControl;
508 break;
509 case SID_INSERT_SPINBUTTON:
510 nInsertObj = SdrObjKind::BasicDialogSpinButton;
511 break;
512 case SID_INSERT_GRIDCONTROL:
513 nInsertObj = SdrObjKind::BasicDialogGridControl;
514 break;
515 case SID_INSERT_HYPERLINKCONTROL:
516 nInsertObj = SdrObjKind::BasicDialogHyperlinkControl;
517 break;
518 case SID_INSERT_TREECONTROL:
519 nInsertObj = SdrObjKind::BasicDialogTreeControl;
520 break;
521 case SID_INSERT_SELECT:
522 m_nControlSlotId = nSlotId;
525 break;
526
527 case SID_DIALOG_TESTMODE:
528 {
529 DlgEditor::Mode eOldMode = GetEditor().GetMode();
531 GetEditor().SetMode( eOldMode );
532 rReq.Done();
533 if (SfxBindings* pBindings = GetBindingsPtr())
534 pBindings->Invalidate( SID_DIALOG_TESTMODE );
535 return;
536 }
537 case SID_EXPORT_DIALOG:
538 SaveDialog();
539 break;
540
541 case SID_IMPORT_DIALOG:
542 ImportDialog();
543 break;
544
545 case SID_BASICIDE_DELETECURRENT:
547 {
549 {
551 GetShell()->RemoveWindow(this, true);
552 }
553 }
554 break;
555 }
556
557 if ( nInsertObj != SdrObjKind::NONE )
558 {
559 m_nControlSlotId = nSlotId;
561 GetEditor().SetInsertObj( nInsertObj );
562
563 if ( rReq.GetModifier() & KEY_MOD1 )
564 {
566 if (SfxBindings* pBindings = GetBindingsPtr())
567 pBindings->Invalidate( SID_DOC_MODIFIED );
568 }
569
571 }
572
573 rReq.Done();
574}
575
577{
578 return m_pEditor->GetDialog();
579}
580
581bool DialogWindow::RenameDialog( const OUString& rNewName )
582{
584 return false;
585
586 if (SfxBindings* pBindings = GetBindingsPtr())
587 pBindings->Invalidate( SID_DOC_MODIFIED );
588
589 return true;
590}
591
593{
595}
596
598{
600}
601
603{
604 sfx2::FileDialogHelper aDlg(ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION,
605 FileDialogFlags::NONE, this->GetFrameWeld());
608
609 xFP.queryThrow<XFilePickerControlAccess>()->setValue(ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, 0, Any(true));
610 xFP->setDefaultName( GetName() );
611
612 OUString aDialogStr(IDEResId(RID_STR_STDDIALOGNAME));
613 xFP->appendFilter( aDialogStr, "*.xdl" );
614 xFP->appendFilter( IDEResId(RID_STR_FILTER_ALLFILES), FilterMask_All );
615 xFP->setCurrentFilter( aDialogStr );
616
617 if( aDlg.Execute() != ERRCODE_NONE )
618 return;
619
620 OUString aSelectedFileURL = xFP->getSelectedFiles()[0];
621
623 Reference< XSimpleFileAccess3 > xSFI( SimpleFileAccess::create(xContext) );
624
626 try
627 {
628 if( xSFI->exists(aSelectedFileURL) )
629 xSFI->kill(aSelectedFileURL);
630 xOutput = xSFI->openFileWrite(aSelectedFileURL);
631 }
632 catch(const Exception& )
633 {}
634
635 if (!xOutput)
636 {
637 std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
638 VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_COULDNTWRITE)));
639 xBox->run();
640 return;
641 }
642
643 // export dialog model to xml
644 auto xInput(xmlscript::exportDialogModel(GetDialog(), xContext, GetDocument().getDocumentOrNull())->createInputStream());
645
646 for (Sequence<sal_Int8> bytes; xInput->readBytes(bytes, xInput->available());)
647 xOutput->writeBytes(bytes);
648
649 // With resource?
651 if (auto xDialogModelPropSet = GetDialog().query<beans::XPropertySet>())
652 {
653 try
654 {
655 Any aResourceResolver = xDialogModelPropSet->getPropertyValue( "ResourceResolver" );
656 aResourceResolver >>= xStringResourceResolver;
657 }
658 catch(const beans::UnknownPropertyException& )
659 {}
660 }
661
662 Sequence<lang::Locale> aLocaleSeq;
663 if (xStringResourceResolver)
664 aLocaleSeq = xStringResourceResolver->getLocales();
665 if (aLocaleSeq.hasElements())
666 {
667 INetURLObject aURLObj(aSelectedFileURL);
668 aURLObj.removeExtension();
669 OUString aDialogName( aURLObj.getName() );
670 aURLObj.removeSegment();
672 OUString aComment = "# " + aDialogName + " strings" ;
674
675 // Remove old properties files in case of overwriting Dialog files
676 if( xSFI->isFolder( aURL ) )
677 {
678 Sequence< OUString > aContentSeq = xSFI->getFolderContents( aURL, false );
679
680 OUString aDialogName_ = aDialogName + "_" ;
681 for( const OUString& rCompleteName : aContentSeq )
682 {
683 OUString aPureName;
684 OUString aExtension;
685 sal_Int32 iDot = rCompleteName.lastIndexOf( '.' );
686 if( iDot != -1 )
687 {
688 sal_Int32 iSlash = rCompleteName.lastIndexOf( '/' );
689 sal_Int32 iCopyFrom = (iSlash != -1) ? iSlash + 1 : 0;
690 aPureName = rCompleteName.copy( iCopyFrom, iDot-iCopyFrom );
691 aExtension = rCompleteName.copy( iDot + 1 );
692 }
693
694 if( aExtension == "properties" || aExtension == "default" )
695 {
696 if( aPureName.startsWith( aDialogName_ ) )
697 {
698 try
699 {
700 xSFI->kill( rCompleteName );
701 }
702 catch(const uno::Exception& )
703 {}
704 }
705 }
706 }
707 }
708
709 Reference< XStringResourceWithLocation > xStringResourceWithLocation =
710 StringResourceWithLocation::create( xContext, aURL, false/*bReadOnly*/,
711 xStringResourceResolver->getDefaultLocale(), aDialogName, aComment, xDummyHandler );
712
713 // Add locales
714 for( const lang::Locale& rLocale : aLocaleSeq )
715 {
716 xStringResourceWithLocation->newLocale( rLocale );
717 }
718
720 xStringResourceResolver, xStringResourceWithLocation );
721
722 xStringResourceWithLocation->store();
723 }
724}
725
726static std::vector< lang::Locale > implGetLanguagesOnlyContainedInFirstSeq
727 ( const Sequence< lang::Locale >& aFirstSeq, const Sequence< lang::Locale >& aSecondSeq )
728{
729 std::vector< lang::Locale > avRet;
730
731 std::copy_if(aFirstSeq.begin(), aFirstSeq.end(),
732 std::back_inserter(avRet),
733 [&aSecondSeq](const lang::Locale& rFirstLocale) {
734 return std::none_of(
735 aSecondSeq.begin(), aSecondSeq.end(),
736 [&rFirstLocale](const lang::Locale& rSecondLocale) {
737 return localesAreEqual(rFirstLocale, rSecondLocale);
738 });
739 });
740 return avRet;
741}
742
743namespace {
744
745class NameClashQueryBox
746{
747private:
748 std::unique_ptr<weld::MessageDialog> m_xQueryBox;
749public:
750 NameClashQueryBox(weld::Window* pParent, const OUString& rTitle, const OUString& rMessage)
751 : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question, VclButtonsType::NONE, rMessage))
752 {
753 if (!rTitle.isEmpty())
754 m_xQueryBox->set_title(rTitle);
755 m_xQueryBox->add_button(IDEResId(RID_STR_DLGIMP_CLASH_RENAME), RET_YES);
756 m_xQueryBox->add_button(IDEResId(RID_STR_DLGIMP_CLASH_REPLACE), RET_NO);
757 m_xQueryBox->add_button(GetStandardText(StandardButtonType::Cancel), RET_CANCEL);
758 m_xQueryBox->set_default_response(RET_YES);
759 }
760 short run() { return m_xQueryBox->run(); }
761};
762
763class LanguageMismatchQueryBox
764{
765private:
766 std::unique_ptr<weld::MessageDialog> m_xQueryBox;
767public:
768 LanguageMismatchQueryBox(weld::Window* pParent, const OUString& rTitle, const OUString& rMessage)
769 : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question, VclButtonsType::NONE, rMessage))
770 {
771 if (!rTitle.isEmpty())
772 m_xQueryBox->set_title(rTitle);
773 m_xQueryBox->add_button(IDEResId(RID_STR_DLGIMP_MISMATCH_ADD), RET_YES);
774 m_xQueryBox->add_button(IDEResId(RID_STR_DLGIMP_MISMATCH_OMIT), RET_NO);
775 m_xQueryBox->add_button(GetStandardText(StandardButtonType::Cancel), RET_CANCEL);
776 m_xQueryBox->add_button(GetStandardText(StandardButtonType::Help), RET_HELP);
777 m_xQueryBox->set_default_response(RET_YES);
778 }
779 short run() { return m_xQueryBox->run(); }
780};
781
782}
783
784bool implImportDialog(weld::Window* pWin, const ScriptDocument& rDocument, const OUString& aLibName)
785{
786 bool bDone = false;
787
788 Reference<uno::XComponentContext> xContext(::comphelper::getProcessComponentContext());
789 sfx2::FileDialogHelper aDlg(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
790 FileDialogFlags::NONE, pWin);
793
794 OUString aDialogStr(IDEResId(RID_STR_STDDIALOGNAME));
795 xFP->appendFilter( aDialogStr, "*.xdl" );
796 xFP->appendFilter( IDEResId(RID_STR_FILTER_ALLFILES), FilterMask_All );
797 xFP->setCurrentFilter( aDialogStr );
798
799 if( aDlg.Execute() == ERRCODE_NONE )
800 {
801 Sequence< OUString > aPaths = xFP->getSelectedFiles();
802
803 OUString aBasePath;
804 OUString aOUCurPath( aPaths[0] );
805 sal_Int32 iSlash = aOUCurPath.lastIndexOf( '/' );
806 if( iSlash != -1 )
807 aBasePath = aOUCurPath.copy( 0, iSlash + 1 );
808
809 try
810 {
811 // create dialog model
813 xContext->getServiceManager()->createInstanceWithContext("com.sun.star.awt.UnoControlDialogModel", xContext),
814 UNO_QUERY_THROW );
815
816 Reference< XSimpleFileAccess3 > xSFI( SimpleFileAccess::create(xContext) );
817
819 if( xSFI->exists( aOUCurPath ) )
820 xInput = xSFI->openFileRead( aOUCurPath );
821
822 ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
823
824 OUString aXmlDlgName;
825 Reference< beans::XPropertySet > xDialogModelPropSet( xDialogModel, UNO_QUERY );
826 assert(xDialogModelPropSet.is());
827 try
828 {
829 Any aXmlDialogNameAny = xDialogModelPropSet->getPropertyValue( DLGED_PROP_NAME );
830 aXmlDialogNameAny >>= aXmlDlgName;
831 }
832 catch(const beans::UnknownPropertyException& )
833 {
834 TOOLS_WARN_EXCEPTION("basctl", "");
835 }
836 assert( !aXmlDlgName.isEmpty() );
837
838 bool bDialogAlreadyExists = rDocument.hasDialog( aLibName, aXmlDlgName );
839
840 OUString aNewDlgName = aXmlDlgName;
841 enum NameClashMode
842 {
843 NO_CLASH,
844 CLASH_OVERWRITE_DIALOG,
845 CLASH_RENAME_DIALOG,
846 };
847 NameClashMode eNameClashMode = NO_CLASH;
848 if( bDialogAlreadyExists )
849 {
850 OUString aQueryBoxTitle(IDEResId(RID_STR_DLGIMP_CLASH_TITLE));
851 OUString aQueryBoxText(IDEResId(RID_STR_DLGIMP_CLASH_TEXT));
852 aQueryBoxText = aQueryBoxText.replaceAll("$(ARG1)", aXmlDlgName);
853
854 NameClashQueryBox aQueryBox(pWin, aQueryBoxTitle, aQueryBoxText);
855 sal_uInt16 nRet = aQueryBox.run();
856 if( nRet == RET_YES )
857 {
858 // RET_YES == Rename, see NameClashQueryBox::NameClashQueryBox
859 eNameClashMode = CLASH_RENAME_DIALOG;
860
861 aNewDlgName = rDocument.createObjectName( E_DIALOGS, aLibName );
862 }
863 else if( nRet == RET_NO )
864 {
865 // RET_NO == Replace, see NameClashQueryBox::NameClashQueryBox
866 eNameClashMode = CLASH_OVERWRITE_DIALOG;
867 }
868 else if( nRet == RET_CANCEL )
869 {
870 return bDone;
871 }
872 }
873
874 Shell* pShell = GetShell();
875 assert(pShell);
876
877 // Resource?
878 css::lang::Locale aLocale = Application::GetSettings().GetUILanguageTag().getLocale();
880 Reference< XStringResourceWithLocation > xImportStringResource =
881 StringResourceWithLocation::create( xContext, aBasePath, true/*bReadOnly*/,
882 aLocale, aXmlDlgName, OUString(), xDummyHandler );
883
884 Sequence< lang::Locale > aImportLocaleSeq = xImportStringResource->getLocales();
885 sal_Int32 nImportLocaleCount = aImportLocaleSeq.getLength();
886
887 Reference< container::XNameContainer > xDialogLib( rDocument.getLibrary( E_DIALOGS, aLibName, true ) );
888 Reference< resource::XStringResourceManager > xLibStringResourceManager = LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib );
889 sal_Int32 nLibLocaleCount = 0;
890 Sequence< lang::Locale > aLibLocaleSeq;
891 if( xLibStringResourceManager.is() )
892 {
893 aLibLocaleSeq = xLibStringResourceManager->getLocales();
894 nLibLocaleCount = aLibLocaleSeq.getLength();
895 }
896
897 // Check language matches
898 std::vector< lang::Locale > aOnlyInImportLanguages =
899 implGetLanguagesOnlyContainedInFirstSeq( aImportLocaleSeq, aLibLocaleSeq );
900 int nOnlyInImportLanguageCount = aOnlyInImportLanguages.size();
901
902 // For now: Keep languages from lib
903 bool bLibLocalized = (nLibLocaleCount > 0);
904 bool bImportLocalized = (nImportLocaleCount > 0);
905
906 bool bAddDialogLanguagesToLib = false;
907 if( nOnlyInImportLanguageCount > 0 )
908 {
909 OUString aQueryBoxTitle(IDEResId(RID_STR_DLGIMP_MISMATCH_TITLE));
910 OUString aQueryBoxText(IDEResId(RID_STR_DLGIMP_MISMATCH_TEXT));
911 LanguageMismatchQueryBox aQueryBox(pWin, aQueryBoxTitle, aQueryBoxText);
912 sal_uInt16 nRet = aQueryBox.run();
913 if( nRet == RET_YES )
914 {
915 // RET_YES == Add, see LanguageMismatchQueryBox::LanguageMismatchQueryBox
916 bAddDialogLanguagesToLib = true;
917 }
918 // RET_NO == Omit, see LanguageMismatchQueryBox::LanguageMismatchQueryBox
919 // -> nothing to do here
920 //else if( RET_NO == nRet )
921 //{
922 //}
923 else if( nRet == RET_CANCEL )
924 {
925 return bDone;
926 }
927 }
928
929 if( bImportLocalized )
930 {
931 bool bCopyResourcesForDialog = true;
932 if( bAddDialogLanguagesToLib )
933 {
934 const std::shared_ptr<LocalizationMgr>& pCurMgr = pShell->GetCurLocalizationMgr();
935
936 lang::Locale aFirstLocale = aOnlyInImportLanguages[0];
937 if( nOnlyInImportLanguageCount > 1 )
938 {
939 // Check if import default belongs to only import languages and use it then
940 lang::Locale aImportDefaultLocale = xImportStringResource->getDefaultLocale();
941
942 if (std::any_of(aOnlyInImportLanguages.begin(), aOnlyInImportLanguages.end(),
943 [&aImportDefaultLocale](const lang::Locale& aTmpLocale) {
944 return localesAreEqual(aImportDefaultLocale, aTmpLocale);
945 }))
946 {
947 aFirstLocale = aImportDefaultLocale;
948 }
949 }
950
951 pCurMgr->handleAddLocales( {aFirstLocale} );
952
953 if( nOnlyInImportLanguageCount > 1 )
954 {
955 Sequence< lang::Locale > aRemainingLocaleSeq( nOnlyInImportLanguageCount - 1 );
956 auto pRemainingLocaleSeq = aRemainingLocaleSeq.getArray();
957 int iSeq = 0;
958 for( const lang::Locale& rLocale : aOnlyInImportLanguages )
959 {
960 if( !localesAreEqual( aFirstLocale, rLocale ) )
961 pRemainingLocaleSeq[iSeq++] = rLocale;
962 }
963 pCurMgr->handleAddLocales( aRemainingLocaleSeq );
964 }
965 }
966 else if( !bLibLocalized )
967 {
968 LocalizationMgr::resetResourceForDialog( xDialogModel, xImportStringResource );
969 bCopyResourcesForDialog = false;
970 }
971
972 if( bCopyResourcesForDialog )
973 {
974 LocalizationMgr::copyResourceForDroppedDialog( xDialogModel, aXmlDlgName,
975 xLibStringResourceManager, xImportStringResource );
976 }
977 }
978 else if( bLibLocalized )
979 {
980 LocalizationMgr::setResourceIDsForDialog( xDialogModel, xLibStringResourceManager );
981 }
982
983
984 LocalizationMgr::setStringResourceAtDialog( rDocument, aLibName, aNewDlgName, xDialogModel );
985
986 if( eNameClashMode == CLASH_OVERWRITE_DIALOG )
987 {
988 if (basctl::RemoveDialog( rDocument, aLibName, aNewDlgName ) )
989 {
990 BaseWindow* pDlgWin = pShell->FindDlgWin( rDocument, aLibName, aNewDlgName, false, true );
991 if( pDlgWin != nullptr )
992 pShell->RemoveWindow( pDlgWin, false );
993 MarkDocumentModified( rDocument );
994 }
995 else
996 {
997 // TODO: Assertion?
998 return bDone;
999 }
1000 }
1001
1002 if( eNameClashMode == CLASH_RENAME_DIALOG )
1003 {
1004 bool bRenamed = false;
1005 if( xDialogModelPropSet.is() )
1006 {
1007 try
1008 {
1009 xDialogModelPropSet->setPropertyValue( DLGED_PROP_NAME, Any(aNewDlgName) );
1010 bRenamed = true;
1011 }
1012 catch(const beans::UnknownPropertyException& )
1013 {}
1014 }
1015
1016
1017 if( bRenamed )
1018 {
1019 LocalizationMgr::renameStringResourceIDs( rDocument, aLibName, aNewDlgName, xDialogModel );
1020 }
1021 else
1022 {
1023 // TODO: Assertion?
1024 return bDone;
1025 }
1026 }
1027
1028 Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
1029 bool bSuccess = rDocument.insertDialog( aLibName, aNewDlgName, xISP );
1030 if( bSuccess )
1031 {
1032 VclPtr<DialogWindow> pNewDlgWin = pShell->CreateDlgWin( rDocument, aLibName, aNewDlgName );
1033 pShell->SetCurWindow( pNewDlgWin, true );
1034 }
1035
1036 bDone = true;
1037 }
1038 catch(const Exception& )
1039 {}
1040 }
1041
1042 return bDone;
1043}
1044
1045void DialogWindow::ImportDialog()
1046{
1047 const ScriptDocument& rDocument = GetDocument();
1048 OUString aLibName = GetLibName();
1049 implImportDialog(GetFrameWeld(), rDocument, aLibName);
1050}
1051
1052DlgEdModel& DialogWindow::GetModel() const
1053{
1054 return m_pEditor->GetModel();
1055}
1056
1057DlgEdPage& DialogWindow::GetPage() const
1058{
1059 return m_pEditor->GetPage();
1060}
1061
1062DlgEdView& DialogWindow::GetView() const
1063{
1064 return m_pEditor->GetView();
1065}
1066
1067bool DialogWindow::IsModified()
1068{
1069 return m_pEditor->IsModified();
1070}
1071
1072SfxUndoManager* DialogWindow::GetUndoManager()
1073{
1074 return m_pUndoMgr.get();
1075}
1076
1077OUString DialogWindow::GetTitle()
1078{
1079 return GetName();
1080}
1081
1082EntryDescriptor DialogWindow::CreateEntryDescriptor()
1083{
1084 ScriptDocument aDocument( GetDocument() );
1085 OUString aLibName( GetLibName() );
1086 LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName );
1087 return EntryDescriptor( aDocument, eLocation, aLibName, OUString(), GetName(), OBJ_TYPE_DIALOG );
1088}
1089
1090void DialogWindow::SetReadOnly (bool bReadOnly)
1091{
1092 m_pEditor->SetMode(bReadOnly ? DlgEditor::READONLY : DlgEditor::SELECT);
1093}
1094
1095bool DialogWindow::IsReadOnly ()
1096{
1097 return m_pEditor->GetMode() == DlgEditor::READONLY;
1098}
1099
1100bool DialogWindow::IsPasteAllowed()
1101{
1102 return m_pEditor->IsPasteAllowed();
1103}
1104
1105void DialogWindow::StoreData()
1106{
1107 if ( !IsModified() )
1108 return;
1109
1110 try
1111 {
1112 Reference< container::XNameContainer > xLib = GetDocument().getLibrary( E_DIALOGS, GetLibName(), true );
1113
1114 if( xLib.is() )
1115 {
1116 Reference< container::XNameContainer > xDialogModel = m_pEditor->GetDialog();
1117
1118 if( xDialogModel.is() )
1119 {
1122 Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().isDocument() ? GetDocument().getDocument() : Reference< frame::XModel >() );
1123 xLib->replaceByName( GetName(), Any( xISP ) );
1124 }
1125 }
1126 }
1127 catch (const uno::Exception& )
1128 {
1129 DBG_UNHANDLED_EXCEPTION("basctl.basicide");
1130 }
1131 MarkDocumentModified( GetDocument() );
1132 m_pEditor->ClearModifyFlag();
1133}
1134
1135void DialogWindow::Activating ()
1136{
1137 UpdateBrowser();
1138 Show();
1139}
1140
1141void DialogWindow::Deactivating()
1142{
1143 Hide();
1144 if ( IsModified() )
1145 MarkDocumentModified( GetDocument() );
1146 DisableBrowser();
1147}
1148
1149sal_Int32 DialogWindow::countPages( Printer* )
1150{
1151 return 1;
1152}
1153
1154void DialogWindow::printPage( sal_Int32 nPage, Printer* pPrinter )
1155{
1156 DlgEditor::printPage( nPage, pPrinter, CreateQualifiedName() );
1157}
1158
1159void DialogWindow::DataChanged( const DataChangedEvent& rDCEvt )
1160{
1161 if( (rDCEvt.GetType()==DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
1162 {
1163 InitSettings();
1164 Invalidate();
1165 }
1166 else
1167 BaseWindow::DataChanged( rDCEvt );
1168}
1169
1170void DialogWindow::InitSettings()
1171{
1172 // FIXME RenderContext
1173 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
1174 vcl::Font aFont = rStyleSettings.GetFieldFont();
1175 SetPointFont(*GetOutDev(), aFont);
1176
1177 SetTextColor( rStyleSettings.GetFieldTextColor() );
1178 SetTextFillColor();
1179
1180 SetBackground(rStyleSettings.GetFaceColor());
1181}
1182
1183css::uno::Reference< css::accessibility::XAccessible > DialogWindow::CreateAccessible()
1184{
1185 return new AccessibleDialogWindow(this);
1186}
1187
1188OUString DialogWindow::GetHid () const
1189{
1191}
1192
1193ItemType DialogWindow::GetType () const
1194{
1195 return TYPE_DIALOG;
1196}
1197
1198
1199// DialogWindowLayout
1200
1201
1202DialogWindowLayout::DialogWindowLayout (vcl::Window* pParent, ObjectCatalog& rObjectCatalog_) :
1203 Layout(pParent),
1204 rObjectCatalog(rObjectCatalog_),
1205 pPropertyBrowser(nullptr)
1206{
1208}
1209
1211{
1212 disposeOnce();
1213}
1214
1216{
1217 if (pPropertyBrowser)
1219 pPropertyBrowser.disposeAndClear();
1221}
1222
1223// shows the property browser (and creates if necessary)
1225{
1226 // not exists?
1227 if (!pPropertyBrowser)
1228 {
1229 // creating
1231 pPropertyBrowser->Show();
1232 // after OnFirstSize():
1233 if (HasSize())
1235 // updating if necessary
1237 }
1238 else
1239 pPropertyBrowser->Show();
1240 // refreshing the button state
1241 if (SfxBindings* pBindings = GetBindingsPtr())
1242 pBindings->Invalidate(SID_SHOW_PROPERTYBROWSER);
1243}
1244
1245// disables the property browser
1247{
1248 if (pPropertyBrowser)
1249 pPropertyBrowser->Update(nullptr);
1250}
1251
1252// updates the property browser
1254{
1255 if (pPropertyBrowser)
1256 pPropertyBrowser->Update(GetShell());
1257}
1258
1260{
1261 assert(dynamic_cast<DialogWindow*>(&rChild));
1265 if (pPropertyBrowser)
1266 pPropertyBrowser->Show();
1267 Layout::Activating(rChild);
1268}
1269
1271{
1274 if (pPropertyBrowser)
1275 pPropertyBrowser->Hide();
1276}
1277
1279{
1280 switch (rReq.GetSlot())
1281 {
1282 case SID_SHOW_PROPERTYBROWSER:
1283 // toggling property browser
1284 if (pPropertyBrowser && pPropertyBrowser->IsVisible())
1285 pPropertyBrowser->Hide();
1286 else
1289 // refreshing the button state
1290 if (SfxBindings* pBindings = GetBindingsPtr())
1291 pBindings->Invalidate(SID_SHOW_PROPERTYBROWSER);
1292 break;
1293 }
1294}
1295
1296void DialogWindowLayout::GetState (SfxItemSet& rSet, unsigned nWhich)
1297{
1298 switch (nWhich)
1299 {
1300 case SID_SHOW_PROPERTYBROWSER:
1301 rSet.Put(SfxBoolItem(nWhich, pPropertyBrowser && pPropertyBrowser->IsVisible()));
1302 break;
1303
1304 case SID_BASICIDE_CHOOSEMACRO:
1305 rSet.Put(SfxVisibilityItem(nWhich, false));
1306 break;
1307 }
1308}
1309
1311{
1312 AddToLeft(&rObjectCatalog, Size(nWidth * 0.25, nHeight * 0.35));
1313 if (pPropertyBrowser)
1315}
1316
1318 Size const aSize = GetOutputSizePixel();
1319 AddToLeft(pPropertyBrowser, Size(aSize.Width() * 0.25, aSize.Height() * 0.65));
1320}
1321
1322
1323} // namespace basctl
1324
1325/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::MessageDialog > m_xQueryBox
Definition: baside3.cxx:748
ScriptDocument aDocument
Definition: basobj2.cxx:194
const LanguageTag & GetUILanguageTag() const
static const AllSettings & GetSettings()
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
CommandEventId GetCommand() const
bool IsMouseEvent() const
DataChangedEventType GetType() const
AllSettingsFlags GetFlags() const
OUString getName(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool removeExtension(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true)
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool removeSegment(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true)
const vcl::KeyCode & GetKeyCode() const
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
bool AreObjectsMarked() const
const tools::Rectangle & GetMarkedRect() const
void Invalidate(sal_uInt16 nId)
void ExecutePopup(const OUString &rResName, vcl::Window *pWin=nullptr, const Point *pPos=nullptr)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void DisableItem(sal_uInt16 nWhich)
sal_uInt16 GetSlot() const
sal_uInt16 GetModifier() const
void Done(bool bRemove=false)
SfxViewFrame * GetFrame() const
bool HasChildWindow(sal_uInt16)
SfxViewFrame & GetViewFrame() const
static SAL_WARN_UNUSED_RESULT SfxViewShell * Current()
sal_uInt16 FirstWhich()
sal_uInt16 NextWhich()
constexpr tools::Long Height() const
constexpr tools::Long Width() const
const Color & GetFieldTextColor() const
const vcl::Font & GetFieldFont() const
const Color & GetFaceColor() const
static VclPtr< reference_type > Create(Arg &&... arg)
virtual void dispose() override
Definition: bastypes.cxx:78
const OUString & GetLibName() const
Definition: bastypes.hxx:234
friend class DialogWindow
Definition: bastypes.hxx:171
ScriptDocument m_aDocument
Definition: bastypes.hxx:166
const OUString & GetName() const
Definition: bastypes.hxx:236
OUString m_aLibName
Definition: bastypes.hxx:167
const ScriptDocument & GetDocument() const
Definition: bastypes.hxx:232
ScrollAdaptor * GetHScrollBar() const
Definition: bastypes.hxx:187
ScrollAdaptor * GetVScrollBar() const
Definition: bastypes.hxx:188
virtual void OnFirstSize(tools::Long nWidth, tools::Long nHeight) override
Definition: baside3.cxx:1310
ObjectCatalog & rObjectCatalog
Definition: baside3.hxx:141
virtual void Deactivating() override
Definition: baside3.cxx:1270
virtual void Activating(BaseWindow &) override
Definition: baside3.cxx:1259
virtual void dispose() override
Definition: baside3.cxx:1215
VclPtr< PropBrw > pPropertyBrowser
Definition: baside3.hxx:143
virtual void ExecuteGlobal(SfxRequest &) override
Definition: baside3.cxx:1278
virtual void GetState(SfxItemSet &, unsigned nWhich) override
Definition: baside3.cxx:1296
virtual ~DialogWindowLayout() override
Definition: baside3.cxx:1210
DialogWindowLayout & m_rLayout
Definition: baside3.hxx:51
virtual void KeyInput(const KeyEvent &rKEvt) override
Definition: baside3.cxx:165
DlgEdView & GetView() const
Definition: baside3.cxx:1062
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: baside3.cxx:120
virtual void dispose() override
Definition: baside3.cxx:106
virtual void Resize() override
Definition: baside3.cxx:125
virtual void DoInit() override
Definition: baside3.cxx:233
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: baside3.cxx:133
bool RenameDialog(const OUString &rNewName)
Definition: baside3.cxx:581
std::unique_ptr< SfxUndoManager > m_pUndoMgr
Definition: baside3.hxx:53
virtual void SetReadOnly(bool bReadOnly) override
Definition: baside3.cxx:1090
virtual bool IsModified() override
Definition: baside3.cxx:1067
sal_uInt16 m_nControlSlotId
Definition: baside3.hxx:54
virtual void Command(const CommandEvent &rCEvt) override
Definition: baside3.cxx:194
virtual void LoseFocus() override
Definition: baside3.cxx:112
virtual void StoreData() override
Definition: baside3.cxx:1105
virtual void DoScroll(Scrollable *pCurScrollBar) override
Definition: baside3.cxx:238
DlgEditor & GetEditor() const
Definition: baside3.hxx:79
std::unique_ptr< DlgEditor > m_pEditor
Definition: baside3.hxx:52
virtual void MouseMove(const MouseEvent &rMEvt) override
Definition: baside3.cxx:160
virtual bool IsReadOnly() override
Definition: baside3.cxx:1095
virtual void GetState(SfxItemSet &) override
Definition: baside3.cxx:243
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: baside3.cxx:141
css::uno::Reference< css::container::XNameContainer > const & GetDialog() const
Definition: baside3.cxx:576
static void NotifyUndoActionHdl(std::unique_ptr< SdrUndoAction >)
Definition: baside3.cxx:226
virtual void ExecuteCommand(SfxRequest &rReq) override
Definition: baside3.cxx:390
void SetInsertObj(SdrObjKind eObj)
Definition: dlged.cxx:598
Mode GetMode() const
Definition: dlged.hxx:189
void SetMode(Mode eMode)
Definition: dlged.cxx:576
void CreateDefaultObject()
Definition: dlged.cxx:605
void SetLayoutWindow(Layout *)
Definition: bastypes.cxx:365
void Show(bool=true)
Definition: bastypes.cxx:375
void Remove(DockingWindow *)
Definition: layout.cxx:69
virtual void dispose() override
Definition: layout.cxx:60
void AddToLeft(DockingWindow *pWin, Size const &rSize)
Definition: layout.hxx:57
bool HasSize() const
Definition: layout.hxx:60
virtual void Deactivating()
Definition: layout.cxx:126
virtual void Activating(BaseWindow &)
Definition: layout.cxx:117
void ArrangeWindows()
Definition: layout.cxx:83
static void copyResourceForDialog(const css::uno::Reference< css::container::XNameContainer > &xDialogModel, const css::uno::Reference< css::resource::XStringResourceResolver > &xSourceStringResolver, const css::uno::Reference< css::resource::XStringResourceManager > &xTargetStringResourceManager)
A docking window that contains a tree of the currently loaded macros.
void UpdateEntries()
Update the entries of Object Catalog Treelist.
encapsulates a document which contains Basic scripts and dialogs
css::uno::Reference< css::frame::XModel > getDocument() const
returns the UNO component representing the document which the instance operates on
bool isDocument() const
determines whether the ScriptDocument instance operates on a real document, as opposed to the whole a...
css::uno::Reference< css::container::XNameContainer > getLibrary(LibraryContainerType _eType, const OUString &_rLibName, bool _bLoadLibrary) const
returns a script or dialog library given by name
bool isReadOnly() const
determines whether the document is read-only
bool insertDialog(const OUString &_rLibName, const OUString &_rDialogName, const css::uno::Reference< css::io::XInputStreamProvider > &_rDialogProvider) const
inserts a given dialog into a given library
bool hasDialog(const OUString &_rLibName, const OUString &_rDialogName) const
determines whether a dialog with the given name exists in the given library
OUString createObjectName(LibraryContainerType _eType, const OUString &_rLibName) const
retrieves a name for a newly to be created module or dialog
void RemoveWindow(BaseWindow *pWindow, bool bDestroy, bool bAllowChangeCurWindow=true)
Definition: basidesh.cxx:781
static void InvalidateControlSlots()
Definition: basidesh.cxx:896
VclPtr< DialogWindow > FindDlgWin(const ScriptDocument &rDocument, const OUString &rLibName, const OUString &rName, bool bCreateIfNotExist=false, bool bFindSuspended=false)
Definition: basides3.cxx:114
const std::shared_ptr< LocalizationMgr > & GetCurLocalizationMgr() const
Definition: basidesh.hxx:164
VclPtr< DialogWindow > CreateDlgWin(const ScriptDocument &rDocument, const OUString &rLibName, const OUString &rDlgName)
Definition: basides3.cxx:42
void SetCurWindow(BaseWindow *pNewWin, bool bUpdateTabBar=false, bool bRememberAsCurrent=true)
Definition: basides1.cxx:1271
const css::uno::Reference< css::ui::dialogs::XFilePicker3 > & GetFilePicker() const
void SetContext(Context _eNewContext)
constexpr Point Center() const
Point LogicToPixel(const Point &rLogicPt) const
bool HandleScrollCommand(const CommandEvent &rCmd, Scrollable *pHScrl, Scrollable *pVScrl)
virtual void Command(const CommandEvent &rCEvt)
Size GetOutputSizePixel() const
weld::Window * GetFrameWeld() const
void SetHelpId(const OUString &)
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
URL aURL
virtual OUString GetName() const override
float u
#define ERRCODE_NONE
bool bReadOnly
constexpr OUStringLiteral HID_BASICIDE_DIALOGWINDOW
Definition: helpids.h:28
OUString aName
constexpr sal_uInt16 KEY_MOD1
constexpr sal_uInt16 KEY_TAB
constexpr sal_uInt16 KEY_BACKSPACE
def run(arg=None, arg2=-1)
NONE
constexpr OUStringLiteral DLGED_PROP_NAME
Definition: dlgeddef.hxx:33
SfxBindings * GetBindingsPtr()
Definition: basobj3.cxx:426
static std::vector< lang::Locale > implGetLanguagesOnlyContainedInFirstSeq(const Sequence< lang::Locale > &aFirstSeq, const Sequence< lang::Locale > &aSecondSeq)
Definition: baside3.cxx:727
bool localesAreEqual(const Locale &rLocaleLeft, const Locale &rLocaleRight)
Definition: managelang.cxx:48
constexpr OUStringLiteral FilterMask_All
Definition: baside3.cxx:75
bool implImportDialog(weld::Window *pWin, const ScriptDocument &rDocument, const OUString &aLibName)
Definition: baside3.cxx:784
bool RemoveDialog(const ScriptDocument &rDocument, const OUString &rLibName, const OUString &rDlgName)
Definition: basobj3.cxx:203
Shell * GetShell()
Definition: iderdll.cxx:80
SfxDispatcher * GetDispatcher()
Definition: basobj3.cxx:454
void MarkDocumentModified(const ScriptDocument &rDocument)
Definition: basobj3.cxx:249
bool RenameDialog(weld::Widget *pErrorParent, ScriptDocument const &rDocument, OUString const &rLibName, OUString const &rOldName, OUString const &rNewName)
renames a dialog
Definition: basobj3.cxx:138
bool QueryDelDialog(std::u16string_view rName, weld::Widget *pParent)
Definition: bastypes.cxx:764
@ OBJ_TYPE_DIALOG
Definition: bastype2.hxx:56
ItemType
Definition: sbxitem.hxx:28
@ TYPE_DIALOG
Definition: sbxitem.hxx:33
OUString IDEResId(TranslateId aId)
Definition: iderdll.cxx:108
@ Exception
Reference< XComponentContext > getProcessComponentContext()
long Long
void SetPointFont(OutputDevice &rDevice, const vcl::Font &rFont)
std::vector< sal_uInt8 > bytes
Reference< io::XInputStream > createInputStream(std::vector< sal_Int8 > &&rInData)
uno::Reference< io::XInputStreamProvider > exportDialogModel(uno::Reference< container::XNameContainer > const &xDialogModel, uno::Reference< uno::XComponentContext > const &xContext, uno::Reference< XModel > const &xDocument)
RegError REGISTRY_CALLTYPE setValue(RegKeyHandle hKey, rtl_uString *keyName, RegValueType valueType, RegValue pData, sal_uInt32 valueSize)
static SfxItemSet & rSet
OUString VCL_DLLPUBLIC GetStandardText(StandardButtonType eButton)
Reference< XModel > xModel
SdrObjKind
RET_CANCEL
RET_NO
RET_YES
VclMessageType
VclButtonsType