summaryrefslogtreecommitdiff
path: root/sw/source/core/undo/unfmco.cxx
blob: 7759230e559a96c8962fd735893f411216e0576c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#include "doc.hxx"
#include "swundo.hxx"
#include "pam.hxx"
#include "ndtxt.hxx"
#include <UndoCore.hxx>
#include "rolbck.hxx"
#include "docary.hxx"

SwUndoFormatColl::SwUndoFormatColl( const SwPaM& rRange,
                              SwFormatColl* pColl,
                              const bool bReset,
                              const bool bResetListAttrs )
    : SwUndo( UNDO_SETFMTCOLL ),
      SwUndRng( rRange ),
      pHistory( new SwHistory ),
      pFormatColl( pColl ),
      mbReset( bReset ),
      mbResetListAttrs( bResetListAttrs )
{
    // #i31191#
    if ( pColl )
        aFormatName = pColl->GetName();
}

SwUndoFormatColl::~SwUndoFormatColl()
{
    delete pHistory;
}

void SwUndoFormatColl::UndoImpl(::sw::UndoRedoContext & rContext)
{
    // restore old values
    pHistory->TmpRollback(& rContext.GetDoc(), 0);
    pHistory->SetTmpEnd( pHistory->Count() );

    // create cursor for undo range
    AddUndoRedoPaM(rContext);
}

void SwUndoFormatColl::RedoImpl(::sw::UndoRedoContext & rContext)
{
    SwPaM & rPam = AddUndoRedoPaM(rContext);

    DoSetFormatColl(rContext.GetDoc(), rPam);
}

void SwUndoFormatColl::RepeatImpl(::sw::RepeatContext & rContext)
{
    DoSetFormatColl(rContext.GetDoc(), rContext.GetRepeatPaM());
}

void SwUndoFormatColl::DoSetFormatColl(SwDoc & rDoc, SwPaM & rPaM)
{
    // Only one TextFrmColl can be applied to a section, thus request only in
    // this array.

    // does the format still exist?
    if( rDoc.GetTextFormatColls()->Contains(static_cast<SwTextFormatColl*>(pFormatColl)) )
    {
        rDoc.SetTextFormatColl(rPaM, static_cast<SwTextFormatColl*>(pFormatColl), mbReset,
                           mbResetListAttrs);
    }
}

SwRewriter SwUndoFormatColl::GetRewriter() const
{
    SwRewriter aResult;

    // #i31191# Use stored format name instead of
    // pFormatColl->GetName(), because pFormatColl does not have to be available
    // anymore.
    aResult.AddRule(UndoArg1, aFormatName );

    return aResult;
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
43009c6b6008 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108418 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com> 2020-08-18tdf#132555 PPTX VML import: handle stroke properties of image shapesMiklos Vajna ComplexShape::implConvertAndInsert() returns early in the graphic object shape case, so stroke model is not applied at all. Also fix a problem in ShapeBase::finalizeFragmentImport(), where the shape type had no stroke, but the shape itself had, and the later should win. The warning in OleObjectGraphicDataContext::onCreateContext() now points out that <mc:AlternateContent> is ignored as a child of <a:graphicData>, which probably should be addressed at some stage, but it's not required to fix the missing stroke. Change-Id: I4ab43b4c6d40d9f43caad22b85f5b885fa8b4ef1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100952 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins 2020-03-16tdf#42949 Fix IWYU warnings in oox/source/[cd]*/*cxxGabor Kelemen Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: Ie3c59da7b9e0ad06fcd7f247e47bcc17ea35b17a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90503 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com> 2020-01-31new loplugin:namespaceindentationNoel Grandin check indentation of braces in namespace decls, and the comments that often appear with them. This is my penance for messing up the indentation with clang-tidy-modernize-namespaces. As such I have limited it to new-style namespaces for now, and the check is off by default. Change-Id: I4db7f10a81c79bc0eece8f8e3ee564da8bc7f168 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87723 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2020-01-15clang-tidy modernize-concat-nested-namespace in ooxNoel Grandin Change-Id: I9877be75e1f7dcefdf7172d05dfbb0a63d06ced1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86803 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2019-05-14SmartArt: regenerate diagram commandGrzegorz Araminowicz It removes diagram content and rebuilds shape tree from diagram markup. Diagram should appear unchanged - editing will be added in future commits. Change-Id: I6bfc21956a1a23e55d3c7a74384db71d957d690d Reviewed-on: https://gerrit.libreoffice.org/71584 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com> 2018-10-18oox: ignore SmartArt "fallback" with empty shape listMiklos Vajna This way at least something shows up in the import result. Far from perfect, though. Change-Id: Iae5a073d458598e7b5059ebdf435d50ce7c7df80 Reviewed-on: https://gerrit.libreoffice.org/61925 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins 2018-07-30Add missing sal/log.hxx headersGabor Kelemen rtl/string.hxx and rtl/ustring.hxx both unnecessarily #include <sal/log.hxx> (and don't make use of it themselves), but many other files happen to depend on it. This is a continuation of commit 6ff2d84ade299cb3d14d4110e4cf1a4b8070c030 to be able to remove those unneeded includes. This commit adds missing headers to every file found by: grep -FwL sal/log.hxx $(git grep -Elw 'SAL_INFO|SAL_INFO_IF|SAL_WARN|SAL_WARN_IF|SAL_DETAIL_LOG_STREAM|SAL_WHERE|SAL_STREAM|SAL_DEBUG') to directories from l10ntools to reportdesign Change-Id: Ia2dc93dd848c2dc0b6a8cb6e19849c614ec55198 Reviewed-on: https://gerrit.libreoffice.org/58205 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> 2017-10-23loplugin:includeform: ooxStephan Bergmann Change-Id: I9f1cc9940f5b31370394f789ebfaddfd6d30ca61 2017-07-31loplugin:constparams in ooxNoel Grandin Change-Id: I43984b4ece82da39ca61a91fa14e4660298509dd Reviewed-on: https://gerrit.libreoffice.org/40581 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2017-06-05clang-tidy performance-unnecessary-value-paramNoel Grandin Change-Id: I6ed8c54c7c45931d91709cc818f2483c70197192 Reviewed-on: https://gerrit.libreoffice.org/38400 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2017-02-27Rename misleadingly named include file fillpropertiesgroupcontext.hxxTor Lillqvist There is nothing called FillPropertiesGroupContext. Rename the file to "misccontexts.hxx" as I could not come up with some more specific name that would describe the collection of classes defined in it. Rename the corresponding cxx file, too. Change-Id: I44db1db8c63c8e897774597b46a237a214aacedf 2017-02-27Clean up a few SAL_INFOs a bit and add useful note about the ==cscode== etcTor Lillqvist I dislike OSL_THIS_FUNC, it is too verbose, at least with Clang on Linux. Just use the Class::Name without parameters and namespaces. Change-Id: Ic8722a131463762ab70ff35d64ae7040c67bf595 2017-02-10Related: tdf#105707 PPTX import: warn on invalid SmartArt fallback relidMiklos Vajna We already warn when the SmartArt doesn't have a drawingML fallback, but having a reference to a fallback that is not a valid one (so resolves to an empty fragment path) is also unusable. So warn in that case as well. Change-Id: I03b2325003b4eb38b1347a88899799c6d5c33606 Reviewed-on: https://gerrit.libreoffice.org/34129 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> 2017-02-03tdf#105707 PPTX import: warn when SmartArt is missing DrawingML fallbackMiklos Vajna By the time DiagramGraphicDataContext::onCreateContext() completes, we know if there will be a DrawingML fallback for the SmartArt (called ExtDrawing in the code) or not. Warn about this case once at the end of the import when in interactive mode. Headless mode silently ignores the warning as expected. Change-Id: I2bfeeedcaa244f08d8a0c208167e79d7bb697e6d Reviewed-on: https://gerrit.libreoffice.org/33866 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> 2017-01-24Move two include files to oox/inc as they are used only in ooxTor Lillqvist Change-Id: Ie13614c1977f45aa8086f4db65ca86b7d9212735 2016-12-15teach sallogareas plugin to catch inconsistenciesNoel Grandin Change-Id: I8bcea5ffc74d48148bea78da8c17744e288c069a Reviewed-on: https://gerrit.libreoffice.org/32004 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2016-05-10tdf#42949: clean up includes in include/oox/helper with iwyuJorenz Paragas ...and fix the many compiler errors that occurred as a result. Change-Id: I497c326272b2f02737ca3765720d6815b735423b Reviewed-on: https://gerrit.libreoffice.org/24735 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com> 2015-11-10loplugin:nullptr (automatic rewrite)Stephan Bergmann Change-Id: I62a20b440064aca6f102e61cb3984bb95e739a4f 2014-10-13oox: refactor embedded media importMichael Stahl Currently the oox import creates a temp file and leaks it, and there is no way to clean it up afterwards. Unfortunately it turns out that SdrModel has no way to access the imported OOXML storage, so add a really ugly hack to get the embedded media into the SdrMediaObj by setting both MediaURL and PrivateStream properties (currently oox really wants to set the properties in alphabetical order too...) Change-Id: I5a235fbeb08e7bc17faf066de52b94867e9a79a2 2014-09-14Replace struct EmbeddedWAVAudioFile with simple string.Matúš Kukan Change-Id: I6659b6e1be865546f380a28e4803fbe593de0803 2014-09-14bnc#591147: OOXML import: Import video file too.Matúš Kukan Change-Id: Ie9b6c5ff866269e5d7a26d025cb1c0d884ff1134 2014-09-14Move oox/drawingml/*hxx internal headers to oox/inc.Matúš Kukan Do not export LinePropertiesContext class as visible. And move GraphicProperties to its own header. Change-Id: I047c181e9f2adc7e59885f59663ea56c7eb898ed 2014-06-25Move more oox/drawingml/ internal headers to oox/inc.Matúš Kukan Change-Id: I0963c92356f8388ce02fb36e172ad3b2af8ba8f8 2014-06-25remove whitespacesMarkus Mohrhard Change-Id: Ie14ba3dcb97f20479a04538748ef2c1c9e6c5dac 2014-06-23Move oox/drawingml/table/ internal headers to oox/inc.Matúš Kukan Change-Id: I9de33fdcd8b1ef73d57884033f502ac4a03f63d3 2014-06-06bnc#880763: PPTX import: wrong z-order becuause of wrong import orderZolnai Tamás importExtDrawings() must be called as soon as possible, before parser starts to parse the next shape. Call it when graphicFrame tag is closed. This tag include the reference to the SmartArt. Plus fix up import tests. Change-Id: I9e8d54c2b1afeb78a1122390dc4982d580c152ae 2014-03-10fix OOXML strict chart importMarkus Mohrhard Change-Id: I84a2fd575ced64d4774147063f13ebb8605c100f 2014-02-26Remove visual noise from ooxAlexander Wilms Change-Id: Ie25838f20f00dc32d9d22959308c118cef688e94 Reviewed-on: https://gerrit.libreoffice.org/8288 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> 2013-11-11convert OUString compareToAscii == 0 to equalsAsciiNoel Grandin Convert code like aStr.compareToAscii("XXX") == 0 to aStr.equalsAscii("XXX") which is both easier to read and faster. Change-Id: I448abf58f2fa0e7715dba53f8e8825ca0587c83f 2013-09-04oox: Enhancing the debugging outputAndres Gomez Change-Id: Ifc055befd5d7436d44e95ce105c52f3c4f061796 Reviewed-on: https://gerrit.libreoffice.org/5768 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>