LibreOffice Module svx (master) 1
cube3d.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
20
21#include <svx/strings.hrc>
22#include <svx/deflt3d.hxx>
23#include <svx/dialmgr.hxx>
24#include <svx/cube3d.hxx>
25#include <svx/svdobjkind.hxx>
28
29
30// DrawContact section
31
32std::unique_ptr<sdr::contact::ViewContact> E3dCubeObj::CreateObjectSpecificViewContact()
33{
34 return std::make_unique<sdr::contact::ViewContactOfE3dCube>(*this);
35}
36
37
39 SdrModel& rSdrModel,
40 const E3dDefaultAttributes& rDefault,
41 const basegfx::B3DPoint& aPos,
42 const basegfx::B3DVector& r3DSize)
43: E3dCompoundObject(rSdrModel)
44{
45 // Set Defaults
46 SetDefaultAttributes(rDefault);
47
48 // position centre or left, bottom, back (dependent on bPosIsCenter)
49 aCubePos = aPos;
50 aCubeSize = r3DSize;
51}
52
54: E3dCompoundObject(rSdrModel)
55{
56 // Set Defaults
57 const E3dDefaultAttributes aDefault;
58
59 SetDefaultAttributes(aDefault);
60}
61
62E3dCubeObj::E3dCubeObj(SdrModel& rSdrModel, E3dCubeObj const & rSource)
63: E3dCompoundObject(rSdrModel, rSource)
64{
65 // Set Defaults
66 const E3dDefaultAttributes aDefault;
67
68 SetDefaultAttributes(aDefault);
69
70 aCubePos = rSource.aCubePos;
71 aCubeSize = rSource.aCubeSize;
72 bPosIsCenter = rSource.bPosIsCenter;
73}
74
76{
77}
78
79void E3dCubeObj::SetDefaultAttributes(const E3dDefaultAttributes& rDefault)
80{
81 aCubePos = rDefault.GetDefaultCubePos();
82 aCubeSize = rDefault.GetDefaultCubeSize();
83 bPosIsCenter = rDefault.GetDefaultCubePosIsCenter();
84}
85
87{
89}
90
91// Convert the object into a group object consisting of 6 polygons
92
93rtl::Reference<SdrObject> E3dCubeObj::DoConvertToPolyObj(bool /*bBezier*/, bool /*bAddText*/) const
94{
95 return nullptr;
96}
97
99{
100 return new E3dCubeObj(rTargetModel, *this);
101}
102
103// Set local parameters with geometry re-creating
104
106{
107 if(aCubePos != rNew)
108 {
109 aCubePos = rNew;
111 }
112}
113
115{
116 if(aCubeSize != rNew)
117 {
118 aCubeSize = rNew;
120 }
121}
122
124{
125 if(bPosIsCenter != bNew)
126 {
127 bPosIsCenter = bNew;
129 }
130}
131
132// Get the name of the object (singular)
133
135{
136 OUString sName = SvxResId(STR_ObjNameSingulCube3d);
137
138 OUString aName(GetName());
139 if (!aName.isEmpty())
140 {
141 sName += " \'" + aName + "'";
142 }
143 return sName;
144}
145
146// Get the name of the object (plural)
147
149{
150 return SvxResId(STR_ObjNamePluralCube3d);
151}
152
153/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetCubeSize(const basegfx::B3DVector &rNew)
Definition: cube3d.cxx:114
virtual OUString TakeObjNamePlural() const override
Definition: cube3d.cxx:148
virtual rtl::Reference< SdrObject > DoConvertToPolyObj(bool bBezier, bool bAddText) const override
Definition: cube3d.cxx:93
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: cube3d.cxx:32
virtual rtl::Reference< SdrObject > CloneSdrObject(SdrModel &rTargetModel) const override
Definition: cube3d.cxx:98
void SetPosIsCenter(bool bNew)
Definition: cube3d.cxx:123
basegfx::B3DVector aCubeSize
Definition: cube3d.hxx:51
void SetDefaultAttributes(const E3dDefaultAttributes &rDefault)
Definition: cube3d.cxx:79
void SetCubePos(const basegfx::B3DPoint &rNew)
Definition: cube3d.cxx:105
virtual SdrObjKind GetObjIdentifier() const override
Definition: cube3d.cxx:86
virtual ~E3dCubeObj() override
Definition: cube3d.cxx:75
basegfx::B3DPoint aCubePos
Definition: cube3d.hxx:50
bool bPosIsCenter
Definition: cube3d.hxx:54
virtual OUString TakeObjNameSingul() const override
Definition: cube3d.cxx:134
E3dCubeObj(SdrModel &rSdrModel, const E3dDefaultAttributes &rDefault, const basegfx::B3DPoint &aPos, const basegfx::B3DVector &r3DSize)
Definition: cube3d.cxx:38
void ActionChanged() const
Definition: svdobj.cxx:273
virtual const OUString & GetName() const
Definition: svdobj.cxx:771
OUString SvxResId(TranslateId aId)
Definition: dialmgr.cxx:24
OUString sName
OUString aName
SdrObjKind
Definition: svdobjkind.hxx:25