LibreOffice Module sw (master)  1
fmtinfmt.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 #ifndef INCLUDED_SW_INC_FMTINFMT_HXX
20 #define INCLUDED_SW_INC_FMTINFMT_HXX
21 
22 #include <svl/poolitem.hxx>
23 #include "swdllapi.h"
24 #include <memory>
25 #include "calbck.hxx"
26 
27 class SvxMacro;
28 class SvxMacroTableDtor;
29 class SwTextINetFormat;
30 class IntlWrapper;
31 enum class SvMacroItemId : sal_uInt16;
32 
33 // ATT_INETFMT
34 
36  : public SfxPoolItem
37  , public sw::BroadcasterMixin
38 {
39  friend class SwTextINetFormat;
40 
41  OUString msURL;
42  OUString msTargetFrame;
43  OUString msINetFormatName;
45  OUString msHyperlinkName;
46  std::unique_ptr<SvxMacroTableDtor> mpMacroTable;
48  sal_uInt16 mnINetFormatId;
49  sal_uInt16 mnVisitedFormatId;
50 public:
51  SwFormatINetFormat( const OUString& rURL, const OUString& rTarget );
52  SwFormatINetFormat( const SwFormatINetFormat& rAttr );
54  virtual ~SwFormatINetFormat() override;
55 
56  static SfxPoolItem* CreateDefault();
57 
59  virtual bool operator==( const SfxPoolItem& ) const override;
60  virtual SfxPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override;
61  virtual bool GetPresentation( SfxItemPresentation ePres,
62  MapUnit eCoreMetric,
63  MapUnit ePresMetric,
64  OUString &rText,
65  const IntlWrapper& rIntl ) const override;
66 
67  virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
68  virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
69 
71  {
72  return mpTextAttr;
73  }
74 
75  const OUString& GetValue() const
76  {
77  return msURL;
78  }
79 
80  const OUString& GetName() const
81  {
82  return msHyperlinkName;
83  }
84  void SetName( const OUString& rNm )
85  {
86  msHyperlinkName = rNm;
87  }
88 
89  const OUString& GetTargetFrame() const
90  {
91  return msTargetFrame;
92  }
93 
95  const OUString& rNm,
96  const sal_uInt16 nId )
97  {
98  msINetFormatName = rNm;
99  mnINetFormatId = nId;
100  }
101 
102  const OUString& GetINetFormat() const
103  {
104  return msINetFormatName;
105  }
106 
107  sal_uInt16 GetINetFormatId() const
108  {
109  return mnINetFormatId;
110  }
111 
113  const OUString& rNm,
114  const sal_uInt16 nId )
115  {
116  msVisitedFormatName = rNm;
117  mnVisitedFormatId = nId;
118  }
119 
120  const OUString& GetVisitedFormat() const
121  {
122  return msVisitedFormatName;
123  }
124 
125  sal_uInt16 GetVisitedFormatId() const
126  {
127  return mnVisitedFormatId;
128  }
129 
131  void SetMacroTable( const SvxMacroTableDtor* pTable );
133  {
134  return mpMacroTable.get();
135  }
136 
138  void SetMacro( SvMacroItemId nEvent, const SvxMacro& rMacro );
139  const SvxMacro* GetMacro( SvMacroItemId nEvent ) const;
140 };
141 
142 #endif
143 
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static SfxPoolItem * CreateDefault()
Definition: fmtatr2.cxx:62
virtual ~SwFormatINetFormat() override
Definition: fmtatr2.cxx:197
virtual bool operator==(const SfxPoolItem &) const =0
OUString msINetFormatName
Definition: fmtinfmt.hxx:43
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
sal_uInt16 mnVisitedFormatId
Definition: fmtinfmt.hxx:49
std::unique_ptr< SvxMacroTableDtor > mpMacroTable
Definition: fmtinfmt.hxx:46
SvMacroItemId
const SvxMacro * GetMacro(SvMacroItemId nEvent) const
Definition: fmtatr2.cxx:256
void SetMacroTable(const SvxMacroTableDtor *pTable)
Set a new MacroTable or clear the current one.
Definition: fmtatr2.cxx:233
const SwTextINetFormat * GetTextINetFormat() const
Definition: fmtinfmt.hxx:70
const OUString & GetValue() const
Definition: fmtinfmt.hxx:75
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
const SvxMacroTableDtor * GetMacroTable() const
Definition: fmtinfmt.hxx:132
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId)
sal_uInt16 GetINetFormatId() const
Definition: fmtinfmt.hxx:107
const OUString & GetName() const
Definition: fmtinfmt.hxx:80
void SetVisitedFormatAndId(const OUString &rNm, const sal_uInt16 nId)
Definition: fmtinfmt.hxx:112
sal_uInt16 GetVisitedFormatId() const
Definition: fmtinfmt.hxx:125
SfxItemPresentation
SwTextINetFormat * mpTextAttr
My TextAttribute.
Definition: fmtinfmt.hxx:47
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
sal_uInt16 mnINetFormatId
Definition: fmtinfmt.hxx:48
OUString msHyperlinkName
Name of the link.
Definition: fmtinfmt.hxx:45
const OUString & GetVisitedFormat() const
Definition: fmtinfmt.hxx:120
virtual bool GetPresentation(SfxItemPresentation ePresentation, MapUnit eCoreMetric, MapUnit ePresentationMetric, OUString &rText, const IntlWrapper &rIntlWrapper) const
unsigned char sal_uInt8
const OUString & GetTargetFrame() const
Definition: fmtinfmt.hxx:89
void SetMacro(SvMacroItemId nEvent, const SvxMacro &rMacro)
Macro getter and setter.
Definition: fmtatr2.cxx:248
OUString msVisitedFormatName
Definition: fmtinfmt.hxx:44
OUString msTargetFrame
Target frame for URL.
Definition: fmtinfmt.hxx:42
MapUnit
const OUString & GetINetFormat() const
Definition: fmtinfmt.hxx:102
OUString msURL
URL.
Definition: fmtinfmt.hxx:41
void SetINetFormatAndId(const OUString &rNm, const sal_uInt16 nId)
Definition: fmtinfmt.hxx:94
void SetName(const OUString &rNm)
Definition: fmtinfmt.hxx:84
SwFormatINetFormat()
For TypeInfo.
Definition: fmtatr2.cxx:154