LibreOffice Module reportdesign (master) 1
ReportUndoFactory.cxx
Go to the documentation of this file.
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 <strings.hrc>
23
24namespace rptui
25{
26 using namespace ::com::sun::star;
27
28static std::unique_ptr<SdrUndoAction> lcl_createUndo(SdrObject& rObject, Action _eAction, TranslateId pCommentId)
29{
30 OObjectBase* pObj = dynamic_cast<OObjectBase*>(&rObject);
31 if ( !pObj )
32 return nullptr;
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 if ( xGroup.is() )
37 return std::make_unique<OUndoGroupSectionAction>(rObject.getSdrModelFromSdrObject(),_eAction,OGroupHelper::getMemberFunction(xSection),xGroup,xReportComponent,pCommentId);
38 else
39 return std::make_unique<OUndoReportSectionAction>(rObject.getSdrModelFromSdrObject(),_eAction,OReportHelper::getMemberFunction(xSection),xSection->getReportDefinition(),xReportComponent,pCommentId);
40}
41
42
44{
45}
46
48{
49}
50
51std::unique_ptr<SdrUndoAction> OReportUndoFactory::CreateUndoMoveObject( SdrObject& rObject, const Size& rDist )
52{
53 return m_pUndoFactory->CreateUndoMoveObject( rObject, rDist );
54}
55
56std::unique_ptr<SdrUndoAction> OReportUndoFactory::CreateUndoGeoObject( SdrObject& rObject )
57{
58 return m_pUndoFactory->CreateUndoGeoObject( rObject );
59}
60
61std::unique_ptr<SdrUndoAction> OReportUndoFactory::CreateUndoAttrObject( SdrObject& rObject, bool bStyleSheet1, bool bSaveText )
62{
63 return m_pUndoFactory->CreateUndoAttrObject( rObject, bStyleSheet1, bSaveText );
64}
65
66std::unique_ptr<SdrUndoAction> OReportUndoFactory::CreateUndoRemoveObject(SdrObject& rObject)
67{
68 return m_pUndoFactory->CreateUndoRemoveObject(rObject);
69}
70
71std::unique_ptr<SdrUndoAction> OReportUndoFactory::CreateUndoInsertObject( SdrObject& rObject, bool /*bOrdNumDirect*/ )
72{
73 return lcl_createUndo(rObject,rptui::Inserted,RID_STR_UNDO_INSERT_CONTROL);
74}
75
76std::unique_ptr<SdrUndoAction> OReportUndoFactory::CreateUndoDeleteObject( SdrObject& rObject, bool /*bOrdNumDirect*/ )
77{
78 return lcl_createUndo(rObject,rptui::Removed,RID_STR_UNDO_DELETE_CONTROL);
79}
80
81std::unique_ptr<SdrUndoAction> OReportUndoFactory::CreateUndoNewObject( SdrObject& rObject, bool /*bOrdNumDirect*/ )
82{
83 return lcl_createUndo(rObject,rptui::Inserted,RID_STR_UNDO_INSERT_CONTROL);
84}
85
86std::unique_ptr<SdrUndoAction> OReportUndoFactory::CreateUndoCopyObject( SdrObject& rObject, bool bOrdNumDirect )
87{
88 return m_pUndoFactory->CreateUndoCopyObject( rObject, bOrdNumDirect );
89}
90
91std::unique_ptr<SdrUndoAction> OReportUndoFactory::CreateUndoObjectOrdNum( SdrObject& rObject, sal_uInt32 nOldOrdNum1, sal_uInt32 nNewOrdNum1)
92{
93 return m_pUndoFactory->CreateUndoObjectOrdNum( rObject, nOldOrdNum1, nNewOrdNum1 );
94}
95
96std::unique_ptr<SdrUndoAction> OReportUndoFactory::CreateUndoReplaceObject( SdrObject& rOldObject, SdrObject& rNewObject )
97{
98 return m_pUndoFactory->CreateUndoReplaceObject( rOldObject, rNewObject );
99}
100
101std::unique_ptr<SdrUndoAction> OReportUndoFactory::CreateUndoObjectLayerChange( SdrObject& rObject, SdrLayerID aOldLayer, SdrLayerID aNewLayer )
102{
103 return m_pUndoFactory->CreateUndoObjectLayerChange( rObject, aOldLayer, aNewLayer );
104}
105
106std::unique_ptr<SdrUndoAction> OReportUndoFactory::CreateUndoObjectSetText( SdrObject& rNewObj, sal_Int32 nText )
107{
108 return m_pUndoFactory->CreateUndoObjectSetText( rNewObj, nText );
109}
110
111// layer
112std::unique_ptr<SdrUndoAction> OReportUndoFactory::CreateUndoNewLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel)
113{
114 return m_pUndoFactory->CreateUndoNewLayer( nLayerNum, rNewLayerAdmin, rNewModel );
115}
116
117std::unique_ptr<SdrUndoAction> OReportUndoFactory::CreateUndoDeleteLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel)
118{
119 return m_pUndoFactory->CreateUndoDeleteLayer( nLayerNum, rNewLayerAdmin, rNewModel );
120}
121
122// page
123std::unique_ptr<SdrUndoAction> OReportUndoFactory::CreateUndoDeletePage(SdrPage& rPage)
124{
125 return m_pUndoFactory->CreateUndoDeletePage(rPage);
126}
127
128std::unique_ptr<SdrUndoAction> OReportUndoFactory::CreateUndoNewPage(SdrPage& rPage)
129{
130 return m_pUndoFactory->CreateUndoNewPage( rPage );
131}
132
133std::unique_ptr<SdrUndoAction> OReportUndoFactory::CreateUndoCopyPage(SdrPage& rPage)
134{
135 return m_pUndoFactory->CreateUndoCopyPage( rPage );
136}
137
138std::unique_ptr<SdrUndoAction> OReportUndoFactory::CreateUndoSetPageNum(SdrPage& rNewPg, sal_uInt16 nOldPageNum1, sal_uInt16 nNewPageNum1)
139{
140 return m_pUndoFactory->CreateUndoSetPageNum( rNewPg, nOldPageNum1, nNewPageNum1 );
141}
142 // master page
143std::unique_ptr<SdrUndoAction> OReportUndoFactory::CreateUndoPageRemoveMasterPage(SdrPage& rChangedPage)
144{
145 return m_pUndoFactory->CreateUndoPageRemoveMasterPage( rChangedPage );
146}
147
148std::unique_ptr<SdrUndoAction> OReportUndoFactory::CreateUndoPageChangeMasterPage(SdrPage& rChangedPage)
149{
150 return m_pUndoFactory->CreateUndoPageChangeMasterPage(rChangedPage);
151}
152
153
154} //rptui
155
156
157/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SdrModel & getSdrModelFromSdrObject() const
static ::std::function< css::uno::Reference< css::report::XSection >(OGroupHelper *)> getMemberFunction(const css::uno::Reference< css::report::XSection > &_xSection)
Definition: UndoActions.cxx:46
static ::std::function< css::uno::Reference< css::report::XSection >(OReportHelper *)> getMemberFunction(const css::uno::Reference< css::report::XSection > &_xSection)
Definition: UndoActions.cxx:55
virtual std::unique_ptr< SdrUndoAction > CreateUndoCopyPage(SdrPage &rPage) override
virtual std::unique_ptr< SdrUndoAction > CreateUndoAttrObject(SdrObject &rObject, bool bStyleSheet1=false, bool bSaveText=false) override
virtual std::unique_ptr< SdrUndoAction > CreateUndoMoveObject(SdrObject &rObject, const Size &rDist) override
virtual std::unique_ptr< SdrUndoAction > CreateUndoSetPageNum(SdrPage &rNewPg, sal_uInt16 nOldPageNum1, sal_uInt16 nNewPageNum1) override
virtual std::unique_ptr< SdrUndoAction > CreateUndoCopyObject(SdrObject &rObject, bool bOrdNumDirect=false) override
virtual std::unique_ptr< SdrUndoAction > CreateUndoObjectOrdNum(SdrObject &rObject, sal_uInt32 nOldOrdNum1, sal_uInt32 nNewOrdNum1) override
virtual std::unique_ptr< SdrUndoAction > CreateUndoObjectLayerChange(SdrObject &rObject, SdrLayerID aOldLayer, SdrLayerID aNewLayer) override
virtual std::unique_ptr< SdrUndoAction > CreateUndoPageChangeMasterPage(SdrPage &rChangedPage) override
virtual std::unique_ptr< SdrUndoAction > CreateUndoNewPage(SdrPage &rPage) override
virtual std::unique_ptr< SdrUndoAction > CreateUndoNewObject(SdrObject &rObject, bool bOrdNumDirect=false) override
::std::unique_ptr< SdrUndoFactory > m_pUndoFactory
virtual std::unique_ptr< SdrUndoAction > CreateUndoDeleteLayer(sal_uInt16 nLayerNum, SdrLayerAdmin &rNewLayerAdmin, SdrModel &rNewModel) override
virtual std::unique_ptr< SdrUndoAction > CreateUndoObjectSetText(SdrObject &rNewObj, sal_Int32 nText) override
virtual std::unique_ptr< SdrUndoAction > CreateUndoGeoObject(SdrObject &rObject) override
virtual ~OReportUndoFactory() override
virtual std::unique_ptr< SdrUndoAction > CreateUndoRemoveObject(SdrObject &rObject) override
virtual std::unique_ptr< SdrUndoAction > CreateUndoInsertObject(SdrObject &rObject, bool bOrdNumDirect=false) override
virtual std::unique_ptr< SdrUndoAction > CreateUndoDeletePage(SdrPage &rPage) override
virtual std::unique_ptr< SdrUndoAction > CreateUndoReplaceObject(SdrObject &rOldObject, SdrObject &rNewObject) override
virtual std::unique_ptr< SdrUndoAction > CreateUndoPageRemoveMasterPage(SdrPage &rChangedPage) override
virtual std::unique_ptr< SdrUndoAction > CreateUndoDeleteObject(SdrObject &rObject, bool bOrdNumDirect=false) override
virtual std::unique_ptr< SdrUndoAction > CreateUndoNewLayer(sal_uInt16 nLayerNum, SdrLayerAdmin &rNewLayerAdmin, SdrModel &rNewModel) override
@ Inserted
Definition: UndoActions.hxx:42
static std::unique_ptr< SdrUndoAction > lcl_createUndo(SdrObject &rObject, Action _eAction, TranslateId pCommentId)