summaryrefslogtreecommitdiff
path: root/sw/source/core/docnode
diff options
context:
space:
mode:
authorJakub Trzebiatowski <ubap.dev@gmail.com>2016-08-11 20:22:39 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-08-16 07:35:12 +0000
commit592a8657fa6bdc6ed72281d792c19ff0bff31387 (patch)
tree0386d09d1a3de82a8dd0d0a4a21348a263165af2 /sw/source/core/docnode
parent1fd006b020212d8f4743eac105f8d36889a21071 (diff)
GSoC Writer Table Styles; Update by example
+ Added possibility to update style by example. + Fixed SwTableAutoFormat::GetBoxFormat Change-Id: I80d9334ceda0ef7e0984fb54731850034b44cd44 Reviewed-on: https://gerrit.libreoffice.org/28063 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw/source/core/docnode')
-rw-r--r--sw/source/core/docnode/ndtbl.cxx29
1 files changed, 29 insertions, 0 deletions
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index c9c9511c3dea..9bff35ab1b50 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -4671,4 +4671,33 @@ std::unique_ptr<SwTableAutoFormat> SwDoc::DelTableStyle(const OUString& rName, b
return pReleasedFormat;
}
+void SwDoc::ChgTableStyle(const OUString& rName, const SwTableAutoFormat& rNewFormat)
+{
+ SwTableAutoFormat* pFormat = GetTableStyles().FindAutoFormat(rName);
+ if (pFormat)
+ {
+ SwTableAutoFormat aOldFormat = *pFormat;
+ *pFormat = rNewFormat;
+ pFormat->SetName(rName);
+
+ size_t nTableCount = GetTableFrameFormatCount(true);
+ for (size_t i=0; i < nTableCount; ++i)
+ {
+ SwFrameFormat* pFrameFormat = &GetTableFrameFormat(i, true);
+ SwTable* pTable = SwTable::FindTable(pFrameFormat);
+ if (pTable->GetTableStyleName() == rName)
+ GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(pTable->GetTableNode());
+ }
+
+ getIDocumentState().SetModified();
+
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo * pUndo = new SwUndoTableStyleUpdate(rName, aOldFormat, this);
+
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */