LibreOffice Module svx (master) 1
tabledesign.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 <com/sun/star/style/XStyle.hpp>
22#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
23#include <com/sun/star/lang/XServiceInfo.hpp>
24#include <com/sun/star/lang/XComponent.hpp>
25#include <com/sun/star/lang/XSingleServiceFactory.hpp>
26#include <com/sun/star/container/XIndexReplace.hpp>
27#include <com/sun/star/container/XNameContainer.hpp>
28#include <com/sun/star/beans/XPropertySet.hpp>
29#include <com/sun/star/util/XModifiable.hpp>
30#include <com/sun/star/util/XModifyListener.hpp>
31#include <com/sun/star/form/XReset.hpp>
32
33#include <vcl/svapp.hxx>
34
40
42#include <svx/dialmgr.hxx>
43#include <svx/strings.hrc>
44
45#include "sdrtableobjimpl.hxx"
46
47#include <vector>
48#include <map>
49
50
51using namespace css;
52using namespace ::com::sun::star::uno;
53using namespace ::com::sun::star::style;
54using namespace ::com::sun::star::lang;
55using namespace ::com::sun::star::beans;
56using namespace ::com::sun::star::util;
57using namespace ::com::sun::star::container;
58
59namespace sdr::table {
60
61typedef std::map< OUString, sal_Int32 > CellStyleNameMap;
62
63typedef ::comphelper::WeakComponentImplHelper< XStyle, XNameReplace, XServiceInfo, XIndexReplace, XModifiable, XModifyListener, XPropertySet > TableDesignStyleBase;
64
65namespace {
66
67class TableDesignStyle : public TableDesignStyleBase
68{
69public:
70 TableDesignStyle();
71
72 // XServiceInfo
73 virtual OUString SAL_CALL getImplementationName() override;
74 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
75 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
76
77 // XStyle
78 virtual sal_Bool SAL_CALL isUserDefined() override;
79 virtual sal_Bool SAL_CALL isInUse() override;
80 virtual OUString SAL_CALL getParentStyle() override;
81 virtual void SAL_CALL setParentStyle( const OUString& aParentStyle ) override;
82
83 // XNamed
84 virtual OUString SAL_CALL getName() override;
85 virtual void SAL_CALL setName( const OUString& aName ) override;
86
87 // XNameAccess
88 virtual Any SAL_CALL getByName( const OUString& aName ) override;
89 virtual Sequence< OUString > SAL_CALL getElementNames() override;
90 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
91
92 // XElementAccess
93 virtual css::uno::Type SAL_CALL getElementType() override;
94 virtual sal_Bool SAL_CALL hasElements() override;
95
96 // XIndexAccess
97 virtual sal_Int32 SAL_CALL getCount() override ;
98 virtual Any SAL_CALL getByIndex( sal_Int32 Index ) override;
99
100 // XIndexReplace
101 virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const Any& Element ) override;
102
103 // XNameReplace
104 virtual void SAL_CALL replaceByName( const OUString& aName, const Any& aElement ) override;
105
106 // XPropertySet
107 virtual Reference<XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
108 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const Any& aValue ) override;
109 virtual Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
110 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const Reference<XPropertyChangeListener>& xListener ) override;
111 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const Reference<XPropertyChangeListener>& aListener ) override;
112 virtual void SAL_CALL addVetoableChangeListener(const OUString& PropertyName, const Reference<XVetoableChangeListener>& aListener ) override;
113 virtual void SAL_CALL removeVetoableChangeListener(const OUString& PropertyName,const Reference<XVetoableChangeListener>&aListener ) override;
114
115 // XModifiable
116 virtual sal_Bool SAL_CALL isModified() override;
117 virtual void SAL_CALL setModified( sal_Bool bModified ) override;
118
119 // XModifyBroadcaster
120 virtual void SAL_CALL addModifyListener( const Reference< XModifyListener >& aListener ) override;
121 virtual void SAL_CALL removeModifyListener( const Reference< XModifyListener >& aListener ) override;
122
123 // XModifyListener
124 virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override;
125 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
126
127 void notifyModifyListener();
128 void resetUserDefined();
129
130 // this function is called upon disposing the component
131 virtual void disposing(std::unique_lock<std::mutex>& aGuard) override;
132
133 static const CellStyleNameMap& getCellStyleNameMap();
134
136 OUString msName;
137 Reference< XStyle > maCellStyles[style_count];
139};
140
141}
142
143typedef std::vector< Reference< XStyle > > TableDesignStyleVector;
144
145namespace {
146
147class TableDesignFamily : public ::cppu::WeakImplHelper< XNameContainer, XNamed, XIndexAccess, XSingleServiceFactory, XServiceInfo, XComponent, XPropertySet, form::XReset >
148{
149public:
150 // XServiceInfo
151 virtual OUString SAL_CALL getImplementationName() override;
152 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
153 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
154
155 // XNamed
156 virtual OUString SAL_CALL getName( ) override;
157 virtual void SAL_CALL setName( const OUString& aName ) override;
158
159 // XNameAccess
160 virtual Any SAL_CALL getByName( const OUString& aName ) override;
161 virtual Sequence< OUString > SAL_CALL getElementNames() override;
162 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
163
164 // XElementAccess
165 virtual Type SAL_CALL getElementType() override;
166 virtual sal_Bool SAL_CALL hasElements() override;
167
168 // XIndexAccess
169 virtual sal_Int32 SAL_CALL getCount() override ;
170 virtual Any SAL_CALL getByIndex( sal_Int32 Index ) override;
171
172 // XNameContainer
173 virtual void SAL_CALL insertByName( const OUString& aName, const Any& aElement ) override;
174 virtual void SAL_CALL removeByName( const OUString& Name ) override;
175
176 // XNameReplace
177 virtual void SAL_CALL replaceByName( const OUString& aName, const Any& aElement ) override;
178
179 // XSingleServiceFactory
180 virtual Reference< XInterface > SAL_CALL createInstance( ) override;
181 virtual Reference< XInterface > SAL_CALL createInstanceWithArguments( const Sequence< Any >& aArguments ) override;
182
183 // XComponent
184 virtual void SAL_CALL dispose( ) override;
185 virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) override;
186 virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) override;
187
188 // XPropertySet
189 virtual Reference<XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
190 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const Any& aValue ) override;
191 virtual Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
192 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const Reference<XPropertyChangeListener>& xListener ) override;
193 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const Reference<XPropertyChangeListener>& aListener ) override;
194 virtual void SAL_CALL addVetoableChangeListener(const OUString& PropertyName, const Reference<XVetoableChangeListener>& aListener ) override;
195 virtual void SAL_CALL removeVetoableChangeListener(const OUString& PropertyName,const Reference<XVetoableChangeListener>&aListener ) override;
196
197 // XReset
198 virtual void SAL_CALL reset() override;
199 virtual void SAL_CALL addResetListener( const Reference<form::XResetListener>& aListener ) override;
200 virtual void SAL_CALL removeResetListener( const Reference<form::XResetListener>& aListener ) override;
201
203};
204
205}
206
207TableDesignStyle::TableDesignStyle()
208 : mbUserDefined(true)
209 , mbModified(false)
210{
211}
212
213const CellStyleNameMap& TableDesignStyle::getCellStyleNameMap()
214{
215 static CellStyleNameMap const aMap
216 {
217 { OUString( "first-row" ) , first_row_style },
218 { OUString( "last-row" ) , last_row_style },
219 { OUString( "first-column" ) , first_column_style },
220 { OUString( "last-column" ) , last_column_style },
221 { OUString( "body" ) , body_style },
222 { OUString( "even-rows" ) , even_rows_style },
223 { OUString( "odd-rows" ) , odd_rows_style },
224 { OUString( "even-columns" ) , even_columns_style },
225 { OUString( "odd-columns" ) , odd_columns_style },
226 { OUString( "background" ) , background_style },
227 };
228
229 return aMap;
230}
231
232// XServiceInfo
233OUString SAL_CALL TableDesignStyle::getImplementationName()
234{
235 return "TableDesignStyle";
236}
237
238sal_Bool SAL_CALL TableDesignStyle::supportsService( const OUString& ServiceName )
239{
240 return cppu::supportsService( this, ServiceName );
241}
242
243Sequence< OUString > SAL_CALL TableDesignStyle::getSupportedServiceNames()
244{
245 return { "com.sun.star.style.Style" };
246}
247
248// XStyle
249sal_Bool SAL_CALL TableDesignStyle::isUserDefined()
250{
251 return mbUserDefined;
252}
253
254void TableDesignStyle::resetUserDefined()
255{
256 mbUserDefined = false;
257}
258
259sal_Bool SAL_CALL TableDesignStyle::isInUse()
260{
261 std::unique_lock aGuard( m_aMutex );
262 if (maModifyListeners.getLength(aGuard))
263 {
265 while ( it.hasMoreElements() )
266 {
267 SdrTableObjImpl* pUser = dynamic_cast< SdrTableObjImpl* >( it.next().get() );
268 if( pUser && pUser->isInUse() )
269 return true;
270 }
271 }
272 return false;
273}
274
275
276OUString SAL_CALL TableDesignStyle::getParentStyle()
277{
278 return OUString();
279}
280
281
282void SAL_CALL TableDesignStyle::setParentStyle( const OUString& )
283{
284}
285
286
287// XNamed
288
289
290OUString SAL_CALL TableDesignStyle::getName()
291{
292 return msName;
293}
294
295
296void SAL_CALL TableDesignStyle::setName( const OUString& rName )
297{
298 msName = rName;
299}
300
301
302// XNameAccess
303
304
305Any SAL_CALL TableDesignStyle::getByName( const OUString& rName )
306{
307 const CellStyleNameMap& rMap = getCellStyleNameMap();
308
309 CellStyleNameMap::const_iterator iter = rMap.find( rName );
310 if( iter == rMap.end() )
311 throw NoSuchElementException();
312
313 return Any( maCellStyles[(*iter).second] );
314}
315
316
317Sequence< OUString > SAL_CALL TableDesignStyle::getElementNames()
318{
319 return comphelper::mapKeysToSequence( getCellStyleNameMap() );
320}
321
322
323sal_Bool SAL_CALL TableDesignStyle::hasByName( const OUString& rName )
324{
325 const CellStyleNameMap& rMap = getCellStyleNameMap();
326
327 CellStyleNameMap::const_iterator iter = rMap.find( rName );
328 return iter != rMap.end();
329}
330
331
332// XElementAccess
333
334
335Type SAL_CALL TableDesignStyle::getElementType()
336{
338}
339
340
341sal_Bool SAL_CALL TableDesignStyle::hasElements()
342{
343 return true;
344}
345
346
347// XIndexAccess
348
349
350sal_Int32 SAL_CALL TableDesignStyle::getCount()
351{
352 return style_count;
353}
354
355
356Any SAL_CALL TableDesignStyle::getByIndex( sal_Int32 Index )
357{
358 if( (Index < 0) || (Index >= style_count) )
359 throw IndexOutOfBoundsException();
360
361 std::unique_lock aGuard( m_aMutex );
362 return Any( maCellStyles[Index] );
363}
364
365
366// XIndexReplace
367
368void SAL_CALL TableDesignStyle::replaceByIndex( sal_Int32 Index, const Any& aElement )
369{
370 if( (Index < 0) || (Index >= style_count) )
371 throw IndexOutOfBoundsException();
372
373 const CellStyleNameMap& rMap = getCellStyleNameMap();
374 auto iter = std::find_if(rMap.begin(), rMap.end(),
375 [&Index](const auto& item) { return Index == item.second; });
376 if (iter != rMap.end())
377 replaceByName(iter->first, aElement);
378}
379
380
381// XNameReplace
382
383
384void SAL_CALL TableDesignStyle::replaceByName( const OUString& rName, const Any& aElement )
385{
386 const CellStyleNameMap& rMap = getCellStyleNameMap();
387 CellStyleNameMap::const_iterator iter = rMap.find( rName );
388 if( iter == rMap.end() )
389 throw NoSuchElementException();
390
391
392 Reference< XStyle > xNewStyle;
393 if( !(aElement >>= xNewStyle) )
394 throw IllegalArgumentException();
395
396 const sal_Int32 nIndex = (*iter).second;
397
398 std::unique_lock aGuard( m_aMutex );
399
400 Reference< XStyle > xOldStyle( maCellStyles[nIndex] );
401
402 if( xNewStyle == xOldStyle )
403 return;
404
405 Reference< XModifyListener > xListener( this );
406
407 // end listening to old style, if possible
408 Reference< XModifyBroadcaster > xOldBroadcaster( xOldStyle, UNO_QUERY );
409 if( xOldBroadcaster.is() )
410 xOldBroadcaster->removeModifyListener( xListener );
411
412 // start listening to new style, if possible
413 Reference< XModifyBroadcaster > xNewBroadcaster( xNewStyle, UNO_QUERY );
414 if( xNewBroadcaster.is() )
415 xNewBroadcaster->addModifyListener( xListener );
416
417 if (xNewStyle && xNewStyle->isUserDefined())
418 mbModified = true;
419
420 maCellStyles[nIndex] = xNewStyle;
421}
422
423
424// XComponent
425
426
427void TableDesignStyle::disposing(std::unique_lock<std::mutex>& aGuard)
428{
429 maModifyListeners.disposeAndClear(aGuard, EventObject(Reference<XComponent>(this)));
430
431 for(Reference<XStyle> & rCellStyle : maCellStyles)
432 {
433 Reference<XModifyBroadcaster> xBroadcaster(rCellStyle, UNO_QUERY);
434 if (xBroadcaster)
435 xBroadcaster->removeModifyListener(this);
436 rCellStyle.clear();
437 }
438}
439
440// XPropertySet
441
442Reference<XPropertySetInfo> TableDesignStyle::getPropertySetInfo()
443{
444 return {};
445}
446
447void TableDesignStyle::setPropertyValue( const OUString&, const Any& )
448{
449}
450
451Any TableDesignStyle::getPropertyValue( const OUString& PropertyName )
452{
453 if (PropertyName != "IsPhysical")
454 throw UnknownPropertyException("unknown property: " + PropertyName, getXWeak());
455
456 return Any(mbModified || mbUserDefined);
457}
458
459void TableDesignStyle::addPropertyChangeListener( const OUString&, const Reference<XPropertyChangeListener>& )
460{
461}
462
463void TableDesignStyle::removePropertyChangeListener( const OUString&, const Reference<XPropertyChangeListener>& )
464{
465}
466
467void TableDesignStyle::addVetoableChangeListener( const OUString&, const Reference<XVetoableChangeListener>& )
468{
469}
470
471void TableDesignStyle::removeVetoableChangeListener( const OUString&,const Reference<XVetoableChangeListener>& )
472{
473}
474
475// XModifiable
476
477sal_Bool TableDesignStyle::isModified()
478{
479 return mbModified;
480}
481
482void TableDesignStyle::setModified( sal_Bool bModified )
483{
484 mbModified = bModified;
485 notifyModifyListener();
486}
487
488
489// XModifyBroadcaster
490
491
492void SAL_CALL TableDesignStyle::addModifyListener( const Reference< XModifyListener >& xListener )
493{
494 std::unique_lock aGuard( m_aMutex );
495 if (m_bDisposed)
496 {
497 aGuard.unlock();
498 EventObject aEvt( getXWeak() );
499 xListener->disposing( aEvt );
500 }
501 else
502 {
503 maModifyListeners.addInterface( aGuard, xListener );
504 }
505}
506
507
508void SAL_CALL TableDesignStyle::removeModifyListener( const Reference< XModifyListener >& xListener )
509{
510 std::unique_lock aGuard( m_aMutex );
511 maModifyListeners.removeInterface( aGuard, xListener );
512}
513
514
515void TableDesignStyle::notifyModifyListener()
516{
517 std::unique_lock aGuard( m_aMutex );
518
519 if( maModifyListeners.getLength(aGuard) )
520 {
521 EventObject aEvt( getXWeak() );
523 [&] (Reference<XModifyListener> const& xListener)
524 { return xListener->modified(aEvt); });
525 }
526}
527
528
529// XModifyListener
530
531
532// if we get a modify hint from a style, notify all registered XModifyListener
533void SAL_CALL TableDesignStyle::modified( const css::lang::EventObject& )
534{
535 notifyModifyListener();
536}
537
538
539void SAL_CALL TableDesignStyle::disposing( const css::lang::EventObject& )
540{
541}
542
543
544// TableStyle
545
546
547// XServiceInfo
548OUString SAL_CALL TableDesignFamily::getImplementationName()
549{
550 return "TableDesignFamily";
551}
552
553sal_Bool SAL_CALL TableDesignFamily::supportsService( const OUString& ServiceName )
554{
555 return cppu::supportsService( this, ServiceName );
556}
557
558Sequence< OUString > SAL_CALL TableDesignFamily::getSupportedServiceNames()
559{
560 return { "com.sun.star.style.StyleFamily" };
561}
562
563// XNamed
564OUString SAL_CALL TableDesignFamily::getName()
565{
566 return "table";
567}
568
569void SAL_CALL TableDesignFamily::setName( const OUString& )
570{
571}
572
573// XNameAccess
574Any SAL_CALL TableDesignFamily::getByName( const OUString& rName )
575{
576 SolarMutexGuard aGuard;
577
578 auto iter = std::find_if(maDesigns.begin(), maDesigns.end(),
579 [&rName](const Reference<XStyle>& rpStyle) { return rpStyle->getName() == rName; });
580 if (iter != maDesigns.end())
581 return Any( (*iter) );
582
583 throw NoSuchElementException();
584}
585
586
587Sequence< OUString > SAL_CALL TableDesignFamily::getElementNames()
588{
589 SolarMutexGuard aGuard;
590
591 Sequence< OUString > aRet( maDesigns.size() );
592 OUString* pNames = aRet.getArray();
593
594 for( const auto& rpStyle : maDesigns )
595 *pNames++ = rpStyle->getName();
596
597 return aRet;
598}
599
600
601sal_Bool SAL_CALL TableDesignFamily::hasByName( const OUString& aName )
602{
603 SolarMutexGuard aGuard;
604
605 return std::any_of(maDesigns.begin(), maDesigns.end(),
606 [&aName](const Reference<XStyle>& rpStyle) { return rpStyle->getName() == aName; });
607}
608
609
610// XElementAccess
611
612
613Type SAL_CALL TableDesignFamily::getElementType()
614{
616}
617
618
619sal_Bool SAL_CALL TableDesignFamily::hasElements()
620{
621 SolarMutexGuard aGuard;
622
623 return !maDesigns.empty();
624}
625
626
627// XIndexAccess
628
629
630sal_Int32 SAL_CALL TableDesignFamily::getCount()
631{
632 SolarMutexGuard aGuard;
633
634 return sal::static_int_cast< sal_Int32 >( maDesigns.size() );
635}
636
637
638Any SAL_CALL TableDesignFamily::getByIndex( sal_Int32 Index )
639{
640 SolarMutexGuard aGuard;
641
642 if( (Index >= 0) && (Index < sal::static_int_cast< sal_Int32 >( maDesigns.size() ) ) )
643 return Any( maDesigns[Index] );
644
645 throw IndexOutOfBoundsException();
646}
647
648
649// XNameContainer
650
651
652void SAL_CALL TableDesignFamily::insertByName( const OUString& rName, const Any& rElement )
653{
654 SolarMutexGuard aGuard;
655
656 Reference< XStyle > xStyle( rElement, UNO_QUERY );
657 if( !xStyle.is() )
658 throw IllegalArgumentException();
659
660 xStyle->setName( rName );
661 if (std::any_of(maDesigns.begin(), maDesigns.end(),
662 [&rName](const Reference<XStyle>& rpStyle) { return rpStyle->getName() == rName; }))
663 throw ElementExistException();
664
665 maDesigns.push_back( xStyle );
666}
667
668
669void SAL_CALL TableDesignFamily::removeByName( const OUString& rName )
670{
671 SolarMutexGuard aGuard;
672
673 auto iter = std::find_if(maDesigns.begin(), maDesigns.end(),
674 [&rName](const Reference<XStyle>& rpStyle) { return rpStyle->getName() == rName; });
675 if (iter != maDesigns.end())
676 {
677 Reference<XComponent> xComponent(*iter, UNO_QUERY);
678 if (xComponent)
679 xComponent->dispose();
680 maDesigns.erase( iter );
681 return;
682 }
683
684 throw NoSuchElementException();
685}
686
687
688// XNameReplace
689
690
691void SAL_CALL TableDesignFamily::replaceByName( const OUString& rName, const Any& aElement )
692{
693 SolarMutexGuard aGuard;
694
695 Reference< XStyle > xStyle( aElement, UNO_QUERY );
696 if( !xStyle.is() )
697 throw IllegalArgumentException();
698
699 auto iter = std::find_if(maDesigns.begin(), maDesigns.end(),
700 [&rName](const Reference<XStyle>& rpStyle) { return rpStyle->getName() == rName; });
701 if (iter != maDesigns.end())
702 {
703 if (!(*iter)->isUserDefined())
704 static_cast<TableDesignStyle*>(xStyle.get())->resetUserDefined();
705
706 Reference<XComponent> xComponent(*iter, UNO_QUERY);
707 if (xComponent)
708 xComponent->dispose();
709 (*iter) = xStyle;
710 xStyle->setName( rName );
711 return;
712 }
713
714 throw NoSuchElementException();
715}
716
717
718// XSingleServiceFactory
719
720
721Reference< XInterface > SAL_CALL TableDesignFamily::createInstance()
722{
723 return Reference< XInterface >( static_cast< XStyle* >( new TableDesignStyle ) );
724}
725
726
727Reference< XInterface > SAL_CALL TableDesignFamily::createInstanceWithArguments( const Sequence< Any >& )
728{
729 return createInstance();
730}
731
732
733// XComponent
734
735
736void SAL_CALL TableDesignFamily::dispose( )
737{
738 TableDesignStyleVector aDesigns;
739 aDesigns.swap( maDesigns );
740
741 for( const auto& rStyle : aDesigns )
742 {
743 Reference< XComponent > xComp( rStyle, UNO_QUERY );
744 if( xComp.is() )
745 xComp->dispose();
746 }
747}
748
749
750void SAL_CALL TableDesignFamily::addEventListener( const Reference< XEventListener >& )
751{
752}
753
754
755void SAL_CALL TableDesignFamily::removeEventListener( const Reference< XEventListener >& )
756{
757}
758
759
760// XPropertySet
761
762
763Reference<XPropertySetInfo> TableDesignFamily::getPropertySetInfo()
764{
765 OSL_FAIL( "###unexpected!" );
766 return Reference<XPropertySetInfo>();
767}
768
769
770void TableDesignFamily::setPropertyValue( const OUString& , const Any& )
771{
772 OSL_FAIL( "###unexpected!" );
773}
774
775
776Any TableDesignFamily::getPropertyValue( const OUString& PropertyName )
777{
778 if ( PropertyName != "DisplayName" )
779 {
780 throw UnknownPropertyException( "unknown property: " + PropertyName, getXWeak() );
781 }
782
783 OUString sDisplayName( SvxResId( RID_SVXSTR_STYLEFAMILY_TABLEDESIGN ) );
784 return Any( sDisplayName );
785}
786
787
788void TableDesignFamily::addPropertyChangeListener( const OUString& , const Reference<XPropertyChangeListener>& )
789{
790 OSL_FAIL( "###unexpected!" );
791}
792
793
794void TableDesignFamily::removePropertyChangeListener( const OUString& , const Reference<XPropertyChangeListener>& )
795{
796 OSL_FAIL( "###unexpected!" );
797}
798
799
800void TableDesignFamily::addVetoableChangeListener( const OUString& , const Reference<XVetoableChangeListener>& )
801{
802 OSL_FAIL( "###unexpected!" );
803}
804
805
806void TableDesignFamily::removeVetoableChangeListener( const OUString& , const Reference<XVetoableChangeListener>& )
807{
808 OSL_FAIL( "###unexpected!" );
809}
810
811// XReset
812
813void TableDesignFamily::reset()
814{
815 for (const auto& aDesign : maDesigns)
816 {
817 auto aStyle = static_cast<TableDesignStyle*>(aDesign.get());
818 aStyle->resetUserDefined();
819 aStyle->setModified(false);
820 }
821}
822
823void TableDesignFamily::addResetListener( const Reference<form::XResetListener>& )
824{
825}
826
827void TableDesignFamily::removeResetListener( const Reference<form::XResetListener>& )
828{
829}
830
831Reference< XNameAccess > CreateTableDesignFamily()
832{
833 return new TableDesignFamily;
834}
835
836}
837
838/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _ADOIndex Index
HRESULT createInstance(REFIID iid, Ifc **ppIfc)
AnyEventRef aEvent
void forEach(std::unique_lock< std::mutex > &rGuard, FuncT const &func) const
sal_Int32 addInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
void disposeAndClear(::std::unique_lock<::std::mutex > &rGuard, const css::lang::EventObject &rEvt)
sal_Int32 getLength(std::unique_lock< std::mutex > &rGuard) const
sal_Int32 removeInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
css::uno::Type const & get()
OUString SvxResId(TranslateId aId)
Definition: dialmgr.cxx:24
OUString sDisplayName
Sequence< PropertyValue > aArguments
sal_Int32 nIndex
OUString aName
css::uno::Sequence< typename M::key_type > mapKeysToSequence(M const &map)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
Type
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
VBAHELPER_DLLPUBLIC bool setPropertyValue(css::uno::Sequence< css::beans::PropertyValue > &aProp, const OUString &aName, const css::uno::Any &aValue)
const sal_Int32 background_style
Definition: tabledesign.hxx:38
::comphelper::WeakComponentImplHelper< XStyle, XNameReplace, XServiceInfo, XIndexReplace, XModifiable, XModifyListener, XPropertySet > TableDesignStyleBase
Definition: tabledesign.cxx:63
const sal_Int32 style_count
Definition: tabledesign.hxx:39
const sal_Int32 last_column_style
Definition: tabledesign.hxx:32
std::map< OUString, sal_Int32 > CellStyleNameMap
Definition: tabledesign.cxx:61
const sal_Int32 first_column_style
Definition: tabledesign.hxx:31
const sal_Int32 odd_columns_style
Definition: tabledesign.hxx:36
const sal_Int32 body_style
Definition: tabledesign.hxx:37
std::vector< Reference< XStyle > > TableDesignStyleVector
const sal_Int32 even_rows_style
Definition: tabledesign.hxx:33
const sal_Int32 first_row_style
Definition: tabledesign.hxx:29
const sal_Int32 last_row_style
Definition: tabledesign.hxx:30
Reference< XNameAccess > CreateTableDesignFamily()
const sal_Int32 even_columns_style
Definition: tabledesign.hxx:35
const sal_Int32 odd_rows_style
Definition: tabledesign.hxx:34
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
void dispose()
HashMap_OWString_Interface aMap
bool mbUserDefined
bool mbModified
OUString msName
comphelper::OInterfaceContainerHelper4< XModifyListener > maModifyListeners
Reference< XStyle > maCellStyles[style_count]
TableDesignStyleVector maDesigns
OUString Name
unsigned char sal_Bool
std::map< OUString, sal_Int32 > CellStyleNameMap