/src/libreoffice/svx/source/sdr/properties/itemsettools.cxx
Line | Count | Source |
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 <sdr/properties/itemsettools.hxx> |
21 | | #include <tools/fract.hxx> |
22 | | #include <svl/itemset.hxx> |
23 | | #include <svl/itemiter.hxx> |
24 | | #include <svx/svdogrp.hxx> |
25 | | #include <svx/svditer.hxx> |
26 | | #include <memory> |
27 | | |
28 | | // class to remember broadcast start positions |
29 | | |
30 | | namespace sdr::properties |
31 | | { |
32 | | ItemChangeBroadcaster::ItemChangeBroadcaster(const SdrObject& rObj) |
33 | 640k | { |
34 | 640k | if (rObj.GetObjIdentifier() == SdrObjKind::Group) |
35 | 1.05k | { |
36 | 1.05k | const SdrObjGroup* pGroupObj = static_cast<const SdrObjGroup*>(&rObj); |
37 | 1.05k | SdrObjListIter aIter(pGroupObj->GetSubList(), SdrIterMode::DeepNoGroups); |
38 | 1.05k | maRectangles.reserve(aIter.Count()); |
39 | | |
40 | 4.92k | while(aIter.IsMore()) |
41 | 3.87k | { |
42 | 3.87k | SdrObject* pObj = aIter.Next(); |
43 | | |
44 | 3.87k | if(pObj) |
45 | 3.87k | { |
46 | 3.87k | maRectangles.push_back(pObj->GetLastBoundRect()); |
47 | 3.87k | } |
48 | 3.87k | } |
49 | 1.05k | } |
50 | 639k | else |
51 | 639k | { |
52 | 639k | maRectangles.push_back(rObj.GetLastBoundRect()); |
53 | 639k | } |
54 | 640k | } |
55 | | |
56 | | |
57 | | void ScaleItemSet(SfxItemSet& rSet, double fScale) |
58 | 0 | { |
59 | 0 | for (SfxItemIter aIter(rSet); !aIter.IsAtEnd(); aIter.Next()) |
60 | 0 | { |
61 | 0 | const SfxPoolItem *pItem = aIter.GetCurItem(); |
62 | 0 | if(!IsDisabledItem(pItem) && pItem->HasMetrics()) |
63 | 0 | { |
64 | 0 | std::unique_ptr<SfxPoolItem> pNewItem(pItem->Clone()); |
65 | 0 | pNewItem->ScaleMetrics(fScale); |
66 | 0 | rSet.Put(std::move(pNewItem)); |
67 | 0 | } |
68 | 0 | } |
69 | 0 | } |
70 | | } // end of namespace |
71 | | |
72 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |