Line data Source code
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 : #include "ReportUndoFactory.hxx"
20 : #include "RptObject.hxx"
21 : #include "UndoActions.hxx"
22 : #include "RptResId.hrc"
23 :
24 : namespace rptui
25 : {
26 : using namespace ::com::sun::star;
27 :
28 0 : SdrUndoAction* lcl_createUndo(SdrObject& rObject,Action _eAction,sal_uInt16 _nCommentId)
29 : {
30 0 : OObjectBase* pObj = dynamic_cast<OObjectBase*>(&rObject);
31 0 : if ( !pObj )
32 0 : return NULL;
33 0 : uno::Reference< report::XReportComponent> xReportComponent = pObj->getReportComponent();
34 0 : uno::Reference< report::XSection> xSection = pObj->getSection();
35 0 : uno::Reference< report::XGroup> xGroup = xSection->getGroup();
36 0 : SdrUndoAction* pUndo = NULL;
37 0 : if ( xGroup.is() )
38 0 : pUndo = new OUndoGroupSectionAction(*rObject.GetModel(),_eAction,OGroupHelper::getMemberFunction(xSection),xGroup,xReportComponent,_nCommentId);
39 : else
40 0 : pUndo = new OUndoReportSectionAction(*rObject.GetModel(),_eAction,OReportHelper::getMemberFunction(xSection),xSection->getReportDefinition(),xReportComponent,_nCommentId);
41 0 : return pUndo;
42 : }
43 :
44 :
45 0 : OReportUndoFactory::OReportUndoFactory() : m_pUndoFactory(new SdrUndoFactory)
46 : {
47 0 : }
48 :
49 0 : OReportUndoFactory::~OReportUndoFactory()
50 : {
51 0 : }
52 :
53 : // shapes
54 0 : SdrUndoAction* OReportUndoFactory::CreateUndoMoveObject( SdrObject& rObject )
55 : {
56 0 : return m_pUndoFactory->CreateUndoMoveObject( rObject );
57 : }
58 :
59 0 : SdrUndoAction* OReportUndoFactory::CreateUndoMoveObject( SdrObject& rObject, const Size& rDist )
60 : {
61 0 : return m_pUndoFactory->CreateUndoMoveObject( rObject, rDist );
62 : }
63 :
64 0 : SdrUndoAction* OReportUndoFactory::CreateUndoGeoObject( SdrObject& rObject )
65 : {
66 0 : return m_pUndoFactory->CreateUndoGeoObject( rObject );
67 : }
68 :
69 0 : SdrUndoAction* OReportUndoFactory::CreateUndoAttrObject( SdrObject& rObject, bool bStyleSheet1, bool bSaveText )
70 : {
71 0 : return m_pUndoFactory->CreateUndoAttrObject( rObject, bStyleSheet1, bSaveText );
72 : }
73 :
74 0 : SdrUndoAction* OReportUndoFactory::CreateUndoRemoveObject( SdrObject& rObject, bool bOrdNumDirect )
75 : {
76 0 : return m_pUndoFactory->CreateUndoRemoveObject( rObject, bOrdNumDirect );
77 : }
78 :
79 0 : SdrUndoAction* OReportUndoFactory::CreateUndoInsertObject( SdrObject& rObject, bool /*bOrdNumDirect*/ )
80 : {
81 0 : return lcl_createUndo(rObject,rptui::Inserted,RID_STR_UNDO_INSERT_CONTROL);
82 : }
83 :
84 0 : SdrUndoAction* OReportUndoFactory::CreateUndoDeleteObject( SdrObject& rObject, bool /*bOrdNumDirect*/ )
85 : {
86 0 : return lcl_createUndo(rObject,rptui::Removed,RID_STR_UNDO_DELETE_CONTROL);
87 : }
88 :
89 0 : SdrUndoAction* OReportUndoFactory::CreateUndoNewObject( SdrObject& rObject, bool /*bOrdNumDirect*/ )
90 : {
91 0 : return lcl_createUndo(rObject,rptui::Inserted,RID_STR_UNDO_INSERT_CONTROL);
92 : }
93 :
94 0 : SdrUndoAction* OReportUndoFactory::CreateUndoCopyObject( SdrObject& rObject, bool bOrdNumDirect )
95 : {
96 0 : return m_pUndoFactory->CreateUndoCopyObject( rObject, bOrdNumDirect );
97 : }
98 :
99 0 : SdrUndoAction* OReportUndoFactory::CreateUndoObjectOrdNum( SdrObject& rObject, sal_uInt32 nOldOrdNum1, sal_uInt32 nNewOrdNum1)
100 : {
101 0 : return m_pUndoFactory->CreateUndoObjectOrdNum( rObject, nOldOrdNum1, nNewOrdNum1 );
102 : }
103 :
104 0 : SdrUndoAction* OReportUndoFactory::CreateUndoReplaceObject( SdrObject& rOldObject, SdrObject& rNewObject, bool bOrdNumDirect )
105 : {
106 0 : return m_pUndoFactory->CreateUndoReplaceObject( rOldObject, rNewObject, bOrdNumDirect );
107 : }
108 :
109 0 : SdrUndoAction* OReportUndoFactory::CreateUndoObjectLayerChange( SdrObject& rObject, SdrLayerID aOldLayer, SdrLayerID aNewLayer )
110 : {
111 0 : return m_pUndoFactory->CreateUndoObjectLayerChange( rObject, aOldLayer, aNewLayer );
112 : }
113 :
114 0 : SdrUndoAction* OReportUndoFactory::CreateUndoObjectSetText( SdrObject& rNewObj, sal_Int32 nText )
115 : {
116 0 : return m_pUndoFactory->CreateUndoObjectSetText( rNewObj, nText );
117 : }
118 :
119 : // layer
120 0 : SdrUndoAction* OReportUndoFactory::CreateUndoNewLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel)
121 : {
122 0 : return m_pUndoFactory->CreateUndoNewLayer( nLayerNum, rNewLayerAdmin, rNewModel );
123 : }
124 :
125 0 : SdrUndoAction* OReportUndoFactory::CreateUndoDeleteLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel)
126 : {
127 0 : return m_pUndoFactory->CreateUndoDeleteLayer( nLayerNum, rNewLayerAdmin, rNewModel );
128 : }
129 :
130 0 : SdrUndoAction* OReportUndoFactory::CreateUndoMoveLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel, sal_uInt16 nNeuPos1)
131 : {
132 0 : return m_pUndoFactory->CreateUndoMoveLayer( nLayerNum, rNewLayerAdmin, rNewModel, nNeuPos1 );
133 : }
134 :
135 : // page
136 0 : SdrUndoAction* OReportUndoFactory::CreateUndoDeletePage(SdrPage& rPage)
137 : {
138 0 : return m_pUndoFactory->CreateUndoDeletePage( rPage );
139 : }
140 :
141 0 : SdrUndoAction* OReportUndoFactory::CreateUndoNewPage(SdrPage& rPage)
142 : {
143 0 : return m_pUndoFactory->CreateUndoNewPage( rPage );
144 : }
145 :
146 0 : SdrUndoAction* OReportUndoFactory::CreateUndoCopyPage(SdrPage& rPage)
147 : {
148 0 : return m_pUndoFactory->CreateUndoCopyPage( rPage );
149 : }
150 :
151 0 : SdrUndoAction* OReportUndoFactory::CreateUndoSetPageNum(SdrPage& rNewPg, sal_uInt16 nOldPageNum1, sal_uInt16 nNewPageNum1)
152 : {
153 0 : return m_pUndoFactory->CreateUndoSetPageNum( rNewPg, nOldPageNum1, nNewPageNum1 );
154 : }
155 : // master page
156 0 : SdrUndoAction* OReportUndoFactory::CreateUndoPageRemoveMasterPage(SdrPage& rChangedPage)
157 : {
158 0 : return m_pUndoFactory->CreateUndoPageRemoveMasterPage( rChangedPage );
159 : }
160 :
161 0 : SdrUndoAction* OReportUndoFactory::CreateUndoPageChangeMasterPage(SdrPage& rChangedPage)
162 : {
163 0 : return m_pUndoFactory->CreateUndoPageChangeMasterPage(rChangedPage);
164 : }
165 :
166 :
167 3 : } //rptui
168 :
169 :
170 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|