LibreOffice Module svx (master) 1
tableshape.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#include <sal/config.h>
21
23#include "shapeimpl.hxx"
25#include <svx/unoshprp.hxx>
26#include <svx/svdotable.hxx>
27#include <svx/svdpool.hxx>
28
29
30using namespace ::osl;
31using namespace ::cppu;
32using namespace sdr::table;
33using namespace ::com::sun::star;
34using namespace ::com::sun::star::uno;
35using namespace ::com::sun::star::lang;
36using namespace ::com::sun::star::container;
37using namespace ::com::sun::star::beans;
38
40: SvxShape( pObj, getSvxMapProvider().GetMap(SVXMAP_TABLE), getSvxMapProvider().GetPropertySet(SVXMAP_TABLE, SdrObject::GetGlobalDrawObjectItemPool()) )
41{
42 SetShapeType( "com.sun.star.drawing.TableShape" );
43}
44
46{
47}
48
50 const OUString& rName,
51 const SfxItemPropertyMapEntry* pProperty,
52 const css::uno::Any& rValue )
53{
54 switch( pProperty->nWID )
55 {
57 {
58 Reference< XIndexAccess > xTemplate;
59
60 if( !(rValue >>= xTemplate) )
61 throw IllegalArgumentException();
62
63 if( HasSdrObject() )
64 static_cast< sdr::table::SdrTableObj* >( GetSdrObject() )->setTableStyle(xTemplate);
65
66 return true;
67 }
74 {
75 if( HasSdrObject() )
76 {
77 TableStyleSettings aSettings( static_cast< sdr::table::SdrTableObj* >( GetSdrObject() )->getTableStyleSettings() );
78
79 switch( pProperty->nWID )
80 {
81 case OWN_ATTR_TABLETEMPLATE_FIRSTROW: rValue >>= aSettings.mbUseFirstRow; break;
82 case OWN_ATTR_TABLETEMPLATE_LASTROW: rValue >>= aSettings.mbUseLastRow; break;
83 case OWN_ATTR_TABLETEMPLATE_FIRSTCOLUMN: rValue >>= aSettings.mbUseFirstColumn; break;
84 case OWN_ATTR_TABLETEMPLATE_LASTCOLUMN: rValue >>= aSettings.mbUseLastColumn; break;
85 case OWN_ATTR_TABLETEMPLATE_BANDINGROWS: rValue >>= aSettings.mbUseRowBanding; break;
86 case OWN_ATTR_TABLETEMPLATE_BANDINGCOLUMNS: rValue >>= aSettings.mbUseColumnBanding; break;
87 }
88
89 static_cast< sdr::table::SdrTableObj* >( GetSdrObject() )->setTableStyleSettings(aSettings);
90 }
91
92 return true;
93 }
94 default:
95 {
96 return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
97 }
98 }
99}
100
102 const OUString& rName,
103 const SfxItemPropertyMapEntry* pProperty,
104 css::uno::Any& rValue )
105{
106 switch( pProperty->nWID )
107 {
109 {
110 if( HasSdrObject() )
111 {
112 rValue <<= static_cast< sdr::table::SdrTableObj* >( GetSdrObject() )->getTable();
113 }
114 return true;
115 }
117 {
118 if( HasSdrObject() )
119 {
120 rValue <<= static_cast< sdr::table::SdrTableObj* >( GetSdrObject() )->getTableStyle();
121 }
122 return true;
123 }
125 {
126 if( HasSdrObject() )
127 {
129 rValue <<= aGraphic.GetXGraphic();
130 }
131 return true;
132 }
139 {
140 if( HasSdrObject() )
141 {
142 TableStyleSettings aSettings( static_cast< sdr::table::SdrTableObj* >( GetSdrObject() )->getTableStyleSettings() );
143
144 switch( pProperty->nWID )
145 {
146 case OWN_ATTR_TABLETEMPLATE_FIRSTROW: rValue <<= aSettings.mbUseFirstRow; break;
147 case OWN_ATTR_TABLETEMPLATE_LASTROW: rValue <<= aSettings.mbUseLastRow; break;
148 case OWN_ATTR_TABLETEMPLATE_FIRSTCOLUMN: rValue <<= aSettings.mbUseFirstColumn; break;
149 case OWN_ATTR_TABLETEMPLATE_LASTCOLUMN: rValue <<= aSettings.mbUseLastColumn; break;
150 case OWN_ATTR_TABLETEMPLATE_BANDINGROWS: rValue <<= aSettings.mbUseRowBanding; break;
151 case OWN_ATTR_TABLETEMPLATE_BANDINGCOLUMNS: rValue <<= aSettings.mbUseColumnBanding; break;
152 }
153 }
154
155 return true;
156 }
157 default:
158 {
159 return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
160 }
161 }
162}
163
165{
167 if( HasSdrObject() )
168 static_cast< sdr::table::SdrTableObj* >( GetSdrObject() )->uno_lock();
169}
170
172{
173 if( HasSdrObject() )
174 static_cast< sdr::table::SdrTableObj* >( GetSdrObject() )->uno_unlock();
176}
177
178/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Graphic SvxGetGraphicForShape(SdrObject &rShape)
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
Abstract DrawObject.
Definition: svdobj.hxx:260
virtual bool getPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, css::uno::Any &rValue)
Definition: unoshape.cxx:2542
virtual void lock()
called from the XActionLockable interface methods on initial locking
Definition: unoshape.cxx:3687
bool HasSdrObject() const
Definition: unoshape.hxx:173
void SetShapeType(const OUString &ShapeType)
Definition: unoshape.hxx:175
virtual void unlock()
called from the XActionLockable interface methods on final unlock
Definition: unoshape.cxx:3693
SdrObject * GetSdrObject() const
Definition: unoshape.hxx:172
virtual bool setPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, const css::uno::Any &rValue)
Definition: unoshape.cxx:2026
virtual void unlock() override
called from the XActionLockable interface methods on final unlock
Definition: tableshape.cxx:171
virtual void lock() override
called from the XActionLockable interface methods on initial locking
Definition: tableshape.cxx:164
virtual ~SvxTableShape() noexcept override
Definition: tableshape.cxx:45
virtual bool getPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, css::uno::Any &rValue) override
Definition: tableshape.cxx:101
SvxTableShape(SdrObject *pObj)
Definition: tableshape.cxx:39
virtual bool setPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, const css::uno::Any &rValue) override
Definition: tableshape.cxx:49
SvxUnoPropertyMapProvider & getSvxMapProvider()
Definition: unoprov.cxx:868
TableStyleSettings.
Definition: svdotable.hxx:75
#define SVXMAP_TABLE
Definition: unoprov.hxx:75
#define OWN_ATTR_TABLETEMPLATE
Definition: unoshprp.hxx:138
#define OWN_ATTR_OLEMODEL
Definition: unoshprp.hxx:103
#define OWN_ATTR_TABLETEMPLATE_BANDINGCOLUMNS
Definition: unoshprp.hxx:144
#define OWN_ATTR_REPLACEMENT_GRAPHIC
reuse attr slots for GraphicObject which will never be used together with graphic object
Definition: unoshprp.hxx:119
#define OWN_ATTR_TABLETEMPLATE_BANDINGROWS
Definition: unoshprp.hxx:143
#define OWN_ATTR_TABLETEMPLATE_FIRSTCOLUMN
Definition: unoshprp.hxx:141
#define OWN_ATTR_TABLETEMPLATE_FIRSTROW
Definition: unoshprp.hxx:139
#define OWN_ATTR_TABLETEMPLATE_LASTCOLUMN
Definition: unoshprp.hxx:142
#define OWN_ATTR_TABLETEMPLATE_LASTROW
Definition: unoshprp.hxx:140