LibreOffice Module sfx2 (master) 1
SfxRedactionHelper.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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
11#include <autoredactdialog.hxx>
12
13#include <com/sun/star/beans/XPropertySet.hpp>
14#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
15#include <com/sun/star/drawing/LineStyle.hpp>
16#include <com/sun/star/lang/XMultiServiceFactory.hpp>
17#include <com/sun/star/graphic/XGraphic.hpp>
18#include <com/sun/star/frame/XLayoutManager.hpp>
19
20// For page margin related methods
21#include <com/sun/star/style/XStyle.hpp>
22#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
23#include <com/sun/star/text/XPageCursor.hpp>
24#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
25#include <com/sun/star/sheet/XSpreadsheetView.hpp>
26
27// Search util
29#include <com/sun/star/util/SearchAlgorithms.hpp>
30#include <com/sun/star/util/SearchAlgorithms2.hpp>
31#include <com/sun/star/util/SearchFlags.hpp>
32#include <vcl/svapp.hxx>
33#include <vcl/settings.hxx>
36
37#include <sfx2/request.hxx>
38#include <sfx2/sfxsids.hrc>
39#include <sfx2/viewfrm.hxx>
40
41#include <svl/eitem.hxx>
42#include <svl/stritem.hxx>
43
45
46#include <tools/gen.hxx>
47#include <tools/stream.hxx>
49
50#include <vcl/gdimtf.hxx>
51#include <vcl/graph.hxx>
52#include <sal/log.hxx>
53
54#include <vcl/wmf.hxx>
55#include <vcl/metaact.hxx>
56#include <vcl/outdev.hxx>
57#include <vcl/vcllayout.hxx>
58#include <o3tl/string_view.hxx>
59
60using namespace ::com::sun::star;
61using namespace ::com::sun::star::lang;
62using namespace ::com::sun::star::uno;
63
65{
66 const SfxItemSet* pArgs = rReq.GetArgs();
67 if (pArgs)
68 {
69 const SfxBoolItem* pIsRedactMode = rReq.GetArg<SfxBoolItem>(SID_IS_REDACT_MODE);
70 if (pIsRedactMode && pIsRedactMode->GetValue())
71 return true;
72 }
73
74 return false;
75}
76
77OUString SfxRedactionHelper::getStringParam(const SfxRequest& rReq, sal_uInt16 nParamId)
78{
79 OUString sStringParam;
80
81 const SfxItemSet* pArgs = rReq.GetArgs();
82 if (!pArgs)
83 return sStringParam;
84
85 const SfxStringItem* pStringArg = rReq.GetArg<SfxStringItem>(nParamId);
86 if (!pStringArg)
87 return sStringParam;
88
89 sStringParam = pStringArg->GetValue();
90 return sStringParam;
91}
92
93namespace
94{
95/*
96 * Roundtrip the gdimetafile to and from WMF
97 * to get rid of the position and size irregularities
98 * We better check the conversion method to see what it
99 * actually does to correct these issues, and do it ourselves.
100 * */
101void fixMetaFile(GDIMetaFile& tmpMtf)
102{
103 SvMemoryStream aDestStrm(65535, 65535);
104 ConvertGDIMetaFileToWMF(tmpMtf, aDestStrm, nullptr, false);
105 aDestStrm.Seek(0);
106
107 tmpMtf.Clear();
108
109 ReadWindowMetafile(aDestStrm, tmpMtf);
110}
111
112/*
113 * Sets page margins for a Draw page. Negative values are considered erroneous
114 * */
115void setPageMargins(const uno::Reference<beans::XPropertySet>& xPageProperySet,
116 const PageMargins& aPageMargins)
117{
118 if (aPageMargins.nTop < 0 || aPageMargins.nBottom < 0 || aPageMargins.nLeft < 0
119 || aPageMargins.nRight < 0)
120 return;
121
122 xPageProperySet->setPropertyValue("BorderTop", css::uno::Any(aPageMargins.nTop));
123 xPageProperySet->setPropertyValue("BorderBottom", css::uno::Any(aPageMargins.nBottom));
124 xPageProperySet->setPropertyValue("BorderLeft", css::uno::Any(aPageMargins.nLeft));
125 xPageProperySet->setPropertyValue("BorderRight", css::uno::Any(aPageMargins.nRight));
126}
127
128// #i10613# Extracted from ImplCheckRect::ImplCreate
129tools::Rectangle ImplCalcActionBounds(const MetaAction& rAct, const OutputDevice& rOut,
130 sal_Int32 nStrStartPos, sal_Int32 nStrEndPos)
131{
132 tools::Rectangle aActionBounds;
133
134 switch (rAct.GetType())
135 {
136 case MetaActionType::TEXTARRAY:
137 {
138 const MetaTextArrayAction& rTextAct = static_cast<const MetaTextArrayAction&>(rAct);
139 const OUString aString(rTextAct.GetText().copy(rTextAct.GetIndex(), rTextAct.GetLen()));
140
141 if (!aString.isEmpty())
142 {
143 // #105987# ImplLayout takes everything in logical coordinates
144 std::unique_ptr<SalLayout> pSalLayout1 = rOut.ImplLayout(
145 aString, 0, nStrStartPos, rTextAct.GetPoint(), 0, rTextAct.GetDXArray());
146 std::unique_ptr<SalLayout> pSalLayout2 = rOut.ImplLayout(
147 aString, 0, nStrEndPos, rTextAct.GetPoint(), 0, rTextAct.GetDXArray());
148 if (pSalLayout2)
149 {
150 tools::Rectangle aBoundRect2(rOut.ImplGetTextBoundRect(*pSalLayout2));
151 aActionBounds = rOut.PixelToLogic(aBoundRect2);
152 }
153 if (pSalLayout1 && nStrStartPos > 0)
154 {
155 tools::Rectangle aBoundRect1(rOut.ImplGetTextBoundRect(*pSalLayout1));
156 aActionBounds.SetLeft(rOut.PixelToLogic(aBoundRect1).Right());
157 }
158 }
159 }
160 break;
161
162 default:
163 break;
164 }
165
166 if (!aActionBounds.IsEmpty())
167 {
168 // fdo#40421 limit current action's output to clipped area
169 if (rOut.IsClipRegion())
170 return rOut.GetClipRegion().GetBoundRect().Intersection(aActionBounds);
171 else
172 return aActionBounds;
173 }
174 else
175 return aActionBounds;
176}
177
178} // End of anon namespace
179
180void SfxRedactionHelper::getPageMetaFilesFromDoc(std::vector<GDIMetaFile>& aMetaFiles,
181 std::vector<::Size>& aPageSizes, sal_Int32 nPages,
182 DocumentToGraphicRenderer& aRenderer)
183{
184 for (sal_Int32 nPage = 1; nPage <= nPages; ++nPage)
185 {
186 ::Size aDocumentSizePixel = aRenderer.getDocumentSizeInPixels(nPage);
187 ::Point aLogicPos;
188 ::Point aCalcPageLogicPos;
189 ::Size aCalcPageContentSize;
190 ::Size aLogic = aRenderer.getDocumentSizeIn100mm(nPage, &aLogicPos, &aCalcPageLogicPos,
191 &aCalcPageContentSize);
192
193 aPageSizes.push_back(aLogic);
194
195 Graphic aGraphic = aRenderer.renderToGraphic(nPage, aDocumentSizePixel, aDocumentSizePixel,
196 COL_TRANSPARENT, true);
197 auto& rGDIMetaFile = const_cast<GDIMetaFile&>(aGraphic.GetGDIMetaFile());
198
199 // Set preferred map unit and size on the metafile, so the Shape size
200 // will be correct in MM.
201 MapMode aMapMode;
202 aMapMode.SetMapUnit(MapUnit::Map100thMM);
203
204 rGDIMetaFile.SetPrefMapMode(aMapMode);
205 rGDIMetaFile.SetPrefSize(aLogic);
206
207 fixMetaFile(rGDIMetaFile);
208
209 aMetaFiles.push_back(rGDIMetaFile);
210 }
211}
212
214 const uno::Reference<XComponent>& xComponent, sal_Int32 nPages,
215 const std::vector<GDIMetaFile>& aMetaFiles, const std::vector<::Size>& aPageSizes,
216 const PageMargins& aPageMargins,
217 const std::vector<std::pair<RedactionTarget, OUString>>& r_aTableTargets, bool bIsAutoRedact)
218{
219 // Access the draw pages
220 uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(xComponent, uno::UNO_QUERY);
221 uno::Reference<drawing::XDrawPages> xDrawPages = xDrawPagesSupplier->getDrawPages();
222
223 uno::Reference<css::lang::XMultiServiceFactory> xFactory(xComponent, uno::UNO_QUERY);
224
225 for (sal_Int32 nPage = 0; nPage < nPages; ++nPage)
226 {
227 GDIMetaFile rGDIMetaFile = aMetaFiles[nPage];
228 Graphic aGraphic(rGDIMetaFile);
229
230 sal_Int32 nPageHeight(aPageSizes[nPage].Height());
231 sal_Int32 nPageWidth(aPageSizes[nPage].Width());
232
233 uno::Reference<graphic::XGraphic> xGraph = aGraphic.GetXGraphic();
234 uno::Reference<drawing::XDrawPage> xPage = xDrawPages->insertNewByIndex(nPage);
235
236 // Set page size & margins
237 uno::Reference<beans::XPropertySet> xPageProperySet(xPage, uno::UNO_QUERY);
238 xPageProperySet->setPropertyValue("Height", css::uno::Any(nPageHeight));
239 xPageProperySet->setPropertyValue("Width", css::uno::Any(nPageWidth));
240
241 setPageMargins(xPageProperySet, aPageMargins);
242
243 // Create and insert the shape
244 uno::Reference<drawing::XShape> xShape(
245 xFactory->createInstance("com.sun.star.drawing.GraphicObjectShape"), uno::UNO_QUERY);
246 uno::Reference<beans::XPropertySet> xShapeProperySet(xShape, uno::UNO_QUERY);
247 xShapeProperySet->setPropertyValue("Graphic", uno::Any(xGraph));
248 xShapeProperySet->setPropertyValue("MoveProtect", uno::Any(true));
249 xShapeProperySet->setPropertyValue("SizeProtect", uno::Any(true));
250
251 // Set size
252 xShape->setSize(
253 awt::Size(rGDIMetaFile.GetPrefSize().Width(), rGDIMetaFile.GetPrefSize().Height()));
254
255 xPage->add(xShape);
256
257 if (bIsAutoRedact && !r_aTableTargets.empty())
258 {
259 for (const auto& targetPair : r_aTableTargets)
260 {
261 autoRedactPage(targetPair.first, rGDIMetaFile, xPage, xComponent);
262 }
263 }
264 }
265
266 // Remove the extra page at the beginning
267 uno::Reference<drawing::XDrawPage> xPage(xDrawPages->getByIndex(0), uno::UNO_QUERY_THROW);
268 xDrawPages->remove(xPage);
269}
270
272{
273 if (!pViewFrame)
274 return;
275
276 Reference<frame::XFrame> xFrame = pViewFrame->GetFrame().GetFrameInterface();
277 Reference<css::beans::XPropertySet> xPropSet(xFrame, UNO_QUERY);
278 Reference<css::frame::XLayoutManager> xLayoutManager;
279
280 if (!xPropSet.is())
281 return;
282
283 try
284 {
285 Any aValue = xPropSet->getPropertyValue("LayoutManager");
286 aValue >>= xLayoutManager;
287 xLayoutManager->createElement("private:resource/toolbar/redactionbar");
288 xLayoutManager->showElement("private:resource/toolbar/redactionbar");
289 }
290 catch (const css::uno::RuntimeException&)
291 {
292 throw;
293 }
294 catch (css::uno::Exception&)
295 {
296 TOOLS_WARN_EXCEPTION("sfx.doc", "Exception while trying to show the Redaction Toolbar!");
297 }
298}
299
301SfxRedactionHelper::getPageMarginsForWriter(const css::uno::Reference<css::frame::XModel>& xModel)
302{
303 PageMargins aPageMargins = { -1, -1, -1, -1 };
304
305 Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(),
306 UNO_QUERY);
307 if (!xTextViewCursorSupplier.is())
308 {
309 SAL_WARN("sfx.doc", "Ref to xTextViewCursorSupplier is null in setPageMargins().");
310 return aPageMargins;
311 }
312
313 Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), UNO_QUERY);
314
315 uno::Reference<beans::XPropertySet> xPageProperySet(xCursor, UNO_QUERY);
316 OUString sPageStyleName;
317 Any aValue = xPageProperySet->getPropertyValue("PageStyleName");
318 aValue >>= sPageStyleName;
319
320 Reference<css::style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xModel, UNO_QUERY);
321 if (!xStyleFamiliesSupplier.is())
322 {
323 SAL_WARN("sfx.doc", "Ref to xStyleFamiliesSupplier is null in setPageMargins().");
324 return aPageMargins;
325 }
326 uno::Reference<container::XNameAccess> xStyleFamilies
327 = xStyleFamiliesSupplier->getStyleFamilies();
328
329 if (!xStyleFamilies.is())
330 return aPageMargins;
331
332 uno::Reference<container::XNameAccess> xPageStyles(xStyleFamilies->getByName("PageStyles"),
333 UNO_QUERY);
334
335 if (!xPageStyles.is())
336 return aPageMargins;
337
338 uno::Reference<css::style::XStyle> xPageStyle(xPageStyles->getByName(sPageStyleName),
339 UNO_QUERY);
340
341 if (!xPageStyle.is())
342 return aPageMargins;
343
344 uno::Reference<beans::XPropertySet> xPageProperties(xPageStyle, uno::UNO_QUERY);
345
346 if (!xPageProperties.is())
347 return aPageMargins;
348
349 xPageProperties->getPropertyValue("LeftMargin") >>= aPageMargins.nLeft;
350 xPageProperties->getPropertyValue("RightMargin") >>= aPageMargins.nRight;
351 xPageProperties->getPropertyValue("TopMargin") >>= aPageMargins.nTop;
352 xPageProperties->getPropertyValue("BottomMargin") >>= aPageMargins.nBottom;
353
354 return aPageMargins;
355}
356
358SfxRedactionHelper::getPageMarginsForCalc(const css::uno::Reference<css::frame::XModel>& xModel)
359{
360 PageMargins aPageMargins = { -1, -1, -1, -1 };
361 OUString sPageStyleName("Default");
362
363 css::uno::Reference<css::sheet::XSpreadsheetView> xSpreadsheetView(
364 xModel->getCurrentController(), UNO_QUERY);
365
366 if (!xSpreadsheetView.is())
367 {
368 SAL_WARN("sfx.doc", "Ref to xSpreadsheetView is null in getPageMarginsForCalc().");
369 return aPageMargins;
370 }
371
372 uno::Reference<beans::XPropertySet> xSheetProperties(xSpreadsheetView->getActiveSheet(),
373 UNO_QUERY);
374
375 xSheetProperties->getPropertyValue("PageStyle") >>= sPageStyleName;
376
377 Reference<css::style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xModel, UNO_QUERY);
378 if (!xStyleFamiliesSupplier.is())
379 {
380 SAL_WARN("sfx.doc", "Ref to xStyleFamiliesSupplier is null in getPageMarginsForCalc().");
381 return aPageMargins;
382 }
383 uno::Reference<container::XNameAccess> xStyleFamilies
384 = xStyleFamiliesSupplier->getStyleFamilies();
385
386 if (!xStyleFamilies.is())
387 return aPageMargins;
388
389 uno::Reference<container::XNameAccess> xPageStyles(xStyleFamilies->getByName("PageStyles"),
390 UNO_QUERY);
391
392 if (!xPageStyles.is())
393 return aPageMargins;
394
395 uno::Reference<css::style::XStyle> xPageStyle(xPageStyles->getByName(sPageStyleName),
396 UNO_QUERY);
397
398 if (!xPageStyle.is())
399 return aPageMargins;
400
401 uno::Reference<beans::XPropertySet> xPageProperties(xPageStyle, uno::UNO_QUERY);
402
403 if (!xPageProperties.is())
404 return aPageMargins;
405
406 xPageProperties->getPropertyValue("LeftMargin") >>= aPageMargins.nLeft;
407 xPageProperties->getPropertyValue("RightMargin") >>= aPageMargins.nRight;
408 xPageProperties->getPropertyValue("TopMargin") >>= aPageMargins.nTop;
409 xPageProperties->getPropertyValue("BottomMargin") >>= aPageMargins.nBottom;
410
411 return aPageMargins;
412}
413
415 const GDIMetaFile& rMtf,
416 std::vector<::tools::Rectangle>& aRedactionRectangles,
417 const uno::Reference<XComponent>& xComponent)
418{
419 // Initialize search
420 i18nutil::SearchOptions2 aSearchOptions;
421 fillSearchOptions(aSearchOptions, rRedactionTarget);
422
423 utl::TextSearch textSearch(aSearchOptions);
424 static tools::Long aLastFontHeight = 0;
425
426 MetaAction* pCurrAct;
427
428 for (pCurrAct = const_cast<GDIMetaFile&>(rMtf).FirstAction(); pCurrAct;
429 pCurrAct = const_cast<GDIMetaFile&>(rMtf).NextAction())
430 {
431 // Watch for TEXTARRAY actions.
432 // They contain the text of paragraphs.
433 if (pCurrAct->GetType() == MetaActionType::TEXTARRAY)
434 {
435 MetaTextArrayAction* pMetaTextArrayAction = static_cast<MetaTextArrayAction*>(pCurrAct);
436
437 // Search operation takes place here
438 OUString sText = pMetaTextArrayAction->GetText();
439 sal_Int32 nStart = 0;
440 sal_Int32 nEnd = sText.getLength();
441
442 bool bFound = textSearch.SearchForward(sText, &nStart, &nEnd);
443
444 // If found the string, add the corresponding rectangle to the collection
445 while (bFound)
446 {
447 OutputDevice* pOutputDevice
449 tools::Rectangle aNewRect(
450 ImplCalcActionBounds(*pMetaTextArrayAction, *pOutputDevice, nStart, nEnd));
451
452 if (!aNewRect.IsEmpty())
453 {
454 // Calculate the difference between current wrong value and value should it be.
455 // Add the difference to current value.
456 // Then increase 10% of the new value to make it look better.
457 aNewRect.SetTop(aNewRect.Bottom() - aLastFontHeight - aLastFontHeight / 10);
458 aRedactionRectangles.push_back(aNewRect);
459 }
460
461 // Search for the next occurrence
462 nStart = nEnd;
463 nEnd = sText.getLength();
464 bFound = textSearch.SearchForward(sText, &nStart, &nEnd);
465 }
466 }
467 else if (pCurrAct->GetType() == MetaActionType::FONT)
468 {
469 const MetaFontAction* pFontAct = static_cast<const MetaFontAction*>(pCurrAct);
470 aLastFontHeight = pFontAct->GetFont().GetFontSize().getHeight();
471 }
472 }
473}
474
476 const uno::Reference<XComponent>& xComponent, const uno::Reference<drawing::XDrawPage>& xPage,
477 const std::vector<::tools::Rectangle>& aNewRectangles)
478{
479 if (!xComponent.is() || !xPage.is())
480 return;
481
482 if (aNewRectangles.empty())
483 return;
484
485 uno::Reference<css::lang::XMultiServiceFactory> xFactory(xComponent, uno::UNO_QUERY);
486
487 for (auto const& aNewRectangle : aNewRectangles)
488 {
489 uno::Reference<drawing::XShape> xRectShape(
490 xFactory->createInstance("com.sun.star.drawing.RectangleShape"), uno::UNO_QUERY);
491 uno::Reference<beans::XPropertySet> xRectShapeProperySet(xRectShape, uno::UNO_QUERY);
492
493 xRectShapeProperySet->setPropertyValue("Name",
494 uno::Any(OUString("RectangleRedactionShape")));
495 xRectShapeProperySet->setPropertyValue("FillTransparence",
496 css::uno::Any(static_cast<sal_Int16>(50)));
497 xRectShapeProperySet->setPropertyValue("FillColor", css::uno::Any(COL_GRAY7));
498 xRectShapeProperySet->setPropertyValue(
499 "LineStyle", css::uno::Any(css::drawing::LineStyle::LineStyle_NONE));
500
501 xRectShape->setSize(awt::Size(aNewRectangle.GetWidth(), aNewRectangle.GetHeight()));
502 xRectShape->setPosition(awt::Point(aNewRectangle.Left(), aNewRectangle.Top()));
503
504 xPage->add(xRectShape);
505 }
506}
507
509 const GDIMetaFile& rGDIMetaFile,
510 const uno::Reference<drawing::XDrawPage>& xPage,
511 const uno::Reference<XComponent>& xComponent)
512{
513 if (rRedactionTarget.sContent.isEmpty())
514 return;
515
516 // Search for the redaction strings, and get the rectangle coordinates
517 std::vector<::tools::Rectangle> aRedactionRectangles;
518 searchInMetaFile(rRedactionTarget, rGDIMetaFile, aRedactionRectangles, xComponent);
519
520 // Add the redaction rectangles to the page
521 addRedactionRectToPage(xComponent, xPage, aRedactionRectangles);
522}
523
524namespace
525{
527}
528
531{
534 {
535 rSearchOpt.AlgorithmType2 = util::SearchAlgorithms2::REGEXP;
536 }
537 else
538 {
539 rSearchOpt.AlgorithmType2 = util::SearchAlgorithms2::ABSOLUTE;
540 }
541
542 rSearchOpt.Locale = GetAppLanguageTag().getLocale();
544 {
545 auto nPredefIndex = o3tl::toUInt32(o3tl::getToken(rTarget.sContent, 0, ';'));
546 rSearchOpt.searchString = m_aPredefinedTargets[nPredefIndex];
547 }
548 else
549 rSearchOpt.searchString = rTarget.sContent;
550
551 rSearchOpt.replaceString.clear();
552
553 if (!rTarget.bCaseSensitive && rTarget.sType != RedactionTargetType::REDACTION_TARGET_REGEX
555 rSearchOpt.transliterateFlags |= TransliterationFlags::IGNORE_CASE;
556 if (rTarget.bWholeWords)
557 rSearchOpt.searchFlag |= util::SearchFlags::NORM_WORD_ONLY;
558}
559
560/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
@ REDACTION_TARGET_REGEX
@ REDACTION_TARGET_PREDEFINED
const LanguageTag & GetLanguageTag() const
static const AllSettings & GetSettings()
const OUString & GetValue() const
Size getDocumentSizeIn100mm(sal_Int32 nCurrentPage, Point *pDocumentPosition=nullptr, Point *pCalcPagePosition=nullptr, Size *pCalcPageSize=nullptr)
Graphic renderToGraphic(sal_Int32 nCurrentPage, Size aDocumentSizePixel, Size aTargetSizePixel, Color aPageColor, bool bExtOutDevData)
Size getDocumentSizeInPixels(sal_Int32 nCurrentPage)
const Size & GetPrefSize() const
void Clear()
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
const GDIMetaFile & GetGDIMetaFile() const
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
void SetMapUnit(MapUnit eUnit)
MetaActionType GetType() const
const vcl::Font & GetFont() const
sal_Int32 GetIndex() const
const KernArray & GetDXArray() const
sal_Int32 GetLen() const
const OUString & GetText() const
const Point & GetPoint() const
vcl::Region GetClipRegion() const
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
bool IsClipRegion() const
tools::Rectangle ImplGetTextBoundRect(const SalLayout &) const
std::unique_ptr< SalLayout > ImplLayout(const OUString &, sal_Int32 nIndex, sal_Int32 nLen, const Point &rLogicPos=Point(0, 0), tools::Long nLogicWidth=0, KernArraySpan aKernArray=KernArraySpan(), o3tl::span< const sal_Bool > pKashidaArray={}, SalLayoutFlags flags=SalLayoutFlags::NONE, vcl::text::TextLayoutCache const *=nullptr, const SalLayoutGlyphs *pGlyphs=nullptr) const
bool GetValue() const
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
Definition: frame.cxx:515
virtual OutputDevice * GetDocumentRefDev()
Definition: objembed.cxx:44
static SfxObjectShell * GetShellFromComponent(const css::uno::Reference< css::uno::XInterface > &xComp)
Definition: objxtor.cxx:1039
static void addPagesToDraw(const uno::Reference< XComponent > &xComponent, sal_Int32 nPages, const std::vector< GDIMetaFile > &aMetaFiles, const std::vector<::Size > &aPageSizes, const PageMargins &aPageMargins, const std::vector< std::pair< RedactionTarget, OUString > > &r_aTableTargets, bool bIsAutoRedact)
static void fillSearchOptions(i18nutil::SearchOptions2 &rSearchOpt, const RedactionTarget &rTarget)
Fill the search options based on the given redaction target.
static void autoRedactPage(const RedactionTarget &rRedactionTarget, const GDIMetaFile &rGDIMetaFile, const uno::Reference< drawing::XDrawPage > &xPage, const uno::Reference< XComponent > &xComponent)
static constexpr std::u16string_view m_aPredefinedTargets[6]
static void addRedactionRectToPage(const uno::Reference< XComponent > &xComponent, const uno::Reference< drawing::XDrawPage > &xPage, const std::vector< tools::Rectangle > &aNewRectangles)
static PageMargins getPageMarginsForCalc(const css::uno::Reference< css::frame::XModel > &xModel)
static OUString getStringParam(const SfxRequest &rReq, sal_uInt16 nParamId)
static PageMargins getPageMarginsForWriter(const css::uno::Reference< css::frame::XModel > &xModel)
static void showRedactionToolbar(const SfxViewFrame *pViewFrame)
static void searchInMetaFile(const RedactionTarget &rRedactionTarget, const GDIMetaFile &rMtf, std::vector< tools::Rectangle > &aRedactionRectangles, const uno::Reference< XComponent > &xComponent)
static bool isRedactMode(const SfxRequest &rReq)
Checks to see if the request has a parameter of IsRedactMode:bool=true.
static void getPageMetaFilesFromDoc(std::vector< GDIMetaFile > &aMetaFiles, std::vector<::Size > &aPageSizes, sal_Int32 nPages, DocumentToGraphicRenderer &aRenderer)
const SfxItemSet * GetArgs() const
Definition: request.hxx:75
const T * GetArg(sal_uInt16 nSlotId) const
Templatized access to the individual parameters of the SfxRequest.
Definition: request.hxx:84
SfxFrame & GetFrame() const
Definition: viewfrm.cxx:2782
constexpr tools::Long getHeight() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
constexpr void SetLeft(tools::Long v)
constexpr void SetTop(tools::Long v)
tools::Rectangle & Intersection(const tools::Rectangle &rRect)
constexpr tools::Long Bottom() const
constexpr bool IsEmpty() const
bool SearchForward(const OUString &rStr, sal_Int32 *pStart, sal_Int32 *pEnd, css::util::SearchResult *pRes=nullptr)
const Size & GetFontSize() const
tools::Rectangle GetBoundRect() const
constexpr ::Color COL_GRAY7(0x66, 0x66, 0x66)
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
#define TOOLS_WARN_EXCEPTION(area, stream)
Reference< XSingleServiceFactory > xFactory
FilterGroup & rTarget
#define SAL_WARN(area, stream)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
sal_uInt32 toUInt32(std::u16string_view str, sal_Int16 radix=10)
long Long
Keeps information for a single redaction target.
TransliterationFlags transliterateFlags
css::lang::Locale Locale
Reference< XFrame > xFrame
Reference< XModel > xModel
SW_DLLPUBLIC const LanguageTag & GetAppLanguageTag()
VCL_DLLPUBLIC bool ReadWindowMetafile(SvStream &rStream, GDIMetaFile &rMTF)
VCL_DLLPUBLIC bool ConvertGDIMetaFileToWMF(const GDIMetaFile &rMTF, SvStream &rTargetStream, FilterConfigItem const *pConfigItem, bool bPlaceable=true)