Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #include "ReportUndoFactory.hxx"
29 : : #include "RptObject.hxx"
30 : : #include "UndoActions.hxx"
31 : : #include "RptResId.hrc"
32 : :
33 : : namespace rptui
34 : : {
35 : : using namespace ::com::sun::star;
36 : : // -----------------------------------------------------------------------------
37 : 0 : SdrUndoAction* lcl_createUndo(SdrObject& rObject,Action _eAction,sal_uInt16 _nCommentId)
38 : : {
39 [ # # ]: 0 : OObjectBase* pObj = dynamic_cast<OObjectBase*>(&rObject);
40 [ # # ]: 0 : if ( !pObj )
41 : 0 : return NULL;
42 [ # # ]: 0 : uno::Reference< report::XReportComponent> xReportComponent = pObj->getReportComponent();
43 [ # # ]: 0 : uno::Reference< report::XSection> xSection = pObj->getSection();
44 [ # # ][ # # ]: 0 : uno::Reference< report::XGroup> xGroup = xSection->getGroup();
45 : 0 : SdrUndoAction* pUndo = NULL;
46 [ # # ]: 0 : if ( xGroup.is() )
47 [ # # ][ # # ]: 0 : pUndo = new OUndoGroupSectionAction(*rObject.GetModel(),_eAction,OGroupHelper::getMemberFunction(xSection),xGroup,xReportComponent,_nCommentId);
[ # # ][ # # ]
48 : : else
49 [ # # ][ # # ]: 0 : pUndo = new OUndoReportSectionAction(*rObject.GetModel(),_eAction,OReportHelper::getMemberFunction(xSection),xSection->getReportDefinition(),xReportComponent,_nCommentId);
[ # # ][ # # ]
[ # # ][ # # ]
50 : 0 : return pUndo;
51 : : }
52 : : // -----------------------------------------------------------------------------
53 : : DBG_NAME( rpt_OReportUndoFactory )
54 : : // -----------------------------------------------------------------------------
55 [ # # ][ # # ]: 0 : OReportUndoFactory::OReportUndoFactory() : m_pUndoFactory(new SdrUndoFactory)
56 : : {
57 : : DBG_CTOR( rpt_OReportUndoFactory,NULL);
58 : 0 : }
59 : : // -----------------------------------------------------------------------------
60 [ # # ][ # # ]: 0 : OReportUndoFactory::~OReportUndoFactory()
61 : : {
62 : : DBG_DTOR( rpt_OReportUndoFactory,NULL);
63 [ # # ]: 0 : }
64 : : ///////////////////////////////////////////////////////////////////////
65 : : // shapes
66 : 0 : SdrUndoAction* OReportUndoFactory::CreateUndoMoveObject( SdrObject& rObject )
67 : : {
68 : 0 : return m_pUndoFactory->CreateUndoMoveObject( rObject );
69 : : }
70 : :
71 : 0 : SdrUndoAction* OReportUndoFactory::CreateUndoMoveObject( SdrObject& rObject, const Size& rDist )
72 : : {
73 : 0 : return m_pUndoFactory->CreateUndoMoveObject( rObject, rDist );
74 : : }
75 : :
76 : 0 : SdrUndoAction* OReportUndoFactory::CreateUndoGeoObject( SdrObject& rObject )
77 : : {
78 : 0 : return m_pUndoFactory->CreateUndoGeoObject( rObject );
79 : : }
80 : :
81 : 0 : SdrUndoAction* OReportUndoFactory::CreateUndoAttrObject( SdrObject& rObject, bool bStyleSheet1, bool bSaveText )
82 : : {
83 : 0 : return m_pUndoFactory->CreateUndoAttrObject( rObject, bStyleSheet1 ? sal_True : sal_False, bSaveText ? sal_True : sal_False );
84 : : }
85 : :
86 : 0 : SdrUndoAction* OReportUndoFactory::CreateUndoRemoveObject( SdrObject& rObject, bool bOrdNumDirect )
87 : : {
88 : 0 : return m_pUndoFactory->CreateUndoRemoveObject( rObject, bOrdNumDirect ? sal_True : sal_False );
89 : : }
90 : :
91 : 0 : SdrUndoAction* OReportUndoFactory::CreateUndoInsertObject( SdrObject& rObject, bool /*bOrdNumDirect*/ )
92 : : {
93 : 0 : return lcl_createUndo(rObject,rptui::Inserted,RID_STR_UNDO_INSERT_CONTROL);
94 : : }
95 : :
96 : 0 : SdrUndoAction* OReportUndoFactory::CreateUndoDeleteObject( SdrObject& rObject, bool /*bOrdNumDirect*/ )
97 : : {
98 : 0 : return lcl_createUndo(rObject,rptui::Removed,RID_STR_UNDO_DELETE_CONTROL);
99 : : }
100 : :
101 : 0 : SdrUndoAction* OReportUndoFactory::CreateUndoNewObject( SdrObject& rObject, bool /*bOrdNumDirect*/ )
102 : : {
103 : 0 : return lcl_createUndo(rObject,rptui::Inserted,RID_STR_UNDO_INSERT_CONTROL);
104 : : }
105 : :
106 : 0 : SdrUndoAction* OReportUndoFactory::CreateUndoCopyObject( SdrObject& rObject, bool bOrdNumDirect )
107 : : {
108 : 0 : return m_pUndoFactory->CreateUndoCopyObject( rObject, bOrdNumDirect ? sal_True : sal_False );
109 : : }
110 : :
111 : 0 : SdrUndoAction* OReportUndoFactory::CreateUndoObjectOrdNum( SdrObject& rObject, sal_uInt32 nOldOrdNum1, sal_uInt32 nNewOrdNum1)
112 : : {
113 : 0 : return m_pUndoFactory->CreateUndoObjectOrdNum( rObject, nOldOrdNum1, nNewOrdNum1 );
114 : : }
115 : :
116 : 0 : SdrUndoAction* OReportUndoFactory::CreateUndoReplaceObject( SdrObject& rOldObject, SdrObject& rNewObject, bool bOrdNumDirect )
117 : : {
118 : 0 : return m_pUndoFactory->CreateUndoReplaceObject( rOldObject, rNewObject, bOrdNumDirect ? sal_True : sal_False );
119 : : }
120 : :
121 : 0 : SdrUndoAction* OReportUndoFactory::CreateUndoObjectLayerChange( SdrObject& rObject, SdrLayerID aOldLayer, SdrLayerID aNewLayer )
122 : : {
123 : 0 : return m_pUndoFactory->CreateUndoObjectLayerChange( rObject, aOldLayer, aNewLayer );
124 : : }
125 : :
126 : 0 : SdrUndoAction* OReportUndoFactory::CreateUndoObjectSetText( SdrObject& rNewObj, sal_Int32 nText )
127 : : {
128 : 0 : return m_pUndoFactory->CreateUndoObjectSetText( rNewObj, nText );
129 : : }
130 : :
131 : : // layer
132 : 0 : SdrUndoAction* OReportUndoFactory::CreateUndoNewLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel)
133 : : {
134 : 0 : return m_pUndoFactory->CreateUndoNewLayer( nLayerNum, rNewLayerAdmin, rNewModel );
135 : : }
136 : :
137 : 0 : SdrUndoAction* OReportUndoFactory::CreateUndoDeleteLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel)
138 : : {
139 : 0 : return m_pUndoFactory->CreateUndoDeleteLayer( nLayerNum, rNewLayerAdmin, rNewModel );
140 : : }
141 : :
142 : 0 : SdrUndoAction* OReportUndoFactory::CreateUndoMoveLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel, sal_uInt16 nNeuPos1)
143 : : {
144 : 0 : return m_pUndoFactory->CreateUndoMoveLayer( nLayerNum, rNewLayerAdmin, rNewModel, nNeuPos1 );
145 : : }
146 : :
147 : : // page
148 : 0 : SdrUndoAction* OReportUndoFactory::CreateUndoDeletePage(SdrPage& rPage)
149 : : {
150 : 0 : return m_pUndoFactory->CreateUndoDeletePage( rPage );
151 : : }
152 : :
153 : 0 : SdrUndoAction* OReportUndoFactory::CreateUndoNewPage(SdrPage& rPage)
154 : : {
155 : 0 : return m_pUndoFactory->CreateUndoNewPage( rPage );
156 : : }
157 : :
158 : 0 : SdrUndoAction* OReportUndoFactory::CreateUndoCopyPage(SdrPage& rPage)
159 : : {
160 : 0 : return m_pUndoFactory->CreateUndoCopyPage( rPage );
161 : : }
162 : :
163 : 0 : SdrUndoAction* OReportUndoFactory::CreateUndoSetPageNum(SdrPage& rNewPg, sal_uInt16 nOldPageNum1, sal_uInt16 nNewPageNum1)
164 : : {
165 : 0 : return m_pUndoFactory->CreateUndoSetPageNum( rNewPg, nOldPageNum1, nNewPageNum1 );
166 : : }
167 : : // master page
168 : 0 : SdrUndoAction* OReportUndoFactory::CreateUndoPageRemoveMasterPage(SdrPage& rChangedPage)
169 : : {
170 : 0 : return m_pUndoFactory->CreateUndoPageRemoveMasterPage( rChangedPage );
171 : : }
172 : :
173 : 0 : SdrUndoAction* OReportUndoFactory::CreateUndoPageChangeMasterPage(SdrPage& rChangedPage)
174 : : {
175 : 0 : return m_pUndoFactory->CreateUndoPageChangeMasterPage(rChangedPage);
176 : : }
177 : :
178 : : //==================================================================
179 : : } //rptui
180 : : //==================================================================
181 : :
182 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|