XMLImageMapContext.cxx (63bba73c) XMLImageMapContext.cxx (1f882ec4)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 5 unchanged lines hidden (view full) ---

14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 5 unchanged lines hidden (view full) ---

14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_xmloff.hxx"
26#include "XMLImageMapContext.hxx"
27#include <rtl/ustrbuf.hxx>
28#include <com/sun/star/uno/Reference.h>
29#include <com/sun/star/beans/XPropertySet.hpp>
22// MARKER(update_precomp.py): autogen include statement, do not remove
23#include "precompiled_xmloff.hxx"
24#include "XMLImageMapContext.hxx"
25#include <rtl/ustrbuf.hxx>
26#include <com/sun/star/uno/Reference.h>
27#include <com/sun/star/beans/XPropertySet.hpp>
30#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP
31#include <com/sun/star/beans/XPropertySetInfo.hpp>
28#include <com/sun/star/beans/XPropertySetInfo.hpp>
32#endif
33#include <com/sun/star/xml/sax/XAttributeList.hpp>
34#include <com/sun/star/container/XIndexContainer.hpp>
35#include <com/sun/star/lang/XMultiServiceFactory.hpp>
36#include <com/sun/star/drawing/PointSequenceSequence.hpp>
29#include <com/sun/star/xml/sax/XAttributeList.hpp>
30#include <com/sun/star/container/XIndexContainer.hpp>
31#include <com/sun/star/lang/XMultiServiceFactory.hpp>
32#include <com/sun/star/drawing/PointSequenceSequence.hpp>
37
38#ifndef _COM_SUN_STAR_DOCUMENT_XEVENTSSUPPLIER_HPP
39#include <com/sun/star/document/XEventsSupplier.hpp>
33#include <com/sun/star/document/XEventsSupplier.hpp>
40#endif
41#include <com/sun/star/awt/Rectangle.hpp>
42#include <xmloff/xmltoken.hxx>
43#include <xmloff/xmlimp.hxx>
44#include <xmloff/xmltkmap.hxx>
45#include "xmloff/xmlnmspe.hxx"
46#include <xmloff/nmspmap.hxx>
47#include <xmloff/xmluconv.hxx>
48#include "xexptran.hxx"
49#include "xmloff/xmlerror.hxx"
50#include <xmloff/XMLEventsImportContext.hxx>
51#include "XMLStringBufferImportContext.hxx"
52#include <tools/debug.hxx>
34#include <com/sun/star/awt/Rectangle.hpp>
35#include <xmloff/xmltoken.hxx>
36#include <xmloff/xmlimp.hxx>
37#include <xmloff/xmltkmap.hxx>
38#include "xmloff/xmlnmspe.hxx"
39#include <xmloff/nmspmap.hxx>
40#include <xmloff/xmluconv.hxx>
41#include "xexptran.hxx"
42#include "xmloff/xmlerror.hxx"
43#include <xmloff/XMLEventsImportContext.hxx>
44#include "XMLStringBufferImportContext.hxx"
45#include <tools/debug.hxx>
46#include <basegfx/polygon/b2dpolygon.hxx>
47#include <basegfx/polygon/b2dpolygontools.hxx>
53
48
54
55using namespace ::com::sun::star;
56using namespace ::xmloff::token;
57
58using ::rtl::OUString;
59using ::rtl::OUStringBuffer;
60using ::com::sun::star::beans::XPropertySet;
61using ::com::sun::star::beans::XPropertySetInfo;
62using ::com::sun::star::container::XIndexContainer;

--- 438 unchanged lines hidden (view full) ---

501 default:
502 XMLImageMapObjectContext::ProcessAttribute(eToken, rValue);
503 break;
504 }
505
506 bValid = bViewBoxOK && bPointsOK;
507}
508
49using namespace ::com::sun::star;
50using namespace ::xmloff::token;
51
52using ::rtl::OUString;
53using ::rtl::OUStringBuffer;
54using ::com::sun::star::beans::XPropertySet;
55using ::com::sun::star::beans::XPropertySetInfo;
56using ::com::sun::star::container::XIndexContainer;

--- 438 unchanged lines hidden (view full) ---

495 default:
496 XMLImageMapObjectContext::ProcessAttribute(eToken, rValue);
497 break;
498 }
499
500 bValid = bViewBoxOK && bPointsOK;
501}
502
509void XMLImageMapPolygonContext::Prepare(
510 Reference<XPropertySet> & rPropertySet)
503void XMLImageMapPolygonContext::Prepare(Reference<XPropertySet> & rPropertySet)
511{
504{
512 // process view box
513 SdXMLImExViewBox aViewBox(sViewBoxString,
514 GetImport().GetMM100UnitConverter());
505 // process view box
506 SdXMLImExViewBox aViewBox(sViewBoxString, GetImport().GetMM100UnitConverter());
515
507
516 // get polygon sequence
517 awt::Point aPoint(aViewBox.GetX(), aViewBox.GetY());
518 awt::Size aSize(aViewBox.GetWidth(), aViewBox.GetHeight());
519 SdXMLImExPointsElement aPoints( sPointsString, aViewBox, aPoint, aSize,
520 GetImport().GetMM100UnitConverter() );
521 PointSequenceSequence aPointSeqSeq = aPoints.GetPointSequenceSequence();
508 // get polygon sequence
509 basegfx::B2DPolygon aPolygon;
522
510
523 // only use first element of sequence-sequence
524 if (aPointSeqSeq.getLength() > 0)
525 {
526 Any aAny;
527 aAny <<= aPointSeqSeq[0];
528 rPropertySet->setPropertyValue(sPolygon, aAny);
529 }
511 if(basegfx::tools::importFromSvgPoints(aPolygon, sPointsString))
512 {
513 if(aPolygon.count())
514 {
515 com::sun::star::drawing::PointSequence aPointSequence;
516 uno::Any aAny;
530
517
531 // parent properties
532 XMLImageMapObjectContext::Prepare(rPropertySet);
518 basegfx::tools::B2DPolygonToUnoPointSequence(aPolygon, aPointSequence);
519 aAny <<= aPointSequence;
520 rPropertySet->setPropertyValue(sPolygon, aAny);
521 }
522 }
523
524 // parent properties
525 XMLImageMapObjectContext::Prepare(rPropertySet);
533}
534
526}
527
535
536
537class XMLImageMapCircleContext : public XMLImageMapObjectContext
538{
539 awt::Point aCenter;
540 sal_Int32 nRadius;
541
542 sal_Bool bXOK;
543 sal_Bool bYOK;
544 sal_Bool bRadiusOK;

--- 175 unchanged lines hidden ---
528class XMLImageMapCircleContext : public XMLImageMapObjectContext
529{
530 awt::Point aCenter;
531 sal_Int32 nRadius;
532
533 sal_Bool bXOK;
534 sal_Bool bYOK;
535 sal_Bool bRadiusOK;

--- 175 unchanged lines hidden ---