LCOV - code coverage report
Current view: top level - include/svx/sdr/properties - properties.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 2 2 100.0 %
Date: 2014-11-03 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #ifndef INCLUDED_SVX_SDR_PROPERTIES_PROPERTIES_HXX
      21             : #define INCLUDED_SVX_SDR_PROPERTIES_PROPERTIES_HXX
      22             : 
      23             : #include <sal/types.h>
      24             : #include <svx/svxdllapi.h>
      25             : 
      26             : 
      27             : // predeclarations
      28             : 
      29             : class SdrObject;
      30             : class SfxItemSet;
      31             : class SfxPoolItem;
      32             : class SfxStyleSheet;
      33             : class Fraction;
      34             : class SfxItemPool;
      35             : class SdrModel;
      36             : 
      37             : namespace sdr
      38             : {
      39             :     namespace properties
      40             :     {
      41             :         class ItemChangeBroadcaster;
      42             :     } // end of namespace properties
      43             : } // end of namespace sdr
      44             : 
      45             : 
      46             : 
      47             : namespace sdr
      48             : {
      49             :     namespace properties
      50             :     {
      51             :         class SVX_DLLPUBLIC BaseProperties
      52             :         {
      53             :         protected:
      54             :             // the owner of this Properties. Set from constructor and not
      55             :             // to be changed in any way.
      56             :             SdrObject&                                      mrObject;
      57             : 
      58             :             // create a new object specific itemset with object specific ranges.
      59             :             virtual SfxItemSet& CreateObjectSpecificItemSet(SfxItemPool& pPool) = 0;
      60             : 
      61             :             // internal access to SdrObject
      62     5607263 :             SdrObject& GetSdrObject() const
      63             :             {
      64     5607263 :                 return mrObject;
      65             :             }
      66             : 
      67             :             // Test changeability for a single item. If a implementation wants to prevent
      68             :             // changing an item this method may be overloaded.
      69             :             virtual bool AllowItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = 0) const = 0;
      70             : 
      71             :             // Do the internal ItemChange. If only nWhich is given, the item needs to be cleared.
      72             :             // Also needs to handle if nWhich and pNewItem is 0, which means to clear all items.
      73             :             virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = 0) = 0;
      74             : 
      75             :             // Called after ItemChange() is done for all items. Allows local reactions on
      76             :             // specific item changes
      77             :             virtual void PostItemChange(const sal_uInt16 nWhich) = 0;
      78             : 
      79             :             // Internally react on ItemSet changes. The given ItemSet contains all changed items, the new ones.
      80             :             virtual void ItemSetChanged(const SfxItemSet& rSet) = 0;
      81             : 
      82             :         public:
      83             :             // basic constructor, used from SdrObject.
      84             :             explicit BaseProperties(SdrObject& rObj);
      85             : 
      86             :             // constructor for copying, but using new object. Used from the Clone()
      87             :             // method.
      88             :             BaseProperties(const BaseProperties& rProps, SdrObject& rObj);
      89             : 
      90             :             // destructor
      91             :             virtual ~BaseProperties();
      92             : 
      93             :             // Clone() operator, normally just calls the local copy constructor,
      94             :             // see above.
      95             :             virtual BaseProperties& Clone(SdrObject& rObj) const = 0;
      96             : 
      97             :             // Get the local ItemSet. This directly returns the local ItemSet of the object. No
      98             :             // merging of ItemSets is done for e.g. Group objects.
      99             :             virtual const SfxItemSet& GetObjectItemSet() const = 0;
     100             : 
     101             :             // get merged ItemSet. Normappl, this maps directly to GetObjectItemSet(), but may
     102             :             // be overloaded e.g for group objects to return a merged ItemSet of the object.
     103             :             // When using this method the returned ItemSet may contain items in the state
     104             :             // SfxItemState::DONTCARE which means there were several such items with different
     105             :             // values.
     106             :             virtual const SfxItemSet& GetMergedItemSet() const;
     107             : 
     108             :             // Sets all items which are on state SfxItemState::SET in rSet at the local ItemSet.
     109             :             // Uses AllowItemChange(), ItemChange(), PostItemChange() and ItemSetChanged() calls.
     110             :             virtual void SetObjectItemSet(const SfxItemSet& rSet) = 0;
     111             : 
     112             :             // Set merged ItemSet. Normally, this maps to SetObjectItemSet().
     113             :             virtual void SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems = false);
     114             : 
     115             :             // Set single item at the local ItemSet. Uses AllowItemChange(),
     116             :             // ItemChange(), PostItemChange() and ItemSetChanged() calls.
     117             :             virtual void SetObjectItem(const SfxPoolItem& rItem) = 0;
     118             : 
     119             :             // Set a single item direct. Only uses AllowItemChange() and ItemChange(),
     120             :             // but not PostItemChange() and ItemSetChanged() calls.
     121             :             virtual void SetObjectItemDirect(const SfxPoolItem& rItem) = 0;
     122             : 
     123             :             // Clear a single local item. Uses AllowItemChange(),
     124             :             // ItemChange(), PostItemChange() and ItemSetChanged() calls.
     125             :             virtual void ClearObjectItem(const sal_uInt16 nWhich = 0) = 0;
     126             : 
     127             :             // Set a single item, iterate over hierarchies if necessary. Default
     128             :             // Implementation falls back to ClearObjectItem().
     129             :             virtual void SetMergedItem(const SfxPoolItem& rItem);
     130             : 
     131             :             // Clear a single item, iterate over hierarchies if necessary. Default
     132             :             // Implementation falls back to ClearObjectItem().
     133             :             virtual void ClearMergedItem(const sal_uInt16 nWhich = 0);
     134             : 
     135             :             // Clear single item direct. Only uses AllowItemChange() and ItemChange(),
     136             :             // but not PostItemChange() and ItemSetChanged() calls.
     137             :             // Also supports complete deletion of items when default parameter 0 is used.
     138             :             virtual void ClearObjectItemDirect(const sal_uInt16 nWhich = 0) = 0;
     139             : 
     140             :             // Set a new StyleSheet. Registers as listener at the StyleSheet to get knowledge
     141             :             // of StyleSheet changes.
     142             :             virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr) = 0;
     143             : 
     144             :             // Get the installed StyleSheet.
     145             :             virtual SfxStyleSheet* GetStyleSheet() const = 0;
     146             : 
     147             :             // Scale the local ItemSet as far as it contains metric items. This needs to be
     148             :             // overloaded to do it for hierarchical objects like e.g. groups.
     149             :             virtual void Scale(const Fraction& rScale);
     150             : 
     151             :             // Move local items to a new ItemPool. This needs to be
     152             :             // overloaded to do it for hierarchical objects like e.g. groups.
     153             :             virtual void MoveToItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel = 0L);
     154             : 
     155             :             // Set new model.
     156             :             virtual void SetModel(SdrModel* pOldModel, SdrModel* pNewModel);
     157             : 
     158             :             // force all attributes which come from styles to hard attributes
     159             :             // to be able to live without the style.
     160             :             virtual void ForceStyleToHardAttributes();
     161             : 
     162             :             // syntactical sugar for ItemSet accesses. Broadcasts before and after the changes
     163             :             // to invalidate views in old and new BoundRects. As soon as the repaint mechanism
     164             :             // will be changed these broadcasts will no longer be needed.
     165             :             //void SetItemAndBroadcast(const SfxPoolItem& rItem);
     166             :             //void ClearItemAndBroadcast(const sal_uInt16 nWhich = 0);
     167             :             void SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, bool bClearAllItems = false);
     168             : 
     169             :             // Just a convenient shortcut for GetObjectItemSet().Get(nWhich).
     170             :             const SfxPoolItem& GetItem(const sal_uInt16 nWhich) const;
     171             : 
     172             :             // support for convenient broadcasting. Used from SetMergedItemAndBroadcast(),
     173             :             // ClearItemAndBroadcast() and SetItemSetAndBroadcast(), see above.
     174             :             // But also from inside SdrObjects.
     175             :             void BroadcastItemChange(const ItemChangeBroadcaster& rChange);
     176             : 
     177             :             // #i101556# add versioning mechanism; used from e.g. text attribute set to
     178             :             // allow detection of e.g. style sheet or single text attribute changes. The
     179             :             // default implementation returns 0 (zero)
     180             :             virtual sal_uInt32 getVersion() const;
     181             :         };
     182             : 
     183             :         // checks the FillStyle item and removes unneeded Gradient, FillBitmap and Hatch items
     184             :         void SVX_DLLPUBLIC CleanupFillProperties( SfxItemSet& rItemSet );
     185             : 
     186             :     } // end of namespace properties
     187             : } // end of namespace sdr
     188             : 
     189             : 
     190             : 
     191             : #endif // INCLUDED_SVX_SDR_PROPERTIES_PROPERTIES_HXX
     192             : 
     193             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10