1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #include "ReportUndoFactory.hxx"
20 #include "RptObject.hxx"
21 #include "UndoActions.hxx"
22 #include "RptResId.hrc"
26 using namespace ::com::sun::star
;
28 SdrUndoAction
* lcl_createUndo(SdrObject
& rObject
,Action _eAction
,sal_uInt16 _nCommentId
)
30 OObjectBase
* pObj
= dynamic_cast<OObjectBase
*>(&rObject
);
33 uno::Reference
< report::XReportComponent
> xReportComponent
= pObj
->getReportComponent();
34 uno::Reference
< report::XSection
> xSection
= pObj
->getSection();
35 uno::Reference
< report::XGroup
> xGroup
= xSection
->getGroup();
36 SdrUndoAction
* pUndo
= NULL
;
38 pUndo
= new OUndoGroupSectionAction(*rObject
.GetModel(),_eAction
,OGroupHelper::getMemberFunction(xSection
),xGroup
,xReportComponent
,_nCommentId
);
40 pUndo
= new OUndoReportSectionAction(*rObject
.GetModel(),_eAction
,OReportHelper::getMemberFunction(xSection
),xSection
->getReportDefinition(),xReportComponent
,_nCommentId
);
45 OReportUndoFactory::OReportUndoFactory() : m_pUndoFactory(new SdrUndoFactory
)
49 OReportUndoFactory::~OReportUndoFactory()
54 SdrUndoAction
* OReportUndoFactory::CreateUndoMoveObject( SdrObject
& rObject
)
56 return m_pUndoFactory
->CreateUndoMoveObject( rObject
);
59 SdrUndoAction
* OReportUndoFactory::CreateUndoMoveObject( SdrObject
& rObject
, const Size
& rDist
)
61 return m_pUndoFactory
->CreateUndoMoveObject( rObject
, rDist
);
64 SdrUndoAction
* OReportUndoFactory::CreateUndoGeoObject( SdrObject
& rObject
)
66 return m_pUndoFactory
->CreateUndoGeoObject( rObject
);
69 SdrUndoAction
* OReportUndoFactory::CreateUndoAttrObject( SdrObject
& rObject
, bool bStyleSheet1
, bool bSaveText
)
71 return m_pUndoFactory
->CreateUndoAttrObject( rObject
, bStyleSheet1
, bSaveText
);
74 SdrUndoAction
* OReportUndoFactory::CreateUndoRemoveObject( SdrObject
& rObject
, bool bOrdNumDirect
)
76 return m_pUndoFactory
->CreateUndoRemoveObject( rObject
, bOrdNumDirect
);
79 SdrUndoAction
* OReportUndoFactory::CreateUndoInsertObject( SdrObject
& rObject
, bool /*bOrdNumDirect*/ )
81 return lcl_createUndo(rObject
,rptui::Inserted
,RID_STR_UNDO_INSERT_CONTROL
);
84 SdrUndoAction
* OReportUndoFactory::CreateUndoDeleteObject( SdrObject
& rObject
, bool /*bOrdNumDirect*/ )
86 return lcl_createUndo(rObject
,rptui::Removed
,RID_STR_UNDO_DELETE_CONTROL
);
89 SdrUndoAction
* OReportUndoFactory::CreateUndoNewObject( SdrObject
& rObject
, bool /*bOrdNumDirect*/ )
91 return lcl_createUndo(rObject
,rptui::Inserted
,RID_STR_UNDO_INSERT_CONTROL
);
94 SdrUndoAction
* OReportUndoFactory::CreateUndoCopyObject( SdrObject
& rObject
, bool bOrdNumDirect
)
96 return m_pUndoFactory
->CreateUndoCopyObject( rObject
, bOrdNumDirect
);
99 SdrUndoAction
* OReportUndoFactory::CreateUndoObjectOrdNum( SdrObject
& rObject
, sal_uInt32 nOldOrdNum1
, sal_uInt32 nNewOrdNum1
)
101 return m_pUndoFactory
->CreateUndoObjectOrdNum( rObject
, nOldOrdNum1
, nNewOrdNum1
);
104 SdrUndoAction
* OReportUndoFactory::CreateUndoReplaceObject( SdrObject
& rOldObject
, SdrObject
& rNewObject
, bool bOrdNumDirect
)
106 return m_pUndoFactory
->CreateUndoReplaceObject( rOldObject
, rNewObject
, bOrdNumDirect
);
109 SdrUndoAction
* OReportUndoFactory::CreateUndoObjectLayerChange( SdrObject
& rObject
, SdrLayerID aOldLayer
, SdrLayerID aNewLayer
)
111 return m_pUndoFactory
->CreateUndoObjectLayerChange( rObject
, aOldLayer
, aNewLayer
);
114 SdrUndoAction
* OReportUndoFactory::CreateUndoObjectSetText( SdrObject
& rNewObj
, sal_Int32 nText
)
116 return m_pUndoFactory
->CreateUndoObjectSetText( rNewObj
, nText
);
120 SdrUndoAction
* OReportUndoFactory::CreateUndoNewLayer(sal_uInt16 nLayerNum
, SdrLayerAdmin
& rNewLayerAdmin
, SdrModel
& rNewModel
)
122 return m_pUndoFactory
->CreateUndoNewLayer( nLayerNum
, rNewLayerAdmin
, rNewModel
);
125 SdrUndoAction
* OReportUndoFactory::CreateUndoDeleteLayer(sal_uInt16 nLayerNum
, SdrLayerAdmin
& rNewLayerAdmin
, SdrModel
& rNewModel
)
127 return m_pUndoFactory
->CreateUndoDeleteLayer( nLayerNum
, rNewLayerAdmin
, rNewModel
);
130 SdrUndoAction
* OReportUndoFactory::CreateUndoMoveLayer(sal_uInt16 nLayerNum
, SdrLayerAdmin
& rNewLayerAdmin
, SdrModel
& rNewModel
, sal_uInt16 nNeuPos1
)
132 return m_pUndoFactory
->CreateUndoMoveLayer( nLayerNum
, rNewLayerAdmin
, rNewModel
, nNeuPos1
);
136 SdrUndoAction
* OReportUndoFactory::CreateUndoDeletePage(SdrPage
& rPage
)
138 return m_pUndoFactory
->CreateUndoDeletePage( rPage
);
141 SdrUndoAction
* OReportUndoFactory::CreateUndoNewPage(SdrPage
& rPage
)
143 return m_pUndoFactory
->CreateUndoNewPage( rPage
);
146 SdrUndoAction
* OReportUndoFactory::CreateUndoCopyPage(SdrPage
& rPage
)
148 return m_pUndoFactory
->CreateUndoCopyPage( rPage
);
151 SdrUndoAction
* OReportUndoFactory::CreateUndoSetPageNum(SdrPage
& rNewPg
, sal_uInt16 nOldPageNum1
, sal_uInt16 nNewPageNum1
)
153 return m_pUndoFactory
->CreateUndoSetPageNum( rNewPg
, nOldPageNum1
, nNewPageNum1
);
156 SdrUndoAction
* OReportUndoFactory::CreateUndoPageRemoveMasterPage(SdrPage
& rChangedPage
)
158 return m_pUndoFactory
->CreateUndoPageRemoveMasterPage( rChangedPage
);
161 SdrUndoAction
* OReportUndoFactory::CreateUndoPageChangeMasterPage(SdrPage
& rChangedPage
)
163 return m_pUndoFactory
->CreateUndoPageChangeMasterPage(rChangedPage
);
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */