LibreOffice Module xmloff (master)  1
ximppage.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 <sal/config.h>
21 
22 #include <com/sun/star/frame/XModel.hpp>
23 #include <com/sun/star/geometry/RealPoint2D.hpp>
24 #include <com/sun/star/text/XTextCursor.hpp>
25 #include <com/sun/star/util/DateTime.hpp>
26 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
27 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
28 #include <cppuhelper/implbase.hxx>
29 #include <sax/tools/converter.hxx>
31 #include <xmloff/xmlstyle.hxx>
32 #include <xmloff/xmltoken.hxx>
33 #include <xmloff/xmlnamespace.hxx>
34 #include "ximppage.hxx"
35 #include <animimp.hxx>
37 #include <xmloff/xmlictxt.hxx>
38 #include "ximpstyl.hxx"
39 #include <xmloff/prstylei.hxx>
40 #include <PropertySetMerger.hxx>
41 #include <sal/log.hxx>
42 #include <tools/diagnose_ex.h>
43 
45 #include <xmloff/xmluconv.hxx>
46 
47 using namespace ::com::sun::star;
48 using namespace ::xmloff::token;
49 using namespace ::com::sun::star::uno;
50 using namespace ::com::sun::star::lang;
51 using namespace ::com::sun::star::text;
52 using namespace ::com::sun::star::util;
53 using namespace ::com::sun::star::beans;
54 using namespace ::com::sun::star::drawing;
55 using namespace ::com::sun::star::container;
56 using namespace ::com::sun::star::office;
57 using namespace ::com::sun::star::xml::sax;
58 using namespace ::com::sun::star::geometry;
59 
60 namespace {
61 
62 class DrawAnnotationContext : public SvXMLImportContext
63 {
64 
65 public:
66  DrawAnnotationContext( SvXMLImport& rImport, const Reference< xml::sax::XFastAttributeList>& xAttrList, const Reference< XAnnotationAccess >& xAnnotationAccess );
67 
68  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
69  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
70  virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList ) override;
71  virtual void SAL_CALL startFastElement( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
72  virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
73 
74 private:
75  Reference< XAnnotation > mxAnnotation;
76  Reference< XTextCursor > mxCursor;
77 
78  OUStringBuffer maAuthorBuffer;
79  OUStringBuffer maInitialsBuffer;
80  OUStringBuffer maDateBuffer;
81 };
82 
83 }
84 
85 DrawAnnotationContext::DrawAnnotationContext( SvXMLImport& rImport, const Reference< xml::sax::XFastAttributeList>& xAttrList, const Reference< XAnnotationAccess >& xAnnotationAccess )
86 : SvXMLImportContext( rImport )
87 , mxAnnotation( xAnnotationAccess->createAndInsertAnnotation() )
88 {
89  if( !mxAnnotation.is() )
90  return;
91 
92  RealPoint2D aPosition;
93  RealSize2D aSize;
94 
95  for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
96  {
97  OUString sValue = aIter.toString();
98 
99  switch( aIter.getToken() )
100  {
101  case XML_ELEMENT(SVG, XML_X):
102  case XML_ELEMENT(SVG_COMPAT, XML_X):
103  {
104  sal_Int32 x;
106  x, sValue);
107  aPosition.X = static_cast<double>(x) / 100.0;
108  break;
109  }
110  case XML_ELEMENT(SVG, XML_Y):
111  case XML_ELEMENT(SVG_COMPAT, XML_Y):
112  {
113  sal_Int32 y;
115  y, sValue);
116  aPosition.Y = static_cast<double>(y) / 100.0;
117  break;
118  }
119  case XML_ELEMENT(SVG, XML_WIDTH):
120  case XML_ELEMENT(SVG_COMPAT, XML_WIDTH):
121  {
122  sal_Int32 w;
124  w, sValue);
125  aSize.Width = static_cast<double>(w) / 100.0;
126  break;
127  }
128  case XML_ELEMENT(SVG, XML_HEIGHT):
129  case XML_ELEMENT(SVG_COMPAT, XML_HEIGHT):
130  {
131  sal_Int32 h;
133  h, sValue);
134  aSize.Height = static_cast<double>(h) / 100.0;
135  }
136  break;
137  default:
138  SAL_WARN("xmloff", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << sValue); }
139  }
140 
141  mxAnnotation->setPosition( aPosition );
142  mxAnnotation->setSize( aSize );
143 }
144 
145 css::uno::Reference< css::xml::sax::XFastContextHandler > DrawAnnotationContext::createFastChildContext(
146  sal_Int32 nElement,
147  const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/ )
148 {
149  if( mxAnnotation.is() )
150  {
151  if (IsTokenInNamespace(nElement, XML_NAMESPACE_DC))
152  {
153  if( (nElement & TOKEN_MASK) == XML_CREATOR )
154  return new XMLStringBufferImportContext(GetImport(), maAuthorBuffer);
155  else if( (nElement & TOKEN_MASK) == XML_DATE )
156  return new XMLStringBufferImportContext(GetImport(), maDateBuffer);
157  }
158  else if ( nElement == XML_ELEMENT(TEXT, XML_SENDER_INITIALS)
159  || nElement == XML_ELEMENT(LO_EXT, XML_SENDER_INITIALS)
160  || nElement == XML_ELEMENT(META, XML_CREATOR_INITIALS))
161  {
162  return new XMLStringBufferImportContext(GetImport(), maInitialsBuffer);
163  }
164  }
165  return nullptr;
166 }
167 
168 SvXMLImportContextRef DrawAnnotationContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList )
169 {
170  SvXMLImportContextRef xContext;
171 
172  if( mxAnnotation.is() )
173  {
174  if( XML_NAMESPACE_DC == nPrefix )
175  {
176  // handled in createFastChildContext
177  }
178  else if (((XML_NAMESPACE_TEXT == nPrefix || XML_NAMESPACE_LO_EXT == nPrefix)
179  && IsXMLToken(rLocalName, XML_SENDER_INITIALS))
180  || (XML_NAMESPACE_META == nPrefix
181  && IsXMLToken(rLocalName, XML_CREATOR_INITIALS)))
182  {
183  // handled in createFastChildContext
184  }
185  else
186  {
187  // create text cursor on demand
188  if( !mxCursor.is() )
189  {
190  uno::Reference< text::XText > xText( mxAnnotation->getTextRange() );
191  if( xText.is() )
192  {
193  rtl::Reference < XMLTextImportHelper > xTxtImport = GetImport().GetTextImport();
194  mxCursor = xText->createTextCursor();
195  if( mxCursor.is() )
196  xTxtImport->SetCursor( mxCursor );
197  }
198  }
199 
200  // if we have a text cursor, lets try to import some text
201  if( mxCursor.is() )
202  {
203  xContext = GetImport().GetTextImport()->CreateTextChildContext( GetImport(), nPrefix, rLocalName, xAttrList );
204  }
205  }
206  }
207 
208  return xContext;
209 }
210 
211 void DrawAnnotationContext::startFastElement( sal_Int32 /*nElement*/,
212  const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/ )
213 {
214 }
215 
216 void DrawAnnotationContext::endFastElement(sal_Int32)
217 {
218  if(mxCursor.is())
219  {
220  // delete addition newline
221  mxCursor->gotoEnd( false );
222  mxCursor->goLeft( 1, true );
223  mxCursor->setString( "" );
224 
225  // reset cursor
226  GetImport().GetTextImport()->ResetCursor();
227  }
228 
229  if( mxAnnotation.is() )
230  {
231  mxAnnotation->setAuthor( maAuthorBuffer.makeStringAndClear() );
232  mxAnnotation->setInitials( maInitialsBuffer.makeStringAndClear() );
233 
234  util::DateTime aDateTime;
235  if (::sax::Converter::parseDateTime(aDateTime,
236  maDateBuffer.makeStringAndClear()))
237  {
238  mxAnnotation->setDateTime(aDateTime);
239  }
240  }
241 }
242 
243 
245  SvXMLImport& rImport,
246  const Reference< xml::sax::XFastAttributeList>& xAttrList,
247  Reference< drawing::XShapes > const & rShapes)
248 : SvXMLImportContext( rImport )
249 , mxShapes( rShapes )
250 , mxAnnotationAccess( rShapes, UNO_QUERY )
251 {
252  for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
253  {
254  if( aIter.getToken() == XML_ELEMENT(DRAW, XML_NAV_ORDER) )
255  {
256  msNavOrder = aIter.toString();
257  break;
258  }
259  }
260 }
261 
263 {
264 }
265 
266 void SdXMLGenericPageContext::startFastElement( sal_Int32 /*nElement*/, const Reference< css::xml::sax::XFastAttributeList >& )
267 {
268  GetImport().GetShapeImport()->pushGroupForPostProcessing( mxShapes );
269 
270  if( GetImport().IsFormsSupported() )
271  GetImport().GetFormImport()->startPage( Reference< drawing::XDrawPage >::query( mxShapes ) );
272 }
273 
274 css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLGenericPageContext::createFastChildContext(
275  sal_Int32 nElement,
276  const Reference< xml::sax::XFastAttributeList>& xAttrList )
277 {
278  if( nElement == XML_ELEMENT(PRESENTATION, XML_ANIMATIONS) )
279  {
280  return new XMLAnimationsContext( GetImport() );
281  }
282  else if( nElement == XML_ELEMENT(OFFICE, XML_ANNOTATION) || nElement == XML_ELEMENT(OFFICE_EXT, XML_ANNOTATION) )
283  {
284  if( mxAnnotationAccess.is() )
285  return new DrawAnnotationContext( GetImport(), xAttrList, mxAnnotationAccess );
286  }
287  return nullptr;
288 }
289 
291  const OUString& rLocalName,
292  const Reference< xml::sax::XAttributeList>& xAttrList )
293 {
294  SvXMLImportContextRef xContext;
295 
296  if( nPrefix == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_ANIMATIONS ) )
297  {
298  // handled in createFastChildContext
299  }
300  else if( nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_FORMS ) )
301  {
302  if( GetImport().IsFormsSupported() )
303  xContext = xmloff::OFormLayerXMLImport::createOfficeFormsContext( GetImport(), nPrefix, rLocalName );
304  }
305  else if( ((nPrefix == XML_NAMESPACE_OFFICE) || (nPrefix == XML_NAMESPACE_OFFICE_EXT)) && IsXMLToken( rLocalName, XML_ANNOTATION ) )
306  {
307  // handled in createFastChildContext
308  }
309  else
310  {
311  // call GroupChildContext function at common ShapeImport
312  xContext = GetImport().GetShapeImport()->CreateGroupChildContext(
313  GetImport(), nPrefix, rLocalName, xAttrList, mxShapes);
314  }
315 
316  return xContext;
317 }
318 
320 {
321  GetImport().GetShapeImport()->popGroupAndPostProcess();
322 
323  if( GetImport().IsFormsSupported() )
324  GetImport().GetFormImport()->endPage();
325 
326  if( !maUseHeaderDeclName.isEmpty() || !maUseFooterDeclName.isEmpty() || !maUseDateTimeDeclName.isEmpty() )
327  {
328  try
329  {
330  Reference <beans::XPropertySet> xSet(mxShapes, uno::UNO_QUERY_THROW );
331  Reference< beans::XPropertySetInfo > xInfo( xSet->getPropertySetInfo() );
332 
333  if( !maUseHeaderDeclName.isEmpty() )
334  {
335  const OUString aStrHeaderTextProp( "HeaderText" );
336  if( xInfo->hasPropertyByName( aStrHeaderTextProp ) )
337  xSet->setPropertyValue( aStrHeaderTextProp,
338  makeAny( GetSdImport().GetHeaderDecl( maUseHeaderDeclName ) ) );
339  }
340 
341  if( !maUseFooterDeclName.isEmpty() )
342  {
343  const OUString aStrFooterTextProp( "FooterText" );
344  if( xInfo->hasPropertyByName( aStrFooterTextProp ) )
345  xSet->setPropertyValue( aStrFooterTextProp,
346  makeAny( GetSdImport().GetFooterDecl( maUseFooterDeclName ) ) );
347  }
348 
349  if( !maUseDateTimeDeclName.isEmpty() )
350  {
351  const OUString aStrDateTimeTextProp( "DateTimeText" );
352  if( xInfo->hasPropertyByName( aStrDateTimeTextProp ) )
353  {
354  bool bFixed;
355  OUString aDateTimeFormat;
356  const OUString aText( GetSdImport().GetDateTimeDecl( maUseDateTimeDeclName, bFixed, aDateTimeFormat ) );
357 
358  xSet->setPropertyValue("IsDateTimeFixed",
359  makeAny( bFixed ) );
360 
361  if( bFixed )
362  {
363  xSet->setPropertyValue( aStrDateTimeTextProp, makeAny( aText ) );
364  }
365  else if( !aDateTimeFormat.isEmpty() )
366  {
367  const SdXMLStylesContext* pStyles = dynamic_cast< const SdXMLStylesContext* >( GetSdImport().GetShapeImport()->GetStylesContext() );
368  if( !pStyles )
369  pStyles = dynamic_cast< const SdXMLStylesContext* >( GetSdImport().GetShapeImport()->GetAutoStylesContext() );
370 
371  if( pStyles )
372  {
373  const SdXMLNumberFormatImportContext* pSdNumStyle =
374  dynamic_cast< const SdXMLNumberFormatImportContext* >( pStyles->FindStyleChildContext( XmlStyleFamily::DATA_STYLE, aDateTimeFormat, true ) );
375 
376  if( pSdNumStyle )
377  {
378  xSet->setPropertyValue("DateTimeFormat",
379  makeAny( pSdNumStyle->GetDrawKey() ) );
380  }
381  }
382  }
383  }
384  }
385  }
386  catch(const uno::Exception&)
387  {
388  TOOLS_WARN_EXCEPTION("xmloff.draw", "");
389  }
390  }
391 
393 }
394 
395 void SdXMLGenericPageContext::SetStyle( OUString const & rStyleName )
396 {
397  // set PageProperties?
398  if(rStyleName.isEmpty())
399  return;
400 
401  try
402  {
403  const SvXMLImportContext* pContext = GetSdImport().GetShapeImport()->GetAutoStylesContext();
404 
405  if (const SdXMLStylesContext* pStyles = dynamic_cast<const SdXMLStylesContext *>(pContext))
406  {
407  const SvXMLStyleContext* pStyle = pStyles->FindStyleChildContext(
409 
410  if (const XMLPropStyleContext* pPropStyle = dynamic_cast<const XMLPropStyleContext*>(pStyle))
411  {
412  Reference <beans::XPropertySet> xPropSet1(mxShapes, uno::UNO_QUERY);
413  if(xPropSet1.is())
414  {
415  Reference< beans::XPropertySet > xPropSet( xPropSet1 );
416  Reference< beans::XPropertySet > xBackgroundSet;
417 
418  const OUString aBackground("Background");
419  if( xPropSet1->getPropertySetInfo()->hasPropertyByName( aBackground ) )
420  {
421  Reference< beans::XPropertySetInfo > xInfo( xPropSet1->getPropertySetInfo() );
422  if( xInfo.is() && xInfo->hasPropertyByName( aBackground ) )
423  {
424  Reference< lang::XMultiServiceFactory > xServiceFact(GetSdImport().GetModel(), uno::UNO_QUERY);
425  if(xServiceFact.is())
426  {
427  xBackgroundSet.set(xServiceFact->createInstance("com.sun.star.drawing.Background"), UNO_QUERY);
428  }
429  }
430 
431  if( xBackgroundSet.is() )
432  xPropSet = PropertySetMerger_CreateInstance( xPropSet1, xBackgroundSet );
433  }
434 
435  if(xPropSet.is())
436  {
437  const_cast<XMLPropStyleContext*>(pPropStyle)->FillPropertySet(xPropSet);
438 
439  if( xBackgroundSet.is() )
440  xPropSet1->setPropertyValue( aBackground, uno::makeAny( xBackgroundSet ) );
441  }
442  }
443  }
444  }
445  }
446  catch (const uno::Exception&)
447  {
448  TOOLS_WARN_EXCEPTION("xmloff.draw", "");
449  }
450 }
451 
453 {
454  // set PresentationPageLayout?
455  if(!GetSdImport().IsImpress() || maPageLayoutName.isEmpty())
456  return;
457 
458  sal_Int32 nType = -1;
459 
460  const SvXMLImportContext* pContext = GetSdImport().GetShapeImport()->GetStylesContext();
461 
462  if (const SdXMLStylesContext* pStyles = dynamic_cast<const SdXMLStylesContext *>(pContext))
463  {
464  const SvXMLStyleContext* pStyle = pStyles->FindStyleChildContext( XmlStyleFamily::SD_PRESENTATIONPAGELAYOUT_ID, maPageLayoutName);
465 
466  if (const SdXMLPresentationPageLayoutContext* pLayout = dynamic_cast<const SdXMLPresentationPageLayoutContext*>(pStyle))
467  {
468  nType = pLayout->GetTypeId();
469  }
470  }
471 
472  if( -1 == nType )
473  {
474  Reference< container::XNameAccess > xPageLayouts( GetSdImport().getPageLayouts() );
475  if( xPageLayouts.is() )
476  {
477  if( xPageLayouts->hasByName( maPageLayoutName ) )
478  xPageLayouts->getByName( maPageLayoutName ) >>= nType;
479  }
480 
481  }
482 
483  if( -1 != nType )
484  {
485  Reference <beans::XPropertySet> xPropSet(mxShapes, uno::UNO_QUERY);
486  if(xPropSet.is())
487  {
488  OUString aPropName("Layout");
489  Reference< beans::XPropertySetInfo > xInfo( xPropSet->getPropertySetInfo() );
490  if( xInfo.is() && xInfo->hasPropertyByName( aPropName ) )
491  xPropSet->setPropertyValue(aPropName, uno::makeAny( static_cast<sal_Int16>(nType) ) );
492  }
493  }
494 }
495 
497 {
498  // now delete all up-to-now contained shapes; they have been created
499  // when setting the presentation page layout.
500  while(mxShapes->getCount())
501  {
502  Reference< drawing::XShape > xShape;
503  uno::Any aAny(mxShapes->getByIndex(0));
504 
505  aAny >>= xShape;
506 
507  if(xShape.is())
508  {
509  mxShapes->remove(xShape);
510  }
511  }
512 }
513 
514 void SdXMLGenericPageContext::SetPageMaster( OUString const & rsPageMasterName )
515 {
516  if (!GetSdImport().GetShapeImport()->GetStylesContext())
517  return;
518 
519  // look for PageMaster with this name
520 
521  // #80012# GetStylesContext() replaced with GetAutoStylesContext()
522  const SvXMLStylesContext* pAutoStyles = GetSdImport().GetShapeImport()->GetAutoStylesContext();
523 
524  const SvXMLStyleContext* pStyle = pAutoStyles ? pAutoStyles->FindStyleChildContext(XmlStyleFamily::SD_PAGEMASTERCONTEXT_ID, rsPageMasterName) : nullptr;
525 
526  const SdXMLPageMasterContext* pPageMaster = dynamic_cast<const SdXMLPageMasterContext*>(pStyle);
527  if (!pPageMaster)
528  return;
529 
530  const SdXMLPageMasterStyleContext* pPageMasterContext = pPageMaster->GetPageMasterStyle();
531 
532  if (!pPageMasterContext)
533  return;
534 
535  Reference< drawing::XDrawPage > xMasterPage(GetLocalShapesContext(), uno::UNO_QUERY);
536  if (!xMasterPage.is())
537  return;
538 
539  // set sizes for this masterpage
540  Reference <beans::XPropertySet> xPropSet(xMasterPage, uno::UNO_QUERY);
541  if (xPropSet.is())
542  {
543  xPropSet->setPropertyValue("BorderBottom", Any(pPageMasterContext->GetBorderBottom()));
544  xPropSet->setPropertyValue("BorderLeft", Any(pPageMasterContext->GetBorderLeft()));
545  xPropSet->setPropertyValue("BorderRight", Any(pPageMasterContext->GetBorderRight()));
546  xPropSet->setPropertyValue("BorderTop", Any(pPageMasterContext->GetBorderTop()));
547  xPropSet->setPropertyValue("Width", Any(pPageMasterContext->GetWidth()));
548  xPropSet->setPropertyValue("Height", Any(pPageMasterContext->GetHeight()));
549  xPropSet->setPropertyValue("Orientation", Any(pPageMasterContext->GetOrientation()));
550  }
551 }
552 
553 namespace {
554 
555 class XoNavigationOrderAccess : public ::cppu::WeakImplHelper< XIndexAccess >
556 {
557 public:
558  explicit XoNavigationOrderAccess( std::vector< Reference< XShape > >& rShapes );
559 
560  // XIndexAccess
561  virtual sal_Int32 SAL_CALL getCount( ) override;
562  virtual Any SAL_CALL getByIndex( sal_Int32 Index ) override;
563 
564  // XElementAccess
565  virtual Type SAL_CALL getElementType( ) override;
566  virtual sal_Bool SAL_CALL hasElements( ) override;
567 
568 private:
569  std::vector< Reference< XShape > > maShapes;
570 };
571 
572 }
573 
574 XoNavigationOrderAccess::XoNavigationOrderAccess( std::vector< Reference< XShape > >& rShapes )
575 {
576  maShapes.swap( rShapes );
577 }
578 
579 // XIndexAccess
580 sal_Int32 SAL_CALL XoNavigationOrderAccess::getCount( )
581 {
582  return static_cast< sal_Int32 >( maShapes.size() );
583 }
584 
585 Any SAL_CALL XoNavigationOrderAccess::getByIndex( sal_Int32 Index )
586 {
587  if( (Index < 0) || (Index > getCount()) )
588  throw IndexOutOfBoundsException();
589 
590  return Any( maShapes[Index] );
591 }
592 
593 // XElementAccess
594 Type SAL_CALL XoNavigationOrderAccess::getElementType( )
595 {
597 }
598 
599 sal_Bool SAL_CALL XoNavigationOrderAccess::hasElements( )
600 {
601  return !maShapes.empty();
602 }
603 
605 {
606  if( msNavOrder.isEmpty() )
607  return;
608 
609  try
610  {
611  sal_uInt32 nIndex;
612  const sal_uInt32 nCount = static_cast< sal_uInt32 >( mxShapes->getCount() );
613  std::vector< Reference< XShape > > aShapes( nCount );
614 
616  SvXMLTokenEnumerator aEnumerator( msNavOrder );
617  OUString sId;
618  for( nIndex = 0; nIndex < nCount; ++nIndex )
619  {
620  if( !aEnumerator.getNextToken(sId) )
621  break;
622 
623  aShapes[nIndex].set( rIdMapper.getReference( sId ), UNO_QUERY );
624  }
625 
626  for( nIndex = 0; nIndex < nCount; ++nIndex )
627  {
628  if( !aShapes[nIndex].is() )
629  {
630  OSL_FAIL("xmloff::SdXMLGenericPageContext::SetNavigationOrder(), draw:nav-order attribute incomplete!");
631  // todo: warning?
632  return;
633  }
634  }
635 
636  Reference< XPropertySet > xSet( mxShapes, UNO_QUERY_THROW );
637  xSet->setPropertyValue("NavigationOrder", Any( Reference< XIndexAccess >( new XoNavigationOrderAccess( aShapes ) ) ) );
638  }
639  catch(const uno::Exception&)
640  {
641  TOOLS_WARN_EXCEPTION("xmloff.draw",
642  "unexpected exception caught while importing shape navigation order!");
643  }
644 }
645 
646 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Type
void SetLayout()
sets the presentation layout at this page.
Definition: ximppage.cxx:452
bool IsXMLToken(const OUString &rString, enum XMLTokenEnum eToken)
compare eToken to the string
Definition: xmltoken.cxx:3434
sal_Int32 nIndex
constexpr sal_uInt16 XML_NAMESPACE_OFFICE
rtl::Reference< ::xmloff::OFormLayerXMLImport > const & GetFormImport()
Definition: xmlimp.hxx:624
void SetPageMaster(OUString const &rsPageMasterName)
sets the properties from a page master style with the given name on this contexts page ...
Definition: ximppage.cxx:514
OUString maUseHeaderDeclName
Definition: ximppage.hxx:38
static SvXMLImportContext * createOfficeFormsContext(SvXMLImport &_rImport, sal_uInt16 _nPrefix, const OUString &_rLocalName)
creates an import context for the office:forms element
virtual void SAL_CALL startFastElement(sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
Definition: xmlictxt.cxx:71
SvXMLImport & GetImport()
Definition: xmlictxt.hxx:62
const SdXMLImport & GetSdImport() const
Definition: ximppage.hxx:52
constexpr sal_uInt16 XML_NAMESPACE_LO_EXT
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: ximppage.cxx:319
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
rtl::Reference< Annotation > mxAnnotation
OUString maUseFooterDeclName
Definition: ximppage.hxx:39
sal_Int32 GetBorderLeft() const
Definition: ximpstyl.hxx:61
bool getNextToken(OUString &rToken)
Definition: xmluconv.cxx:449
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximppage.cxx:266
sal_Int32 GetHeight() const
Definition: ximpstyl.hxx:65
float x
const css::uno::Reference< css::uno::XInterface > & getReference(const OUString &rIdentifier) const
bool convertMeasureToCore(sal_Int32 &rValue, const OUString &rString, sal_Int32 nMin=SAL_MIN_INT32, sal_Int32 nMax=SAL_MAX_INT32) const
convert string to measure with meCoreMeasureUnit, using optional min and max values ...
Definition: xmluconv.cxx:171
DRAW
int nCount
::comphelper::UnoInterfaceToUniqueIdentifierMapper & getInterfaceToIdentifierMapper()
Definition: xmlimp.cxx:1877
static OUString getPrefixAndNameFromToken(sal_Int32 nToken)
Definition: xmlimp.cxx:2025
const SdXMLPageMasterStyleContext * GetPageMasterStyle() const
Definition: ximpstyl.hxx:88
float y
static bool parseDateTime(css::util::DateTime &rDateTime, const OUString &rString)
#define TOOLS_WARN_EXCEPTION(area, stream)
css::uno::Reference< css::drawing::XShapes > mxShapes
Definition: ximppage.hxx:33
void DeleteAllShapes()
deletes all shapes on this drawing page
Definition: ximppage.cxx:496
constexpr sal_uInt16 XML_NAMESPACE_TEXT
sal_Int32 GetWidth() const
Definition: ximpstyl.hxx:64
css::view::PaperOrientation GetOrientation() const
Definition: ximpstyl.hxx:66
sal_Int32 GetBorderBottom() const
Definition: ximpstyl.hxx:60
OUString maUseDateTimeDeclName
Definition: ximppage.hxx:40
css::uno::Reference< css::office::XAnnotationAccess > mxAnnotationAccess
Definition: ximppage.hxx:34
unsigned char sal_Bool
sal_Int32 w
css::uno::Type const & get()
sal_Int32 GetBorderTop() const
Definition: ximpstyl.hxx:63
constexpr sal_uInt16 XML_NAMESPACE_DC
Import all text into a string buffer.
This class deliberately does not support XWeak, to improve performance when loading large documents...
Definition: xmlictxt.hxx:44
Reference< XPropertySet > PropertySetMerger_CreateInstance(const Reference< XPropertySet > &rPropSet1, const Reference< XPropertySet > &rPropSet2)
constexpr sal_uInt16 XML_NAMESPACE_PRESENTATION
virtual void SAL_CALL endFastElement(sal_Int32 Element) override
Definition: xmlictxt.cxx:114
constexpr bool IsTokenInNamespace(sal_Int32 nToken, sal_uInt16 nNamespacePrefix)
Definition: xmlimp.hxx:101
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
Create a children element context.
Definition: ximppage.cxx:290
Handling of tokens in XML:
virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
Definition: xmlictxt.cxx:128
const css::uno::Reference< css::drawing::XShapes > & GetLocalShapesContext() const
Definition: ximppage.hxx:75
#define XML_ELEMENT(prefix, name)
Definition: xmlimp.hxx:94
const SvXMLUnitConverter & GetMM100UnitConverter() const
Definition: xmlimp.hxx:404
QPRO_FUNC_TYPE nType
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList)
Create a children element context.
Definition: xmlictxt.cxx:51
const SvXMLStyleContext * FindStyleChildContext(XmlStyleFamily nFamily, const OUString &rName, bool bCreateIndex=false) const
Definition: xmlstyle.cxx:808
constexpr sal_uInt16 XML_NAMESPACE_OFFICE_EXT
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
Definition: ximppage.cxx:274
OUString sId
#define SAL_WARN(area, stream)
constexpr sal_Int32 TOKEN_MASK
Definition: xmlimp.hxx:91
constexpr sal_uInt16 XML_NAMESPACE_META
void SetStyle(OUString const &rStyleName)
sets the page style on this page
Definition: ximppage.cxx:395
sal_Int32 GetBorderRight() const
Definition: ximpstyl.hxx:62
struct _ADOIndex Index
SdXMLGenericPageContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes)
Definition: ximppage.cxx:244
sal_Int32 h
virtual ~SdXMLGenericPageContext() override
Definition: ximppage.cxx:262
rtl::Reference< XMLShapeImportHelper > const & GetShapeImport()
Definition: xmlimp.hxx:608
css::uno::Any SAL_CALL makeAny(const SharedUNOComponent< INTERFACE, COMPONENT > &value)