LibreOffice Module basctl (master) 1
dlged.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
21#include <dlged.hxx>
22#include <dlgedclip.hxx>
23#include <dlgeddef.hxx>
24#include <dlgedfac.hxx>
25#include <dlgedfunc.hxx>
26#include <dlgedmod.hxx>
27#include <dlgedobj.hxx>
28#include <dlgedpage.hxx>
29#include <dlgedview.hxx>
30#include <localizationmgr.hxx>
31#include <baside3.hxx>
32
33#include <com/sun/star/awt/Toolkit.hpp>
34#include <com/sun/star/awt/UnoControlDialog.hpp>
35#include <com/sun/star/awt/XVclWindowPeer.hpp>
36#include <com/sun/star/resource/StringResource.hpp>
37#include <com/sun/star/util/XCloneable.hpp>
38#include <com/sun/star/util/NumberFormatsSupplier.hpp>
39#include <comphelper/types.hxx>
41#include <tools/debug.hxx>
42#include <svl/itempool.hxx>
44#include <svx/svdpagv.hxx>
46#include <vcl/print.hxx>
47#include <vcl/svapp.hxx>
50#include <osl/diagnose.h>
51
52namespace basctl
53{
54
55using namespace comphelper;
56using namespace ::com::sun::star;
57using namespace ::com::sun::star::uno;
58using namespace ::com::sun::star::beans;
59using namespace ::com::sun::star::io;
60
61constexpr OUStringLiteral aResourceResolverPropName = u"ResourceResolver";
62constexpr OUStringLiteral aDecorationPropName = u"Decoration";
63
64
65// DlgEdHint
66
67
69 : eKind(eHint)
70 , pDlgEdObj(nullptr)
71{
72}
73
75 : eKind(eHint)
76 , pDlgEdObj(pObj)
77{
78}
79
81{
82}
83
84
85// DlgEditor
86
87
89{
90 uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext();
91
92 // create a dialog
93 uno::Reference< awt::XUnoControlDialog > xDlg = awt::UnoControlDialog::create( xContext );
94
95 // clone the dialog model
96 uno::Reference< util::XCloneable > xC( m_xUnoControlDialogModel, uno::UNO_QUERY );
97 uno::Reference< util::XCloneable > xNew = xC->createClone();
98 uno::Reference< awt::XControlModel > xDlgMod( xNew, uno::UNO_QUERY );
99
100 uno::Reference< beans::XPropertySet > xSrcDlgModPropSet( m_xUnoControlDialogModel, uno::UNO_QUERY );
101 uno::Reference< beans::XPropertySet > xNewDlgModPropSet( xDlgMod, uno::UNO_QUERY );
102 if( xNewDlgModPropSet.is() )
103 {
104 if( xSrcDlgModPropSet.is() )
105 {
106 try
107 {
108 Any aResourceResolver = xSrcDlgModPropSet->getPropertyValue( aResourceResolverPropName );
109 xNewDlgModPropSet->setPropertyValue( aResourceResolverPropName, aResourceResolver );
110 }
111 catch(const UnknownPropertyException& )
112 {
113 OSL_FAIL( "DlgEditor::ShowDialog(): No ResourceResolver property" );
114 }
115 }
116
117 // Disable decoration
118 try
119 {
120 bool bDecoration = true;
121
122 Any aDecorationAny = xSrcDlgModPropSet->getPropertyValue( aDecorationPropName );
123 aDecorationAny >>= bDecoration;
124 if( !bDecoration )
125 {
126 xNewDlgModPropSet->setPropertyValue( aDecorationPropName, Any( true ) );
127 xNewDlgModPropSet->setPropertyValue( "Title", Any( OUString() ) );
128 }
129 }
130 catch(const UnknownPropertyException& )
131 {}
132 }
133
134 // set the model
135 xDlg->setModel( xDlgMod );
136
137 // create a peer
138 uno::Reference< awt::XToolkit> xToolkit = awt::Toolkit::create( xContext );
139 xDlg->createPeer( xToolkit, rWindow.GetComponentInterface() );
140
141 xDlg->execute();
142
143 // need to cast because of multiple inheritance
144 Reference<awt::XControl>(xDlg)->dispose();
145}
146
147
149{
150 SdrObject* pDlgObj = pDlgEdModel->GetPage(0)->GetObj(0);
151 SdrPageView* pPgView = pDlgEdView->GetSdrPageView();
152
153 bool bWasMarked = pDlgEdView->IsObjMarked( pDlgObj );
154
155 if( bWasMarked )
156 pDlgEdView->MarkObj( pDlgObj, pPgView, true );
157
158 return bWasMarked;
159}
160
161
163{
164 SdrObject* pDlgObj = pDlgEdModel->GetPage(0)->GetObj(0);
165 SdrPageView* pPgView = pDlgEdView->GetSdrPageView();
166
167 bool bWasMarked = pDlgEdView->IsObjMarked( pDlgObj );
168
169 if( !bWasMarked )
170 pDlgEdView->MarkObj( pDlgObj, pPgView );
171
172 return bWasMarked;
173}
174
175
177 vcl::Window& rWindow_, DialogWindowLayout& rLayout_,
178 css::uno::Reference<css::frame::XModel> const& xModel,
179 css::uno::Reference<css::container::XNameContainer> const & xDialogModel
180)
181 :pHScroll(nullptr)
182 ,pVScroll(nullptr)
183 ,pDlgEdModel(new DlgEdModel())
184 ,pDlgEdPage(new DlgEdPage(*pDlgEdModel))
185 // set clipboard data flavors
186 ,m_ClipboardDataFlavors{ { /* MimeType */ "application/vnd.sun.xml.dialog",
187 /* HumanPresentableName */ "Dialog 6.0",
188 /* DataType */ cppu::UnoType<Sequence< sal_Int8 >>::get() } }
189 ,m_ClipboardDataFlavorsResource{ m_ClipboardDataFlavors[0],
190 { /* MimeType */ "application/vnd.sun.xml.dialogwithresource",
191 /* HumanPresentableName */ "Dialog 8.0",
192 /* DataType */ cppu::UnoType<Sequence< sal_Int8 >>::get() } }
193 ,pObjFac(new DlgEdFactory(xModel))
194 ,rWindow(rWindow_)
195 ,pFunc(new DlgEdFuncSelect(*this))
196 ,rLayout(rLayout_)
197 ,eMode( DlgEditor::SELECT )
198 ,eActObj( SdrObjKind::BasicDialogPushButton )
199 ,bFirstDraw(false)
200 ,bCreateOK(true)
201 ,bDialogModelChanged(false)
202 ,aMarkIdle("basctl DlgEditor Mark")
203 ,mnPaintGuard(0)
204 ,m_xDocument( xModel )
205{
206 pDlgEdModel->GetItemPool().FreezeIdRanges();
207 pDlgEdView.reset(new DlgEdView(*pDlgEdModel, *rWindow_.GetOutDev(), *this));
208 pDlgEdModel->SetScaleUnit( MapUnit::Map100thMM );
209
210 SdrLayerAdmin& rAdmin = pDlgEdModel->GetLayerAdmin();
211 rAdmin.NewLayer( rAdmin.GetControlLayerName() );
212 rAdmin.NewLayer( "HiddenLayer" );
213
214 pDlgEdModel->InsertPage(pDlgEdPage);
215
216 aMarkIdle.SetInvokeHandler( LINK( this, DlgEditor, MarkTimeout ) );
217
218 rWindow.SetMapMode( MapMode( MapUnit::Map100thMM ) );
219 pDlgEdPage->SetSize( rWindow.PixelToLogic( Size(DLGED_PAGE_WIDTH_MIN, DLGED_PAGE_HEIGHT_MIN) ) );
220
221 pDlgEdView->ShowSdrPage(pDlgEdView->GetModel().GetPage(0));
222 pDlgEdView->SetLayerVisible( "HiddenLayer", false );
223 pDlgEdView->SetMoveSnapOnlyTopLeft(true);
224 pDlgEdView->SetWorkArea( tools::Rectangle( Point( 0, 0 ), pDlgEdPage->GetSize() ) );
225
226 Size aGridSize( 100, 100 ); // 100TH_MM
227 pDlgEdView->SetGridCoarse( aGridSize );
228 pDlgEdView->SetSnapGridWidth(Fraction(aGridSize.Width(), 1), Fraction(aGridSize.Height(), 1));
229 pDlgEdView->SetGridSnap( true );
230 pDlgEdView->SetGridVisible( false );
231 pDlgEdView->SetDragStripes(false);
232
233 pDlgEdView->SetDesignMode();
234
235 ::comphelper::disposeComponent( m_xControlContainer );
236
237 SetDialog(xDialogModel);
238}
239
240DlgEditor::~DlgEditor()
241{
242 aMarkIdle.Stop();
243
244 ::comphelper::disposeComponent( m_xControlContainer );
245}
246
247Reference< awt::XControlContainer > const & DlgEditor::GetWindowControlContainer()
248{
249 if (!m_xControlContainer.is())
250 m_xControlContainer = VCLUnoHelper::CreateControlContainer(&rWindow);
251 return m_xControlContainer;
252}
253
254void DlgEditor::SetScrollBars(ScrollAdaptor* pHS, ScrollAdaptor* pVS)
255{
256 pHScroll = pHS;
257 pVScroll = pVS;
258
259 InitScrollBars();
260}
261
262void DlgEditor::InitScrollBars()
263{
264 DBG_ASSERT( pHScroll, "DlgEditor::InitScrollBars: no horizontal scroll bar!" );
265 DBG_ASSERT( pVScroll, "DlgEditor::InitScrollBars: no vertical scroll bar!" );
266 if ( !pHScroll || !pVScroll )
267 return;
268
269 Size aOutSize = rWindow.GetOutDev()->GetOutputSize();
270 Size aPgSize = pDlgEdPage->GetSize();
271
272 pHScroll->SetRange( Range( 0, aPgSize.Width() ));
273 pVScroll->SetRange( Range( 0, aPgSize.Height() ));
274 pHScroll->SetVisibleSize( aOutSize.Width() );
275 pVScroll->SetVisibleSize( aOutSize.Height() );
276
277 pHScroll->SetLineSize( aOutSize.Width() / 10 );
278 pVScroll->SetLineSize( aOutSize.Height() / 10 );
279 pHScroll->SetPageSize( aOutSize.Width() / 2 );
280 pVScroll->SetPageSize( aOutSize.Height() / 2 );
281
282 DoScroll();
283}
284
285
286void DlgEditor::DoScroll()
287{
288 if( !pHScroll || !pVScroll )
289 return;
290
291 MapMode aMap = rWindow.GetMapMode();
292 Point aOrg = aMap.GetOrigin();
293
294 Size aScrollPos( pHScroll->GetThumbPos(), pVScroll->GetThumbPos() );
295 aScrollPos = rWindow.LogicToPixel( aScrollPos );
296 aScrollPos = rWindow.PixelToLogic( aScrollPos );
297
298 tools::Long nX = aScrollPos.Width() + aOrg.X();
299 tools::Long nY = aScrollPos.Height() + aOrg.Y();
300
301 if( !nX && !nY )
302 return;
303
304 rWindow.PaintImmediately();
305
306 // #i31562#
307 // When scrolling, someone was rescuing the Wallpaper and forced the window scroll to
308 // be done without background refresh. I do not know why, but that causes the repaint
309 // problems. Taking that out.
310 // Wallpaper aOldBackground = rWindow.GetBackground();
311 // rWindow.SetBackground();
312
313 // #i74769# children should be scrolled
314 rWindow.Scroll( -nX, -nY, ScrollFlags::Children);
315 aMap.SetOrigin( Point( -aScrollPos.Width(), -aScrollPos.Height() ) );
316 rWindow.SetMapMode( aMap );
317 rWindow.PaintImmediately();
318
319 DlgEdHint aHint( DlgEdHint::WINDOWSCROLLED );
320 Broadcast( aHint );
321}
322
323
324void DlgEditor::UpdateScrollBars()
325{
326 MapMode aMap = rWindow.GetMapMode();
327 Point aOrg = aMap.GetOrigin();
328
329 if ( pHScroll )
330 pHScroll->SetThumbPos( -aOrg.X() );
331
332 if ( pVScroll )
333 pVScroll->SetThumbPos( -aOrg.Y() );
334}
335
336
337void DlgEditor::SetDialog( const uno::Reference< container::XNameContainer >& xUnoControlDialogModel )
338{
339 // set dialog model
340 m_xUnoControlDialogModel = xUnoControlDialogModel;
341
342 // create dialog form
343 pDlgEdForm = new DlgEdForm(*pDlgEdModel, *this);
344 uno::Reference< awt::XControlModel > xDlgMod( m_xUnoControlDialogModel , uno::UNO_QUERY );
345 pDlgEdForm->SetUnoControlModel(xDlgMod);
346 static_cast<DlgEdPage*>(pDlgEdModel->GetPage(0))->SetDlgEdForm( pDlgEdForm.get() );
347 pDlgEdModel->GetPage(0)->InsertObject( pDlgEdForm.get() );
348 AdjustPageSize();
349 pDlgEdForm->SetRectFromProps();
350 pDlgEdForm->UpdateTabIndices(); // for backward compatibility
351 pDlgEdForm->StartListening();
352
353 // create controls
354 if ( m_xUnoControlDialogModel.is() )
355 {
356 // get sequence of control names
357 Sequence< OUString > aNames = m_xUnoControlDialogModel->getElementNames();
358 const OUString* pNames = aNames.getConstArray();
359 sal_Int32 nCtrls = aNames.getLength();
360
361 // create a map of tab indices and control names, sorted by tab index
362 IndexToNameMap aIndexToNameMap;
363 for ( sal_Int32 i = 0; i < nCtrls; ++i )
364 {
365 // get name
366 OUString aName( pNames[i] );
367
368 // get tab index
369 sal_Int16 nTabIndex = -1;
370 Any aCtrl = m_xUnoControlDialogModel->getByName( aName );
372 aCtrl >>= xPSet;
373 if ( xPSet.is() )
374 xPSet->getPropertyValue( DLGED_PROP_TABINDEX ) >>= nTabIndex;
375
376 // insert into map
377 aIndexToNameMap.emplace( nTabIndex, aName );
378 }
379
380 // create controls and insert them into drawing page
381 for (auto const& indexToName : aIndexToNameMap)
382 {
383 Any aCtrl = m_xUnoControlDialogModel->getByName( indexToName.second );
385 aCtrl >>= xCtrlModel;
386 rtl::Reference<DlgEdObj> pCtrlObj = new DlgEdObj(*pDlgEdModel);
387 pCtrlObj->SetUnoControlModel( xCtrlModel );
388 pCtrlObj->SetDlgEdForm( pDlgEdForm.get() );
389 pDlgEdForm->AddChild( pCtrlObj.get() );
390 pDlgEdModel->GetPage(0)->InsertObject( pCtrlObj.get() );
391 pCtrlObj->SetRectFromProps();
392 pCtrlObj->UpdateStep();
393 pCtrlObj->StartListening();
394 }
395 }
396
397 bFirstDraw = true;
398
399 pDlgEdModel->SetChanged(false);
400}
401
402void DlgEditor::ResetDialog ()
403{
404 DlgEdForm* pOldDlgEdForm = pDlgEdForm.get();
405 DlgEdPage* pPage = static_cast<DlgEdPage*>(pDlgEdModel->GetPage(0));
406 SdrPageView* pPgView = pDlgEdView->GetSdrPageView();
407 bool bWasMarked = pDlgEdView->IsObjMarked( pOldDlgEdForm );
408 pDlgEdView->UnmarkAll();
409
410 // clear SdrObjects with broadcasting
411 pPage->ClearSdrObjList();
412
413 pPage->SetDlgEdForm( nullptr );
414 SetDialog( m_xUnoControlDialogModel );
415 if( bWasMarked )
416 pDlgEdView->MarkObj( pDlgEdForm.get(), pPgView );
417}
418
419
420Reference< util::XNumberFormatsSupplier > const & DlgEditor::GetNumberFormatsSupplier()
421{
422 if ( !m_xSupplier.is() )
423 {
424 Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
425 Reference< util::XNumberFormatsSupplier > xSupplier( util::NumberFormatsSupplier::createWithDefaultLocale(xContext) );
426
427 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
428 if ( !m_xSupplier.is() )
429 {
430 m_xSupplier = xSupplier;
431 }
432 }
433 return m_xSupplier;
434}
435
436
437void DlgEditor::MouseButtonDown( const MouseEvent& rMEvt )
438{
439 rWindow.GrabFocus();
440 pFunc->MouseButtonDown( rMEvt );
441}
442
443
444void DlgEditor::MouseButtonUp( const MouseEvent& rMEvt )
445{
446 bool bRet = pFunc->MouseButtonUp( rMEvt );
447
448 if( eMode == DlgEditor::INSERT )
449 bCreateOK = bRet;
450}
451
452
453void DlgEditor::MouseMove( const MouseEvent& rMEvt )
454{
455 pFunc->MouseMove( rMEvt );
456}
457
458
459bool DlgEditor::KeyInput( const KeyEvent& rKEvt )
460{
461 return pFunc->KeyInput( rKEvt );
462}
463
464
465void DlgEditor::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
466{
467 aPaintRect = rRect;
468 mnPaintGuard++;
469
470 if (bFirstDraw && rWindow.IsVisible() && (rRenderContext.GetOutputSize() != Size()))
471 {
472 bFirstDraw = false;
473
474 // get property set
475 css::uno::Reference<css::beans::XPropertySet> xPSet(pDlgEdForm->GetUnoControlModel(), css::uno::UNO_QUERY);
476
477 if (xPSet.is())
478 {
479 // get dialog size from properties
480 sal_Int32 nWidth = 0, nHeight = 0;
481 xPSet->getPropertyValue( DLGED_PROP_WIDTH ) >>= nWidth;
482 xPSet->getPropertyValue( DLGED_PROP_HEIGHT ) >>= nHeight;
483
484 if (nWidth == 0 && nHeight == 0)
485 {
486 Size aSize = rRenderContext.PixelToLogic( Size( 400, 300 ) );
487
488 // align with grid
489 Size aGridSize_(tools::Long(pDlgEdView->GetSnapGridWidthX()), tools::Long(pDlgEdView->GetSnapGridWidthY()));
490 aSize.AdjustWidth( -(aSize.Width() % aGridSize_.Width()) );
491 aSize.AdjustHeight( -(aSize.Height() % aGridSize_.Height()) );
492
493 Point aPos;
494 Size aOutSize = rRenderContext.GetOutputSize();
495 aPos.setX( (aOutSize.Width()>>1) - (aSize.Width()>>1) );
496 aPos.setY( (aOutSize.Height()>>1) - (aSize.Height()>>1) );
497
498 // align with grid
499 aPos.AdjustX( -(aPos.X() % aGridSize_.Width()) );
500 aPos.AdjustY( -(aPos.Y() % aGridSize_.Height()) );
501
502 // don't put in the corner
503 Point aMinPos = rRenderContext.PixelToLogic( Point( 30, 20 ) );
504 if( (aPos.X() < aMinPos.X()) || (aPos.Y() < aMinPos.Y()) )
505 {
506 aPos = aMinPos;
507 aPos.AdjustX( -(aPos.X() % aGridSize_.Width()) );
508 aPos.AdjustY( -(aPos.Y() % aGridSize_.Height()) );
509 }
510
511 // set dialog position and size
512 pDlgEdForm->SetSnapRect( tools::Rectangle( aPos, aSize ) );
513 pDlgEdForm->EndListening(false);
514 pDlgEdForm->SetPropsFromRect();
515 pDlgEdForm->GetDlgEditor().SetDialogModelChanged();
516 pDlgEdForm->StartListening();
517
518 // set position and size of controls
519 if (const size_t nObjCount = pDlgEdPage->GetObjCount())
520 {
521 for (size_t i = 0 ; i < nObjCount ; ++i)
522 {
523 if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pDlgEdPage->GetObj(i)))
524 {
525 if (!dynamic_cast<DlgEdForm*>(pDlgEdObj))
526 {
527 pDlgEdObj->SetRectFromProps();
528 }
529 }
530 }
531 }
532 }
533 }
534 }
535
536 // repaint, get PageView and prepare Region
537 SdrPageView* pPgView = pDlgEdView->GetSdrPageView();
538 const vcl::Region aPaintRectRegion(aPaintRect);
539
540 // #i74769#
541 SdrPaintWindow* pTargetPaintWindow = nullptr;
542
543 // mark repaint start
544 if (pPgView)
545 {
546 pTargetPaintWindow = pPgView->GetView().BeginDrawLayers(&rRenderContext, aPaintRectRegion);
547 OSL_ENSURE(pTargetPaintWindow, "BeginDrawLayers: Got no SdrPaintWindow (!)");
548 }
549
550 // draw background self using wallpaper
551 // #i79128# ...and use correct OutDev for that
552 if (pTargetPaintWindow)
553 {
554 Color maBackColor = rRenderContext.GetSettings().GetStyleSettings().GetLightColor();
555 OutputDevice& rTargetOutDev = pTargetPaintWindow->GetTargetOutputDevice();
556 rTargetOutDev.DrawWallpaper(aPaintRect, Wallpaper(maBackColor));
557 }
558
559 // do paint (unbuffered) and mark repaint end
560 if (pPgView)
561 {
562 // paint of control layer is done in EndDrawLayers anyway...
563 pPgView->GetView().EndDrawLayers(*pTargetPaintWindow, true);
564 }
565
566 mnPaintGuard--;
567}
568
569
570IMPL_LINK_NOARG(DlgEditor, MarkTimeout, Timer *, void)
571{
572 rLayout.UpdatePropertyBrowser();
573}
574
575
576void DlgEditor::SetMode (Mode eNewMode )
577{
578 if ( eNewMode != eMode )
579 {
580 if ( eNewMode == INSERT )
581 pFunc.reset(new DlgEdFuncInsert(*this));
582 else
583 pFunc.reset(new DlgEdFuncSelect(*this));
584
585 if ( eNewMode == READONLY )
586 pDlgEdModel->SetReadOnly( true );
587 else
588 pDlgEdModel->SetReadOnly( false );
589 }
590
591 if ( eNewMode == TEST )
592 ShowDialog();
593
594 eMode = eNewMode;
595}
596
597
598void DlgEditor::SetInsertObj(SdrObjKind eObj)
599{
600 eActObj = eObj;
601
602 pDlgEdView->SetCurrentObj( eActObj, SdrInventor::BasicDialog );
603}
604
605void DlgEditor::CreateDefaultObject()
606{
607 // create object by factory
609 *pDlgEdModel,
610 pDlgEdView->GetCurrentObjInventor(),
611 pDlgEdView->GetCurrentObjIdentifier());
612
613 DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pObj.get());
614 if (!pDlgEdObj)
615 return;
616
617 // set position and size
618 Size aSize = rWindow.PixelToLogic( Size( 96, 24 ) );
619 Point aPoint = pDlgEdForm->GetSnapRect().Center();
620 aPoint.AdjustX( -(aSize.Width() / 2) );
621 aPoint.AdjustY( -(aSize.Height() / 2) );
622 pDlgEdObj->SetSnapRect( tools::Rectangle( aPoint, aSize ) );
623
624 // set default property values
625 pDlgEdObj->SetDefaults();
626
627 // insert object into drawing page
628 SdrPageView* pPageView = pDlgEdView->GetSdrPageView();
629 if (pDlgEdView->InsertObjectAtView(pDlgEdObj, *pPageView))
630 {
631 // start listening
632 pDlgEdObj->StartListening();
633 }
634}
635
636void DlgEditor::Cut()
637{
638 Copy();
639 Delete();
640}
641
644{
645 xStream->readBytes( bytes, xStream->available() );
646 for (;;)
647 {
648 Sequence< sal_Int8 > readBytes;
649 sal_Int32 nRead = xStream->readBytes( readBytes, 1024 );
650 if (! nRead)
651 break;
652
653 sal_Int32 nPos = bytes.getLength();
654 bytes.realloc( nPos + nRead );
655 memcpy( bytes.getArray() + nPos, readBytes.getConstArray(), static_cast<sal_uInt32>(nRead) );
656 }
657}
658
659void DlgEditor::Copy()
660{
661 if( !pDlgEdView->AreObjectsMarked() )
662 return;
663
664 // stop all drawing actions
665 pDlgEdView->BrkAction();
666
667 // create an empty clipboard dialog model
668 Reference< util::XCloneable > xClone( m_xUnoControlDialogModel, UNO_QUERY );
669 Reference< util::XCloneable > xNewClone = xClone->createClone();
670 Reference< container::XNameContainer > xClipDialogModel( xNewClone, UNO_QUERY );
671
672 if ( xClipDialogModel.is() )
673 {
674 Sequence< OUString > aNames = xClipDialogModel->getElementNames();
675 const OUString* pNames = aNames.getConstArray();
676 sal_uInt32 nCtrls = aNames.getLength();
677
678 for ( sal_uInt32 n = 0; n < nCtrls; n++ )
679 {
680 xClipDialogModel->removeByName( pNames[n] );
681 }
682 }
683
684 // insert control models of marked objects into clipboard dialog model
685 const size_t nMark = pDlgEdView->GetMarkedObjectList().GetMarkCount();
686 for( size_t i = 0; i < nMark; ++i )
687 {
688 SdrObject* pObj = pDlgEdView->GetMarkedObjectList().GetMark(i)->GetMarkedSdrObj();
689 DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pObj);
690
691 if (pDlgEdObj && !dynamic_cast<DlgEdForm*>(pDlgEdObj))
692 {
693 OUString aName;
694 Reference< beans::XPropertySet > xMarkPSet(pDlgEdObj->GetUnoControlModel(), uno::UNO_QUERY);
695 if (xMarkPSet.is())
696 {
697 xMarkPSet->getPropertyValue( DLGED_PROP_NAME ) >>= aName;
698 }
699
700 if ( m_xUnoControlDialogModel.is() && m_xUnoControlDialogModel->hasByName(aName) )
701 {
702 Any aCtrl = m_xUnoControlDialogModel->getByName( aName );
703
704 // clone control model
706 aCtrl >>= xCtrl;
707 Reference< util::XCloneable > xNewCtrl = xCtrl->createClone();
708 Any aNewCtrl;
709 aNewCtrl <<= xNewCtrl;
710
711 if (xClipDialogModel.is())
712 xClipDialogModel->insertByName( aName , aNewCtrl );
713 }
714 }
715 }
716
717 // export clipboard dialog model to xml
720 Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xClipDialogModel, xContext, m_xDocument );
721 Reference< XInputStream > xStream( xISP->createInputStream() );
722 Sequence< sal_Int8 > DialogModelBytes;
723 implCopyStreamToByteSequence( xStream, DialogModelBytes );
724 xStream->closeInput();
725
726 // set clipboard content
727 Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow().GetClipboard();
728 if ( !xClipboard.is() )
729 return;
730
731 // With resource?
732 uno::Reference< beans::XPropertySet > xDialogModelPropSet( m_xUnoControlDialogModel, uno::UNO_QUERY );
733 uno::Reference< resource::XStringResourcePersistence > xStringResourcePersistence;
734 if( xDialogModelPropSet.is() )
735 {
736 try
737 {
738 Any aResourceResolver = xDialogModelPropSet->getPropertyValue( aResourceResolverPropName );
739 aResourceResolver >>= xStringResourcePersistence;
740 }
741 catch(const UnknownPropertyException& )
742 {}
743 }
744
746 if( xStringResourcePersistence.is() )
747 {
748 // With resource, support old and new format
749
750 // Export xClipDialogModel another time with ids replaced by current language string
751 LocalizationMgr::resetResourceForDialog( xClipDialogModel, xStringResourcePersistence );
752 Reference< XInputStreamProvider > xISP2 = ::xmlscript::exportDialogModel( xClipDialogModel, xContext, m_xDocument );
753 Reference< XInputStream > xStream2( xISP2->createInputStream() );
754 Sequence< sal_Int8 > NoResourceDialogModelBytes;
755 implCopyStreamToByteSequence( xStream2, NoResourceDialogModelBytes );
756 xStream2->closeInput();
757
758 // Old format contains dialog with replaced ids
759 Any aNoResourceDialogModelBytesAny;
760 aNoResourceDialogModelBytesAny <<= NoResourceDialogModelBytes;
761
762 // New format contains dialog and resource
763 Sequence< sal_Int8 > aResData = xStringResourcePersistence->exportBinary();
764
765 // Create sequence for combined dialog and resource
766 sal_Int32 nDialogDataLen = DialogModelBytes.getLength();
767 sal_Int32 nResDataLen = aResData.getLength();
768
769 // Combined data = 4 Bytes 32Bit Offset to begin of resource data, lowest byte first
770 // + nDialogDataLen bytes dialog data + nResDataLen resource data
771 sal_Int32 nTotalLen = 4 + nDialogDataLen + nResDataLen;
772 sal_Int32 nResOffset = 4 + nDialogDataLen;
773 Sequence< sal_Int8 > aCombinedData( nTotalLen );
774 sal_Int8* pCombinedData = aCombinedData.getArray();
775
776 // Write offset
777 sal_Int32 n = nResOffset;
778 for( sal_Int16 i = 0 ; i < 4 ; i++ )
779 {
780 pCombinedData[i] = sal_Int8( n & 0xff );
781 n >>= 8;
782 }
783 memcpy( pCombinedData + 4, DialogModelBytes.getConstArray(), nDialogDataLen );
784 memcpy( pCombinedData + nResOffset, aResData.getConstArray(), nResDataLen );
785
786 Sequence< Any > aSeqData
787 {
788 aNoResourceDialogModelBytesAny,
789 Any(aCombinedData)
790 };
791
792 pTrans = new DlgEdTransferableImpl( m_ClipboardDataFlavorsResource, aSeqData );
793 }
794 else
795 {
796 // No resource, support only old format
797 pTrans = new DlgEdTransferableImpl( m_ClipboardDataFlavors , { Any(DialogModelBytes) } );
798 }
799 SolarMutexReleaser aReleaser;
800 xClipboard->setContents( pTrans , pTrans );
801}
802
803
804void DlgEditor::Paste()
805{
806 // stop all drawing actions
807 pDlgEdView->BrkAction();
808
809 // unmark all objects
810 pDlgEdView->UnmarkAll();
811
812 // get clipboard
813 Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow().GetClipboard();
814 if ( !xClipboard.is() )
815 return;
816
818 {
819 SolarMutexReleaser aReleaser;
820 // get clipboard content
821 xTransf = xClipboard->getContents();
822 }
823 if ( !xTransf.is() )
824 return;
825
826 // Is target dialog (library) localized?
827 uno::Reference< beans::XPropertySet > xDialogModelPropSet( m_xUnoControlDialogModel, uno::UNO_QUERY );
828 uno::Reference< resource::XStringResourceManager > xStringResourceManager;
829 if( xDialogModelPropSet.is() )
830 {
831 try
832 {
833 Any aResourceResolver = xDialogModelPropSet->getPropertyValue( aResourceResolverPropName );
834 aResourceResolver >>= xStringResourceManager;
835 }
836 catch(const UnknownPropertyException& )
837 {}
838 }
839 bool bLocalized = false;
840 if( xStringResourceManager.is() )
841 bLocalized = xStringResourceManager->getLocales().hasElements();
842
843 if ( !xTransf->isDataFlavorSupported( m_ClipboardDataFlavors[0] ) )
844 return;
845
846 // create clipboard dialog model from xml
848 Reference< container::XNameContainer > xClipDialogModel( xContext->getServiceManager()->createInstanceWithContext(
849 "com.sun.star.awt.UnoControlDialogModel", xContext ), uno::UNO_QUERY );
850
851 bool bSourceIsLocalized = false;
852 Sequence< sal_Int8 > DialogModelBytes;
853 Sequence< sal_Int8 > aResData;
854 if( bLocalized && xTransf->isDataFlavorSupported( m_ClipboardDataFlavorsResource[1] ) )
855 {
856 bSourceIsLocalized = true;
857
858 Any aCombinedDataAny = xTransf->getTransferData( m_ClipboardDataFlavorsResource[1] );
859 Sequence< sal_Int8 > aCombinedData;
860 aCombinedDataAny >>= aCombinedData;
861 const sal_Int8* pCombinedData = aCombinedData.getConstArray();
862
863 sal_Int32 nTotalLen = aCombinedData.getLength();
864
865 // Reading offset
866 sal_Int32 nResOffset = 0;
867 sal_Int32 nFactor = 1;
868 for( sal_Int16 i = 0; i < 4; i++ )
869 {
870 nResOffset += nFactor * sal_uInt8( pCombinedData[i] );
871 nFactor *= 256;
872 }
873
874 sal_Int32 nResDataLen = nTotalLen - nResOffset;
875 sal_Int32 nDialogDataLen = nTotalLen - nResDataLen - 4;
876
877 DialogModelBytes.realloc( nDialogDataLen );
878 memcpy( DialogModelBytes.getArray(), pCombinedData + 4, nDialogDataLen );
879
880 aResData.realloc( nResDataLen );
881 memcpy( aResData.getArray(), pCombinedData + nResOffset, nResDataLen );
882 }
883 else
884 {
885 Any aAny = xTransf->getTransferData( m_ClipboardDataFlavors[0] );
886 aAny >>= DialogModelBytes;
887 }
888
889 if ( xClipDialogModel.is() )
890 {
891 Reference<XInputStream> xIn = ::xmlscript::createInputStream( DialogModelBytes.getConstArray(), DialogModelBytes.getLength() );
892 ::xmlscript::importDialogModel( xIn , xClipDialogModel, xContext, m_xDocument );
893 }
894
895 // get control models from clipboard dialog model
896 if ( !xClipDialogModel.is() )
897 return;
898
899 Sequence< OUString > aNames = xClipDialogModel->getElementNames();
900 const OUString* pNames = aNames.getConstArray();
901 sal_uInt32 nCtrls = aNames.getLength();
902
903 Reference< resource::XStringResourcePersistence > xStringResourcePersistence;
904 if( nCtrls > 0 && bSourceIsLocalized )
905 {
906 xStringResourcePersistence = css::resource::StringResource::create( getProcessComponentContext() );
907 xStringResourcePersistence->importBinary( aResData );
908 }
909 for( sal_uInt32 n = 0; n < nCtrls; n++ )
910 {
911 Any aA = xClipDialogModel->getByName( pNames[n] );
913 aA >>= xCM;
914
915 // clone the control model
916 Reference< util::XCloneable > xClone( xCM, uno::UNO_QUERY );
917 Reference< awt::XControlModel > xCtrlModel( xClone->createClone(), uno::UNO_QUERY );
918
919 rtl::Reference<DlgEdObj> pCtrlObj = new DlgEdObj(*pDlgEdModel);
920 pCtrlObj->SetDlgEdForm(pDlgEdForm.get()); // set parent form
921 pDlgEdForm->AddChild(pCtrlObj.get()); // add child to parent form
922 pCtrlObj->SetUnoControlModel( xCtrlModel ); // set control model
923
924 // set new name
925 OUString aOUniqueName( pCtrlObj->GetUniqueName() );
926 Reference< beans::XPropertySet > xPSet( xCtrlModel , UNO_QUERY );
927 xPSet->setPropertyValue( DLGED_PROP_NAME, Any(aOUniqueName) );
928
929 // set tabindex
930 Sequence< OUString > aNames_ = m_xUnoControlDialogModel->getElementNames();
931 xPSet->setPropertyValue( DLGED_PROP_TABINDEX, Any(static_cast<sal_Int16>(aNames_.getLength())) );
932
933 if( bLocalized )
934 {
935 Any aControlAny;
936 aControlAny <<= xCtrlModel;
937 if( bSourceIsLocalized && xStringResourcePersistence.is() )
938 {
939 LocalizationMgr::copyResourcesForPastedEditorObject( this,
940 aControlAny, aOUniqueName, xStringResourcePersistence );
941 }
942 else
943 {
944 LocalizationMgr::setControlResourceIDsForNewEditorObject
945 ( this, aControlAny, aOUniqueName );
946 }
947 }
948
949 // insert control model in editor dialog model
950 Any aCtrlModel;
951 aCtrlModel <<= xCtrlModel;
952 m_xUnoControlDialogModel->insertByName( aOUniqueName , aCtrlModel );
953
954 // insert object into drawing page
955 pDlgEdModel->GetPage(0)->InsertObject( pCtrlObj.get() );
956 pCtrlObj->SetRectFromProps();
957 pCtrlObj->UpdateStep();
958 pDlgEdForm->UpdateTabOrderAndGroups();
959 pCtrlObj->StartListening(); // start listening
960
961 // mark object
962 SdrPageView* pPgView = pDlgEdView->GetSdrPageView();
963 pDlgEdView->MarkObj( pCtrlObj.get(), pPgView, false, true);
964 }
965
966 // center marked objects in dialog editor form
967 Point aMarkCenter = pDlgEdView->GetMarkedObjRect().Center();
968 Point aFormCenter = pDlgEdForm->GetSnapRect().Center();
969 Point aPoint = aFormCenter - aMarkCenter;
970 Size aSize( aPoint.X() , aPoint.Y() );
971 pDlgEdView->MoveMarkedObj( aSize ); // update of control model properties (position + size) in NbcMove
972 pDlgEdView->MarkListHasChanged();
973
974 // dialog model changed
975 SetDialogModelChanged();
976}
977
978
979void DlgEditor::Delete()
980{
981 if( !pDlgEdView->AreObjectsMarked() )
982 return;
983
984 // remove control models of marked objects from dialog model
985 const size_t nMark = pDlgEdView->GetMarkedObjectList().GetMarkCount();
986
987 for( size_t i = 0; i < nMark; ++i )
988 {
989 SdrObject* pObj = pDlgEdView->GetMarkedObjectList().GetMark(i)->GetMarkedSdrObj();
990 DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pObj);
991
992 if ( pDlgEdObj && !dynamic_cast<DlgEdForm*>(pDlgEdObj) )
993 {
994 // get name from property
995 OUString aName;
996 uno::Reference< beans::XPropertySet > xPSet(pDlgEdObj->GetUnoControlModel(), uno::UNO_QUERY);
997 if (xPSet.is())
998 {
999 xPSet->getPropertyValue( DLGED_PROP_NAME ) >>= aName;
1000 }
1001
1002 // remove control from dialog model
1003 Reference< css::container::XNameAccess > xNameAcc(pDlgEdObj->GetDlgEdForm()->GetUnoControlModel(), UNO_QUERY );
1004 if ( xNameAcc.is() && xNameAcc->hasByName(aName) )
1005 {
1006 Reference< css::container::XNameContainer > xCont(xNameAcc, UNO_QUERY );
1007 if ( xCont.is() )
1008 {
1009 if( xCont->hasByName( aName ) )
1010 {
1011 Any aAny = xCont->getByName( aName );
1012 LocalizationMgr::deleteControlResourceIDsForDeletedEditorObject( this, aAny, aName );
1013 }
1014 xCont->removeByName( aName );
1015 }
1016 }
1017
1018 // remove child from parent form
1019 pDlgEdForm->RemoveChild( pDlgEdObj );
1020 }
1021 }
1022
1023 // update tab indices
1024 pDlgEdForm->UpdateTabIndices();
1025
1026 pDlgEdView->BrkAction();
1027
1028 bool const bDlgMarked = UnmarkDialog();
1029 pDlgEdView->DeleteMarked();
1030 if( bDlgMarked )
1031 RemarkDialog();
1032}
1033
1034
1035bool DlgEditor::IsPasteAllowed()
1036{
1037 // get clipboard
1038 Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow().GetClipboard();
1039 if ( xClipboard.is() )
1040 {
1042 {
1043 SolarMutexReleaser aReleaser;
1044 // get clipboard content
1045 xTransf = xClipboard->getContents();
1046 }
1047 if (xTransf.is())
1048 return xTransf->isDataFlavorSupported(m_ClipboardDataFlavors[0]);
1049 }
1050 return false;
1051}
1052
1053
1054void DlgEditor::ShowProperties()
1055{
1056 rLayout.ShowPropertyBrowser();
1057}
1058
1059
1060void DlgEditor::UpdatePropertyBrowserDelayed()
1061{
1062 aMarkIdle.Start();
1063}
1064
1065
1066bool DlgEditor::IsModified() const
1067{
1068 return pDlgEdModel->IsChanged() || bDialogModelChanged;
1069}
1070
1071
1072void DlgEditor::ClearModifyFlag()
1073{
1074 pDlgEdModel->SetChanged(false);
1075 bDialogModelChanged = false;
1076}
1077
1078
1079namespace Print
1080{
1086}
1087
1088static void lcl_PrintHeader( Printer* pPrinter, const OUString& rTitle ) // not working yet
1089{
1090
1091 pPrinter->Push();
1092
1093 Size const aSz = pPrinter->GetOutputSize();
1094
1095 pPrinter->SetLineColor( COL_BLACK );
1096 pPrinter->SetFillColor();
1097
1098 vcl::Font aFont( pPrinter->GetFont() );
1099 aFont.SetWeight( WEIGHT_BOLD );
1100 aFont.SetAlignment( ALIGN_BOTTOM );
1101 pPrinter->SetFont( aFont );
1102
1103 tools::Long const nFontHeight = pPrinter->GetTextHeight();
1104
1105 // 1st border => line, 2+3 border = free space
1106 tools::Long const nYTop = Print::nTopMargin - 3*Print::nBorder - nFontHeight;
1107
1108 tools::Long const nXLeft = Print::nLeftMargin - Print::nBorder;
1109 tools::Long const nXRight = aSz.Width() - Print::nRightMargin + Print::nBorder;
1110
1111 pPrinter->DrawRect(tools::Rectangle(
1112 Point(nXLeft, nYTop),
1113 Size(nXRight - nXLeft, aSz.Height() - nYTop - Print::nBottomMargin + Print::nBorder)
1114 ));
1115
1117 Point aPos(Print::nLeftMargin, nY);
1118 pPrinter->DrawText( aPos, rTitle );
1119
1121 pPrinter->DrawLine( Point( nXLeft, nY ), Point( nXRight, nY ) );
1122
1123 pPrinter->Pop();
1124}
1125
1126
1127void DlgEditor::printPage( sal_Int32 nPage, Printer* pPrinter, const OUString& rTitle )
1128{
1129 if( nPage == 0 )
1130 Print( pPrinter, rTitle );
1131}
1132
1133
1134void DlgEditor::Print( Printer* pPrinter, const OUString& rTitle ) // not working yet
1135{
1136 MapMode aOldMap( pPrinter->GetMapMode());
1137 vcl::Font aOldFont( pPrinter->GetFont() );
1138
1139 MapMode aMap( MapUnit::Map100thMM );
1140 pPrinter->SetMapMode( aMap );
1141 vcl::Font aFont;
1142 aFont.SetAlignment( ALIGN_BOTTOM );
1143 aFont.SetFontSize( Size( 0, 360 ));
1144 pPrinter->SetFont( aFont );
1145
1146 Size aPaperSz = pPrinter->GetOutputSize();
1147 aPaperSz.AdjustWidth( -(Print::nLeftMargin + Print::nRightMargin) );
1149
1150 lcl_PrintHeader( pPrinter, rTitle );
1151
1152 BitmapEx aDlgEx;
1153 Size aBmpSz( pPrinter->PixelToLogic( aDlgEx.GetSizePixel() ) );
1154 double nPaperSzWidth = aPaperSz.Width();
1155 double nPaperSzHeight = aPaperSz.Height();
1156 double nBmpSzWidth = aBmpSz.Width();
1157 double nBmpSzHeight = aBmpSz.Height();
1158 double nScaleX = nPaperSzWidth / nBmpSzWidth;
1159 double nScaleY = nPaperSzHeight / nBmpSzHeight;
1160
1161 Size aOutputSz;
1162 if( nBmpSzHeight * nScaleX <= nPaperSzHeight )
1163 {
1164 aOutputSz.setWidth( static_cast<tools::Long>(nBmpSzWidth * nScaleX) );
1165 aOutputSz.setHeight( static_cast<tools::Long>(nBmpSzHeight * nScaleX) );
1166 }
1167 else
1168 {
1169 aOutputSz.setWidth( static_cast<tools::Long>(nBmpSzWidth * nScaleY) );
1170 aOutputSz.setHeight( static_cast<tools::Long>(nBmpSzHeight * nScaleY) );
1171 }
1172
1173 Point aPosOffs(
1174 (aPaperSz.Width() / 2) - (aOutputSz.Width() / 2),
1175 (aPaperSz.Height()/ 2) - (aOutputSz.Height() / 2));
1176
1177 aPosOffs.AdjustX(Print::nLeftMargin );
1178 aPosOffs.AdjustY(Print::nTopMargin );
1179
1180 pPrinter->DrawBitmapEx( aPosOffs, aOutputSz, aDlgEx );
1181
1182 pPrinter->SetMapMode( aOldMap );
1183 pPrinter->SetFont( aOldFont );
1184}
1185
1186
1187bool DlgEditor::AdjustPageSize()
1188{
1189 bool bAdjustedPageSize = false;
1190 Reference< beans::XPropertySet > xPSet( m_xUnoControlDialogModel, UNO_QUERY );
1191 if ( xPSet.is() )
1192 {
1193 sal_Int32 nFormXIn = 0, nFormYIn = 0, nFormWidthIn = 0, nFormHeightIn = 0;
1194 xPSet->getPropertyValue( DLGED_PROP_POSITIONX ) >>= nFormXIn;
1195 xPSet->getPropertyValue( DLGED_PROP_POSITIONY ) >>= nFormYIn;
1196 xPSet->getPropertyValue( DLGED_PROP_WIDTH ) >>= nFormWidthIn;
1197 xPSet->getPropertyValue( DLGED_PROP_HEIGHT ) >>= nFormHeightIn;
1198
1199 sal_Int32 nFormX, nFormY, nFormWidth, nFormHeight;
1200 if ( pDlgEdForm && pDlgEdForm->TransformFormToSdrCoordinates( nFormXIn, nFormYIn, nFormWidthIn, nFormHeightIn, nFormX, nFormY, nFormWidth, nFormHeight ) )
1201 {
1202 Size aPageSizeDelta( 400, 300 );
1203 aPageSizeDelta = rWindow.PixelToLogic( aPageSizeDelta, MapMode( MapUnit::Map100thMM ) );
1204
1205 sal_Int32 nNewPageWidth = nFormX + nFormWidth + aPageSizeDelta.Width();
1206 sal_Int32 nNewPageHeight = nFormY + nFormHeight + aPageSizeDelta.Height();
1207
1209 aPageSizeMin = rWindow.PixelToLogic( aPageSizeMin, MapMode( MapUnit::Map100thMM ) );
1210 sal_Int32 nPageWidthMin = aPageSizeMin.Width();
1211 sal_Int32 nPageHeightMin = aPageSizeMin.Height();
1212
1213 if ( nNewPageWidth < nPageWidthMin )
1214 nNewPageWidth = nPageWidthMin;
1215
1216 if ( nNewPageHeight < nPageHeightMin )
1217 nNewPageHeight = nPageHeightMin;
1218
1219 if ( pDlgEdPage )
1220 {
1221 Size aPageSize = pDlgEdPage->GetSize();
1222 if ( nNewPageWidth != aPageSize.Width() || nNewPageHeight != aPageSize.Height() )
1223 {
1224 Size aNewPageSize( nNewPageWidth, nNewPageHeight );
1225 pDlgEdPage->SetSize( aNewPageSize );
1226 pDlgEdView->SetWorkArea( tools::Rectangle( Point( 0, 0 ), aNewPageSize ) );
1227 bAdjustedPageSize = true;
1228 }
1229 }
1230 }
1231 }
1232
1233 return bAdjustedPageSize;
1234}
1235
1236
1237} // namespace basctl
1238
1239/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XInputStream > xStream
const StyleSettings & GetStyleSettings() const
const Size & GetSizePixel() const
Size GetOutputSize() const
const vcl::Font & GetFont() const
void DrawBitmapEx(const Point &rDestPt, const BitmapEx &rBitmapEx)
void SetFont(const vcl::Font &rNewFont)
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
void DrawRect(const tools::Rectangle &rRect)
void DrawLine(const Point &rStartPt, const Point &rEndPt)
void SetLineColor()
void SetMapMode()
void SetFillColor()
const MapMode & GetMapMode() const
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
tools::Long GetTextHeight() const
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, std::vector< tools::Rectangle > *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
const AllSettings & GetSettings() const
SAL_DLLPRIVATE void DrawWallpaper(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, const Wallpaper &rWallpaper)
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
const OUString & GetControlLayerName() const
SdrLayer * NewLayer(const OUString &rName, sal_uInt16 nPos=0xFFFF)
static rtl::Reference< SdrObject > MakeNewObject(SdrModel &rSdrModel, SdrInventor nInventor, SdrObjKind nObjIdentifier, const tools::Rectangle *pSnapRect=nullptr)
void ClearSdrObjList()
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
virtual void SetSnapRect(const tools::Rectangle &rRect)
SdrView & GetView()
void EndDrawLayers(SdrPaintWindow &rPaintWindow, bool bPaintFormLayer)
SdrPaintWindow * BeginDrawLayers(OutputDevice *pOut, const vcl::Region &rReg, bool bDisableIntersect=false)
OutputDevice & GetTargetOutputDevice()
const css::uno::Reference< css::awt::XControlModel > & GetUnoControlModel() const
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
void setWidth(tools::Long nWidth)
tools::Long AdjustWidth(tools::Long n)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
const Color & GetLightColor() const
static css::uno::Reference< css::awt::XControlContainer > CreateControlContainer(vcl::Window *pWindow)
virtual ~DlgEdHint() override
Definition: dlged.cxx:80
DlgEdHint(Kind)
Definition: dlged.cxx:68
DlgEdForm * GetDlgEdForm() const
Definition: dlgedobj.hxx:97
void StartListening()
Definition: dlgedobj.cxx:1055
void SetDefaults()
Definition: dlgedobj.cxx:980
void SetDlgEdForm(DlgEdForm *pForm)
Definition: dlgedpage.hxx:44
bool RemarkDialog()
Definition: dlged.cxx:162
css::uno::Reference< css::container::XNameContainer > m_xUnoControlDialogModel
Definition: dlged.hxx:116
DlgEditor(vcl::Window &, DialogWindowLayout &, css::uno::Reference< css::frame::XModel > const &xModel, css::uno::Reference< css::container::XNameContainer > const &xDialogModel)
Definition: dlged.cxx:176
bool UnmarkDialog()
Definition: dlged.cxx:148
void ShowDialog()
Definition: dlged.cxx:88
vcl::Window & rWindow
Definition: dlged.hxx:122
std::unique_ptr< DlgEdModel > pDlgEdModel
Definition: dlged.hxx:112
std::unique_ptr< DlgEdView > pDlgEdView
Definition: dlged.hxx:114
void SetFontSize(const Size &)
void SetWeight(FontWeight)
void SetAlignment(TextAlign)
virtual css::uno::Reference< css::awt::XVclWindowPeer > GetComponentInterface(bool bCreate=true)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
Reference< XOfficeDatabaseDocument > m_xDocument
#define DBG_ASSERT(sCon, aError)
const bool READONLY
float u
ALIGN_BOTTOM
WEIGHT_BOLD
OUString aName
Mode eMode
sal_Int64 n
sal_uInt16 nPos
sal_Int32 nLeftMargin
def Print(s)
tools::Long const nRightMargin
Definition: dlged.cxx:1082
tools::Long const nBottomMargin
Definition: dlged.cxx:1084
tools::Long const nTopMargin
Definition: dlged.cxx:1083
tools::Long const nBorder
Definition: dlged.cxx:1085
constexpr OUStringLiteral DLGED_PROP_NAME
Definition: dlgeddef.hxx:33
constexpr auto DLGED_PAGE_WIDTH_MIN
Definition: dlged.hxx:51
IMPL_LINK_NOARG(DlgEditor, MarkTimeout, Timer *, void)
Definition: dlged.cxx:570
constexpr auto DLGED_PAGE_HEIGHT_MIN
Definition: dlged.hxx:52
constexpr OUStringLiteral aDecorationPropName
Definition: dlged.cxx:62
std::multimap< sal_Int16, OUString > IndexToNameMap
Definition: dlgedobj.hxx:34
constexpr OUStringLiteral aResourceResolverPropName
Definition: dlged.cxx:61
constexpr OUStringLiteral DLGED_PROP_WIDTH
Definition: dlgeddef.hxx:41
constexpr OUStringLiteral DLGED_PROP_POSITIONX
Definition: dlgeddef.hxx:35
constexpr OUStringLiteral DLGED_PROP_TABINDEX
Definition: dlgeddef.hxx:38
constexpr OUStringLiteral DLGED_PROP_HEIGHT
Definition: dlgeddef.hxx:31
static void implCopyStreamToByteSequence(const Reference< XInputStream > &xStream, Sequence< sal_Int8 > &bytes)
Definition: dlged.cxx:642
static void lcl_PrintHeader(Printer *pPrinter, const OUString &rTitle)
Definition: dlged.cxx:1088
constexpr OUStringLiteral DLGED_PROP_POSITIONY
Definition: dlgeddef.hxx:36
Reference< XComponentContext > getProcessComponentContext()
int i
TEST
long Long
std::vector< sal_uInt8 > bytes
HashMap_OWString_Interface aMap
SdrObjKind
unsigned char sal_uInt8
signed char sal_Int8