wrtsh2.cxx (69a74367) wrtsh2.cxx (3b32dd21)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 51 unchanged lines hidden (view full) ---

60#include <navipi.hxx>
61#include <crsskip.hxx>
62#include <txtinet.hxx>
63#include <cmdid.h>
64#include <wrtsh.hrc>
65#include "swabstdlg.hxx"
66#include "fldui.hrc"
67#include <SwRewriter.hxx>
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 51 unchanged lines hidden (view full) ---

60#include <navipi.hxx>
61#include <crsskip.hxx>
62#include <txtinet.hxx>
63#include <cmdid.h>
64#include <wrtsh.hrc>
65#include "swabstdlg.hxx"
66#include "fldui.hrc"
67#include <SwRewriter.hxx>
68#include <xmloff/odffields.hxx>
68
69#include <com/sun/star/document/XDocumentProperties.hpp>
70#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
71
72
73/*------------------------------------------------------------------------
74 Beschreibung:
75------------------------------------------------------------------------*/
76
69
70#include <com/sun/star/document/XDocumentProperties.hpp>
71#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
72
73
74/*------------------------------------------------------------------------
75 Beschreibung:
76------------------------------------------------------------------------*/
77
77void SwWrtShell::Insert(SwField &rFld)
78void SwWrtShell::Insert(
79 SwField& rFld,
80 const SwPaM* pCommentRange )
78{
81{
79 ResetCursorStack();
80 if(!_CanInsert())
81 return;
82 StartAllAction();
82 ResetCursorStack();
83 if(!_CanInsert())
84 return;
85 StartAllAction();
83
84 SwRewriter aRewriter;
85 aRewriter.AddRule(UNDO_ARG1, rFld.GetDescription());
86
86
87 SwRewriter aRewriter;
88 aRewriter.AddRule(UNDO_ARG1, rFld.GetDescription());
89
87 StartUndo(UNDO_INSERT, &aRewriter);
90 StartUndo(UNDO_INSERT, &aRewriter);
88
91
92 if ( pCommentRange && GetDoc() )
93 {
94 // If an annotation field is inserted, take care of the relevant fieldmark.
95 IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess();
96 sw::mark::IFieldmark* pFieldmark =
97 pMarksAccess->makeFieldBookmark(
98 *pCommentRange,
99 ::rtl::OUString(),
100 ::rtl::OUString::createFromAscii( ODF_COMMENTRANGE ) );
101 ((SwPostItField&)rFld).SetName(pFieldmark->GetName());
102 }
103
89 bool bDeleted = false;
104 bool bDeleted = false;
90 if( HasSelection() )
105 if( HasSelection() )
91 {
92 bDeleted = DelRight() != 0;
93 }
94
95 SwEditShell::Insert2(rFld, bDeleted);
96 EndUndo();
106 {
107 bDeleted = DelRight() != 0;
108 }
109
110 SwEditShell::Insert2(rFld, bDeleted);
111 EndUndo();
97 EndAllAction();
112 EndAllAction();
98}
99
100/*--------------------------------------------------------------------
101 Beschreibung: Felder Update anschmeissen
102 --------------------------------------------------------------------*/
103
104
105

--- 391 unchanged lines hidden ---
113}
114
115/*--------------------------------------------------------------------
116 Beschreibung: Felder Update anschmeissen
117 --------------------------------------------------------------------*/
118
119
120

--- 391 unchanged lines hidden ---