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