LibreOffice Module sc (master) 1
postit.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <rtl/ustring.hxx>
23#include <svl/itemset.hxx>
24#include <rtl/ref.hxx>
25#include "address.hxx"
26#include "scdllapi.h"
27
28#include <memory>
29#include <string_view>
30
31class EditTextObject;
33class SdrCaptionObj;
34class SdrPage;
35
36class ScDocument;
37namespace tools { class Rectangle; }
39
42{
43 typedef std::shared_ptr< ScCaptionInitData > ScCaptionInitDataRef;
44
45 OUString maDate;
46 OUString maAuthor;
49 bool mbShown;
50
51 explicit ScNoteData( bool bShown = false );
52};
53
58{
59public:
60 static sal_uInt32 mnLastPostItId;
61
64 explicit ScPostIt( ScDocument& rDoc, const ScAddress& rPos, sal_uInt32 nPostItId = 0 );
65
67 explicit ScPostIt( ScDocument& rDoc, const ScAddress& rPos, const ScPostIt& rNote, sal_uInt32 nPostItId = 0 );
68
79 explicit ScPostIt(
80 ScDocument& rDoc, const ScAddress& rPos,
81 ScNoteData aNoteData, bool bAlwaysCreateCaption, sal_uInt32 nPostItId = 0 );
82
84 ~ScPostIt();
85
94 std::unique_ptr<ScPostIt> Clone(
95 const ScAddress& rOwnPos,
96 ScDocument& rDestDoc, const ScAddress& rDestPos,
97 bool bCloneCaption ) const;
98
100 sal_uInt32 GetId() const { return mnPostItId; }
101
103 const ScNoteData& GetNoteData() const { return maNoteData;}
104
106 const OUString& GetDate() const { return maNoteData.maDate;}
108 void SetDate( const OUString& rDate );
109
111 const OUString& GetAuthor() const { return maNoteData.maAuthor;}
113 void SetAuthor( const OUString& rAuthor );
114
116 void AutoStamp();
117
119 const OutlinerParaObject* GetOutlinerObject() const;
121 const EditTextObject* GetEditTextObject() const;
122
124 OUString GetText() const;
126 void SetText( const ScAddress& rPos, const OUString& rText );
127
132 SdrCaptionObj* GetCaption() const { return maNoteData.mxCaption.get();}
137 SdrCaptionObj* GetOrCreateCaption( const ScAddress& rPos ) const;
138
145 void ForgetCaption( bool bPreserveData = false );
146
148 void ShowCaption( const ScAddress& rPos, bool bShow );
150 bool IsCaptionShown() const { return maNoteData.mbShown;}
151
153 void ShowCaptionTemp( const ScAddress& rPos, bool bShow = true );
154
156 void UpdateCaptionPos( const ScAddress& rPos );
157
158private:
159 ScPostIt( const ScPostIt& ) = delete;
160 ScPostIt& operator=( const ScPostIt& ) = delete;
161
163 void CreateCaptionFromInitData( const ScAddress& rPos ) const;
165 void CreateCaption( const ScAddress& rPos, const SdrCaptionObj* pCaption = nullptr );
167 void RemoveCaption();
168
169private:
172 sal_uInt32 mnPostItId;
173};
174
176{
177public:
178
180 static rtl::Reference<SdrCaptionObj> CreateTempCaption( ScDocument& rDoc, const ScAddress& rPos,
181 SdrPage& rDrawPage, std::u16string_view rUserText,
182 const tools::Rectangle& rVisRect, bool bTailFront );
183
202 static ScPostIt* CreateNoteFromCaption(
203 ScDocument& rDoc, const ScAddress& rPos,
204 SdrCaptionObj* pCaption, bool bHasStyle );
205
232 static ScPostIt* CreateNoteFromObjectData(
233 ScDocument& rDoc, const ScAddress& rPos,
234 SfxItemSet&& oItemSet, const OUString& rStyleName,
235 const OutlinerParaObject& rOutlinerObj,
236 const tools::Rectangle& rCaptionRect, bool bShown );
237
254 static ScPostIt* CreateNoteFromString(
255 ScDocument& rDoc, const ScAddress& rPos,
256 const OUString& rNoteText, bool bShown,
257 bool bAlwaysCreateCaption, sal_uInt32 nPostItId = 0 );
258
259};
260
261namespace sc {
262
264{
267
268 NoteEntry( const ScAddress& rPos, const ScPostIt* pNote );
269};
270
271}
272
273/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Additional class containing cell annotation data.
Definition: postit.hxx:58
const ScNoteData & GetNoteData() const
Returns the data struct containing all note settings.
Definition: postit.hxx:103
sal_uInt32 GetId() const
Returns the note id.
Definition: postit.hxx:100
ScNoteData maNoteData
Parent document containing the note.
Definition: postit.hxx:171
const OUString & GetDate() const
Returns the creation date of this note.
Definition: postit.hxx:106
const OUString & GetAuthor() const
Returns the author date of this note.
Definition: postit.hxx:111
ScPostIt(const ScPostIt &)=delete
static sal_uInt32 mnLastPostItId
Definition: postit.hxx:60
sal_uInt32 mnPostItId
Note data with pointer to caption object.
Definition: postit.hxx:172
ScDocument & mrDoc
Definition: postit.hxx:170
ScPostIt & operator=(const ScPostIt &)=delete
bool IsCaptionShown() const
Returns true, if the caption object is visible.
Definition: postit.hxx:150
SdrCaptionObj * GetCaption() const
Returns an existing note caption object.
Definition: postit.hxx:132
virtual void SetText(const OUString &rStr) override
CAUTION! The following defines must be in the same namespace as the respective type.
Definition: broadcast.cxx:15
css::uno::Reference< css::animations::XAnimationNode > Clone(const css::uno::Reference< css::animations::XAnimationNode > &xSourceNode, const SdPage *pSource=nullptr, const SdPage *pTarget=nullptr)
#define SC_DLLPUBLIC
Definition: scdllapi.h:27
Internal data for a cell annotation.
Definition: postit.hxx:42
rtl::Reference< SdrCaptionObj > mxCaption
Initial data for invisible notes without SdrObject.
Definition: postit.hxx:48
ScCaptionInitDataRef mxInitData
Author of the note.
Definition: postit.hxx:47
OUString maDate
Definition: postit.hxx:45
OUString maAuthor
Creation date of the note.
Definition: postit.hxx:46
bool mbShown
Drawing object representing the cell note.
Definition: postit.hxx:49
ScNoteData(bool bShown=false)
True = note is visible.
Definition: postit.cxx:445
std::shared_ptr< ScCaptionInitData > ScCaptionInitDataRef
Definition: postit.hxx:43
ScAddress maPos
Definition: postit.hxx:265
const ScPostIt * mpNote
Definition: postit.hxx:266
NoteEntry(const ScAddress &rPos, const ScPostIt *pNote)
Definition: postit.cxx:991