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
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
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 #ifndef WRAP_POLYGON_HANDLER_HXX
25 #define WRAP_POLYGON_HANDLER_HXX
26 
27 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
28 #include <resourcemodel/LoggedResources.hxx>
29 #include <resourcemodel/Fraction.hxx>
30 
31 namespace writerfilter {
32 namespace dmapper {
33 
34 using namespace ::com::sun::star;
35 using resourcemodel::Fraction;
36 
37 class WrapPolygon
38 {
39 public:
40     typedef ::std::deque<awt::Point> Points_t;
41     typedef ::boost::shared_ptr<WrapPolygon> Pointer_t;
42 
43 private:
44     Points_t mPoints;
45 
46 public:
47     WrapPolygon();
48     virtual ~WrapPolygon();
49 
50     void addPoint(const awt::Point & rPoint);
51 
52     Points_t::const_iterator begin() const;
53     Points_t::const_iterator end() const;
54     Points_t::iterator begin();
55     Points_t::iterator end();
56 
57     size_t size() const;
58 
59     WrapPolygon::Pointer_t move(const awt::Point & rMove);
60     WrapPolygon::Pointer_t scale(const Fraction & rFractionX, const Fraction & rFractionY);
61     WrapPolygon::Pointer_t correctWordWrapPolygon(const awt::Size & rSrcSize, const awt::Size & rDstSize);
62     drawing::PointSequenceSequence getPointSequenceSequence() const;
63 };
64 
65 class WrapPolygonHandler : public LoggedProperties
66 {
67 public:
68     WrapPolygonHandler();
69     virtual ~WrapPolygonHandler();
70 
71     WrapPolygon::Pointer_t getPolygon();
72 
73 private:
74     WrapPolygon::Pointer_t mpPolygon;
75 
76     sal_uInt32 mnX;
77     sal_uInt32 mnY;
78 
79     // Properties
80     virtual void lcl_attribute(Id Name, Value & val);
81     virtual void lcl_sprm(Sprm & sprm);
82 
83 };
84 
85 }}
86 
87 #endif // WRAP_POLYGON_HANDLER_HXX
88