LibreOffice Module sw (master)  1
xmltexti.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 
23 #include <com/sun/star/embed/EmbeddedObjectCreator.hpp>
24 #include <com/sun/star/embed/OOoEmbeddedObjectFactory.hpp>
25 #include <com/sun/star/embed/XEmbeddedObject.hpp>
26 #include <com/sun/star/embed/Aspects.hpp>
27 #include <com/sun/star/frame/XModel.hpp>
28 #include <com/sun/star/task/XInteractionHandler.hpp>
29 #include <o3tl/any.hxx>
30 #include <rtl/ustrbuf.hxx>
31 #include <sal/log.hxx>
32 #include <comphelper/classids.hxx>
33 #include <com/sun/star/lang/XUnoTunnel.hpp>
34 #include <xmloff/prstylei.hxx>
35 #include <xmloff/maptype.hxx>
36 #include <xmloff/xmlprmap.hxx>
37 #include <xmloff/txtprmap.hxx>
38 #include <xmloff/i18nmap.hxx>
39 #include <xmloff/xmlimppr.hxx>
40 #include <TextCursorHelper.hxx>
41 #include <unoframe.hxx>
42 #include <doc.hxx>
45 #include <fmtfsize.hxx>
46 #include <fmtanchr.hxx>
47 #include <fmtcntnt.hxx>
48 #include "xmlimp.hxx"
49 #include "xmltbli.hxx"
50 #include "xmltexti.hxx"
53 #include <SwAppletImpl.hxx>
54 #include <ndole.hxx>
55 #include <docsh.hxx>
56 #include <sfx2/docfile.hxx>
57 #include <vcl/svapp.hxx>
59 #include <svtools/embedhlp.hxx>
60 #include <svl/urihelper.hxx>
61 #include <sfx2/frmdescr.hxx>
62 #include <tools/globname.hxx>
63 #include <tools/UnitConversion.hxx>
64 
65 using namespace ::com::sun::star;
66 using namespace ::com::sun::star::uno;
67 using namespace ::com::sun::star::lang;
68 using namespace ::com::sun::star::text;
69 using namespace ::com::sun::star::frame;
70 using namespace ::com::sun::star::beans;
71 using namespace xml::sax;
72 
73 namespace {
74 
75 struct XMLServiceMapEntry_Impl
76 {
77  const char *sFilterService;
78  sal_Int32 nFilterServiceLen;
79 
80  sal_uInt32 n1;
81  sal_uInt16 n2, n3;
82  sal_uInt8 n4, n5, n6, n7, n8, n9, n10, n11;
83 };
84 
85 }
86 
87 #define SERVICE_MAP_ENTRY( app, s ) \
88  { XML_IMPORT_FILTER_##app, sizeof(XML_IMPORT_FILTER_##app)-1, \
89  SO3_##s##_CLASSID }
90 
91 const XMLServiceMapEntry_Impl aServiceMap[] =
92 {
94  SERVICE_MAP_ENTRY( CALC, SC ),
95  SERVICE_MAP_ENTRY( DRAW, SDRAW ),
96  SERVICE_MAP_ENTRY( IMPRESS, SIMPRESS ),
97  SERVICE_MAP_ENTRY( CHART, SCH ),
98  SERVICE_MAP_ENTRY( MATH, SM ),
99  { nullptr, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
100 };
101 static void lcl_putHeightAndWidth ( SfxItemSet &rItemSet,
102  sal_Int32 nHeight, sal_Int32 nWidth,
103  Size *pTwipSize = nullptr )
104 {
105  if( nWidth > 0 && nHeight > 0 )
106  {
107  nWidth = convertMm100ToTwip( nWidth );
108  if( nWidth < MINFLY )
109  nWidth = MINFLY;
110  nHeight = convertMm100ToTwip( nHeight );
111  if( nHeight < MINFLY )
112  nHeight = MINFLY;
113  rItemSet.Put( SwFormatFrameSize( SwFrameSize::Fixed, nWidth, nHeight ) );
114  }
115 
116  SwFormatAnchor aAnchor( RndStdIds::FLY_AT_CHAR );
117  rItemSet.Put( aAnchor );
118 
119  if( pTwipSize )
120  {
121  pTwipSize->setWidth( nWidth );
122  pTwipSize->setHeight( nHeight);
123  }
124 }
125 
126 static void lcl_setObjectVisualArea( const uno::Reference< embed::XEmbeddedObject >& xObj,
127  sal_Int64 nAspect,
128  const Size& aVisSize,
129  const MapUnit& aUnit )
130 {
131  if( !(xObj.is() && nAspect != embed::Aspects::MSOLE_ICON) )
132  return;
133 
134  // convert the visual area to the objects units
135  MapUnit aObjUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
136  Size aObjVisSize = OutputDevice::LogicToLogic(aVisSize, MapMode(aUnit), MapMode(aObjUnit));
137  awt::Size aSz;
138  aSz.Width = aObjVisSize.Width();
139  aSz.Height = aObjVisSize.Height();
140 
141  try
142  {
143  xObj->setVisualAreaSize( nAspect, aSz );
144  }
145  catch( uno::Exception& )
146  {
147  OSL_FAIL( "Couldn't set visual area of the object!" );
148  }
149 }
150 
152  const uno::Reference < XModel>& rModel,
153  SvXMLImport& rImport,
154  const uno::Reference<XPropertySet> & rInfoSet,
155  bool bInsertM, bool bStylesOnlyM,
156  bool bBlockM, bool bOrganizerM ) :
157  XMLTextImportHelper( rModel, rImport, bInsertM, bStylesOnlyM, true/*bProgress*/,
158  bBlockM, bOrganizerM ),
159  pRedlineHelper( nullptr )
160 {
161  uno::Reference<XPropertySet> xDocPropSet( rModel, UNO_QUERY );
163  bInsertM || bBlockM, xDocPropSet, rInfoSet );
164 }
165 
167 {
168  // the redline helper destructor sets properties on the document
169  // and may throw an exception while doing so... catch this
170  try
171  {
172  delete pRedlineHelper;
173  }
174  catch ( const RuntimeException& )
175  {
176  // ignore
177  }
178 }
179 
181  SvXMLImport& rImport,
182  sal_uInt16 nPrefix, const OUString& rLocalName,
183  const uno::Reference< XAttributeList > & xAttrList )
184 {
185  return new SwXMLTableContext(
186  static_cast<SwXMLImport&>(rImport), nPrefix, rLocalName, xAttrList );
187 }
188 
190 {
191  uno::Reference<XUnoTunnel> xCursorTunnel(
192  const_cast<SwXMLTextImportHelper *>(this)->GetCursor(), UNO_QUERY );
193  assert(xCursorTunnel.is() && "missing XUnoTunnel for Cursor");
194  OTextCursorHelper *pTextCursor = reinterpret_cast< OTextCursorHelper * >(
195  sal::static_int_cast< sal_IntPtr >( xCursorTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() )));
196  SAL_WARN_IF(!pTextCursor, "sw.uno", "SwXTextCursor missing");
197  SwDoc *pDoc = pTextCursor ? pTextCursor->GetDoc() : nullptr;
198 
199  return pDoc && pDoc->IsInHeaderFooter( pTextCursor->GetPaM()->GetPoint()->nNode );
200 }
201 
202 static SwOLENode *lcl_GetOLENode( const SwFrameFormat *pFrameFormat )
203 {
204  SwOLENode *pOLENd = nullptr;
205  if( pFrameFormat )
206  {
207  const SwFormatContent& rContent = pFrameFormat->GetContent();
208  const SwNodeIndex *pNdIdx = rContent.GetContentIdx();
209  pOLENd = pNdIdx->GetNodes()[pNdIdx->GetIndex() + 1]->GetOLENode();
210  }
211  OSL_ENSURE( pOLENd, "Where is the OLE node" );
212  return pOLENd;
213 }
214 
215 uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOLEObject(
216  SvXMLImport& rImport,
217  const OUString& rHRef,
218  const OUString& rStyleName,
219  const OUString& rTableName,
220  sal_Int32 nWidth, sal_Int32 nHeight )
221 {
222  // this method will modify the document directly -> lock SolarMutex
223  SolarMutexGuard aGuard;
224 
225  uno::Reference < XPropertySet > xPropSet;
226 
227  sal_Int32 nPos = rHRef.indexOf( ':' );
228  if( -1 == nPos )
229  return xPropSet;
230 
231  OUString aObjName( rHRef.copy( nPos+1) );
232 
233  if( aObjName.isEmpty() )
234  return xPropSet;
235 
236  uno::Reference<XUnoTunnel> xCursorTunnel( GetCursor(), UNO_QUERY );
237  assert(xCursorTunnel.is() && "missing XUnoTunnel for Cursor");
238  OTextCursorHelper *pTextCursor = reinterpret_cast< OTextCursorHelper * >(
239  sal::static_int_cast< sal_IntPtr >( xCursorTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() )));
240  SAL_WARN_IF(!pTextCursor, "sw.uno", "SwXTextCursor missing");
241  SwDoc *pDoc = SwImport::GetDocFromXMLImport( rImport );
242 
244  RES_FRMATR_END>{} );
245  Size aTwipSize( 0, 0 );
246  tools::Rectangle aVisArea( 0, 0, nWidth, nHeight );
247  lcl_putHeightAndWidth( aItemSet, nHeight, nWidth,
248  &aTwipSize );
249 
250  SwFrameFormat *pFrameFormat = nullptr;
251  SwOLENode *pOLENd = nullptr;
252  if( rHRef.startsWith("vnd.sun.star.ServiceName:") )
253  {
254  bool bInsert = false;
255  SvGlobalName aClassName;
256  const XMLServiceMapEntry_Impl *pEntry = aServiceMap;
257  while( pEntry->sFilterService )
258  {
259  if( aObjName.equalsAsciiL( pEntry->sFilterService,
260  pEntry->nFilterServiceLen ) )
261  {
262  aClassName = SvGlobalName( pEntry->n1, pEntry->n2,
263  pEntry->n3, pEntry->n4,
264  pEntry->n5, pEntry->n6,
265  pEntry->n7, pEntry->n8,
266  pEntry->n9, pEntry->n10,
267  pEntry->n11 );
268  bInsert = true;
269  break;
270  }
271  pEntry++;
272  }
273 
274  if( bInsert )
275  {
276  uno::Reference < embed::XStorage > xStorage = comphelper::OStorageHelper::GetTemporaryStorage();
277  try
278  {
279  // create object with desired ClassId
280  uno::Sequence < sal_Int8 > aClass( aClassName.GetByteSequence() );
281  uno::Reference < embed::XEmbeddedObjectCreator > xFactory = embed::EmbeddedObjectCreator::create( ::comphelper::getProcessComponentContext() );
282  uno::Sequence<beans::PropertyValue> aObjArgs( comphelper::InitPropertySequence({
283  { "DefaultParentBaseURL", Any(GetXMLImport().GetBaseURL()) }
284  }));
285  uno::Reference < embed::XEmbeddedObject > xObj( xFactory->createInstanceInitNew(
286  aClass, OUString(), xStorage, "DummyName", aObjArgs), uno::UNO_QUERY );
287  if ( xObj.is() )
288  {
289  //TODO/LATER: is it enough to only set the VisAreaSize?
290  lcl_setObjectVisualArea( xObj, embed::Aspects::MSOLE_CONTENT, aTwipSize, MapUnit::MapTwip );
291  }
292 
293  if( pTextCursor )
294  {
295  pFrameFormat = pDoc->getIDocumentContentOperations().InsertEmbObject(
296  *pTextCursor->GetPaM(),
297  ::svt::EmbeddedObjectRef(xObj, embed::Aspects::MSOLE_CONTENT),
298  &aItemSet);
299  pOLENd = lcl_GetOLENode( pFrameFormat );
300  }
301 
302  if( pOLENd )
303  aObjName = pOLENd->GetOLEObj().GetCurrentPersistName();
304  }
305  catch ( uno::Exception& )
306  {
307  }
308  }
309  }
310  else
311  {
312  // check whether an object with this name already exists in the document
313  OUString aName;
315  for( SwContentNode* pNd = aIter.First(); pNd; pNd = aIter.Next() )
316  {
317  SwOLENode* pExistingOLENd = pNd->GetOLENode();
318  if( pExistingOLENd )
319  {
320  OUString aExistingName = pExistingOLENd->GetOLEObj().GetCurrentPersistName();
321  if ( aExistingName == aObjName )
322  {
323  OSL_FAIL( "The document contains duplicate object references, means it is partially broken, please let developers know how this document was generated!" );
324 
325  OUString aTmpName = pDoc->GetPersist()->GetEmbeddedObjectContainer().CreateUniqueObjectName();
326  try
327  {
328  pDoc->GetPersist()->GetStorage()->copyElementTo( aObjName,
329  pDoc->GetPersist()->GetStorage(),
330  aTmpName );
331  aName = aTmpName;
332  }
333  catch ( uno::Exception& )
334  {
335  OSL_FAIL( "Couldn't create a copy of the object!" );
336  }
337 
338  break;
339  }
340  }
341  }
342 
343  if ( aName.isEmpty() )
344  aName = aObjName;
345 
346  // the correct aspect will be set later
347  // TODO/LATER: Actually it should be set here
348  if( pTextCursor )
349  {
350  pFrameFormat = pDoc->getIDocumentContentOperations().InsertOLE( *pTextCursor->GetPaM(), aName, embed::Aspects::MSOLE_CONTENT, &aItemSet, nullptr );
351  pOLENd = lcl_GetOLENode( pFrameFormat );
352  }
353  aObjName = aName;
354  }
355 
356  if( !pFrameFormat )
357  return xPropSet;
358 
359  if( IsInsertMode() )
360  {
361  if( !pOLENd )
362  pOLENd = lcl_GetOLENode( pFrameFormat );
363  if( pOLENd )
364  pOLENd->SetOLESizeInvalid( true );
365  }
366 
368  *pDoc, pFrameFormat), uno::UNO_QUERY);
370  {
371  // req for z-order
372  SwXFrame::GetOrCreateSdrObject(*static_cast<SwFlyFrameFormat*>(pFrameFormat));
373  }
374  if( !rTableName.isEmpty() )
375  {
376  const SwFormatContent& rContent = pFrameFormat->GetContent();
377  const SwNodeIndex *pNdIdx = rContent.GetContentIdx();
378  SwOLENode *pOLENode = pNdIdx->GetNodes()[pNdIdx->GetIndex() + 1]->GetOLENode();
379  OSL_ENSURE( pOLENode, "Where is the OLE node" );
380 
381  OUStringBuffer aBuffer( rTableName.getLength() );
382  bool bQuoted = false;
383  bool bEscape = false;
384  bool bError = false;
385  for( sal_Int32 i=0; i < rTableName.getLength(); i++ )
386  {
387  bool bEndOfNameFound = false;
388  sal_Unicode c = rTableName[i];
389  switch( c )
390  {
391  case '\'':
392  if( bEscape )
393  {
394  aBuffer.append( c );
395  bEscape = false;
396  }
397  else if( bQuoted )
398  {
399  bEndOfNameFound = true;
400  }
401  else if( 0 == i )
402  {
403  bQuoted = true;
404  }
405  else
406  {
407  bError = true;
408  }
409  break;
410  case '\\':
411  if( bEscape )
412  {
413  aBuffer.append( c );
414  bEscape = false;
415  }
416  else
417  {
418  bEscape = true;
419  }
420  break;
421  case ' ':
422  case '.':
423  if( !bQuoted )
424  {
425  bEndOfNameFound = true;
426  }
427  else
428  {
429  aBuffer.append( c );
430  bEscape = false;
431  }
432  break;
433  default:
434  {
435  aBuffer.append( c );
436  bEscape = false;
437  }
438  break;
439  }
440  if( bError || bEndOfNameFound )
441  break;
442  }
443  if( !bError )
444  {
445  OUString sTableName( aBuffer.makeStringAndClear() );
446  pOLENode->SetChartTableName( GetRenameMap().Get( XML_TEXT_RENAME_TYPE_TABLE, sTableName ) );
447  }
448  }
449 
450  sal_Int64 nDrawAspect = 0;
451  const XMLPropStyleContext *pStyle = nullptr;
452  bool bHasSizeProps = false;
453  if( !rStyleName.isEmpty() )
454  {
455  pStyle = FindAutoFrameStyle( rStyleName );
456  if( pStyle )
457  {
459  pStyle->GetStyles()
460  ->GetImportPropertyMapper(pStyle->GetFamily());
461  OSL_ENSURE( xImpPrMap.is(), "Where is the import prop mapper?" );
462  if( xImpPrMap.is() )
463  {
465  xImpPrMap->getPropertySetMapper();
466 
467  sal_Int32 nCount = pStyle->GetProperties().size();
468  for( sal_Int32 i=0; i < nCount; i++ )
469  {
470  const XMLPropertyState& rProp = pStyle->GetProperties()[i];
471  sal_Int32 nIdx = rProp.mnIndex;
472  if( -1 == nIdx )
473  continue;
474 
475  switch( rPropMapper->GetEntryContextId(nIdx) )
476  {
478  {
479  sal_Int32 nVal = 0;
480  rProp.maValue >>= nVal;
481  aVisArea.setX( nVal );
482  }
483  break;
485  {
486  sal_Int32 nVal = 0;
487  rProp.maValue >>= nVal;
488  aVisArea.setY( nVal );
489  }
490  break;
492  {
493  sal_Int32 nVal = 0;
494  rProp.maValue >>= nVal;
495  aVisArea.setWidth( nVal );
496  bHasSizeProps = true;
497  }
498  break;
500  {
501  sal_Int32 nVal = 0;
502  rProp.maValue >>= nVal;
503  aVisArea.setHeight( nVal );
504  bHasSizeProps = true;
505  }
506  break;
507  case CTF_OLE_DRAW_ASPECT:
508  {
509  rProp.maValue >>= nDrawAspect;
510 
511  if ( !nDrawAspect )
512  nDrawAspect = embed::Aspects::MSOLE_CONTENT;
513 
514  if ( pOLENd )
515  pOLENd->GetOLEObj().GetObject().SetViewAspect( nDrawAspect );
516  }
517  break;
518  }
519  }
520  }
521  }
522  }
523 
524  if ( bHasSizeProps )
525  {
526  uno::Reference < embed::XEmbeddedObject > xObj =
528  if( xObj.is() )
529  lcl_setObjectVisualArea( xObj, ( nDrawAspect ? nDrawAspect : embed::Aspects::MSOLE_CONTENT ),
530  aVisArea.GetSize(), MapUnit::Map100thMM );
531  }
532 
533  return xPropSet;
534 }
535 
536 uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOOoLink(
537  SvXMLImport& rImport,
538  const OUString& rHRef,
539  const OUString& /*rStyleName*/,
540  const OUString& /*rTableName*/,
541  sal_Int32 nWidth, sal_Int32 nHeight )
542 {
543  // this method will modify the document directly -> lock SolarMutex
544  SolarMutexGuard aGuard;
545 
546  uno::Reference < XPropertySet > xPropSet;
547 
548  uno::Reference<XUnoTunnel> xCursorTunnel( GetCursor(), UNO_QUERY );
549  assert(xCursorTunnel.is() && "missing XUnoTunnel for Cursor");
550  OTextCursorHelper *pTextCursor = reinterpret_cast< OTextCursorHelper * >(
551  sal::static_int_cast< sal_IntPtr >( xCursorTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() )));
552  OSL_ENSURE( pTextCursor, "SwXTextCursor missing" );
553  SwDoc *pDoc = SwImport::GetDocFromXMLImport( rImport );
554 
556  RES_FRMATR_END>{} );
557  Size aTwipSize( 0, 0 );
558  lcl_putHeightAndWidth( aItemSet, nHeight, nWidth,
559  &aTwipSize );
560 
561  // We'll need a (valid) URL. If we don't have do not insert the link and return early.
562  // Copy URL into URL object on the way.
563  INetURLObject aURLObj;
564  bool bValidURL = !rHRef.isEmpty() &&
566  INetURLObject( GetXMLImport().GetBaseURL() ), rHRef ) );
567  if( !bValidURL )
568  return xPropSet;
569 
570  uno::Reference < embed::XStorage > xStorage = comphelper::OStorageHelper::GetTemporaryStorage();
571  try
572  {
573  // create object with desired ClassId
574  uno::Reference < embed::XEmbeddedObjectCreator > xFactory =
575  embed::OOoEmbeddedObjectFactory::create(::comphelper::getProcessComponentContext());
576 
577  uno::Sequence< beans::PropertyValue > aMediaDescriptor( 1 );
578  aMediaDescriptor[0].Name = "URL";
579  aMediaDescriptor[0].Value <<= aURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
580 
581  if (SfxMedium* pMedium = pDoc->GetDocShell() ? pDoc->GetDocShell()->GetMedium() : nullptr)
582  {
583  uno::Reference< task::XInteractionHandler > xInteraction = pMedium->GetInteractionHandler();
584  if ( xInteraction.is() )
585  {
586  aMediaDescriptor.realloc( 2 );
587  aMediaDescriptor[1].Name = "InteractionHandler";
588  aMediaDescriptor[1].Value <<= xInteraction;
589  }
590 
591  const auto nLen = aMediaDescriptor.getLength() + 1;
592  aMediaDescriptor.realloc(nLen);
593  aMediaDescriptor[nLen - 1].Name = "Referer";
594  aMediaDescriptor[nLen - 1].Value <<= pMedium->GetName();
595  }
596 
597  uno::Reference < embed::XEmbeddedObject > xObj(
598  xFactory->createInstanceLink(
599  xStorage, "DummyName", aMediaDescriptor, uno::Sequence< beans::PropertyValue >() ),
600  uno::UNO_QUERY_THROW );
601 
602  {
603  SwFrameFormat *const pFrameFormat =
605  *pTextCursor->GetPaM(),
606  ::svt::EmbeddedObjectRef(xObj, embed::Aspects::MSOLE_CONTENT),
607  &aItemSet );
608 
609  // TODO/LATER: in future may need a way to set replacement image url to the link ( may be even to the object ), needs oasis cws???
610 
612  *pDoc, pFrameFormat), uno::UNO_QUERY);
614  {
616  static_cast<SwFlyFrameFormat*>(pFrameFormat)); // req for z-order
617  }
618  }
619  }
620  catch ( uno::Exception& )
621  {
622  }
623 
624  // TODO/LATER: should the rStyleName and rTableName be handled as for usual embedded object?
625 
626  return xPropSet;
627 }
628 
629 uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertApplet(
630  const OUString &rName,
631  const OUString &rCode,
632  bool bMayScript,
633  const OUString& rHRef,
634  sal_Int32 nWidth, sal_Int32 nHeight )
635 {
636  // this method will modify the document directly -> lock SolarMutex
637  SolarMutexGuard aGuard;
638 
639  uno::Reference < XPropertySet > xPropSet;
640  uno::Reference<XUnoTunnel> xCursorTunnel( GetCursor(), UNO_QUERY );
641  assert(xCursorTunnel.is() && "missing XUnoTunnel for Cursor");
642  OTextCursorHelper *pTextCursor = reinterpret_cast< OTextCursorHelper * >(
643  sal::static_int_cast< sal_IntPtr >( xCursorTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() )));
644  OSL_ENSURE( pTextCursor, "SwXTextCursor missing" );
645  SwDoc *pDoc = pTextCursor->GetDoc();
646 
648  RES_FRMATR_END>{} );
649  lcl_putHeightAndWidth( aItemSet, nHeight, nWidth);
650 
651  SwApplet_Impl aAppletImpl ( aItemSet );
652 
653  OUString sCodeBase;
654  if( !rHRef.isEmpty() )
655  sCodeBase = GetXMLImport().GetAbsoluteReference( rHRef );
656 
657  aAppletImpl.CreateApplet ( rCode, rName, bMayScript, sCodeBase, GetXMLImport().GetDocumentBase() );
658 
659  // set the size of the applet
660  lcl_setObjectVisualArea( aAppletImpl.GetApplet(),
661  embed::Aspects::MSOLE_CONTENT,
662  Size( nWidth, nHeight ),
663  MapUnit::Map100thMM );
664 
665  SwFrameFormat *const pFrameFormat =
666  pDoc->getIDocumentContentOperations().InsertEmbObject( *pTextCursor->GetPaM(),
667  ::svt::EmbeddedObjectRef(aAppletImpl.GetApplet(), embed::Aspects::MSOLE_CONTENT),
668  &aAppletImpl.GetItemSet());
670  *pDoc, pFrameFormat), uno::UNO_QUERY);
672  {
673  // req for z-order
674  SwXFrame::GetOrCreateSdrObject(*static_cast<SwFlyFrameFormat*>(pFrameFormat));
675  }
676 
677  return xPropSet;
678 }
679 
680 uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertPlugin(
681  const OUString &rMimeType,
682  const OUString& rHRef,
683  sal_Int32 nWidth, sal_Int32 nHeight )
684 {
685  uno::Reference < XPropertySet > xPropSet;
686  uno::Reference<XUnoTunnel> xCursorTunnel( GetCursor(), UNO_QUERY );
687  assert(xCursorTunnel.is() && "missing XUnoTunnel for Cursor");
688  OTextCursorHelper *pTextCursor = reinterpret_cast< OTextCursorHelper * >(
689  sal::static_int_cast< sal_IntPtr >( xCursorTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() )));
690  OSL_ENSURE( pTextCursor, "SwXTextCursor missing" );
691  SwDoc *pDoc = pTextCursor->GetDoc();
692 
694  RES_FRMATR_END>{} );
695  lcl_putHeightAndWidth( aItemSet, nHeight, nWidth);
696 
697  // We'll need a (valid) URL, or we need a MIME type. If we don't have
698  // either, do not insert plugin and return early. Copy URL into URL object
699  // on the way.
700  INetURLObject aURLObj;
701 
702  bool bValidURL = !rHRef.isEmpty() &&
703  aURLObj.SetURL( URIHelper::SmartRel2Abs( INetURLObject( GetXMLImport().GetBaseURL() ), rHRef ) );
704  bool bValidMimeType = !rMimeType.isEmpty();
705  if( !bValidURL && !bValidMimeType )
706  return xPropSet;
707 
708  uno::Reference < embed::XStorage > xStorage = comphelper::OStorageHelper::GetTemporaryStorage();
709  try
710  {
711  // create object with desired ClassId
712  uno::Sequence < sal_Int8 > aClass( SvGlobalName( SO3_PLUGIN_CLASSID ).GetByteSequence() );
713  uno::Reference < embed::XEmbeddedObjectCreator > xFactory = embed::EmbeddedObjectCreator::create( ::comphelper::getProcessComponentContext() );
714  uno::Reference < embed::XEmbeddedObject > xObj( xFactory->createInstanceInitNew(
715  aClass, OUString(), xStorage, "DummyName",
716  uno::Sequence < beans::PropertyValue >() ), uno::UNO_QUERY );
717 
718  // set size to the object
720  embed::Aspects::MSOLE_CONTENT,
721  Size( nWidth, nHeight ),
722  MapUnit::Map100thMM );
723 
725  {
726  uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY );
727  if ( xSet.is() )
728  {
729  if( bValidURL )
730  xSet->setPropertyValue("PluginURL",
732  if( bValidMimeType )
733  xSet->setPropertyValue("PluginMimeType",
734  makeAny( rMimeType ) );
735  }
736 
737  SwFrameFormat *const pFrameFormat =
739  *pTextCursor->GetPaM(),
740  ::svt::EmbeddedObjectRef(xObj, embed::Aspects::MSOLE_CONTENT),
741  &aItemSet);
743  *pDoc, pFrameFormat), uno::UNO_QUERY);
745  {
747  static_cast<SwFlyFrameFormat*>(pFrameFormat)); // req for z-order
748  }
749  }
750  }
751  catch ( uno::Exception& )
752  {
753  }
754 
755  return xPropSet;
756 }
758  const OUString& rName,
759  const OUString& rHRef,
760  const OUString& rStyleName,
761  sal_Int32 nWidth, sal_Int32 nHeight )
762 {
763  // this method will modify the document directly -> lock SolarMutex
764  SolarMutexGuard aGuard;
765 
766  uno::Reference < XPropertySet > xPropSet;
767  uno::Reference<XUnoTunnel> xCursorTunnel( GetCursor(), UNO_QUERY );
768  assert(xCursorTunnel.is() && "missing XUnoTunnel for Cursor");
769  OTextCursorHelper *pTextCursor = reinterpret_cast< OTextCursorHelper * >(
770  sal::static_int_cast< sal_IntPtr >( xCursorTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() )));
771  OSL_ENSURE( pTextCursor, "SwXTextCursor missing" );
772  SwDoc *pDoc = pTextCursor->GetDoc();
773 
775  RES_FRMATR_END>{} );
776  lcl_putHeightAndWidth( aItemSet, nHeight, nWidth);
777 
778  ScrollingMode eScrollMode = ScrollingMode::Auto;
779  bool bHasBorder = false;
780  bool bIsBorderSet = false;
781  Size aMargin( SIZE_NOT_SET, SIZE_NOT_SET );
782  const XMLPropStyleContext *pStyle = nullptr;
783  if( !rStyleName.isEmpty() )
784  {
785  pStyle = FindAutoFrameStyle( rStyleName );
786  if( pStyle )
787  {
789  pStyle->GetStyles()
790  ->GetImportPropertyMapper(pStyle->GetFamily());
791  OSL_ENSURE( xImpPrMap.is(), "Where is the import prop mapper?" );
792  if( xImpPrMap.is() )
793  {
795  xImpPrMap->getPropertySetMapper();
796 
797  sal_Int32 nCount = pStyle->GetProperties().size();
798  for( sal_Int32 i=0; i < nCount; i++ )
799  {
800  const XMLPropertyState& rProp = pStyle->GetProperties()[i];
801  sal_Int32 nIdx = rProp.mnIndex;
802  if( -1 == nIdx )
803  continue;
804 
805  switch( rPropMapper->GetEntryContextId(nIdx) )
806  {
808  {
809  bool bYes = *o3tl::doAccess<bool>(rProp.maValue);
810  eScrollMode = bYes ? ScrollingMode::Yes : ScrollingMode::No;
811  }
812  break;
814  {
815  bHasBorder = *o3tl::doAccess<bool>(rProp.maValue);
816  bIsBorderSet = true;
817  }
818  break;
820  {
821  sal_Int32 nVal = SIZE_NOT_SET;
822  rProp.maValue >>= nVal;
823  aMargin.setWidth( nVal );
824  }
825  break;
827  {
828  sal_Int32 nVal = SIZE_NOT_SET;
829  rProp.maValue >>= nVal;
830  aMargin.setHeight( nVal );
831  }
832  break;
833  }
834  }
835  }
836  }
837  }
838 
839  uno::Reference < embed::XStorage > xStorage = comphelper::OStorageHelper::GetTemporaryStorage();
840  try
841  {
842  // create object with desired ClassId
843  uno::Sequence < sal_Int8 > aClass( SvGlobalName( SO3_IFRAME_CLASSID ).GetByteSequence() );
844  uno::Reference < embed::XEmbeddedObjectCreator > xFactory = embed::EmbeddedObjectCreator::create( ::comphelper::getProcessComponentContext() );
845  uno::Reference < embed::XEmbeddedObject > xObj( xFactory->createInstanceInitNew(
846  aClass, OUString(), xStorage, "DummyName",
847  uno::Sequence < beans::PropertyValue >() ), uno::UNO_QUERY );
848 
849  // set size to the object
851  embed::Aspects::MSOLE_CONTENT,
852  Size( nWidth, nHeight ),
853  MapUnit::Map100thMM );
854 
856  {
857  uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY );
858  if ( xSet.is() )
859  {
860  xSet->setPropertyValue("FrameURL",
862  INetURLObject( GetXMLImport().GetBaseURL() ), rHRef ) ) );
863 
864  xSet->setPropertyValue("FrameName",
865  makeAny( rName ) );
866 
867  if ( eScrollMode == ScrollingMode::Auto )
868  xSet->setPropertyValue("FrameIsAutoScroll",
869  makeAny( true ) );
870  else
871  xSet->setPropertyValue("FrameIsScrollingMode",
872  makeAny( eScrollMode == ScrollingMode::Yes ) );
873 
874  if ( bIsBorderSet )
875  xSet->setPropertyValue("FrameIsBorder",
876  makeAny( bHasBorder ) );
877  else
878  xSet->setPropertyValue("FrameIsAutoBorder",
879  makeAny( true ) );
880 
881  xSet->setPropertyValue("FrameMarginWidth",
882  makeAny( sal_Int32( aMargin.Width() ) ) );
883 
884  xSet->setPropertyValue("FrameMarginHeight",
885  makeAny( sal_Int32( aMargin.Height() ) ) );
886  }
887 
888  SwFrameFormat *const pFrameFormat =
890  *pTextCursor->GetPaM(),
891  ::svt::EmbeddedObjectRef(xObj, embed::Aspects::MSOLE_CONTENT),
892  &aItemSet);
894  *pDoc, pFrameFormat), uno::UNO_QUERY);
896  {
897  // req for z-order
899  static_cast<SwFlyFrameFormat*>(pFrameFormat));
900  }
901  }
902  }
903  catch ( uno::Exception& )
904  {
905  }
906 
907  return xPropSet;
908 }
909 
911  const uno::Reference < XPropertySet > &rPropSet,
912  std::map < const OUString, OUString > &rParamMap)
913 {
914  // this method will modify the document directly -> lock SolarMutex
915  SolarMutexGuard aGuard;
916 
917  uno::Reference<XUnoTunnel> xCursorTunnel( rPropSet, UNO_QUERY );
918  assert(xCursorTunnel.is() && "missing XUnoTunnel for embedded");
919  SwXFrame *pFrame = reinterpret_cast< SwXFrame * >(
920  sal::static_int_cast< sal_IntPtr >( xCursorTunnel->getSomething( SwXFrame::getUnoTunnelId() )));
921  OSL_ENSURE( pFrame, "SwXFrame missing" );
922  SwFrameFormat *pFrameFormat = pFrame->GetFrameFormat();
923  const SwFormatContent& rContent = pFrameFormat->GetContent();
924  const SwNodeIndex *pNdIdx = rContent.GetContentIdx();
925  SwOLENode *pOLENd = pNdIdx->GetNodes()[pNdIdx->GetIndex() + 1]->GetNoTextNode()->GetOLENode();
926  SwOLEObj& rOLEObj = pOLENd->GetOLEObj();
927 
928  uno::Reference < embed::XEmbeddedObject > xEmbObj( rOLEObj.GetOleRef() );
929  if ( !svt::EmbeddedObjectRef::TryRunningState( xEmbObj ) )
930  return;
931 
932  uno::Reference < beans::XPropertySet > xSet( xEmbObj->getComponent(), uno::UNO_QUERY );
933  if ( !xSet.is() )
934  return;
935 
936  const sal_Int32 nCount = rParamMap.size();
937  uno::Sequence< beans::PropertyValue > aCommandSequence( nCount );
938 
939  sal_Int32 nIndex=0;
940  for (const auto& rParam : rParamMap )
941  {
942  aCommandSequence[nIndex].Name = rParam.first;
943  aCommandSequence[nIndex].Handle = -1;
944  aCommandSequence[nIndex].Value <<= rParam.second;
945  aCommandSequence[nIndex].State = beans::PropertyState_DIRECT_VALUE;
946  ++nIndex;
947  }
948 
949  // unfortunately the names of the properties are depending on the object
950  OUString aParaName("AppletCommands");
951  try
952  {
953  xSet->setPropertyValue( aParaName, makeAny( aCommandSequence ) );
954  }
955  catch ( uno::Exception& )
956  {
957  aParaName = "PluginCommands";
958  try
959  {
960  xSet->setPropertyValue( aParaName, makeAny( aCommandSequence ) );
961  }
962  catch ( uno::Exception& )
963  {
964  }
965  }
966 }
967 
968 // redlining helper methods
969 // (override to provide the real implementation)
971  const OUString& rType,
972  const OUString& rId,
973  const OUString& rAuthor,
974  const OUString& rComment,
975  const util::DateTime& rDateTime,
976  bool bMergeLastPara)
977 {
978  // create redline helper on demand
979  OSL_ENSURE(nullptr != pRedlineHelper, "helper should have been created in constructor");
980  if (nullptr != pRedlineHelper)
981  pRedlineHelper->Add(rType, rId, rAuthor, rComment, rDateTime,
982  bMergeLastPara);
983 }
984 
985 uno::Reference<XTextCursor> SwXMLTextImportHelper::RedlineCreateText(
986  uno::Reference<XTextCursor> & rOldCursor,
987  const OUString& rId)
988 {
989  uno::Reference<XTextCursor> xRet;
990 
991  if (nullptr != pRedlineHelper)
992  {
993  xRet = pRedlineHelper->CreateRedlineTextSection(rOldCursor, rId);
994  }
995 
996  return xRet;
997 }
998 
1000  const OUString& rId,
1001  bool bStart,
1002  bool bIsOutsideOfParagraph)
1003 {
1004  if (nullptr != pRedlineHelper) {
1005  uno::Reference<XTextRange> xTextRange( GetCursor()->getStart() );
1006  pRedlineHelper->SetCursor(rId, bStart, xTextRange,
1007  bIsOutsideOfParagraph);
1008  }
1009  // else: ignore redline (wasn't added before, else we'd have a helper)
1010 }
1011 
1013 {
1014  OUString rId = GetOpenRedlineId();
1015  if ((nullptr != pRedlineHelper) && !rId.isEmpty())
1016  {
1019  }
1020  // else: ignore redline (wasn't added before, or no open redline ID
1021 }
1022 
1023 void SwXMLTextImportHelper::SetShowChanges( bool bShowChanges )
1024 {
1025  if ( nullptr != pRedlineHelper )
1026  pRedlineHelper->SetShowChanges( bShowChanges );
1027 }
1028 
1029 void SwXMLTextImportHelper::SetRecordChanges( bool bRecordChanges )
1030 {
1031  if ( nullptr != pRedlineHelper )
1032  pRedlineHelper->SetRecordChanges( bRecordChanges );
1033 }
1034 
1036  const Sequence<sal_Int8> & rKey )
1037 {
1038  if ( nullptr != pRedlineHelper )
1040 }
1041 
1042 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
long Width() const
const css::uno::Reference< css::embed::XEmbeddedObject > & GetApplet() const
XmlStyleFamily GetFamily() const
#define SERVICE_MAP_ENTRY(app, s)
Definition: xmltexti.cxx:87
sal_Int32 nIndex
void setHeight(long n)
virtual css::uno::Reference< css::text::XTextCursor > RedlineCreateText(css::uno::Reference< css::text::XTextCursor > &rOldCursor, const OUString &rId) override
merge last paragraph
Definition: xmltexti.cxx:985
css::uno::Reference< css::text::XTextCursor > & GetCursor()
virtual void SetRecordChanges(bool bRecordChanges) override
Definition: xmltexti.cxx:1029
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
Definition: ndole.hxx:161
const SwOLEObj & GetOLEObj() const
Definition: ndole.hxx:112
SwDocShell * GetDocShell()
Definition: doc.hxx:1348
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
long Height() const
int n1
const ::std::vector< XMLPropertyState > & GetProperties() const
#define SO3_IFRAME_CLASSID
#define MINFLY
Definition: swtypes.hxx:65
virtual void RedlineSetCursor(const OUString &rId, bool bStart, bool bIsOutsideOfParagraph) override
ID used to RedlineAdd() call.
Definition: xmltexti.cxx:999
#define CTF_FRAME_MARGIN_HORI
css::uno::Reference< css::embed::XEmbeddedObject > const & GetOleRef()
Definition: ndole.cxx:913
Definition: doc.hxx:184
#define CTF_OLE_VIS_AREA_TOP
sal_Int32 mnIndex
css::uno::Sequence< sal_Int8 > GetByteSequence() const
#define CTF_OLE_VIS_AREA_WIDTH
#define CTF_OLE_VIS_AREA_LEFT
SfxItemSet & GetItemSet()
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:31
#define CTF_FRAME_DISPLAY_SCROLLBAR
SvI18NMap & GetRenameMap()
CALC
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:315
bool IsInHeaderFooter(const SwNodeIndex &rIdx) const
Definition: doclay.cxx:1550
virtual css::uno::Reference< css::beans::XPropertySet > createAndInsertOOoLink(SvXMLImport &rImport, const OUString &rHRef, const OUString &rStyleName, const OUString &rTableName, sal_Int32 nWidth, sal_Int32 nHeight) override
Definition: xmltexti.cxx:536
virtual css::uno::Reference< css::beans::XPropertySet > createAndInsertFloatingFrame(const OUString &rName, const OUString &rHRef, const OUString &rStyleName, sal_Int32 nWidth, sal_Int32 nHeight) override
Definition: xmltexti.cxx:757
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:155
css::uno::Reference< css::embed::XStorage > const & GetStorage()
void SetRecordChanges(bool bRecordChanges)
sal_uInt16 sal_Unicode
int n2
ScrollingMode
virtual void RedlineAdd(const OUString &rType, const OUString &rId, const OUString &rAuthor, const OUString &rComment, const css::util::DateTime &rDateTime, bool bMergeLastPara) override
Definition: xmltexti.cxx:970
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
void SetProtectionKey(const css::uno::Sequence< sal_Int8 > &rKey)
DRAW
void SetShowChanges(bool bShowChanges)
svt::EmbeddedObjectRef & GetObject()
Definition: ndole.cxx:965
virtual css::uno::Reference< css::beans::XPropertySet > createAndInsertApplet(const OUString &rName, const OUString &rCode, bool bMayScript, const OUString &rHRef, sal_Int32 nWidth, sal_Int32 nHeight) override
Definition: xmltexti.cxx:629
int nCount
sal_uLong GetIndex() const
Definition: ndindex.hxx:152
void CreateApplet(const OUString &rCode, const OUString &rName, bool bMayScript, const OUString &rCodeBase, const OUString &rBaseURL)
virtual SvXMLImportContext * CreateTableChildContext(SvXMLImport &rImport, sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
Definition: xmltexti.cxx:180
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
const SvXMLStylesContext * GetStyles() const
virtual SwFlyFrameFormat * InsertOLE(const SwPaM &rRg, const OUString &rObjName, sal_Int64 nAspect, const SfxItemSet *pFlyAttrSet, const SfxItemSet *pGrfAttrSet)=0
const XMLServiceMapEntry_Impl aServiceMap[]
Definition: xmltexti.cxx:91
const OUString & GetCurrentPersistName() const
Definition: ndole.hxx:69
css::uno::Reference< css::text::XTextCursor > CreateRedlineTextSection(css::uno::Reference< css::text::XTextCursor > const &xOldCursor, const OUString &rId)
void setWidth(long n)
virtual css::uno::Reference< css::beans::XPropertySet > createAndInsertPlugin(const OUString &rMimeType, const OUString &rHRef, sal_Int32 nWidth, sal_Int32 nHeight) override
Definition: xmltexti.cxx:680
virtual void SetShowChanges(bool bShowChanges) override
Definition: xmltexti.cxx:1023
#define XML_TEXT_RENAME_TYPE_TABLE
WRITER
virtual css::uno::Reference< css::beans::XPropertySet > createAndInsertOLEObject(SvXMLImport &rImport, const OUString &rHRef, const OUString &rStyleName, const OUString &rTableName, sal_Int32 nWidth, sal_Int32 nHeight) override
Definition: xmltexti.cxx:215
static css::uno::Reference< css::embed::XStorage > GetTemporaryStorage(const css::uno::Reference< css::uno::XComponentContext > &rxContext=css::uno::Reference< css::uno::XComponentContext >())
virtual rtl::Reference< SvXMLImportPropertyMapper > GetImportPropertyMapper(XmlStyleFamily nFamily) const
Style of a layout element.
Definition: frmfmt.hxx:57
int i
SvXMLImport & GetXMLImport()
void setY(long y)
MATH
FlyAnchors.
Definition: fmtanchr.hxx:34
virtual void endAppletOrPlugin(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, std::map< const OUString, OUString > &rParamMap) override
Definition: xmltexti.cxx:910
static SdrObject * GetOrCreateSdrObject(SwFlyFrameFormat &rFormat)
Definition: unoframe.cxx:1358
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
SwXMLTextImportHelper(const css::uno::Reference< css::frame::XModel > &rModel, SvXMLImport &rImport, const css::uno::Reference< css::beans::XPropertySet > &rInfoSet, bool bInsertM, bool bStylesOnlyM, bool bBlockM, bool bOrganizerM)
Definition: xmltexti.cxx:151
virtual bool IsInHeaderFooter() const override
Definition: xmltexti.cxx:189
Marks a node in the document model.
Definition: ndindex.hxx:31
virtual ~SwXMLTextImportHelper() override
Definition: xmltexti.cxx:166
bool IsInsertMode() const
#define CTF_FRAME_DISPLAY_BORDER
static SwOLENode * lcl_GetOLENode(const SwFrameFormat *pFrameFormat)
Definition: xmltexti.cxx:202
static void lcl_setObjectVisualArea(const uno::Reference< embed::XEmbeddedObject > &xObj, sal_Int64 nAspect, const Size &aVisSize, const MapUnit &aUnit)
Definition: xmltexti.cxx:126
#define CTF_FRAME_MARGIN_VERT
Frame cannot be moved in Var-direction.
#define CTF_OLE_DRAW_ASPECT
Size GetSize() const
virtual SwFlyFrameFormat * InsertEmbObject(const SwPaM &rRg, const svt::EmbeddedObjectRef &xObj, SfxItemSet *pFlyAttrSet)=0
Insert OLE-objects.
virtual void SetChangesProtectionKey(const css::uno::Sequence< sal_Int8 > &rKey) override
Definition: xmltexti.cxx:1035
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
void SetCursor(const OUString &rId, bool bStart, css::uno::Reference< css::text::XTextRange > const &rRange, bool bIsOutsideOfParagraph)
css::uno::Reference< css::embed::XEmbeddedObject > GetEmbeddedObject(const OUString &, OUString const *pBaseURL=nullptr)
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
void SetChartTableName(const OUString &rNm)
Definition: ndole.hxx:153
void AdjustStartNodeCursor(const OUString &rId)
Adjust the start (end) position for a redline that begins in a start node.
constexpr sal_uInt16 RES_FRMATR_END(131)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
comphelper::EmbeddedObjectContainer & GetEmbeddedObjectContainer() const
std::unique_ptr< char[]> aBuffer
void SetViewAspect(sal_Int64 nAspect)
css::uno::Any maValue
static void lcl_putHeightAndWidth(SfxItemSet &rItemSet, sal_Int32 nHeight, sal_Int32 nWidth, Size *pTwipSize=nullptr)
Definition: xmltexti.cxx:101
#define CTF_OLE_VIS_AREA_HEIGHT
OUString GetAbsoluteReference(const OUString &rValue) const
static MapUnit UnoEmbed2VCLMapUnit(sal_Int32 nUnoEmbedMapUnit)
#define SAL_WARN_IF(condition, area, stream)
unsigned char sal_uInt8
const SwNodes & GetNodes() const
Definition: ndindex.hxx:156
void Add(const OUString &rType, const OUString &rId, const OUString &rAuthor, const OUString &rComment, const css::util::DateTime &rDateTime, bool bMergeLastParagraph)
XMLPropStyleContext * FindAutoFrameStyle(const OUString &rName) const
OUString aName
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
SfxObjectShell * GetPersist() const
Definition: docnew.cxx:637
Reference< XComponentContext > getProcessComponentContext()
IMPRESS
constexpr sal_Int64 convertMm100ToTwip(sal_Int64 n)
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
void SetOLESizeInvalid(bool b)
Definition: ndole.hxx:134
virtual void RedlineAdjustStartNodeCursor() override
Definition: xmltexti.cxx:1012
MapUnit
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unoframe.cxx:1168
Reference< XSingleServiceFactory > xFactory
bool SetURL(OUString const &rTheAbsURIRef, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
static bool TryRunningState(const css::uno::Reference< css::embed::XEmbeddedObject > &)
static css::uno::Reference< css::text::XTextContent > CreateXTextEmbeddedObject(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3486
void setX(long x)
SwDoc * GetDocFromXMLImport(SvXMLImport const &)
Definition: xmlimp.cxx:1721
const SwGrfFormatColl * GetDfltGrfFormatColl() const
Definition: doc.hxx:801
void setWidth(long nWidth)
#define SO3_PLUGIN_CLASSID
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
#define SIZE_NOT_SET
sal_uInt16 nPos
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1315
XMLRedlineImportHelper * pRedlineHelper
Definition: xmltexti.hxx:29
OUString const & GetOpenRedlineId() const
SVL_DLLPUBLIC OUString SmartRel2Abs(INetURLObject const &rTheBaseURIRef, OUString const &rTheRelURIRef, Link< OUString *, bool > const &rMaybeFileHdl=Link< OUString *, bool >(), bool bCheckFileExists=true, bool bIgnoreFragment=false, INetURLObject::EncodeMechanism eEncodeMechanism=INetURLObject::EncodeMechanism::WasEncoded, INetURLObject::DecodeMechanism eDecodeMechanism=INetURLObject::DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, FSysStyle eStyle=FSysStyle::Detect)
void setHeight(long nHeight)
SfxMedium * GetMedium() const
css::uno::Any SAL_CALL makeAny(const SharedUNOComponent< INTERFACE, COMPONENT > &value)