xref: /AOO42X/main/sc/source/filter/xml/XMLTableShapeResizer.hxx (revision 9bce9b0d387299c68bd81d539e1478357a103de5)
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 SC_XMLTABLESHAPERESIZER_HXX
25 #define SC_XMLTABLESHAPERESIZER_HXX
26 
27 #include <com/sun/star/drawing/XShape.hpp>
28 #include <com/sun/star/table/CellAddress.hpp>
29 #include <com/sun/star/sheet/XSpreadsheet.hpp>
30 #include <list>
31 
32 class ScXMLImport;
33 class ScChartListenerCollection;
34 class ScDocument;
35 class Rectangle;
36 
37 struct ScMyToResizeShape
38 {
39     com::sun::star::uno::Reference <com::sun::star::drawing::XShape> xShape;
40     rtl::OUString* pRangeList;
41     com::sun::star::table::CellAddress  aEndCell;
42     com::sun::star::table::CellAddress  aStartCell;
43     sal_Int32 nEndX;
44     sal_Int32 nEndY;
45 
ScMyToResizeShapeScMyToResizeShape46     ScMyToResizeShape() : pRangeList(NULL) {}
47 };
48 
49 typedef std::list<ScMyToResizeShape> ScMyToResizeShapes;
50 
51 class ScMyShapeResizer
52 {
53     ScXMLImport&                rImport;
54     ScMyToResizeShapes          aShapes;
55     ScChartListenerCollection*  pCollection;
56 
57     sal_Bool IsOLE(com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rShape) const;
58     void CreateChartListener(ScDocument* pDoc,
59         const rtl::OUString& rName,
60         const rtl::OUString* pRangeList);
61     void GetNewShapeSizePos(ScDocument* pDoc, const Rectangle& rStartRect,
62                             const com::sun::star::table::CellAddress& rEndCell,
63                             com::sun::star::awt::Point& rPoint, com::sun::star::awt::Size& rSize,
64                             sal_Int32& rEndX, sal_Int32& rEndY) const;
65 public:
66     ScMyShapeResizer(ScXMLImport& rImport);
67     ~ScMyShapeResizer();
68 
69     void    AddShape(com::sun::star::uno::Reference <com::sun::star::drawing::XShape>& rShape,
70                     rtl::OUString* pRangeList,
71                     com::sun::star::table::CellAddress& rStartAddress,
72                     com::sun::star::table::CellAddress& rEndAddress,
73                     sal_Int32 nEndX, sal_Int32 nEndY);
74     void    ResizeShapes();
75 };
76 
77 #endif
78