LibreOffice Module embeddedobj (master) 1
miscobj.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 <commonembobj.hxx>
21#include <com/sun/star/embed/EmbedStates.hpp>
22#include <com/sun/star/embed/EmbedVerbs.hpp>
23#include <com/sun/star/embed/XStorage.hpp>
24#include <com/sun/star/embed/EmbedUpdateModes.hpp>
25#include <com/sun/star/embed/XInplaceClient.hpp>
26#include <com/sun/star/lang/DisposedException.hpp>
27#include <com/sun/star/lang/NoSupportException.hpp>
28#include <com/sun/star/beans/NamedValue.hpp>
29
30#include <com/sun/star/ucb/SimpleFileAccess.hpp>
31#include <com/sun/star/io/TempFile.hpp>
34
37
38#include <utility>
39#include <vcl/weld.hxx>
40#include <vcl/stdtext.hxx>
41#include <strings.hrc>
42#include <osl/file.hxx>
44
45#include <vcl/svapp.hxx>
49
50#include "persistence.hxx"
51
52#include <cassert>
53
54using namespace ::com::sun::star;
55
56
57OCommonEmbeddedObject::OCommonEmbeddedObject( uno::Reference< uno::XComponentContext > xContext,
58 const uno::Sequence< beans::NamedValue >& aObjProps )
59: m_bReadOnly( false )
60, m_bDisposed( false )
61, m_bClosed( false )
62, m_nObjectState( -1 )
63, m_nTargetState( -1 )
64, m_nUpdateMode ( embed::EmbedUpdateModes::ALWAYS_UPDATE )
65, m_xContext(std::move( xContext ))
66, m_nMiscStatus( 0 )
67, m_bEmbeddedScriptSupport( true )
68, m_bDocumentRecoverySupport( true )
69, m_bWaitSaveCompleted( false )
70, m_bIsLinkURL( false )
71, m_bLinkTempFileChanged( false )
72, m_pLinkFile( )
73, m_bOleUpdate( false )
74, m_bInHndFunc( false )
75, m_bLinkHasPassword( false )
76, m_aLinkTempFile( )
77, m_bHasClonedSize( false )
78, m_nClonedMapUnit( 0 )
79{
80 CommonInit_Impl( aObjProps );
81}
82
83
85 uno::Reference< uno::XComponentContext > xContext,
86 const uno::Sequence< beans::NamedValue >& aObjProps,
87 const uno::Sequence< beans::PropertyValue >& aMediaDescr,
88 const uno::Sequence< beans::PropertyValue >& aObjectDescr )
89: m_bReadOnly( false )
90, m_bDisposed( false )
91, m_bClosed( false )
92, m_nObjectState( embed::EmbedStates::LOADED )
93, m_nTargetState( -1 )
94, m_nUpdateMode ( embed::EmbedUpdateModes::ALWAYS_UPDATE )
95, m_xContext(std::move( xContext ))
96, m_nMiscStatus( 0 )
97, m_bEmbeddedScriptSupport( true )
98, m_bDocumentRecoverySupport( true )
99, m_bWaitSaveCompleted( false )
100, m_bIsLinkURL( true )
101, m_bLinkTempFileChanged( false )
102, m_pLinkFile( )
103, m_bOleUpdate( false )
104, m_bInHndFunc( false )
105, m_bLinkHasPassword( false )
106, m_aLinkTempFile( )
107, m_bHasClonedSize( false )
108, m_nClonedMapUnit( 0 )
109{
110 // linked object has no own persistence so it is in loaded state starting from creation
111 LinkInit_Impl( aObjProps, aMediaDescr, aObjectDescr );
112}
113
114
115void OCommonEmbeddedObject::CommonInit_Impl( const uno::Sequence< beans::NamedValue >& aObjectProps )
116{
117 OSL_ENSURE( m_xContext.is(), "No ServiceFactory is provided!" );
118 if ( !m_xContext.is() )
119 throw uno::RuntimeException();
120
122
123 // parse configuration entries
124 // TODO/LATER: in future UI names can be also provided here
125 for ( beans::NamedValue const & prop : aObjectProps )
126 {
127 if ( prop.Name == "ClassID" )
128 prop.Value >>= m_aClassID;
129 else if ( prop.Name == "ObjectDocumentServiceName" )
130 prop.Value >>= m_aDocServiceName;
131 else if ( prop.Name == "ObjectDocumentFilterName" )
132 prop.Value >>= m_aPresetFilterName;
133 else if ( prop.Name == "ObjectMiscStatus" )
134 prop.Value >>= m_nMiscStatus;
135 else if ( prop.Name == "ObjectVerbs" )
136 prop.Value >>= m_aObjectVerbs;
137 }
138
139 if ( m_aClassID.getLength() != 16 /*|| !m_aDocServiceName.getLength()*/ )
140 throw uno::RuntimeException(); // something goes really wrong
141
142 // verbs table
143 for ( auto const & verb : std::as_const(m_aObjectVerbs) )
144 {
145 if ( verb.VerbID == embed::EmbedVerbs::MS_OLEVERB_PRIMARY )
146 {
147 m_aVerbTable.insert( { verb.VerbID, embed::EmbedStates::UI_ACTIVE } );
148 }
149 else if ( verb.VerbID == embed::EmbedVerbs::MS_OLEVERB_SHOW )
150 {
151 m_aVerbTable.insert( { verb.VerbID, embed::EmbedStates::UI_ACTIVE } );
152 }
153 else if ( verb.VerbID == embed::EmbedVerbs::MS_OLEVERB_OPEN )
154 {
155 m_aVerbTable.insert( { verb.VerbID, embed::EmbedStates::ACTIVE } );
156 }
157 else if ( verb.VerbID == embed::EmbedVerbs::MS_OLEVERB_IPACTIVATE )
158 {
159 m_aVerbTable.insert( { verb.VerbID, embed::EmbedStates::INPLACE_ACTIVE } );
160 }
161 else if ( verb.VerbID == embed::EmbedVerbs::MS_OLEVERB_UIACTIVATE )
162 {
163 m_aVerbTable.insert( { verb.VerbID, embed::EmbedStates::UI_ACTIVE } );
164 }
165 else if ( verb.VerbID == embed::EmbedVerbs::MS_OLEVERB_HIDE )
166 {
167 m_aVerbTable.insert( { verb.VerbID, embed::EmbedStates::RUNNING } );
168 }
169 }
170}
171
172
174 const uno::Sequence< beans::NamedValue >& aObjectProps,
175 const uno::Sequence< beans::PropertyValue >& aMediaDescr,
176 const uno::Sequence< beans::PropertyValue >& aObjectDescr )
177{
178 // setPersistance has no effect on own links, so the complete initialization must be done here
179
180 for ( beans::PropertyValue const & prop : aMediaDescr )
181 if ( prop.Name == "URL" )
182 prop.Value >>= m_aLinkURL;
183 else if ( prop.Name == "FilterName" )
184 prop.Value >>= m_aLinkFilterName;
185
186 OSL_ENSURE( m_aLinkURL.getLength() && m_aLinkFilterName.getLength(), "Filter and URL must be provided!" );
187
188 m_bReadOnly = true;
189 if ( m_aLinkFilterName.getLength() )
190 {
192 OUString aExportFilterName = aHelper.GetExportFilterFromImportFilter( m_aLinkFilterName );
193 m_bReadOnly = aExportFilterName != m_aLinkFilterName;
194 }
195
197 {
198 // tdf#141529 we have a linked OLE object. To prevent the original OLE
199 // data to be changed each time the OLE gets changed (at deactivate), copy it to
200 // a temporary file. That file will be changed on activated OLE changes then.
201 // The moment the original gets changed itself will now be associated with the
202 // file/document embedding the OLE being changed (see other additions to the
203 // task-ID above)
204 //
205 // open OLE original data as read input file
207 {
208 // create temporary file
209 m_aLinkTempFile = io::TempFile::create( m_xContext );
210
213 }
214 }
215
216 if(m_aLinkTempFile.is())
217 {
218 uno::Sequence< beans::PropertyValue > aAlternativeMediaDescr(aMediaDescr.getLength());
219 auto aAlternativeMediaDescrRange = asNonConstRange(aAlternativeMediaDescr);
220
221 for ( sal_Int32 a(0); a < aMediaDescr.getLength(); a++ )
222 {
223 const beans::PropertyValue& rSource(aMediaDescr[a]);
224 beans::PropertyValue& rDestination(aAlternativeMediaDescrRange[a]);
225
226 rDestination.Name = rSource.Name;
227 if(rSource.Name == "URL")
228 rDestination.Value <<= m_aLinkTempFile->getUri();
229 else
230 rDestination.Value = rSource.Value;
231 }
232
233 m_aDocMediaDescriptor = GetValuableArgs_Impl( aAlternativeMediaDescr, false );
234 }
235 else
236 {
237 m_aDocMediaDescriptor = GetValuableArgs_Impl( aMediaDescr, false );
238 }
239
240 uno::Reference< frame::XDispatchProviderInterceptor > xDispatchInterceptor;
241 for ( beans::PropertyValue const & prop : aObjectDescr )
242 if ( prop.Name == "OutplaceDispatchInterceptor" )
243 {
244 prop.Value >>= xDispatchInterceptor;
245 break;
246 }
247 else if ( prop.Name == "Parent" )
248 {
249 prop.Value >>= m_xParent;
250 }
251
252 CommonInit_Impl( aObjectProps );
253
254 if ( xDispatchInterceptor.is() )
255 m_xDocHolder->SetOutplaceDispatchInterceptor( xDispatchInterceptor );
256}
257
258
260{
261 if ( !(m_pInterfaceContainer || m_xDocHolder.is()) )
262 return;
263
264 osl_atomic_increment(&m_refCount);
266 {
267 try {
268 lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
269 m_pInterfaceContainer->disposeAndClear( aSource );
270 } catch( const uno::Exception& ) {}
271 m_pInterfaceContainer.reset();
272 }
273
274 try {
275 if ( m_xDocHolder.is() )
276 {
277 m_xDocHolder->CloseFrame();
278 try {
279 m_xDocHolder->CloseDocument( true, true );
280 } catch ( const uno::Exception& ) {}
281 m_xDocHolder->FreeOffice();
282
283 m_xDocHolder.clear();
284 }
285 } catch( const uno::Exception& ) {}
286}
287
288
289void OCommonEmbeddedObject::requestPositioning( const awt::Rectangle& aRect )
290{
291 // the method is called in case object is inplace active and the object window was resized
292
293 OSL_ENSURE( m_xClientSite.is(), "The client site must be set for inplace active object!" );
294 if ( !m_xClientSite.is() )
295 return;
296
297 uno::Reference< embed::XInplaceClient > xInplaceClient( m_xClientSite, uno::UNO_QUERY );
298
299 OSL_ENSURE( xInplaceClient.is(), "The client site must support XInplaceClient to allow inplace activation!" );
300 if ( xInplaceClient.is() )
301 {
302 try {
303 xInplaceClient->changedPlacement( aRect );
304 }
305 catch( const uno::Exception& )
306 {
307 TOOLS_WARN_EXCEPTION( "embeddedobj", "Exception on request to resize!" );
308 }
309 }
310}
311
312
313void OCommonEmbeddedObject::PostEvent_Impl( const OUString& aEventName )
314{
316 return;
317
320 if( !pIC )
321 return;
322
323 document::EventObject aEvent;
324 aEvent.EventName = aEventName;
325 aEvent.Source.set( static_cast< ::cppu::OWeakObject* >( this ) );
326 // For now all the events are sent as object events
327 // aEvent.Source = ( xSource.is() ? xSource
328 // : uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ) );
330 while( aIt.hasMoreElements() )
331 {
332 try
333 {
334 static_cast<document::XEventListener *>(aIt.next())->notifyEvent( aEvent );
335 }
336 catch( const uno::RuntimeException& )
337 {
338 aIt.remove();
339 }
340
341 // the listener could dispose the object.
342 if ( m_bDisposed )
343 return;
344 }
345}
346
347
348int OCommonEmbeddedObject::ShowMsgDialog(TranslateId Msg, const OUString& sFileName)
349{
350 std::locale aResLocale = Translate::Create( "emo" );
351 OUString aMsg = Translate::get( Msg, aResLocale );
352 OUString aBtn = Translate::get( BTN_OVERWRITE_TEXT, aResLocale );
353 OUString aTemp = sFileName;
354
355 osl::FileBase::getSystemPathFromFileURL( sFileName, aTemp );
356
357 aMsg = aMsg.replaceFirst( "%{filename}", aTemp );
359
360 std::unique_ptr<weld::MessageDialog> xQueryBox (Application::CreateMessageDialog( pParent,
361 VclMessageType::Warning, VclButtonsType::NONE, aMsg ) );
362 xQueryBox->add_button( aBtn, RET_YES );
363 xQueryBox->add_button( GetStandardText( StandardButtonType::Cancel ), RET_CANCEL );
364 xQueryBox->set_default_response( RET_CANCEL );
365
366 return xQueryBox->run();
367}
368
369
371{
372 // do not refresh and autosave at the same time
373 // when refresh all, then get both Link and Ole Update, in this case ignore OLE-refresh
374 if ( m_bInHndFunc || m_bOleUpdate || !m_aLinkTempFile.is() )
375 return;
376
377 m_bInHndFunc = true;
378
379 bool bLnkFileChg = m_pLinkFile->hasFileChanged( false );
380 bool bTmpFileChg = m_bLinkTempFileChanged;
381
382
383 if ( eState != CopyBackToOLELink::CopyLinkToTempInit && !bLnkFileChg && !bTmpFileChg )
384 {
385 // no changes
387 }
388 else if ( ( eState == CopyBackToOLELink::CopyTempToLink ) && bLnkFileChg && !bTmpFileChg )
389 {
390 // Save pressed, but the Link-file is changed, but not the temp-file
391 // in this case update the object with new link data
393 }
394 else if ( ( eState == CopyBackToOLELink::CopyTempToLink ) && bLnkFileChg && bTmpFileChg )
395 {
396 // Save pressed, but the Link-file is changed, question to user for overwrite
397 if ( ShowMsgDialog(STR_OVERWRITE_LINK, m_aLinkURL) == RET_CANCEL )
399 }
400 else if ( ( eState == CopyBackToOLELink::CopyLinkToTemp ) && bTmpFileChg )
401 {
402 // Refresh pressed, but the Temp-file is changed, question to user for overwrite
403 // it is not important it has bLnkFileChg, always overwrite the temp-file
404 if ( ShowMsgDialog( STR_OVERWRITE_TEMP, m_aLinkURL ) == RET_CANCEL )
406 }
407
408 auto writeFile = [ this ]( const OUString& SrcName, const OUString& DesName )
409 {
410 uno::Reference < ucb::XSimpleFileAccess2 > xWriteAccess( ucb::SimpleFileAccess::create( m_xContext ) );
411 uno::Reference < ucb::XSimpleFileAccess > xReadAccess( ucb::SimpleFileAccess::create( m_xContext ) );
412
413 try
414 {
415 uno::Reference < io::XInputStream > xInStream( xReadAccess->openFileRead (SrcName ) );
416
417 // This is *needed* since OTempFileService calls OTempFileService::readBytes which
418 // ensures the SvStream mpStream gets/is opened, *but* also sets the mnCachedPos from
419 // OTempFileService which still points to the end-of-file (from write-cc'ing).
420 uno::Reference < io::XSeekable > xSeek( xInStream, uno::UNO_QUERY_THROW );
421 xSeek->seek( 0 );
422
423 xWriteAccess->writeFile( DesName, xInStream );
425 // store the new timestamp
426 m_pLinkFile->hasFileChanged();
427 }
428 catch ( const uno::Exception& ex )
429 {
430 OUString aMsg;
431 osl::FileBase::getSystemPathFromFileURL( SrcName, aMsg );
432 aMsg = ex.Message + "\n\n" + aMsg;
434 std::unique_ptr<weld::MessageDialog> xQueryBox( Application::CreateMessageDialog( pParent,
435 VclMessageType::Error, VclButtonsType::Ok, aMsg ) );
436
437 xQueryBox->run();
438 }
439 };
440
441 switch ( eState )
442 {
444 break;
445 case CopyBackToOLELink::CopyLinkToTemp: // copy Link-File to Temp-File (Refresh)
446 case CopyBackToOLELink::CopyLinkToTempInit: //create temp file
447 writeFile( m_aLinkURL, m_aLinkTempFile->getUri() );
448 break;
449 case CopyBackToOLELink::CopyTempToLink: // copy Temp-File to Link-File (Save)
450 // tdf#141529 if we have a changed copy of the original OLE data we now
451 // need to write it back 'over' the original OLE data
452 writeFile( m_aLinkTempFile->getUri(), m_aLinkURL );
453 break;
454 case CopyBackToOLELink::CopyLinkToTempRefresh: // need a Refresh not save
455 // do nothing
456 break;
457 default:
458 break;
459 }
460
461 m_bInHndFunc = false;
462}
463
464
466{
467 uno::Any aReturn;
468
470 {
471 void * p = static_cast< embed::XEmbeddedObject * >( this );
472 return uno::Any( &p, rType );
473 }
475 {
476 void* p = static_cast<embed::XEmbedPersist2*>(this);
477 return uno::Any(&p, rType);
478 }
479 else if (rType == cppu::UnoType<lang::XServiceInfo>::get())
480 {
481 void* p = static_cast<lang::XServiceInfo*>(this);
482 return uno::Any(&p, rType);
483 }
485 {
486 void* p = static_cast<lang::XInitialization*>(this);
487 return uno::Any(&p, rType);
488 }
489 else if (rType == cppu::UnoType<lang::XTypeProvider>::get())
490 {
491 void* p = static_cast<lang::XTypeProvider*>(this);
492 return uno::Any(&p, rType);
493 }
494 else
495 aReturn = ::cppu::queryInterface(
496 rType,
497 static_cast< embed::XInplaceObject* >( this ),
498 static_cast< embed::XVisualObject* >( this ),
499 static_cast< embed::XCommonEmbedPersist* >( static_cast< embed::XEmbedPersist* >( this ) ),
500 static_cast< embed::XEmbedPersist* >( this ),
501 static_cast< embed::XLinkageSupport* >( this ),
502 static_cast< embed::XStateChangeBroadcaster* >( this ),
503 static_cast< embed::XClassifiedObject* >( this ),
504 static_cast< embed::XComponentSupplier* >( this ),
505 static_cast< util::XCloseable* >( this ),
506 static_cast< container::XChild* >( this ),
507 static_cast< chart2::XDefaultSizeTransmitter* >( this ),
508 static_cast< document::XEventBroadcaster* >( this ) );
509
510 if ( aReturn.hasValue() )
511 return aReturn;
512 else
513 return ::cppu::OWeakObject::queryInterface( rType ) ;
514
515}
516
517
519 noexcept
520{
522}
523
524
526 noexcept
527{
529}
530
531
532uno::Sequence< sal_Int8 > SAL_CALL OCommonEmbeddedObject::getClassID()
533{
534 if ( m_bDisposed )
535 throw lang::DisposedException();
536
537 return m_aClassID;
538}
539
541{
542 if ( m_bDisposed )
543 throw lang::DisposedException();
544
545 return m_aClassName;
546}
547
549 const uno::Sequence< sal_Int8 >& /*aClassID*/, const OUString& /*aClassName*/ )
550{
551 // the object class info can not be changed explicitly
552 throw lang::NoSupportException(); //TODO:
553}
554
555
556uno::Reference< util::XCloseable > SAL_CALL OCommonEmbeddedObject::getComponent()
557{
558 SolarMutexGuard aGuard;
559 if ( m_bDisposed )
560 throw lang::DisposedException(); // TODO
561
562 // add an exception
563 if ( m_nObjectState == -1 )
564 {
565 // the object is still not loaded
566 throw uno::RuntimeException( "Can't store object without persistence!",
567 static_cast< ::cppu::OWeakObject* >(this) );
568 }
569
570 return m_xDocHolder->GetComponent();
571}
572
573
574void SAL_CALL OCommonEmbeddedObject::addStateChangeListener( const uno::Reference< embed::XStateChangeListener >& xListener )
575{
576 SolarMutexGuard aGuard;
577 if ( m_bDisposed )
578 throw lang::DisposedException(); // TODO
579
582
584 xListener );
585}
586
587
589 const uno::Reference< embed::XStateChangeListener >& xListener )
590{
591 SolarMutexGuard aGuard;
594 xListener );
595}
596
597
598void SAL_CALL OCommonEmbeddedObject::close( sal_Bool bDeliverOwnership )
599{
600 SolarMutexGuard aGuard;
601 if ( m_bClosed )
602 throw lang::DisposedException(); // TODO
603
604 uno::Reference< uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >( this ) );
605 lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
606
608 {
611 if ( pContainer != nullptr )
612 {
613 comphelper::OInterfaceIteratorHelper2 pIterator(*pContainer);
614 while (pIterator.hasMoreElements())
615 {
616 try
617 {
618 static_cast<util::XCloseListener*>(pIterator.next())->queryClosing( aSource, bDeliverOwnership );
619 }
620 catch( const uno::RuntimeException& )
621 {
622 pIterator.remove();
623 }
624 }
625 }
626
627 pContainer = m_pInterfaceContainer->getContainer(
629 if ( pContainer != nullptr )
630 {
631 comphelper::OInterfaceIteratorHelper2 pCloseIterator(*pContainer);
632 while (pCloseIterator.hasMoreElements())
633 {
634 try
635 {
636 static_cast<util::XCloseListener*>(pCloseIterator.next())->notifyClosing( aSource );
637 }
638 catch( const uno::RuntimeException& )
639 {
640 pCloseIterator.remove();
641 }
642 }
643 }
644
645 m_pInterfaceContainer->disposeAndClear( aSource );
646 m_pInterfaceContainer.reset();
647 }
648
649 m_bDisposed = true; // the object is disposed now for outside
650
651 // it is possible that the document can not be closed, in this case if the argument is false
652 // the exception will be thrown otherwise in addition to exception the object must register itself
653 // as termination listener and listen for document events
654
655 if ( m_xDocHolder.is() )
656 {
657 m_xDocHolder->CloseFrame();
658
659 try {
660 m_xDocHolder->CloseDocument( bDeliverOwnership, bDeliverOwnership );
661 }
662 catch( const uno::Exception& )
663 {
664 if ( bDeliverOwnership )
665 {
666 m_xDocHolder.clear();
667 m_bClosed = true;
668 }
669
670 throw;
671 }
672
673 m_xDocHolder->FreeOffice();
674
675 m_xDocHolder.clear();
676 }
677
678 // TODO: for now the storage will be disposed by the object, but after the document
679 // will use the storage, the storage will be disposed by the document and recreated by the object
680 if ( m_xObjectStorage.is() )
681 {
682 try {
683 m_xObjectStorage->dispose();
684 } catch ( const uno::Exception& ) {}
685
686 m_xObjectStorage.clear();
687 m_xRecoveryStorage.clear();
688 }
689
690 m_bClosed = true; // the closing succeeded
691}
692
693
694void SAL_CALL OCommonEmbeddedObject::addCloseListener( const uno::Reference< util::XCloseListener >& xListener )
695{
696 SolarMutexGuard aGuard;
697 if ( m_bDisposed )
698 throw lang::DisposedException(); // TODO
699
702
704}
705
706
707void SAL_CALL OCommonEmbeddedObject::removeCloseListener( const uno::Reference< util::XCloseListener >& xListener )
708{
709 SolarMutexGuard aGuard;
712 xListener );
713}
714
715
716void SAL_CALL OCommonEmbeddedObject::addEventListener( const uno::Reference< document::XEventListener >& xListener )
717{
718 SolarMutexGuard aGuard;
719 if ( m_bDisposed )
720 throw lang::DisposedException(); // TODO
721
724
726}
727
728
729void SAL_CALL OCommonEmbeddedObject::removeEventListener( const uno::Reference< document::XEventListener >& xListener )
730{
731 SolarMutexGuard aGuard;
734 xListener );
735}
736
738{
739 return "com.sun.star.comp.embed.OCommonEmbeddedObject";
740}
741
742sal_Bool SAL_CALL OCommonEmbeddedObject::supportsService(const OUString& ServiceName)
743{
745}
746
747uno::Sequence<OUString> SAL_CALL OCommonEmbeddedObject::getSupportedServiceNames()
748{
749 return { "com.sun.star.comp.embed.OCommonEmbeddedObject" };
750}
751
752uno::Sequence<uno::Type> SAL_CALL OCommonEmbeddedObject::getTypes()
753{
754 static const uno::Sequence<uno::Type> aTypes{
764 };
765 return aTypes;
766}
767
768uno::Sequence<sal_Int8> SAL_CALL OCommonEmbeddedObject::getImplementationId()
769{
770 return uno::Sequence<sal_Int8>();
771}
772
773void SAL_CALL OCommonEmbeddedObject::initialize(const uno::Sequence<uno::Any>& rArguments)
774{
775 if (!rArguments.hasElements())
776 {
777 return;
778 }
779
780 comphelper::SequenceAsHashMap aMap(rArguments[0]);
781 auto it = aMap.find("ReadOnly");
782 if (it != aMap.end())
783 {
784 it->second >>= m_bReadOnly;
785 }
786}
787
788/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XComponentContext > m_xContext
AnyEventRef aEvent
static weld::Window * GetFrameWeld(const css::uno::Reference< css::awt::XWindow > &rWindow)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
std::map< sal_Int32, sal_Int32 > m_aVerbTable
css::uno::Sequence< css::beans::PropertyValue > m_aDocMediaDescriptor
virtual css::uno::Reference< css::util::XCloseable > SAL_CALL getComponent() override
Definition: miscobj.cxx:556
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::document::XEventListener > &Listener) override
Definition: miscobj.cxx:716
virtual void SAL_CALL addCloseListener(const css::uno::Reference< css::util::XCloseListener > &Listener) override
Definition: miscobj.cxx:694
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getClassID() override
Definition: miscobj.cxx:532
std::unique_ptr<::comphelper::OMultiTypeInterfaceContainerHelper2 > m_pInterfaceContainer
virtual void SAL_CALL release() noexcept override
Definition: miscobj.cxx:525
css::uno::Reference< css::uno::XInterface > m_xParent
void PostEvent_Impl(const OUString &aEventName)
Definition: miscobj.cxx:313
OCommonEmbeddedObject(css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Sequence< css::beans::NamedValue > &aObjectProps)
css::uno::Reference< css::embed::XStorage > m_xRecoveryStorage
css::uno::Sequence< css::embed::VerbDescriptor > m_aObjectVerbs
css::uno::Reference< css::awt::XWindow > m_xClientWindow
css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: miscobj.cxx:768
void requestPositioning(const css::awt::Rectangle &aRect)
Definition: miscobj.cxx:289
int ShowMsgDialog(TranslateId Msg, const OUString &sFileName)
Definition: miscobj.cxx:348
virtual void SAL_CALL setClassInfo(const css::uno::Sequence< sal_Int8 > &aClassID, const OUString &aClassName) override
Definition: miscobj.cxx:548
void LinkInit_Impl(const css::uno::Sequence< css::beans::NamedValue > &aObjectProps, const css::uno::Sequence< css::beans::PropertyValue > &aMediaDescr, const css::uno::Sequence< css::beans::PropertyValue > &aObjectDescr)
Definition: miscobj.cxx:173
css::uno::Reference< css::io::XTempFile > m_aLinkTempFile
virtual void SAL_CALL removeStateChangeListener(const css::uno::Reference< css::embed::XStateChangeListener > &xListener) override
Definition: miscobj.cxx:588
virtual ~OCommonEmbeddedObject() override
Definition: miscobj.cxx:259
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::document::XEventListener > &Listener) override
Definition: miscobj.cxx:729
css::uno::Sequence< sal_Int8 > m_aClassID
virtual OUString SAL_CALL getClassName() override
Definition: miscobj.cxx:540
OUString SAL_CALL getImplementationName() override
Definition: miscobj.cxx:737
rtl::Reference< DocumentHolder > m_xDocHolder
virtual void SAL_CALL close(sal_Bool DeliverOwnership) override
Definition: miscobj.cxx:598
::std::unique_ptr< FileChangedChecker > m_pLinkFile
void handleLinkedOLE(CopyBackToOLELink eState)
Definition: miscobj.cxx:370
css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: miscobj.cxx:747
css::uno::Reference< css::embed::XEmbeddedClient > m_xClientSite
css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: miscobj.cxx:752
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: miscobj.cxx:465
void CommonInit_Impl(const css::uno::Sequence< css::beans::NamedValue > &aObjectProps)
Definition: miscobj.cxx:115
virtual void SAL_CALL acquire() noexcept override
Definition: miscobj.cxx:518
virtual void SAL_CALL removeCloseListener(const css::uno::Reference< css::util::XCloseListener > &Listener) override
Definition: miscobj.cxx:707
virtual void SAL_CALL addStateChangeListener(const css::uno::Reference< css::embed::XStateChangeListener > &xListener) override
Definition: miscobj.cxx:574
void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &rArguments) override
Definition: miscobj.cxx:773
sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: miscobj.cxx:742
css::uno::Reference< css::embed::XStorage > m_xObjectStorage
static bool fileExists(const OUString &rBaseURL)
css::uno::XInterface * next()
oslInterlockedCount m_refCount
virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
css::uno::Type const & get()
#define TOOLS_WARN_EXCEPTION(area, stream)
Any aHelper
bool m_bDisposed
bool m_bReadOnly
void * p
uno_Any a
std::locale Create(std::string_view aPrefixName, const LanguageTag &rLocale)
OUString get(TranslateId sContextAndId, const std::locale &loc)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
HashMap_OWString_Interface aMap
uno::Sequence< beans::PropertyValue > GetValuableArgs_Impl(const uno::Sequence< beans::PropertyValue > &aMedDescr, bool bCanUseDocumentBaseURL)
Definition: persistence.cxx:67
OUString VCL_DLLPUBLIC GetStandardText(StandardButtonType eButton)
bool hasValue()
unsigned char sal_Bool
RET_CANCEL
RET_YES
const SvXMLTokenMapEntry aTypes[]